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 IOAPI_NO_64)
7list(APPEND CORE_VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-file.c ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-dirent.c ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-devlist.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(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE)
16set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)
17
18list(APPEND GUI_SRC ${CMAKE_CURRENT_BINARY_DIR}/font.c ${CMAKE_CURRENT_BINARY_DIR}/icons.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 MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/src/platform/wii/font.tpl
28 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
29
30add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icons.c
31 COMMAND ${RAW2C} ${CMAKE_SOURCE_DIR}/src/platform/wii/icons.tpl
32 MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/src/platform/wii/icons.tpl
33 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
34
35add_custom_target(${BINARY_NAME}.dol ALL
36 ${ELF2DOL} ${BINARY_NAME}.elf ${BINARY_NAME}.dol
37 DEPENDS ${BINARY_NAME}.elf)
38
39add_custom_target(run ${WIILOAD} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.dol
40 DEPENDS ${BINARY_NAME}.dol)
41
42configure_file(${CMAKE_CURRENT_SOURCE_DIR}/meta.xml.in ${CMAKE_CURRENT_BINARY_DIR}/meta.xml)
43install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icon.png ${CMAKE_CURRENT_BINARY_DIR}/meta.xml DESTINATION . COMPONENT ${BINARY_NAME}-wii)
44install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.dol DESTINATION . RENAME boot.dol COMPONENT ${BINARY_NAME}-wii)