all repos — mgba @ 4888fa71885ba1798882a52d057fea244c5f3163

mGBA Game Boy Advance Emulator

src/platform/psp2/CMakeLists.txt (view raw)

 1find_program(FIXUP vita-elf-create)
 2find_program(MAKE_FSELF vita-make-fself)
 3find_program(MAKE_SFO vita-mksfoex)
 4find_program(OBJCOPY ${cross_prefix}objcopy)
 5find_file(NIDDB db.json PATHS ${VITASDK} ${VITASDK}/bin ${VITASDK}/share)
 6find_program(STRIP ${cross_prefix}strip)
 7
 8set(OS_DEFINES IOAPI_NO_64)
 9set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)
10
11file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/psp2-*.c)
12set(OS_SRC ${OS_SRC} PARENT_SCOPE)
13source_group("PS Vita-specific code" FILES ${OS_SRC})
14
15list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sce-vfs.c)
16set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE)
17
18set(OS_LIB -lvita2d -lSceCtrl_stub -lScePgf_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceCommonDialog_stub -lSceMotion_stub -lScePower_stub -lSceSysmodule_stub -lSceTouch_stub -l${M_LIBRARY})
19set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm)
20
21list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
22
23set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/icons.o
24                            ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
25                            PROPERTIES GENERATED ON)
26add_executable(${BINARY_NAME}.elf ${PLATFORM_SRC} ${GUI_SRC} main.c
27               ${CMAKE_CURRENT_BINARY_DIR}/icons.o
28               ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o)
29set_target_properties(${BINARY_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
30target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${OS_LIB})
31
32add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icons.o
33                   COMMAND ${OBJCOPY_CMD} icons2x.png ${CMAKE_CURRENT_BINARY_DIR}/icons.o
34                   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res)
35
36add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
37                   COMMAND ${OBJCOPY_CMD} backdrop.png ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
38                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
39
40add_custom_target(${BINARY_NAME}.velf ALL
41                  ${STRIP} --strip-unneeded -go ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.elf
42                  COMMAND ${FIXUP} ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.velf ${NIDDB}
43                  DEPENDS ${BINARY_NAME}.elf)
44
45add_custom_target(sce_sys ${CMAKE_COMMAND} -E make_directory sce_sys)
46
47add_custom_target(param.sfo
48                  ${MAKE_SFO} ${PROJECT_NAME} -s TITLE_ID=MGBA00001 sce_sys/param.sfo
49                  DEPENDS sce_sys)
50
51add_custom_target(eboot.bin
52                  ${MAKE_FSELF} ${BINARY_NAME}.velf eboot.bin
53                  DEPENDS ${BINARY_NAME}.velf)
54
55add_custom_target(livearea
56                  ${CMAKE_COMMAND} -E make_directory sce_sys/livearea/contents
57                  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/icon0.png sce_sys
58                  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/pic0.png sce_sys
59                  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/template.xml sce_sys/livearea/contents
60                  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bg.png sce_sys/livearea/contents
61                  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/startup.png sce_sys/livearea/contents
62                  DEPENDS sce_sys)
63
64add_custom_target(${BINARY_NAME}.vpk ALL
65                  zip -r ${BINARY_NAME}.vpk sce_sys eboot.bin
66                  DEPENDS livearea eboot.bin param.sfo)
67
68install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.vpk DESTINATION . COMPONENT ${BINARY_NAME}-psp2)