3DS: Add CMakeToolchain for 3DS
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Dec 2014 16:02:11 -0800
1 files changed,
35 insertions(+),
0 deletions(-)
A
src/platform/3ds/CMakeToolchain.txt
@@ -0,0 +1,35 @@
+if(DEFINED ENV{DEVKITPRO}) + set(DEVKITPRO $ENV{DEVKITPRO}) +else() + message(FATAL_ERROR "Could not find DEVKITPRO in environment") +endif() + +if(ENV{DEVKITARM) + set(DEVKITARM $ENV{DEVKITARM}) +else() + set(DEVKITARM ${DEVKITPRO}/devkitARM) +endif() + +set(toolchain_bin_dir ${DEVKITARM}/bin) +set(cross_prefix ${toolchain_bin_dir}/arm-none-eabi-) +set(inc_flags -I${DEVKITPRO}/libcrtu/include) +set(link_flags -L${DEVKITPRO}/libcrtu/lib) + +set(CMAKE_SYSTEM_NAME Unknown CACHE INTERNAL "system name") +set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor") +set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi") +set(CMAKE_AR ${cross_prefix}ar CACHE FILEPATH "archiver") +set(CMAKE_C_COMPILER ${cross_prefix}gcc) +set(CMAKE_CXX_COMPILER ${cross_prefix}g++) +set(CMAKE_ASM_COMPILER ${cross_prefix}gcc) +set(common_flags "-march=armv6k -mtune=mpcore -mfpu=vfp ${inc_flags}") +set(CMAKE_C_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_ASM_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_CXX_FLAGS ${common_flags} CACHE INTERNAL "cxx compiler flags") +set(CMAKE_LINKER ${cross_prefix}ld) + +set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags") +set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags") +set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags") + +set(3DS ON)