src/platform/3ds/CMakeToolchain.txt (view raw)
1if(DEFINED ENV{DEVKITPRO})
2 set(DEVKITPRO $ENV{DEVKITPRO})
3else()
4 message(FATAL_ERROR "Could not find DEVKITPRO in environment")
5endif()
6
7if(ENV{DEVKITARM)
8 set(DEVKITARM $ENV{DEVKITARM})
9else()
10 set(DEVKITARM ${DEVKITPRO}/devkitARM)
11endif()
12
13set(toolchain_bin_dir ${DEVKITARM}/bin)
14set(cross_prefix ${toolchain_bin_dir}/arm-none-eabi-)
15set(inc_flags -I${DEVKITPRO}/libcrtu/include)
16set(arch_flags "-march=armv6k -mtune=mpcore -mfpu=vfp -mfloat-abi=softfp")
17set(link_flags "-L${DEVKITPRO}/libcrtu/lib -lctru -lm -specs=3dsx.specs ${arch_flags}")
18
19set(CMAKE_SYSTEM_NAME Unknown CACHE INTERNAL "system name")
20set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
21set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi")
22set(CMAKE_AR ${cross_prefix}ar)
23set(CMAKE_C_COMPILER ${cross_prefix}gcc)
24set(CMAKE_CXX_COMPILER ${cross_prefix}g++)
25set(CMAKE_ASM_COMPILER ${cross_prefix}gcc)
26set(common_flags "${arch_flags} -mword-relocations ${inc_flags}")
27set(CMAKE_C_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags")
28set(CMAKE_ASM_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags")
29set(CMAKE_CXX_FLAGS ${common_flags} CACHE INTERNAL "cxx compiler flags")
30set(CMAKE_LINKER ${cross_prefix}ld)
31
32set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")
33set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")
34set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags")
35
36set(3DS ON)
37add_definitions(-D_3DS -DARM11)