src/platform/psp2/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
13set(toolchain_dir ${DEVKITARM}/psp2)
14set(toolchain_bin_dir ${toolchain_dir}/bin)
15set(cross_prefix ${DEVKITARM}/bin/arm-none-eabi-)
16set(inc_flags -I${toolchain_dir}/include)
17set(arch_flags "-march=armv7-a -mtune=cortex-a9")
18set(link_flags "-L${toolchain_dir}/lib -specs=psp2.specs ${arch_flags}")
19
20set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name")
21set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
22set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi")
23set(CMAKE_AR ${cross_prefix}ar CACHE INTERNAL "archiver")
24set(CMAKE_C_COMPILER ${cross_prefix}gcc CACHE INTERNAL "c compiler")
25set(CMAKE_CXX_COMPILER ${cross_prefix}g++ CACHE INTERNAL "cxx compiler")
26set(CMAKE_ASM_COMPILER ${cross_prefix}gcc CACHE INTERNAL "assembler")
27set(common_flags "${arch_flags} -fno-reorder-functions -fno-optimize-sibling-calls ${inc_flags}")
28set(CMAKE_C_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags")
29set(CMAKE_ASM_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags")
30set(CMAKE_CXX_FLAGS ${common_flags} CACHE INTERNAL "cxx compiler flags")
31set(CMAKE_LINKER ${cross_prefix}ld CACHE INTERNAL "linker")
32
33set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")
34set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")
35set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags")
36
37set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
38
39set(FIXUP ${toolchain_bin_dir}/psp2-fixup)
40
41set(PSP2 ON)
42add_definitions(-DPSP2)
43
44set(CMAKE_C_COMPILER_WORKS 1) # Skip test