summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-02-18 01:58:05 +0100
committerAki <please@ignore.pl>2024-02-18 02:06:42 +0100
commit67068c9cd91e11800d9a06b386705100a2050da0 (patch)
tree75ff7f7c20430785c012668524173929fe5a69a4
parent7f5562530f9a1decfae9e4c88b95422c82ed829c (diff)
downloadstarshatter-67068c9cd91e11800d9a06b386705100a2050da0.zip
starshatter-67068c9cd91e11800d9a06b386705100a2050da0.tar.gz
starshatter-67068c9cd91e11800d9a06b386705100a2050da0.tar.bz2
All files containing version are now updated more consistently
-rw-r--r--CMakeLists.txt4
-rw-r--r--StarsEx/CMakeLists.txt2
-rw-r--r--Starshatter/CMakeLists.txt4
-rw-r--r--Starshatter/Starshatter.rc.conf4
-rw-r--r--cmake/modules/AddVersionFile.cmake13
-rw-r--r--cmake/modules/download_resource.cmake.in1
-rw-r--r--cmake/modules/generate_version_file.cmake3
7 files changed, 21 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bca9e2..1f56a50 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,6 @@ set(CMAKE_CXX_EXTENSIONS Yes)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
project(Starshatter)
include(AddVersionFile)
-include(GitDescribe)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/Starshatter" CACHE PATH "Prefix to install to" FORCE)
@@ -16,7 +15,6 @@ if(MSVC)
set(WINDOWSSDK_LIBPATH "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0" CACHE FILEPATH "Path to a versioned lib directory of selected Windows SDK")
set(WINDOWSSDK_PATH "C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0" CACHE FILEPATH "Path to a versioned include directory of selected Windows SDK")
endif()
-git_describe(STARSHATTER_VERSION)
add_subdirectory(ArchiveEx)
add_subdirectory(contrib)
add_subdirectory(data)
@@ -29,7 +27,7 @@ add_subdirectory(NetEx)
add_subdirectory(Starserver)
add_subdirectory(StarsEx)
add_subdirectory(Starshatter)
-add_version_file(version.txt version.txt.conf)
+add_version_file(version.txt version.txt.conf ALL)
install(
FILES NOTICE COPYING
COMPONENT Copyright
diff --git a/StarsEx/CMakeLists.txt b/StarsEx/CMakeLists.txt
index 5083039..1c443b1 100644
--- a/StarsEx/CMakeLists.txt
+++ b/StarsEx/CMakeLists.txt
@@ -290,7 +290,7 @@ target_compile_definitions(
StarsEx
PRIVATE _ALLOW_KEYWORD_MACROS
)
-configure_file(VersionInfo.cpp.conf ${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.cpp @ONLY)
+add_version_file(VersionInfo.cpp VersionInfo.cpp.conf)
target_sources(
StarsEx
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.cpp
diff --git a/Starshatter/CMakeLists.txt b/Starshatter/CMakeLists.txt
index 913685f..e73a639 100644
--- a/Starshatter/CMakeLists.txt
+++ b/Starshatter/CMakeLists.txt
@@ -1,5 +1,4 @@
project(Starshatter)
-include(GitToResource)
add_executable(
Starshatter WIN32
Main.cpp
@@ -12,8 +11,7 @@ target_link_libraries(
Starshatter
PRIVATE StarsEx
)
-git_to_resource(RC_VERSION ${STARSHATTER_VERSION})
-configure_file(Starshatter.rc.conf ${CMAKE_CURRENT_BINARY_DIR}/Starshatter.rc @ONLY)
+add_version_file(Starshatter.rc Starshatter.rc.conf)
target_sources(
Starshatter
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/Starshatter.rc
diff --git a/Starshatter/Starshatter.rc.conf b/Starshatter/Starshatter.rc.conf
index 123e9de..7febfc6 100644
--- a/Starshatter/Starshatter.rc.conf
+++ b/Starshatter/Starshatter.rc.conf
@@ -5,8 +5,8 @@
Stars ICON DISCARDABLE "Stars.ico"
VS_VERSION_INFO VERSIONINFO
- FILEVERSION @RC_VERSION@
- PRODUCTVERSION @RC_VERSION@
+ FILEVERSION @STARSHATTER_RC_VERSION@
+ PRODUCTVERSION @STARSHATTER_RC_VERSION@
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
diff --git a/cmake/modules/AddVersionFile.cmake b/cmake/modules/AddVersionFile.cmake
index 67b3371..a0208c8 100644
--- a/cmake/modules/AddVersionFile.cmake
+++ b/cmake/modules/AddVersionFile.cmake
@@ -1,8 +1,19 @@
+# Adds a target that generates file with version information:
+#
+# add_version_file(version.txt version.txt.conf ALL)
+#
+# Where 'version.txt.conf' is a template file which has referenced like "@VARIABLE@" substituted with appropriate
+# values.
+
set(ADD_VERSION_FILE_DIR "${CMAKE_CURRENT_LIST_DIR}")
function(add_version_file OUTPUT TEMPLATE)
+ cmake_parse_arguments(PARSE_ARGV 2 VERSION_FILE "ALL" "" "")
+ if(VERSION_FILE_ALL)
+ set(VERSION_FILE_ALL_ARG ALL)
+ endif()
add_custom_target(
${OUTPUT}
- ALL
+ ${VERSION_FILE_ALL_ARG}
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
diff --git a/cmake/modules/download_resource.cmake.in b/cmake/modules/download_resource.cmake.in
index 26a1347..e41ff31 100644
--- a/cmake/modules/download_resource.cmake.in
+++ b/cmake/modules/download_resource.cmake.in
@@ -1,3 +1,4 @@
+# See AddDownloadableResource.cmake
file(
DOWNLOAD @RESOURCE_BASE_URL@/@RESOURCE_ARCHIVE_BASENAME@ @RESOURCE_ARCHIVE@
EXPECTED_HASH SHA1=@RESOURCE_SHA1@
diff --git a/cmake/modules/generate_version_file.cmake b/cmake/modules/generate_version_file.cmake
index e8d8196..874d0ab 100644
--- a/cmake/modules/generate_version_file.cmake
+++ b/cmake/modules/generate_version_file.cmake
@@ -1,3 +1,6 @@
+# See AddVersionFile.cmake
include(GitDescribe)
+include(GitToResource)
git_describe(STARSHATTER_VERSION)
+git_to_resource(STARSHATTER_VERSION_RC ${STARSHATTER_VERSION})
configure_file("${TEMPLATE}" "${OUTPUT}" @ONLY)