all repos — mgba @ e9c393b8767aa0656359ffe5df43777d47ed31b2

mGBA Game Boy Advance Emulator

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

 1include("${VITASDK}/share/vita.cmake" REQUIRED)
 2
 3find_program(OBJCOPY ${cross_prefix}objcopy)
 4find_file(NIDDB db.json PATHS ${VITASDK} ${VITASDK}/bin ${VITASDK}/share)
 5
 6set(OS_DEFINES IOAPI_NO_64)
 7set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)
 8
 9file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/psp2-*.c)
10set(OS_SRC ${OS_SRC} PARENT_SCOPE)
11source_group("PS Vita-specific code" FILES ${OS_SRC})
12
13list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sce-vfs.c)
14set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE)
15
16set(OS_LIB -lvita2d -lSceAppMgr_stub -lSceCtrl_stub -lSceAudio_stub -lSceCamera_stub -lSceCommonDialog_stub -lSceDisplay_stub -lSceGxm_stub -lSceMotion_stub -lScePgf_stub -lScePhotoExport_stub -lScePower_stub -lSceSysmodule_stub -lSceTouch_stub -l${M_LIBRARY})
17set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm)
18
19list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
20
21set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/icons.o
22                            ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
23                            PROPERTIES GENERATED ON)
24add_executable(${BINARY_NAME}.elf ${PLATFORM_SRC} ${GUI_SRC} main.c
25               ${CMAKE_CURRENT_BINARY_DIR}/icons.o
26               ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o)
27set_target_properties(${BINARY_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
28target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${OS_LIB})
29
30add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icons.o
31                   COMMAND ${OBJCOPY_CMD} icons2x.png ${CMAKE_CURRENT_BINARY_DIR}/icons.o
32                   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res)
33
34add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
35                   COMMAND ${OBJCOPY_CMD} backdrop.png ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
36                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
37
38vita_create_self(${BINARY_NAME}.self ${BINARY_NAME}.elf)
39
40configure_file(${CMAKE_CURRENT_SOURCE_DIR}/template.xml.in ${CMAKE_CURRENT_BINARY_DIR}/template.xml)
41
42vita_create_vpk(${BINARY_NAME}.vpk MGBA00001 ${BINARY_NAME}.self
43                NAME ${PROJECT_NAME}
44                FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon0.png sce_sys/icon0.png
45                FILE ${CMAKE_CURRENT_SOURCE_DIR}/pic0.png sce_sys/pic0.png
46                FILE ${CMAKE_CURRENT_SOURCE_DIR}/bg.png sce_sys/livearea/contents/bg.png
47                FILE ${CMAKE_CURRENT_SOURCE_DIR}/startup.png sce_sys/livearea/contents/startup.png
48                FILE ${CMAKE_CURRENT_BINARY_DIR}/template.xml sce_sys/livearea/contents/template.xml)
49
50install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.vpk DESTINATION . COMPONENT ${BINARY_NAME}-psp2)