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(DEFINED ENV{DEVKITARM})
8 set(DEVKITARM $ENV{DEVKITARM})
9else()
10 set(DEVKITARM ${DEVKITPRO}/devkitARM)
11endif()
12
13if(DEFINED ENV{CTRULIB})
14 set(CTRULIB $ENV{CTRULIB})
15else()
16 set(CTRULIB ${DEVKITPRO}/libctru)
17endif()
18
19set(extension)
20if (CMAKE_HOST_WIN32)
21 set(extension .exe)
22endif()
23
24set(CMAKE_PROGRAM_PATH ${DEVKITARM}/bin)
25set(cross_prefix ${CMAKE_PROGRAM_PATH}/arm-none-eabi-)
26set(arch_flags "-march=armv6k -mtune=mpcore -mfpu=vfp -mfloat-abi=hard")
27set(inc_flags "-I${CTRULIB}/include ${arch_flags} -mword-relocations")
28set(link_flags "-L${CTRULIB}/lib -lctru -specs=3dsx.specs ${arch_flags}")
29
30set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name")
31set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
32set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi")
33
34set(CMAKE_AR ${cross_prefix}gcc-ar${extension} CACHE INTERNAL "archiver")
35set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension} CACHE INTERNAL "archiver")
36set(CMAKE_C_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "c compiler")
37set(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension} CACHE INTERNAL "cxx compiler")
38set(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "assembler")
39set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
40set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
41set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags")
42set(CMAKE_LINKER ${cross_prefix}ld CACHE INTERNAL "linker")
43
44set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")
45set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")
46set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags")
47
48set(3DS ON)
49add_definitions(-D_3DS -DARM11)