summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Stars45/CMakeLists.txt9
-rw-r--r--Stars45/CmpnScreen.cpp1
-rw-r--r--Stars45/DataLoader.cpp1
-rw-r--r--Stars45/Game.cpp1
-rw-r--r--Stars45/GameScreen.cpp1
-rw-r--r--Stars45/LoadScreen.cpp1
-rw-r--r--Stars45/MenuScreen.cpp1
-rw-r--r--Stars45/NetClientConfig.cpp1
-rw-r--r--Stars45/NetServerConfig.cpp1
-rw-r--r--Stars45/PlanScreen.cpp1
-rw-r--r--Stars45/StarServer.cpp1
-rw-r--r--Stars45/Stars.rc99
-rw-r--r--Stars45/Stars.rc.conf37
-rw-r--r--Stars45/Starshatter.cpp1
-rw-r--r--Stars45/resource.h20
-rw-r--r--cmake/modules/GitToResource.cmake10
16 files changed, 59 insertions, 127 deletions
diff --git a/Stars45/CMakeLists.txt b/Stars45/CMakeLists.txt
index 025df81..7f5216d 100644
--- a/Stars45/CMakeLists.txt
+++ b/Stars45/CMakeLists.txt
@@ -1,5 +1,6 @@
project(Stars45)
include(GitDescribe)
+include(GitToResource)
add_executable(
Stars45 WIN32
ActiveWindow.cpp
@@ -296,8 +297,14 @@ target_compile_definitions(
PRIVATE _ALLOW_KEYWORD_MACROS
)
git_describe(VERSION)
+git_to_resource(RC_VERSION ${VERSION})
+configure_file(Stars.rc.conf ${CMAKE_CURRENT_BINARY_DIR}/Stars.rc @ONLY)
configure_file(VersionInfo.cpp.conf ${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.cpp @ONLY)
-target_sources(Stars45 PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.cpp)
+target_sources(
+ Stars45
+ PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/Stars.rc
+ PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.cpp
+ )
set_target_properties(Stars45 PROPERTIES OUTPUT_NAME Starshatter)
if(MSVC)
target_include_directories(
diff --git a/Stars45/CmpnScreen.cpp b/Stars45/CmpnScreen.cpp
index d53a0e0..a5bdfad 100644
--- a/Stars45/CmpnScreen.cpp
+++ b/Stars45/CmpnScreen.cpp
@@ -41,7 +41,6 @@
#include "FontMgr.h"
#include "EventDispatch.h"
#include "DataLoader.h"
-#include "resource.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/DataLoader.cpp b/Stars45/DataLoader.cpp
index 566bc0d..9c58608 100644
--- a/Stars45/DataLoader.cpp
+++ b/Stars45/DataLoader.cpp
@@ -16,7 +16,6 @@
#include "Bmp.h"
#include "Pcx.h"
#include "Sound.h"
-#include "resource.h"
#include "Video.h"
#include "Wave.h"
diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp
index 6bab303..ca66426 100644
--- a/Stars45/Game.cpp
+++ b/Stars45/Game.cpp
@@ -18,7 +18,6 @@
#include "DataLoader.h"
#include "Keyboard.h"
#include "Pcx.h"
-#include "resource.h"
#include "Bitmap.h"
#include "MachineInfo.h"
#include "Video.h"
diff --git a/Stars45/GameScreen.cpp b/Stars45/GameScreen.cpp
index e74f74a..60382b1 100644
--- a/Stars45/GameScreen.cpp
+++ b/Stars45/GameScreen.cpp
@@ -51,7 +51,6 @@
#include "FontMgr.h"
#include "EventDispatch.h"
#include "DataLoader.h"
-#include "resource.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/LoadScreen.cpp b/Stars45/LoadScreen.cpp
index 4cc3d0a..7fdb1be 100644
--- a/Stars45/LoadScreen.cpp
+++ b/Stars45/LoadScreen.cpp
@@ -25,7 +25,6 @@
#include "Font.h"
#include "FontMgr.h"
#include "DataLoader.h"
-#include "resource.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/MenuScreen.cpp b/Stars45/MenuScreen.cpp
index 4f05d34..24ad6b7 100644
--- a/Stars45/MenuScreen.cpp
+++ b/Stars45/MenuScreen.cpp
@@ -61,7 +61,6 @@
#include "FontMgr.h"
#include "EventDispatch.h"
#include "DataLoader.h"
-#include "resource.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/NetClientConfig.cpp b/Stars45/NetClientConfig.cpp
index 85592b7..72eb716 100644
--- a/Stars45/NetClientConfig.cpp
+++ b/Stars45/NetClientConfig.cpp
@@ -21,7 +21,6 @@
#include "Game.h"
#include "DataLoader.h"
#include "ParseUtil.h"
-#include "resource.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/NetServerConfig.cpp b/Stars45/NetServerConfig.cpp
index 4e89333..84f39fa 100644
--- a/Stars45/NetServerConfig.cpp
+++ b/Stars45/NetServerConfig.cpp
@@ -25,7 +25,6 @@
#include "Game.h"
#include "DataLoader.h"
#include "ParseUtil.h"
-#include "resource.h"
#include "VersionInfo.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/PlanScreen.cpp b/Stars45/PlanScreen.cpp
index 5312b37..20fe413 100644
--- a/Stars45/PlanScreen.cpp
+++ b/Stars45/PlanScreen.cpp
@@ -35,7 +35,6 @@
#include "FontMgr.h"
#include "EventDispatch.h"
#include "DataLoader.h"
-#include "resource.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/StarServer.cpp b/Stars45/StarServer.cpp
index c99e499..3a1a3df 100644
--- a/Stars45/StarServer.cpp
+++ b/Stars45/StarServer.cpp
@@ -50,7 +50,6 @@
#include "MultiController.h"
#include "DataLoader.h"
#include "ParseUtil.h"
-#include "resource.h"
#include "VersionInfo.h"
// +--------------------------------------------------------------------+
diff --git a/Stars45/Stars.rc b/Stars45/Stars.rc
deleted file mode 100644
index 4eaa114..0000000
--- a/Stars45/Stars.rc
+++ /dev/null
@@ -1,99 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-Stars ICON DISCARDABLE "Stars.ico"
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 4,5,0,0
- PRODUCTVERSION 4,5,0,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "Destroyer Studios\0"
- VALUE "FileDescription", "Stars\0"
- VALUE "FileVersion", "5, 0, 0, 0\0"
- VALUE "InternalName", "Stars\0"
- VALUE "LegalCopyright", "Copyright © 2006\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "Stars.exe\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "Starshatter\0"
- VALUE "ProductVersion", "5, 0, 0, 0\0"
- VALUE "SpecialBuild", "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
-
diff --git a/Stars45/Stars.rc.conf b/Stars45/Stars.rc.conf
new file mode 100644
index 0000000..6f5ff78
--- /dev/null
+++ b/Stars45/Stars.rc.conf
@@ -0,0 +1,37 @@
+#include "resource.h"
+
+Stars ICON DISCARDABLE "Stars.ico"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @RC_VERSION@
+ PRODUCTVERSION @RC_VERSION@
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ 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 "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"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp
index 8dc87f4..29f44c7 100644
--- a/Stars45/Starshatter.cpp
+++ b/Stars45/Starshatter.cpp
@@ -106,7 +106,6 @@
#include "Archive.h"
#include "DataLoader.h"
#include "Random.h"
-#include "resource.h"
#include "Universe.h"
#include "Video.h"
#include "VideoSettings.h"
diff --git a/Stars45/resource.h b/Stars45/resource.h
index 59a737b..4dd9864 100644
--- a/Stars45/resource.h
+++ b/Stars45/resource.h
@@ -1,18 +1,6 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by Stars.rc
-//
+#ifndef resource_h
+#define resource_h
+
#define Stars 100
-#define IDI_ICON1 101
-#define IDI_ICON2 102
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 104
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+#endif // resource_h
diff --git a/cmake/modules/GitToResource.cmake b/cmake/modules/GitToResource.cmake
new file mode 100644
index 0000000..ac48cdb
--- /dev/null
+++ b/cmake/modules/GitToResource.cmake
@@ -0,0 +1,10 @@
+# Converts git version name acquired by GitDescribe to a format that can be embedded into rc file.
+
+function(git_to_resource VAR VERSION)
+ string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)-?([0-9]*)" OUTPUT ${VERSION})
+ set(RC_VERSION "${CMAKE_MATCH_1},${CMAKE_MATCH_2},${CMAKE_MATCH_3},${CMAKE_MATCH_4}")
+ if(NOT DEFINED CMAKE_MATCH_4)
+ string(APPEND RC_VERSION "0")
+ endif()
+ set(${VAR} ${RC_VERSION} PARENT_SCOPE)
+endfunction()