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 -l${M_LIBRARY}
17 -lSceAppMgr_stub
18 -lSceAppUtil_stub
19 -lSceAudio_stub
20 -lSceCamera_stub
21 -lSceCommonDialog_stub
22 -lSceCtrl_stub
23 -lSceDisplay_stub
24 -lSceGxm_stub
25 -lSceMotion_stub
26 -lScePgf_stub
27 -lScePhotoExport_stub
28 -lScePower_stub
29 -lSceSysmodule_stub
30 -lSceTouch_stub)
31set(OS_LIB ${OS_LIB} PARENT_SCOPE)
32set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm)
33
34list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
35
36set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/icons.o
37 ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
38 PROPERTIES GENERATED ON)
39add_executable(${BINARY_NAME}.elf ${PLATFORM_SRC} ${GUI_SRC} main.c
40 ${CMAKE_CURRENT_BINARY_DIR}/icons.o
41 ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o)
42set_target_properties(${BINARY_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
43target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${OS_LIB})
44
45add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icons.o
46 COMMAND ${OBJCOPY_CMD} icons2x.png ${CMAKE_CURRENT_BINARY_DIR}/icons.o
47 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res)
48
49add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
50 COMMAND ${OBJCOPY_CMD} backdrop.png ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
51 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
52
53vita_create_self(${BINARY_NAME}.self ${BINARY_NAME}.elf)
54
55configure_file(${CMAKE_CURRENT_SOURCE_DIR}/template.xml.in ${CMAKE_CURRENT_BINARY_DIR}/template.xml)
56
57vita_create_vpk(${BINARY_NAME}.vpk MGBA00001 ${BINARY_NAME}.self
58 NAME ${PROJECT_NAME}
59 FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon0.png sce_sys/icon0.png
60 FILE ${CMAKE_CURRENT_SOURCE_DIR}/pic0.png sce_sys/pic0.png
61 FILE ${CMAKE_CURRENT_SOURCE_DIR}/bg.png sce_sys/livearea/contents/bg.png
62 FILE ${CMAKE_CURRENT_SOURCE_DIR}/startup.png sce_sys/livearea/contents/startup.png
63 FILE ${CMAKE_CURRENT_BINARY_DIR}/template.xml sce_sys/livearea/contents/template.xml)
64
65if(BUILD_PERF)
66 add_executable(perf-main.elf perf.c)
67 set_target_properties(perf-main.elf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
68 target_link_libraries(perf-main.elf ${OS_LIB})
69
70 vita_create_self(perf.bin ../${BINARY_NAME}-perf)
71 vita_create_self(perf-main.self perf-main.elf)
72
73 vita_create_vpk(${BINARY_NAME}-perf.vpk MGBA00002 perf-main.self
74 NAME "${PROJECT_NAME} Perf Tester"
75 FILE ${CMAKE_CURRENT_BINARY_DIR}/perf.bin perf.bin
76 FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon0.png sce_sys/icon0.png
77 FILE ${CMAKE_CURRENT_SOURCE_DIR}/pic0.png sce_sys/pic0.png
78 FILE ${CMAKE_CURRENT_SOURCE_DIR}/bg.png sce_sys/livearea/contents/bg.png
79 FILE ${CMAKE_CURRENT_SOURCE_DIR}/startup.png sce_sys/livearea/contents/startup.png
80 FILE ${CMAKE_CURRENT_BINARY_DIR}/template.xml sce_sys/livearea/contents/template.xml)
81
82 install(FILES
83 ${CMAKE_CURRENT_BINARY_DIR}/perf.bin
84 ${CMAKE_CURRENT_SOURCE_DIR}/perf-start.sh
85 ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}-perf.vpk
86 DESTINATION . COMPONENT ${BINARY_NAME}-perf)
87endif()
88
89install(TARGETS ${BINARY_NAME}.elf DESTINATION . COMPONENT ${BINARY_NAME}-dbg)
90install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.vpk DESTINATION . COMPONENT ${BINARY_NAME}-psp2)