src/platform/psp2/CMakeLists.txt (view raw)
1file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/psp2/psp2-*.c)
2set(OS_SRC ${OS_SRC} PARENT_SCOPE)
3source_group("PS Vita-specific code" FILES ${OS_SRC})
4
5list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sce-vfs.c)
6set(VFS_SRC ${VFS_SRC} PARENT_SCOPE)
7
8set(OS_LIB -lvita2d -lSceCtrl_stub -lSceRtc_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceMotion_stub -lScePower_stub -lSceTouch_stub -lpng -lz -l${M_LIBRARY})
9set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm)
10
11list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
12
13set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/font.o ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o PROPERTIES GENERATED ON)
14add_executable(${BINARY_NAME}.elf ${PLATFORM_SRC} ${GUI_SRC} ${CMAKE_CURRENT_BINARY_DIR}/font.o ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o main.c)
15set_target_properties(${BINARY_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES}")
16target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${OS_LIB})
17
18add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/font.o
19 COMMAND ${OBJCOPY_CMD} font.png ${CMAKE_CURRENT_BINARY_DIR}/font.o
20 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res)
21
22add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
23 COMMAND ${OBJCOPY_CMD} backdrop.png ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
24 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
25
26add_custom_target(${BINARY_NAME}.velf ALL
27 ${STRIP} --strip-unneeded -go ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.elf
28 COMMAND ${FIXUP} ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.velf ${NIDDB}
29 DEPENDS ${BINARY_NAME}.elf)
30
31install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.velf DESTINATION . COMPONENT ${BINARY_NAME}-psp2)