0026878: CMake - encode properly version of OCCT in Windows binaries
authoribs <ibs@opencascade.com>
Mon, 21 Dec 2015 13:57:39 +0000 (16:57 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 22 Dec 2015 11:47:10 +0000 (14:47 +0300)
.rc file has been added to each toolkit project for msvc

adm/cmake/occt_toolkit.cmake
adm/templates/occt_toolkit.rc.in [new file with mode: 0644]

index f7a845c..b191cd6 100644 (file)
@@ -116,8 +116,19 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
 endforeach()
 string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
 
+set (USED_RCFILE "")
+if (MSVC)
+  set (USED_RCFILE "${CMAKE_BINARY_DIR}/resources/${PROJECT_NAME}.rc")
+
+  if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in")
+    configure_file("${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
+  else()
+    configure_file("${CMAKE_SOURCE_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
+  endif()
+endif()
+
 if ("${PROJECT_NAME}" STREQUAL "DRAWEXE")
-  add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES})
+  add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
 
   install (TARGETS ${PROJECT_NAME}
            CONFIGURATIONS Release
@@ -129,7 +140,7 @@ if ("${PROJECT_NAME}" STREQUAL "DRAWEXE")
            CONFIGURATIONS Debug
            DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
 else()
-  add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES})
+  add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
 
   install (TARGETS ${PROJECT_NAME}
            CONFIGURATIONS Release
diff --git a/adm/templates/occt_toolkit.rc.in b/adm/templates/occt_toolkit.rc.in
new file mode 100644 (file)
index 0000000..e92bae1
--- /dev/null
@@ -0,0 +1,30 @@
+#include <windows.h>
+#include <Standard_Version.hxx>
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION     OCC_VERSION_MAJOR, OCC_VERSION_MINOR, OCC_VERSION_MAINTENANCE, 0
+PRODUCTVERSION  OCC_VERSION_MAJOR, OCC_VERSION_MINOR, OCC_VERSION_MAINTENANCE, 0
+FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
+#ifdef _DEBUG
+FILEFLAGS VS_FF_DEBUG
+#endif
+FILEOS          VOS_NT
+FILETYPE        VFT_DLL
+FILESUBTYPE     VFT2_UNKNOWN
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN BLOCK "040904E4" // Language type = U.S English(0x0409) and Character Set = Windows, Multilingual(0x04E4)
+    BEGIN
+      VALUE "FileDescription", "@PROJECT_NAME@ Toolkit\000"
+      VALUE "FileVersion",     OCC_VERSION_STRING_EXT "\000"
+      VALUE "LegalCopyright",  "\251 OPEN CASCADE SAS\000"
+      VALUE "ProductName",     "@PROJECT_NAME@\000"
+      VALUE "ProductVersion",  OCC_VERSION_STRING_EXT "\000"
+      VALUE "OfficialSite",    "www.opencascade.org\000"
+    END
+  END
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x0409, 0x04E4
+  END
+END