src/platform/wii/CMakeLists.txt (view raw)
1find_program(ELF2DOL elf2dol)
2find_program(GXTEXCONV gxtexconv)
3find_program(RAW2C raw2c)
4find_program(WIILOAD wiiload)
5
6set(OS_DEFINES COLOR_16_BIT COLOR_5_6_5 USE_VFS_FILE)
7list(APPEND VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-file.c ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-dirent.c)
8
9include_directories(${CMAKE_CURRENT_BINARY_DIR})
10
11file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/wii/wii-*.c)
12list(APPEND OS_LIB wiiuse bte fat ogc)
13set(OS_SRC ${OS_SRC} PARENT_SCOPE)
14source_group("Wii-specific code" FILES ${OS_SRC})
15set(VFS_SRC ${VFS_SRC} PARENT_SCOPE)
16set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)
17
18list(APPEND GUI_SRC ${CMAKE_CURRENT_BINARY_DIR}/font.c ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
19
20set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/font.c PROPERTIES GENERATED ON)
21add_executable(${BINARY_NAME}.elf ${GUI_SRC} main.c)
22set_target_properties(${BINARY_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
23target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${OS_LIB})
24
25add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/font.c
26 COMMAND ${RAW2C} ${CMAKE_SOURCE_DIR}/src/platform/wii/font.tpl
27 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
28
29add_custom_target(${BINARY_NAME}.dol ALL
30 ${ELF2DOL} ${BINARY_NAME}.elf ${BINARY_NAME}.dol
31 DEPENDS ${BINARY_NAME}.elf)
32
33add_custom_target(run ${WIILOAD} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.dol
34 DEPENDS ${BINARY_NAME}.dol)
35
36configure_file(${CMAKE_CURRENT_SOURCE_DIR}/meta.xml.in ${CMAKE_CURRENT_BINARY_DIR}/meta.xml)
37install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icon.png ${CMAKE_CURRENT_BINARY_DIR}/meta.xml DESTINATION . COMPONENT ${BINARY_NAME}-wii)
38install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.dol DESTINATION . RENAME boot.dol COMPONENT ${BINARY_NAME}-wii)