mirror of https://github.com/aap/librw.git
cmake: fix Nintendo Switch support
This commit is contained in:
parent
829cf6b700
commit
83ba0bd615
|
@ -12,7 +12,7 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: "Build files"
|
- name: "Build files"
|
||||||
run: |
|
run: |
|
||||||
/opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -S. -Bbuild .. -DLIBRW_PLATFORM=GL3 -DLIBRW_GL3_GFXLIB=GLFW -DLIBRW_INSTALL=True
|
/opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -S. -Bbuild -DLIBRW_PLATFORM=GL3 -DLIBRW_GL3_GFXLIB=GLFW -DLIBRW_INSTALL=True
|
||||||
cmake --build build --parallel
|
cmake --build build --parallel
|
||||||
- name: "Create binary package (cpack)"
|
- name: "Create binary package (cpack)"
|
||||||
working-directory: ./build
|
working-directory: ./build
|
||||||
|
|
|
@ -14,7 +14,7 @@ elseif(NINTENDO_SWITCH)
|
||||||
set(LIBRW_PLATFORMS "NULL" "GL3")
|
set(LIBRW_PLATFORMS "NULL" "GL3")
|
||||||
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL OFF)
|
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL OFF)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nxtoolchain")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nxtoolchain")
|
||||||
include(CheckNXFunctions)
|
include(NXFunctions)
|
||||||
else()
|
else()
|
||||||
set(LIBRW_PLATFORMS "NULL" "GL3" "PS2")
|
set(LIBRW_PLATFORMS "NULL" "GL3" "PS2")
|
||||||
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL ON)
|
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL ON)
|
||||||
|
@ -41,6 +41,11 @@ if(LIBRW_PLATFORM_PS2)
|
||||||
enable_language(DSM)
|
enable_language(DSM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT COMMAND librw_platform_target)
|
||||||
|
function(librw_platform_target)
|
||||||
|
endfunction()
|
||||||
|
endif()
|
||||||
|
|
||||||
option(LIBRW_TOOLS "Build librw tools" ON)
|
option(LIBRW_TOOLS "Build librw tools" ON)
|
||||||
option(LIBRW_INSTALL "Install librw files" OFF)
|
option(LIBRW_INSTALL "Install librw files" OFF)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
if(NOT COMMAND nx_generate_nacp)
|
|
||||||
message(FATAL_ERROR "The `nx_generate_nacp` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT COMMAND nx_create_nro)
|
|
||||||
message(FATAL_ERROR "The `nx_create_nro` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.")
|
|
||||||
endif()
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
if(NOT COMMAND nx_generate_nacp)
|
||||||
|
message(FATAL_ERROR "The `nx_generate_nacp` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT COMMAND nx_create_nro)
|
||||||
|
message(FATAL_ERROR "The `nx_create_nro` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||||
|
|
||||||
|
function(librw_platform_target TARGET)
|
||||||
|
cmake_parse_arguments(LPT "INSTALL" "" "" ${ARGN})
|
||||||
|
|
||||||
|
get_target_property(TARGET_TYPE "${TARGET}" TYPE)
|
||||||
|
if(TARGET_TYPE STREQUAL "EXECUTABLE")
|
||||||
|
nx_generate_nacp(${TARGET}.nacp
|
||||||
|
NAME "${TARGET}"
|
||||||
|
AUTHOR "${librw_AUTHOR}"
|
||||||
|
VERSION "${librw_VERSION}"
|
||||||
|
)
|
||||||
|
|
||||||
|
nx_create_nro(${TARGET}
|
||||||
|
NACP ${TARGET}.nacp
|
||||||
|
)
|
||||||
|
|
||||||
|
if(LIBRW_INSTALL AND LPT_INSTALL)
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.nro"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
|
@ -11,3 +11,5 @@ add_custom_command(
|
||||||
TARGET camera POST_BUILD
|
TARGET camera POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/files" "$<TARGET_FILE_DIR:camera>/files"
|
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/files" "$<TARGET_FILE_DIR:camera>/files"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
librw_platform_target(camera)
|
||||||
|
|
|
@ -13,20 +13,4 @@ if(LIBRW_INSTALL)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NINTENDO_SWITCH)
|
librw_platform_target(dumprwtree INSTALL)
|
||||||
nx_generate_nacp(dumprwtree.nacp
|
|
||||||
NAME "dumprwtree"
|
|
||||||
AUTHOR "${librw_AUTHOR}"
|
|
||||||
VERSION "${librw_VERSION}"
|
|
||||||
)
|
|
||||||
|
|
||||||
nx_create_nro(dumprwtree
|
|
||||||
NACP dumprwtree.nacp
|
|
||||||
)
|
|
||||||
|
|
||||||
if(LIBRW_INSTALL)
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dumprwtree.nro"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -11,3 +11,5 @@ add_custom_command(
|
||||||
TARGET im2d POST_BUILD
|
TARGET im2d POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/files" "$<TARGET_FILE_DIR:im2d>/files"
|
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/files" "$<TARGET_FILE_DIR:im2d>/files"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
librw_platform_target(im2d)
|
||||||
|
|
|
@ -11,3 +11,5 @@ add_custom_command(
|
||||||
TARGET im3d POST_BUILD
|
TARGET im3d POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/files" "$<TARGET_FILE_DIR:im3d>/files"
|
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/files" "$<TARGET_FILE_DIR:im3d>/files"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
librw_platform_target(im3d)
|
||||||
|
|
|
@ -14,20 +14,4 @@ if(LIBRW_INSTALL)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NINTENDO_SWITCH)
|
librw_platform_target(imguitest INSTALL)
|
||||||
nx_generate_nacp(imguitest.nacp
|
|
||||||
NAME "librw imguitest"
|
|
||||||
AUTHOR "${librw_AUTHOR}"
|
|
||||||
VERSION "${librw_VERSION}"
|
|
||||||
)
|
|
||||||
|
|
||||||
nx_create_nro(imguitest
|
|
||||||
NACP imguitest.nacp
|
|
||||||
)
|
|
||||||
|
|
||||||
if(LIBRW_INSTALL)
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/imguitest.nro"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -11,3 +11,5 @@ add_custom_command(
|
||||||
TARGET lights POST_BUILD
|
TARGET lights POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/checker.dff" "$<TARGET_FILE_DIR:lights>"
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/checker.dff" "$<TARGET_FILE_DIR:lights>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
librw_platform_target(lights)
|
||||||
|
|
|
@ -4,10 +4,12 @@ add_executable(playground WIN32
|
||||||
|
|
||||||
target_link_libraries(playground
|
target_link_libraries(playground
|
||||||
PUBLIC
|
PUBLIC
|
||||||
librw librw_skeleton
|
librw librw_skeleton_imgui
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET playground POST_BUILD
|
TARGET playground POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/teapot.dff" "${CMAKE_CURRENT_SOURCE_DIR}/maze.tga" "${CMAKE_CURRENT_SOURCE_DIR}/Bm437_IBM_VGA8.FON" "${CMAKE_CURRENT_SOURCE_DIR}/Bm437_IBM_BIOS.FON" "$<TARGET_FILE_DIR:playground>"
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/teapot.dff" "${CMAKE_CURRENT_SOURCE_DIR}/maze.tga" "${CMAKE_CURRENT_SOURCE_DIR}/Bm437_IBM_VGA8.FON" "${CMAKE_CURRENT_SOURCE_DIR}/Bm437_IBM_BIOS.FON" "$<TARGET_FILE_DIR:playground>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
librw_platform_target(playground)
|
||||||
|
|
|
@ -6,3 +6,5 @@ target_link_libraries(ska2anm
|
||||||
PUBLIC
|
PUBLIC
|
||||||
librw
|
librw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
librw_platform_target(ska2anm)
|
||||||
|
|
|
@ -6,3 +6,5 @@ target_link_libraries(subrast
|
||||||
PUBLIC
|
PUBLIC
|
||||||
librw librw_skeleton librw_skeleton_imgui
|
librw librw_skeleton librw_skeleton_imgui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
librw_platform_target(subrast)
|
||||||
|
|
Loading…
Reference in New Issue