Homebrew CMake for 3ds homebrews

Lectem

Active Member
OP
Newcomer
Joined
Nov 21, 2014
Messages
43
Trophies
0
Age
30
XP
135
Country
France
Hi folks,
I made some cmake scripts a few weeks ago, with those you can easily port cmake projects to devkitpro with only minor changes.

The repo url is https://github.com/Lectem/3ds-cmake

The reason I'm sharing it here is that I'd like people to use the same scripts instead of baking their own, so that it will be easier to maintain those in the future.

A quick example of its functionnalities :

Code:
cmake_minimum_required(VERSION 2.8)
project(hello_world)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DKA_SUGGESTED_C_FLAGS}") # Use the devkitArm suggested flags. This is not mandatory.

# Note that you must copy the cmake folder and the DevkitArm3DS.cmake file in this directory
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) # Add the cmake folder to the modules paths, so that we can use the tools and find_package for ctrulib
include(Tools3DS) # Include all the macros and tools needed for 3ds development.

find_package(CTRULIB REQUIRED) # Look for ctrulib

add_executable(hello_world source/main.c) # Create the elf file
target_link_libraries(hello_world ${LIBCTRU_LIBRARIES}) # Link ctrulib
target_include_directories(hello_world PUBLIC ${LIBCTRU_INCLUDE_DIRS}) # Add the ctrulib include folder

add_3dsx_target(hello_world) # Generate the .3dsx and .smdh from the hello_world target

Hope it will help some people around here !
 
  • Like
Reactions: hippy dave
General chit-chat
Help Users
    AncientBoi @ AncientBoi: My kind of sausage! :D