From 081f071ac11ab6ebaee1f7a2367fa1f9ecad784a Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 15 Oct 2022 17:31:39 +0200 Subject: Added version file to build artifacts to support automatic deployment --- CMakeLists.txt | 7 +++++++ StarsEx/CMakeLists.txt | 2 -- StarsEx/VersionInfo.cpp.conf | 2 +- Starshatter/CMakeLists.txt | 4 +--- Starshatter/Starshatter.rc.conf | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd698d5..68c1938 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS Yes) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") project(Starshatter) +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) @@ -14,6 +15,7 @@ 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) @@ -26,4 +28,9 @@ add_subdirectory(NetEx) add_subdirectory(Starserver) add_subdirectory(StarsEx) add_subdirectory(Starshatter) +add_custom_target( + version ALL + BYPRODUCTS version + COMMAND ${CMAKE_COMMAND} -E echo "${STARSHATTER_VERSION}" >version + ) install(FILES NOTICE COPYING DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/StarsEx/CMakeLists.txt b/StarsEx/CMakeLists.txt index 91e82d8..5083039 100644 --- a/StarsEx/CMakeLists.txt +++ b/StarsEx/CMakeLists.txt @@ -1,5 +1,4 @@ project(StarsEx) -include(GitDescribe) add_library( StarsEx STATIC ActiveWindow.cpp @@ -291,7 +290,6 @@ target_compile_definitions( StarsEx PRIVATE _ALLOW_KEYWORD_MACROS ) -git_describe(VERSION) configure_file(VersionInfo.cpp.conf ${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.cpp @ONLY) target_sources( StarsEx diff --git a/StarsEx/VersionInfo.cpp.conf b/StarsEx/VersionInfo.cpp.conf index adaad2c..345135c 100644 --- a/StarsEx/VersionInfo.cpp.conf +++ b/StarsEx/VersionInfo.cpp.conf @@ -6,4 +6,4 @@ #include "VersionInfo.h" -const char* versionInfo = "@VERSION@"; +const char* versionInfo = "@STARSHATTER_VERSION@"; diff --git a/Starshatter/CMakeLists.txt b/Starshatter/CMakeLists.txt index 9623f9a..2501825 100644 --- a/Starshatter/CMakeLists.txt +++ b/Starshatter/CMakeLists.txt @@ -1,5 +1,4 @@ project(Starshatter) -include(GitDescribe) include(GitToResource) add_executable( Starshatter WIN32 @@ -13,8 +12,7 @@ target_link_libraries( Starshatter PRIVATE StarsEx ) -git_describe(VERSION) -git_to_resource(RC_VERSION ${VERSION}) +git_to_resource(RC_VERSION ${STARSHATTER_VERSION}) configure_file(Starshatter.rc.conf ${CMAKE_CURRENT_BINARY_DIR}/Starshatter.rc @ONLY) target_sources( Starshatter diff --git a/Starshatter/Starshatter.rc.conf b/Starshatter/Starshatter.rc.conf index 45479d3..123e9de 100644 --- a/Starshatter/Starshatter.rc.conf +++ b/Starshatter/Starshatter.rc.conf @@ -24,12 +24,12 @@ BEGIN VALUE "Comments", "A military space combat simulator\0" VALUE "CompanyName", "Starshatter: The Open Source Project Contributors\0" VALUE "FileDescription", "Stars\0" - VALUE "FileVersion", "@VERSION@\0" + VALUE "FileVersion", "@STARSHATTER_VERSION@\0" VALUE "InternalName", "Stars45\0" VALUE "LegalCopyright", "Copyright (c) 2022, Starshatter: The Open Source Project Contributors\0" VALUE "OriginalFilename", "Stars45.exe\0" VALUE "ProductName", "Starshatter: The Open Source Project\0" - VALUE "ProductVersion", "@VERSION@\0" + VALUE "ProductVersion", "@STARSHATTER_VERSION@\0" END END BLOCK "VarFileInfo" -- cgit v1.1