all repos — mgba @ b4c86ea161856a61117e3712d00307f6b5cd15e5

mGBA Game Boy Advance Emulator

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

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