all repos — mgba @ 7d7efe5ebbe554e1c0ba431d1a0fb5bc0c73c548

mGBA Game Boy Advance Emulator

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