My CMake project doesn't make a 3dsx executable

Post Reply
MRcodino
Posts: 1
Joined: Tue Apr 23, 2024 9:23 pm

My CMake project doesn't make a 3dsx executable

Post by MRcodino » Tue Apr 23, 2024 9:34 pm

Hi, i'm new to using the devkitPro toolchain, and I have problems setting it up with CMake. I actually included the Nintendo3DS.cmake file in the CMakeLists.txt, and setup the CMake options to use 3DS.cmake as the CMAKE_TOOLCHAIN_FILE, but when i build the project, it only spits out a .elf executable, and not the 3ds executable.

CMakeLists.txt:

Code: Select all

cmake_minimum_required(VERSION 3.5)

project(template)

list(APPEND CMAKE_MODULE_PATH $ENV{DEVKITPRO}/cmake/Platform)
include(Nintendo3DS)

set(CMAKE_CXX_STANDARD 17)
add_executable(template main.c)
ctr_create_3dsx(template)
CMake arguments setup in my IDE:

Code: Select all

-D CMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake
Thanks in advance

WinterMute
Site Admin
Posts: 1860
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: My CMake project doesn't make a 3dsx executable

Post by WinterMute » Wed Apr 24, 2024 2:57 pm

MRcodino wrote: Tue Apr 23, 2024 9:34 pm Hi, i'm new to using the devkitPro toolchain,
devkitPro is not a toolchain. devkitPro is us - the people who create and maintain the tools and libraries used to create homebrew. The toolchain being used here is devkitARM, one of the 3 toolchains we currently maintain.


Don't try to include devkitPro cmakery in your CMakeLists.txt. This is all handled by the toolchain file. It will also lead to less clutter if you keep your source & include files in subfolders.

Code: Select all

cmake_minimum_required(VERSION 3.13)

project(test LANGUAGES C VERSION 1.0.0)

add_executable(${PROJECT_NAME}
  source/main.c
)

target_compile_options(${PROJECT_NAME} PRIVATE
  -g -O2 -Wall
)

target_include_directories(${PROJECT_NAME} PRIVATE
  include
)

ctr_generate_smdh(${PROJECT_NAME}.smdh
  NAME "${PROJECT_NAME}"
  DESCRIPTION "v${PROJECT_VERSION}"
  AUTHOR "Me!"
)

ctr_create_3dsx(${PROJECT_NAME}
  SMDH ${PROJECT_NAME}.smdh
)
This can be configured from commandline using

Code: Select all

/opt/devkitpro/portlibs/3ds/bin/arm-none-eabi-cmake -B _3ds -S .
Help keep devkitPro toolchains free, Donate today

Personal Blog

MRcodino
Posts: 1
Joined: Tue Apr 23, 2024 9:23 pm

Re: My CMake project doesn't make a 3dsx executable

Post by MRcodino » Wed Apr 24, 2024 3:44 pm

WinterMute wrote: Wed Apr 24, 2024 2:57 pm
MRcodino wrote: Tue Apr 23, 2024 9:34 pm Hi, i'm new to using the devkitPro toolchain,
devkitPro is not a toolchain. devkitPro is us - the people who create and maintain the tools and libraries used to create homebrew. The toolchain being used here is devkitARM, one of the 3 toolchains we currently maintain.


Don't try to include devkitPro cmakery in your CMakeLists.txt. This is all handled by the toolchain file. It will also lead to less clutter if you keep your source & include files in subfolders.

Code: Select all

cmake_minimum_required(VERSION 3.13)

project(test LANGUAGES C VERSION 1.0.0)

add_executable(${PROJECT_NAME}
  source/main.c
)

target_compile_options(${PROJECT_NAME} PRIVATE
  -g -O2 -Wall
)

target_include_directories(${PROJECT_NAME} PRIVATE
  include
)

ctr_generate_smdh(${PROJECT_NAME}.smdh
  NAME "${PROJECT_NAME}"
  DESCRIPTION "v${PROJECT_VERSION}"
  AUTHOR "Me!"
)

ctr_create_3dsx(${PROJECT_NAME}
  SMDH ${PROJECT_NAME}.smdh
)
This can be configured from commandline using

Code: Select all

/opt/devkitpro/portlibs/3ds/bin/arm-none-eabi-cmake -B _3ds -S .
I just found out that i only had to change the output target in the IDE... I'm not using the arm-none-eabi-cmake executable but it seems to compile to .3dsx just fine, could it be a problem in the long run? I do this because in my IDE (CLion) this allows me to use the build buttons of the IDE without using the terminal. Thanks for the quick reply and sorry for the mixup with the names!
Last edited by MRcodino on Wed Apr 24, 2024 3:49 pm, edited 2 times in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests