src/platform/psp2/CMakeToolchain.vitasdk (view raw)
1if(DEFINED ENV{VITASDK})
2 set(VITASDK $ENV{VITASDK})
3else()
4 message(FATAL_ERROR "Could not find VITASDK in environment")
5endif()
6
7set(extension)
8if (CMAKE_HOST_WIN32)
9 set(extension .exe)
10endif()
11
12set(toolchain_dir ${VITASDK})
13set(CMAKE_PROGRAM_PATH ${toolchain_dir}/bin)
14
15set(cross_prefix arm-vita-eabi-)
16set(inc_flags -I${toolchain_dir}/include)
17set(link_flags "-L${toolchain_dir}/lib -Wl,-z,nocopyreloc")
18
19set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name")
20set(CMAKE_SYSTEM_PROCESSOR armv7-a CACHE INTERNAL "processor")
21set(CMAKE_LIBRARY_ARCHITECTURE arm-vita-eabi CACHE INTERNAL "abi")
22
23find_program(CMAKE_AR ${cross_prefix}gcc-ar${extension})
24find_program(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension})
25find_program(CMAKE_C_COMPILER ${cross_prefix}gcc${extension})
26find_program(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension})
27find_program(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension})
28find_program(CMAKE_LINKER ${cross_prefix}ld${extension})
29set(CMAKE_C_FLAGS "${inc_flags} -Wl,-q" CACHE INTERNAL "c compiler flags")
30set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "assembler flags")
31set(CMAKE_CXX_FLAGS "${inc_flags} -Wl,-q" CACHE INTERNAL "cxx compiler flags")
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(CMAKE_FIND_ROOT_PATH ${VITASDK}/arm-vita-eabi;${VITASDK})
38set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
39set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
40set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
41set(ENV{PKG_CONFIG_PATH} ${VITASDK}/arm-vita-eabi/lib/pkgconfig)
42set(ENV{PKG_CONFIG_LIBDIR} ${VITASDK}/arm-vita-eabi/lib/pkgconfig)
43
44set(VITA_ELF_CREATE "${VITASDK}/bin/vita-elf-create${TOOL_OS_SUFFIX}" CACHE PATH "vita-elf-create")
45set(VITA_ELF_EXPORT "${VITASDK}/bin/vita-elf-export${TOOL_OS_SUFFIX}" CACHE PATH "vita-elf-export")
46set(VITA_LIBS_GEN "${VITASDK}/bin/vita-libs-gen${TOOL_OS_SUFFIX}" CACHE PATH "vita-libs-gen")
47set(VITA_MAKE_FSELF "${VITASDK}/bin/vita-make-fself${TOOL_OS_SUFFIX}" CACHE PATH "vita-make-fself")
48set(VITA_MKSFOEX "${VITASDK}/bin/vita-mksfoex${TOOL_OS_SUFFIX}" CACHE PATH "vita-mksfoex")
49set(VITA_PACK_VPK "${VITASDK}/bin/vita-pack-vpk${TOOL_OS_SUFFIX}" CACHE PATH "vita-pack-vpk")
50
51set(PSP2 ON)
52add_definitions(-DPSP2)
53set(M_LIBRARY m)