diff options
author | Adrian Graber <adrian@adriangraber.com> | 2021-07-12 02:27:45 +0200 |
---|---|---|
committer | Adrian Graber <adrian@adriangraber.com> | 2021-07-13 00:50:49 +0200 |
commit | 5cab196718d94c1ddfe1ddda0490a639cac7fde0 (patch) | |
tree | b543d8e0291ef591d85519e786d6f63255fca218 /cmake/nx/NXFunctions.cmake | |
parent | 3bde84f6c8480217b2fcd7ec29c28f62672a3279 (diff) |
Finish cmake stuff for Switch build
* SDL2 for OpenAL not needed anymore
* Add re3_platform_target function and use that instead of manually building NRO
Diffstat (limited to 'cmake/nx/NXFunctions.cmake')
-rw-r--r-- | cmake/nx/NXFunctions.cmake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmake/nx/NXFunctions.cmake b/cmake/nx/NXFunctions.cmake index 8fa23fae..cf3f974b 100644 --- a/cmake/nx/NXFunctions.cmake +++ b/cmake/nx/NXFunctions.cmake @@ -5,3 +5,34 @@ 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(re3_platform_target TARGET) + cmake_parse_arguments(RPT "INSTALL" "" "" ${ARGN}) + + get_target_property(TARGET_TYPE "${TARGET}" TYPE) + if(TARGET_TYPE STREQUAL "EXECUTABLE") + nx_generate_nacp(${TARGET}.nacp + NAME "${TARGET}" + AUTHOR "${${PROJECT}_AUTHOR}" + VERSION "1.0.0-${GIT_SHA1}" + ) + + nx_create_nro(${TARGET} + NACP ${TARGET}.nacp + ICON "${PROJECT_SOURCE_DIR}/res/images/logo_256.jpg" + ) + + if(${PROJECT}_INSTALL AND RPT_INSTALL) + get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME) + if(NOT TARGET_OUTPUT_NAME) + set(TARGET_OUTPUT_NAME "${TARGET}") + endif() + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_OUTPUT_NAME}.nro" + DESTINATION "." + ) + endif() + endif() +endfunction() |