PSP2: Update toolchain to use vita.cmake
Vicki Pfau vi@endrift.com
Thu, 06 Jul 2017 12:26:43 -0700
3 files changed,
21 insertions(+),
33 deletions(-)
M
src/platform/psp2/CMakeLists.txt
→
src/platform/psp2/CMakeLists.txt
@@ -1,9 +1,7 @@
-find_program(FIXUP vita-elf-create) -find_program(MAKE_FSELF vita-make-fself) -find_program(MAKE_SFO vita-mksfoex) +include("${VITASDK}/share/vita.cmake" REQUIRED) + find_program(OBJCOPY ${cross_prefix}objcopy) find_file(NIDDB db.json PATHS ${VITASDK} ${VITASDK}/bin ${VITASDK}/share) -find_program(STRIP ${cross_prefix}strip) set(OS_DEFINES IOAPI_NO_64) set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)@@ -37,34 +35,16 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
COMMAND ${OBJCOPY_CMD} backdrop.png ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -add_custom_target(${BINARY_NAME}.velf ALL - ${STRIP} --strip-unneeded -go ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.elf - COMMAND ${FIXUP} ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.velf ${NIDDB} - DEPENDS ${BINARY_NAME}.elf) - -add_custom_target(sce_sys ${CMAKE_COMMAND} -E make_directory sce_sys) - -add_custom_target(param.sfo - ${MAKE_SFO} ${PROJECT_NAME} -s TITLE_ID=MGBA00001 sce_sys/param.sfo - DEPENDS sce_sys) - -add_custom_target(eboot.bin - ${MAKE_FSELF} -s ${BINARY_NAME}.velf eboot.bin - DEPENDS ${BINARY_NAME}.velf) +vita_create_self(${BINARY_NAME}.self ${BINARY_NAME}.elf) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/template.xml.in ${CMAKE_CURRENT_BINARY_DIR}/template.xml) -add_custom_target(livearea - ${CMAKE_COMMAND} -E make_directory sce_sys/livearea/contents - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/icon0.png sce_sys - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/pic0.png sce_sys - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/template.xml sce_sys/livearea/contents - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bg.png sce_sys/livearea/contents - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/startup.png sce_sys/livearea/contents - DEPENDS sce_sys) - -add_custom_target(${BINARY_NAME}.vpk ALL - zip -qr ${BINARY_NAME}.vpk sce_sys eboot.bin - DEPENDS livearea eboot.bin param.sfo) +vita_create_vpk(${BINARY_NAME}.vpk MGBA00001 ${BINARY_NAME}.self + NAME ${PROJECT_NAME} + FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon0.png sce_sys/icon0.png + FILE ${CMAKE_CURRENT_SOURCE_DIR}/pic0.png sce_sys/pic0.png + FILE ${CMAKE_CURRENT_SOURCE_DIR}/bg.png sce_sys/livearea/contents/bg.png + FILE ${CMAKE_CURRENT_SOURCE_DIR}/startup.png sce_sys/livearea/contents/startup.png + FILE ${CMAKE_CURRENT_BINARY_DIR}/template.xml sce_sys/livearea/contents/template.xml) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.vpk DESTINATION . COMPONENT ${BINARY_NAME}-psp2)
M
src/platform/psp2/CMakeToolchain.vitasdk
→
src/platform/psp2/CMakeToolchain.vitasdk
@@ -14,7 +14,7 @@ set(CMAKE_PROGRAM_PATH ${toolchain_dir}/bin)
set(cross_prefix arm-vita-eabi-) set(inc_flags -I${toolchain_dir}/include) -set(link_flags "-L${toolchain_dir}/lib -Wl,-q") +set(link_flags "-L${toolchain_dir}/lib -Wl,-z,nocopyreloc") set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name") set(CMAKE_SYSTEM_PROCESSOR armv7-a CACHE INTERNAL "processor")@@ -26,9 +26,9 @@ find_program(CMAKE_C_COMPILER ${cross_prefix}gcc${extension})
find_program(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension}) find_program(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension}) find_program(CMAKE_LINKER ${cross_prefix}ld${extension}) -set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_C_FLAGS "${inc_flags} -Wl,-q" CACHE INTERNAL "c compiler flags") set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "assembler flags") -set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags") +set(CMAKE_CXX_FLAGS "${inc_flags} -Wl,-q" CACHE INTERNAL "cxx compiler flags") set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags") set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")@@ -40,6 +40,13 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "") set(ENV{PKG_CONFIG_PATH} ${VITASDK}/arm-vita-eabi/lib/pkgconfig) set(ENV{PKG_CONFIG_LIBDIR} ${VITASDK}/arm-vita-eabi/lib/pkgconfig) + +set(VITA_ELF_CREATE "${VITASDK}/bin/vita-elf-create${TOOL_OS_SUFFIX}" CACHE PATH "vita-elf-create") +set(VITA_ELF_EXPORT "${VITASDK}/bin/vita-elf-export${TOOL_OS_SUFFIX}" CACHE PATH "vita-elf-export") +set(VITA_LIBS_GEN "${VITASDK}/bin/vita-libs-gen${TOOL_OS_SUFFIX}" CACHE PATH "vita-libs-gen") +set(VITA_MAKE_FSELF "${VITASDK}/bin/vita-make-fself${TOOL_OS_SUFFIX}" CACHE PATH "vita-make-fself") +set(VITA_MKSFOEX "${VITASDK}/bin/vita-mksfoex${TOOL_OS_SUFFIX}" CACHE PATH "vita-mksfoex") +set(VITA_PACK_VPK "${VITASDK}/bin/vita-pack-vpk${TOOL_OS_SUFFIX}" CACHE PATH "vita-pack-vpk") set(PSP2 ON) add_definitions(-DPSP2)