summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorth-2021 <90853655+th-2021@users.noreply.github.com>2022-10-04 01:13:29 +0200
committerGitHub <noreply@github.com>2022-10-04 01:13:29 +0200
commitf1070a2e74716b3e475fc4e78a7edf3f7dac0aa2 (patch)
tree3b775cadea2814a2b723a6f154b961bf02b93808
parent02c0caff4fff3ab922e844ccd0fb875f163df2d7 (diff)
set version in build.c from CmakeLists.txt version info (#1678)
-rw-r--r--CMake/Packaging-2.cmake2
-rw-r--r--CMakeLists.txt9
-rw-r--r--soh/CMakeLists.txt11
-rw-r--r--soh/macosx/Info.plist.in (renamed from soh/macosx/Info.plist)6
-rw-r--r--soh/src/boot/build.c4
-rw-r--r--soh/src/boot/build.c.in5
6 files changed, 20 insertions, 17 deletions
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($<$<CXX_COMPILER_ID:MSVC>:/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.in
index 800d42eeb..b44948b36 100644
--- a/soh/macosx/Info.plist
+++ b/soh/macosx/Info.plist.in
@@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>soh</string>
<key>CFBundleGetInfoString</key>
- <string>4.0.1</string>
+ <string>@CMAKE_PROJECT_VERSION@</string>
<key>CFBundleIconFile</key>
<string>soh.icns</string>
<key>CFBundleIdentifier</key>
@@ -22,11 +22,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>4.0.1</string>
+ <string>@CMAKE_PROJECT_VERSION@</string>
<key>CFBundleSignature</key>
<string>ZOoT</string>
<key>CFBundleVersion</key>
- <string>4.0.1</string>
+ <string>@CMAKE_PROJECT_VERSION@</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2022 HarbourMasters.</string>
<key>LSMinimumSystemVersion</key>
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[] = "";
+