mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-26 03:35:40 +00:00
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
This commit is contained in:
parent
3bde84f6c8
commit
5cab196718
3 changed files with 43 additions and 28 deletions
|
@ -4,18 +4,25 @@ set(EXECUTABLE re3)
|
|||
set(PROJECT RE3)
|
||||
|
||||
project(${EXECUTABLE} C CXX)
|
||||
set(${PROJECT}_AUTHOR "${PROJECT} Team")
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1 "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
|
||||
message(STATUS "Building ${CMAKE_PROJECT_NAME} GIT SHA1: ${GIT_SHA1}")
|
||||
|
||||
if(WIN32)
|
||||
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
||||
elseif(NINTENDO_SWITCH)
|
||||
if(NINTENDO_SWITCH)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nx")
|
||||
include(NXFunctions)
|
||||
set(${PROJECT}_AUDIOS "OAL")
|
||||
endif()
|
||||
|
||||
if(NOT COMMAND re3_platform_target)
|
||||
function(re3_platform_target)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
||||
else()
|
||||
set(${PROJECT}_AUDIOS "OAL")
|
||||
endif()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -156,27 +156,4 @@ if(${PROJECT}_INSTALL)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Build Nintendo Switch binaries
|
||||
if(NINTENDO_SWITCH)
|
||||
# Needed for OpenAL-Soft
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
SDL2
|
||||
)
|
||||
|
||||
nx_generate_nacp (${EXECUTABLE}.nacp
|
||||
NAME "${EXECUTABLE}"
|
||||
AUTHOR "${EXECUTABLE} Team"
|
||||
VERSION "1.0.0-${GIT_SHA1}"
|
||||
)
|
||||
|
||||
nx_create_nro(${EXECUTABLE}
|
||||
NACP ${EXECUTABLE}.nacp
|
||||
ICON "${PROJECT_SOURCE_DIR}/res/images/logo_256.jpg"
|
||||
)
|
||||
|
||||
if(${PROJECT}_INSTALL)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}.nro"
|
||||
DESTINATION "."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
re3_platform_target(${EXECUTABLE} INSTALL)
|
||||
|
|
Loading…
Reference in a new issue