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(link_flags -L${DEVKITPRO}/libcrtu/lib)
17
18set(CMAKE_SYSTEM_NAME Unknown CACHE INTERNAL "system name")
19set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
20set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi")
21set(CMAKE_AR ${cross_prefix}ar CACHE FILEPATH "archiver")
22set(CMAKE_C_COMPILER ${cross_prefix}gcc)
23set(CMAKE_CXX_COMPILER ${cross_prefix}g++)
24set(CMAKE_ASM_COMPILER ${cross_prefix}gcc)
25set(common_flags "-march=armv6k -mtune=mpcore -mfpu=vfp ${inc_flags}")
26set(CMAKE_C_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags")
27set(CMAKE_ASM_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags")
28set(CMAKE_CXX_FLAGS ${common_flags} CACHE INTERNAL "cxx compiler flags")
29set(CMAKE_LINKER ${cross_prefix}ld)
30
31set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")
32set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")
33set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags")
34
35set(3DS ON)