From f1070a2e74716b3e475fc4e78a7edf3f7dac0aa2 Mon Sep 17 00:00:00 2001 From: th-2021 <90853655+th-2021@users.noreply.github.com> Date: Tue, 4 Oct 2022 01:13:29 +0200 Subject: set version in build.c from CmakeLists.txt version info (#1678) --- CMake/Packaging-2.cmake | 2 +- CMakeLists.txt | 9 ++++----- soh/CMakeLists.txt | 11 +++++++---- soh/macosx/Info.plist | 35 ----------------------------------- soh/macosx/Info.plist.in | 35 +++++++++++++++++++++++++++++++++++ soh/src/boot/build.c | 4 ---- soh/src/boot/build.c.in | 5 +++++ 7 files changed, 52 insertions(+), 49 deletions(-) delete mode 100644 soh/macosx/Info.plist create mode 100644 soh/macosx/Info.plist.in delete mode 100644 soh/src/boot/build.c create mode 100644 soh/src/boot/build.c.in diff --git a/CMake/Packaging-2.cmake b/CMake/Packaging-2.cmake index 2e1183190..c6e501c73 100644 --- a/CMake/Packaging-2.cmake +++ b/CMake/Packaging-2.cmake @@ -22,7 +22,7 @@ endif() if (CPACK_GENERATOR MATCHES "Bundle") set(CPACK_BUNDLE_NAME "soh") - set(CPACK_BUNDLE_PLIST "../soh/macosx/Info.plist") + set(CPACK_BUNDLE_PLIST "macosx/Info.plist") set(CPACK_BUNDLE_ICON "macosx/soh.icns") set(CPACK_BUNDLE_STARTUP_COMMAND "../soh/macosx/soh-macos.sh") set(CPACK_BUNDLE_APPLE_CERT_APP "-") diff --git a/CMakeLists.txt b/CMakeLists.txt index 436872372..db2ccbc0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,11 +6,10 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) -project(Ship C CXX) - -set(PROJECT_VERSION_MAJOR "4") -set(PROJECT_VERSION_MINOR "0") -set(PROJECT_VERSION_PATCH "1") +project(Ship LANGUAGES C CXX + VERSION 4.0.1) +set(PROJECT_BUILD_NAME "ZHORA BRAVO" CACHE STRING "") +set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "") set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh) add_compile_options($<$:/MP>) diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 7fbb80a73..372e64d80 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -95,6 +95,8 @@ set(PROJECT_NAME soh) ################################################################################ # Source groups ################################################################################ +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c.in ${CMAKE_BINARY_DIR}/build.c @ONLY) + set(Header_Files "resource.h" ) @@ -395,7 +397,7 @@ endif() set(Source_Files__src__boot "src/boot/assert.c" "src/boot/boot_main.c" - "src/boot/build.c" + "${CMAKE_BINARY_DIR}/build.c" "src/boot/idle.c" "src/boot/is_debug.c" "src/boot/logutils.c" @@ -2039,6 +2041,7 @@ find_program(CURL NAMES curl DOC "Path to the curl program. Used to download fi execute_process(COMMAND ${CURL} -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt OUTPUT_VARIABLE RESULT) if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/macosx/Info.plist.in ${CMAKE_BINARY_DIR}/macosx/Info.plist @ONLY) INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION ../MacOS COMPONENT ship) elseif(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "NintendoSwitch|CafeOS") INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION . COMPONENT ship) @@ -2057,8 +2060,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch") nx_generate_nacp(Ship.nacp NAME "Ship of Harkinian" - AUTHOR "Harbour Masters" - VERSION "4.0.0" + AUTHOR "${PROJECT_TEAM}" + VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" ) nx_create_nro(soh @@ -2075,7 +2078,7 @@ wut_create_rpx(${PROJECT_NAME}) wut_create_wuhb(${PROJECT_NAME} NAME "Ship of Harkinian" SHORTNAME "SoH" - AUTHOR "Harbour Masters" + AUTHOR "${PROJECT_TEAM}" ICON ${CMAKE_CURRENT_SOURCE_DIR}/icon.jpg ) diff --git a/soh/macosx/Info.plist b/soh/macosx/Info.plist deleted file mode 100644 index 800d42eeb..000000000 --- a/soh/macosx/Info.plist +++ /dev/null @@ -1,35 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleName - Ship of Harkinian - CFBundleExecutable - soh - CFBundleGetInfoString - 4.0.1 - CFBundleIconFile - soh.icns - CFBundleIdentifier - com.shipofharkinian.ShipOfHarkinian - CFBundleDocumentTypes - - - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - 4.0.1 - CFBundleSignature - ZOoT - CFBundleVersion - 4.0.1 - NSHumanReadableCopyright - Copyright 2022 HarbourMasters. - LSMinimumSystemVersion - 10.15 - - diff --git a/soh/macosx/Info.plist.in b/soh/macosx/Info.plist.in new file mode 100644 index 000000000..b44948b36 --- /dev/null +++ b/soh/macosx/Info.plist.in @@ -0,0 +1,35 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleName + Ship of Harkinian + CFBundleExecutable + soh + CFBundleGetInfoString + @CMAKE_PROJECT_VERSION@ + CFBundleIconFile + soh.icns + CFBundleIdentifier + com.shipofharkinian.ShipOfHarkinian + CFBundleDocumentTypes + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + @CMAKE_PROJECT_VERSION@ + CFBundleSignature + ZOoT + CFBundleVersion + @CMAKE_PROJECT_VERSION@ + NSHumanReadableCopyright + Copyright 2022 HarbourMasters. + LSMinimumSystemVersion + 10.15 + + diff --git a/soh/src/boot/build.c b/soh/src/boot/build.c deleted file mode 100644 index 0fb6d64ad..000000000 --- a/soh/src/boot/build.c +++ /dev/null @@ -1,4 +0,0 @@ -const char gBuildVersion[] = "ZHORA BRAVO (4.0.1)"; -const char gBuildTeam[] = "github.com/harbourmasters"; -const char gBuildDate[] = __DATE__ " " __TIME__; -const char gBuildMakeOption[] = ""; diff --git a/soh/src/boot/build.c.in b/soh/src/boot/build.c.in new file mode 100644 index 000000000..6bf50e39f --- /dev/null +++ b/soh/src/boot/build.c.in @@ -0,0 +1,5 @@ +const char gBuildVersion[] = "@PROJECT_BUILD_NAME@ (@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@)"; +const char gBuildTeam[] = "@PROJECT_TEAM@"; +const char gBuildDate[] = __DATE__ " " __TIME__; +const char gBuildMakeOption[] = ""; + -- cgit v1.2.3