diff CMakeLists.txt @ 16:777b677cc9fc OrthancPython-1.0

generation of windows resources
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Apr 2020 10:43:11 +0200
parents 13589c36243d
children 3848f5b1d993
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Apr 01 09:45:03 2020 +0200
+++ b/CMakeLists.txt	Wed Apr 01 10:43:11 2020 +0200
@@ -14,6 +14,7 @@
 include(CheckIncludeFileCXX)
 include(CheckIncludeFiles)
 include(CheckLibraryExists)
+include(FindPythonInterp)
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
   set(PYTHON_INCLUDE_DIRS ${PYTHON_WINDOWS_ROOT}/include)
@@ -39,6 +40,25 @@
 include(${ORTHANC_ROOT}/Resources/CMake/BoostConfiguration.cmake)
 include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake)
 
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  execute_process(
+    COMMAND 
+    ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
+    ${PLUGIN_VERSION} "Python plugin" OrthancPython.dll
+    "Plugin to create Orthanc plugins using Python"
+    ERROR_VARIABLE Failure
+    OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/Version.rc
+    )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while computing the version information: ${Failure}")
+  endif()
+
+  set(WINDOWS_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/Version.rc)
+endif()
+
+
 include_directories(
   ${ORTHANC_ROOT}/Sdk-1.5.7
   )
@@ -56,6 +76,7 @@
   ${BOOST_SOURCES}
   ${JSONCPP_SOURCES}
   ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
+  ${WINDOWS_RESOURCES}
   Sources/Autogenerated/sdk.cpp
   Sources/OnChangeCallback.cpp
   Sources/OnStoredInstanceCallback.cpp