2020-06-19 23:02:31 +02:00
|
|
|
#==========================================
|
|
|
|
|
#
|
|
|
|
|
# ODAMEX FOR NINTENDO SWITCH CMAKE FILE
|
2025-11-14 23:58:45 -06:00
|
|
|
#
|
|
|
|
|
# Do not forget to run this before even
|
2020-06-19 23:02:31 +02:00
|
|
|
# trying to do ANYTHING (CMake/Compile)!
|
|
|
|
|
#
|
2025-11-14 23:58:45 -06:00
|
|
|
# Please read "client/switch/readme.md" for
|
|
|
|
|
# more informations on how to compile for
|
2020-06-19 23:02:31 +02:00
|
|
|
# the Nintendo Switch.
|
|
|
|
|
#
|
|
|
|
|
#==========================================
|
|
|
|
|
message("Generating for Nintendo Switch")
|
|
|
|
|
message("MAKE SURE you entered this command BEFORE either compiling OR CMAKEing!")
|
|
|
|
|
message("source $DEVKITPRO/switchvars.sh")
|
|
|
|
|
message("")
|
|
|
|
|
message("")
|
|
|
|
|
|
|
|
|
|
set (PKG_CONFIG_EXECUTABLE, "$ENV{DEVKITPRO}/portlibs/switch/bin/aarch64-none-elf-pkg-config")
|
|
|
|
|
set (CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE)
|
|
|
|
|
|
|
|
|
|
# Build type (Release/Debug)
|
|
|
|
|
set (CMAKE_BUILD_TYPE, "Release")
|
|
|
|
|
|
|
|
|
|
# Odamex specific settings
|
|
|
|
|
set (BUILD_CLIENT 1)
|
|
|
|
|
set (BUILD_SERVER 0)
|
|
|
|
|
set (BUILD_MASTER 0)
|
2020-12-30 19:09:32 +01:00
|
|
|
set (BUILD_LAUNCHER 0)
|
2020-06-19 23:02:31 +02:00
|
|
|
set (USE_MINIUPNP 0)
|
|
|
|
|
set (USE_DISCORDRPC 0)
|
|
|
|
|
set (ENABLE_PORTMIDI 0)
|
|
|
|
|
|
|
|
|
|
# This is a flag meaning we're compiling for a console
|
2021-01-17 21:54:52 +01:00
|
|
|
set (GCONSOLE 1)
|
|
|
|
|
|
2021-03-16 14:42:30 +01:00
|
|
|
# NACP info
|
2021-03-16 04:37:14 +01:00
|
|
|
set (APP_TITLE "Odamex for Nintendo Switch")
|
|
|
|
|
set (APP_AUTHOR "The Odamex Team")
|
2026-08-02 01:34:12 +00:00
|
|
|
set (APP_VERSION "12.3.0")
|
2021-03-16 04:37:14 +01:00
|
|
|
|
|
|
|
|
# Compiler stuff
|
|
|
|
|
set(NACP_TOOL "${DEVKITPRO}/tools/bin/nacptool" CACHE PATH "nacp-tool")
|
|
|
|
|
set(ELF2NRO_TOOL "${DEVKITPRO}/tools/bin/elf2nro" CACHE PATH "elf2nro")
|
2021-01-17 21:54:52 +01:00
|
|
|
|
|
|
|
|
function (odamex_target_settings_nx _DIRECTORY _FILES)
|
|
|
|
|
# set(${_DIRECTORY} ${CLIENT_DIR} switch) # Nintendo Switch
|
|
|
|
|
# file(${_FILES} CLIENT_HEADERS ${CLIENT_HEADERS} switch/*.h)
|
|
|
|
|
# file(${_FILES} CLIENT_SOURCES ${CLIENT_SOURCES} switch/*.cpp)
|
|
|
|
|
add_definitions("-DUNIX -DGCONSOLE")
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2021-03-16 14:42:30 +01:00
|
|
|
|
|
|
|
|
# Create a function for post-compiling Odamex.
|
2021-03-16 04:37:14 +01:00
|
|
|
macro(odamex_target_postcompile_nx source)
|
2021-03-16 14:42:30 +01:00
|
|
|
# Generate NACP
|
2021-03-16 04:37:14 +01:00
|
|
|
add_custom_command(OUTPUT ${source}.nacp
|
|
|
|
|
COMMAND ${NACP_TOOL} --create ${APP_TITLE} ${APP_AUTHOR} ${APP_VERSION} ${source}.nacp
|
|
|
|
|
DEPENDS ${source}
|
2021-03-16 14:42:30 +01:00
|
|
|
COMMENT "Generating NACP info for ${source}"
|
2021-03-16 04:37:14 +01:00
|
|
|
)
|
|
|
|
|
# NRO
|
|
|
|
|
add_custom_command(OUTPUT ${source}.nro
|
|
|
|
|
COMMAND ${ELF2NRO_TOOL} ${source} ${CMAKE_BINARY_DIR}/${source}.nro --icon=${CMAKE_SOURCE_DIR}/client/switch/assets/odamex.jpg --nacp=${source}.nacp
|
|
|
|
|
DEPENDS ${source}.nacp
|
2021-03-16 14:42:30 +01:00
|
|
|
COMMENT "Generating NRO ${source}.nro"
|
2021-03-16 04:37:14 +01:00
|
|
|
)
|
|
|
|
|
add_custom_target(NRO ALL DEPENDS ${source}.nacp ${source}.nro)
|
2021-06-12 23:04:13 -04:00
|
|
|
endmacro(switch_create_nro)
|