From d7a1dda0429d5e84d99bca6cff6bccb985e48cd7 Mon Sep 17 00:00:00 2001 From: mhochsteger Date: Mon, 16 Nov 2020 16:10:46 +0100 Subject: [PATCH] cmake - add version info to netgen.exe on Windows --- CMakeLists.txt | 2 +- ng/CMakeLists.txt | 13 +++++++------ windows/.gitignore | 1 + windows/CMakeLists.txt | 4 ++++ windows/{netgen.rc => netgen.rc.template} | 12 ++++++------ 5 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 windows/.gitignore rename windows/{netgen.rc => netgen.rc.template} (82%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7916e6ee..9e07e4ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -417,12 +417,12 @@ endif(USE_CGNS) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/netgen_version.hpp ${CMAKE_CURRENT_BINARY_DIR}/netgen_config.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE}/include COMPONENT netgen_devel) +add_subdirectory(windows) add_subdirectory(libsrc) add_subdirectory(ng) add_subdirectory(tutorials) add_subdirectory(py_tutorials) add_subdirectory(doc) -add_subdirectory(windows) add_subdirectory(nglib) if (USE_PYTHON) add_subdirectory(python) diff --git a/ng/CMakeLists.txt b/ng/CMakeLists.txt index 82d8ea91..82350afc 100644 --- a/ng/CMakeLists.txt +++ b/ng/CMakeLists.txt @@ -4,13 +4,11 @@ else() add_definitions(-DINTERNAL_TCL_DEFAULT=0) endif() -set(netgen_sources ngappinit.cpp onetcl.cpp) if(WIN32) - # add icon to netgen executable - enable_language(RC) - set(netgen_sources ${netgen_sources} ../windows/netgen.rc) - # Don't use ccache here due to incompatibility with the resource compiler - set_directory_properties(PROPERTIES RULE_LAUNCH_COMPILE "") + # add icon and version info to netgen executable + enable_language(RC) + # Don't use ccache here due to incompatibility with the resource compiler + set_directory_properties(PROPERTIES RULE_LAUNCH_COMPILE "") endif(WIN32) if(USE_GUI) @@ -23,6 +21,9 @@ if(USE_GUI) ) add_executable(netgen ngappinit.cpp) + if(WIN32) + target_sources(netgen PRIVATE ../windows/netgen.rc) + endif(WIN32) target_link_libraries( gui PUBLIC nglib ) target_link_libraries( gui PRIVATE ${LIBTOGL} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_Xmu_LIB} ${X11_X11_LIB} ${OCC_LIBRARIES} ) diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 00000000..73a41fa4 --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1 @@ +netgen.rc diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index e69de29b..e1ef0a93 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -0,0 +1,4 @@ +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/netgen.rc.template" + "${CMAKE_CURRENT_SOURCE_DIR}/netgen.rc" + IMMEDIATE @ONLY) diff --git a/windows/netgen.rc b/windows/netgen.rc.template similarity index 82% rename from windows/netgen.rc rename to windows/netgen.rc.template index 047feb6f..6280e2fa 100644 --- a/windows/netgen.rc +++ b/windows/netgen.rc.template @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -35,8 +35,8 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,1,0,0 - PRODUCTVERSION 5,1,0,0 + FILEVERSION @NETGEN_VERSION_MAJOR@,@NETGEN_VERSION_MINOR@,@NETGEN_VERSION_PATCH@,@NETGEN_VERSION_TWEAK@ + PRODUCTVERSION @NETGEN_VERSION_MAJOR@,@NETGEN_VERSION_MINOR@,@NETGEN_VERSION_PATCH@,@NETGEN_VERSION_TWEAK@ FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x3L @@ -51,14 +51,14 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "CompanyName", "Vienna UT" + VALUE "CompanyName", "TU Wien" VALUE "FileDescription", "Netgen Meshing Software" - VALUE "FileVersion", "5.1-dev" + VALUE "FileVersion", "@NETGEN_VERSION@" VALUE "InternalName", "Netgen" VALUE "LegalCopyright", "GNU Public License (GPL)" VALUE "OriginalFilename", "Netgen.exe" VALUE "ProductName", "Netgen" - VALUE "ProductVersion", "5.1-dev" + VALUE "ProductVersion", "@NETGEN_VERSION@" END END BLOCK "VarFileInfo"