From 3e52dd5c6838e87acaa45a233fa322b7135251e4 Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 2 Mar 2014 23:49:19 +0100 Subject: [PATCH] Improved win32 file version information --- CMakeLists.txt | 2 ++ misc/winresource.rc | 52 +++++++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 5 +++-- src/cmake_config.h.in | 6 +++++ src/config.h | 14 ++++++++++++ 5 files changed, 77 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8883896e..aae3a593 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") set(VERSION_MAJOR 0) set(VERSION_MINOR 4) set(VERSION_PATCH 9) +set(VERSION_PATCH_ORIG ${VERSION_PATCH}) + if(VERSION_EXTRA) set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA}) else() diff --git a/misc/winresource.rc b/misc/winresource.rc index 8913ff57..ecb314c1 100644 --- a/misc/winresource.rc +++ b/misc/winresource.rc @@ -1,5 +1,57 @@ #include #include #include +#define USE_CMAKE_CONFIG_H +#include "config.h" +#undef USE_CMAKE_CONFIG_H + +#if RUN_IN_PLACE == 1 + #define BUILDMODE "RUN_IN_PLACE=1\0" +#else + #define BUILDMODE "RUN_IN_PLACE=0\0" +#endif + LANGUAGE 0, SUBLANG_NEUTRAL 130 ICON "minetest-icon.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH_ORIG,0 + PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH_ORIG,0 + FILEFLAGSMASK 0x3fL +#ifndef NDEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Minetest Community\0" + VALUE "FileDescription", "Minetest engine core main application\0" + VALUE "FileVersion", VERSION_STRING + VALUE "InternalName", "Minetest engine\0" + VALUE "LegalCopyright", "(c) 2014 celeron55\0" + VALUE "LegalTrademarks", """Minetest"" is property of Minetest community, don't use the name for your application without permission!\0" + VALUE "OriginalFilename", "minetest.exe\0" + VALUE "PrivateBuild", VERSION_EXTRA_STRING + VALUE "ProductName", "Minetest\0" + VALUE "ProductVersion", PRODUCT_VERSION_STRING + VALUE "SpecialBuild", BUILDMODE + END +END +BLOCK "VarFileInfo" +BEGIN + VALUE "Translation", 0x409, 1200 +END +END diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a5cad8fc..562306e1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -385,7 +385,7 @@ set(common_SRCS ${UTIL_SRCS} ) -# This gives us the icon +# This gives us the icon and file version information if(WIN32) set(WINRESOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../misc/winresource.rc) if(MINGW) @@ -396,7 +396,8 @@ if(WIN32) COMMAND ${CMAKE_RC_COMPILER} -I${CMAKE_CURRENT_SOURCE_DIR} -i${WINRESOURCE_FILE} -o ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${WINRESOURCE_FILE}) SET(common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o) else(MINGW) # Probably MSVC set(common_SRCS ${common_SRCS} ${WINRESOURCE_FILE}) diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in index 75e448f7..17d3c224 100644 --- a/src/cmake_config.h.in +++ b/src/cmake_config.h.in @@ -5,6 +5,7 @@ #define CMAKE_PROJECT_NAME "@PROJECT_NAME@" #define CMAKE_VERSION_STRING "@VERSION_STRING@" +#define CMAKE_PRODUCT_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@" #define CMAKE_RUN_IN_PLACE @RUN_IN_PLACE@ #define CMAKE_USE_GETTEXT @USE_GETTEXT@ #define CMAKE_USE_CURL @USE_CURL@ @@ -13,6 +14,11 @@ #define CMAKE_STATIC_SHAREDIR "@SHAREDIR@" #define CMAKE_USE_LEVELDB @USE_LEVELDB@ #define CMAKE_USE_LUAJIT @USE_LUAJIT@ +#define CMAKE_VERSION_MAJOR @VERSION_MAJOR@ +#define CMAKE_VERSION_MINOR @VERSION_MINOR@ +#define CMAKE_VERSION_PATCH @VERSION_PATCH@ +#define CMAKE_VERSION_PATCH_ORIG @VERSION_PATCH_ORIG@ +#define CMAKE_VERSION_EXTRA_STRING "@VERSION_EXTRA@" #ifdef NDEBUG #define CMAKE_BUILD_TYPE "Release" diff --git a/src/config.h b/src/config.h index 1c0aac4f..55bbb5be 100644 --- a/src/config.h +++ b/src/config.h @@ -36,6 +36,20 @@ #define USE_LEVELDB CMAKE_USE_LEVELDB #undef USE_LUAJIT #define USE_LUAJIT CMAKE_USE_LUAJIT + #undef VERSION_MAJOR + #define VERSION_MAJOR CMAKE_VERSION_MAJOR + #undef VERSION_MINOR + #define VERSION_MINOR CMAKE_VERSION_MINOR + #undef VERSION_PATCH + #define VERSION_PATCH CMAKE_VERSION_PATCH + #undef VERSION_PATCH_ORIG + #define VERSION_PATCH_ORIG CMAKE_VERSION_PATCH_ORIG + #undef VERSION_STRING + #define VERSION_STRING CMAKE_VERSION_STRING + #undef PRODUCT_VERSION_STRING + #define PRODUCT_VERSION_STRING CMAKE_PRODUCT_VERSION_STRING + #undef VERSION_EXTRA_STRING + #define VERSION_EXTRA_STRING CMAKE_VERSION_EXTRA_STRING #endif #endif -- 2.30.2