diff Applications/CMakeLists.txt @ 9:021482366dac

Windows resources for command-line tools
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Oct 2016 17:11:24 +0200
parents 62adabb8c122
children e944d00a8a9e
line wrap: on
line diff
--- a/Applications/CMakeLists.txt	Wed Oct 26 16:53:54 2016 +0200
+++ b/Applications/CMakeLists.txt	Wed Oct 26 17:11:24 2016 +0200
@@ -109,6 +109,7 @@
   SRGB_ICC_PROFILE          ${ORTHANC_WSI_DIR}/Resources/sRGB.icc
   )
 
+
 add_library(OrthancWSIFramework STATIC
   #${ORTHANC_WSI_DIR}/Framework/Messaging/PluginOrthancConnection.cpp
   ${ORTHANC_WSI_DIR}/Framework/Algorithms/PyramidReader.cpp
@@ -194,9 +195,28 @@
 ## Build the WSI DICOM-izer
 #####################################################################
 
+# Create the Windows resources, if need be
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  execute_process(
+    COMMAND 
+    ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
+    ${ORTHANC_WSI_VERSION} OrthancWSIDicomizer OrthancWSIDicomizer.exe "Companion tool to Orthanc for whole-slide imaging"
+    ERROR_VARIABLE Failure
+    OUTPUT_FILE ${AUTOGENERATED_DIR}/OrthancWSIDicomizer.rc
+    )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while computing the version information: ${Failure}")
+  endif()
+
+  set(DICOMIZER_RESOURCES ${AUTOGENERATED_DIR}/OrthancWSIDicomizer.rc)
+endif()
+
+
 add_executable(OrthancWSIDicomizer
   Dicomizer.cpp
   ApplicationToolbox.cpp
+  ${DICOMIZER_RESOURCES}
   )
 
 target_link_libraries(OrthancWSIDicomizer OrthancWSIFramework ${DCMTK_LIBRARIES})
@@ -211,9 +231,28 @@
 ## Build the DICOM-to-TIFF conversion tool
 #####################################################################
 
+# Create the Windows resources, if need be
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  execute_process(
+    COMMAND 
+    ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
+    ${ORTHANC_WSI_VERSION} OrthancWSIDicomToTiff OrthancWSIDicomToTiff.exe "Companion tool to Orthanc for whole-slide imaging"
+    ERROR_VARIABLE Failure
+    OUTPUT_FILE ${AUTOGENERATED_DIR}/OrthancWSIDicomToTiff.rc
+    )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while computing the version information: ${Failure}")
+  endif()
+
+  set(DICOM_TO_TIFF_RESOURCES ${AUTOGENERATED_DIR}/OrthancWSIDicomToTiff.rc)
+endif()
+
+
 add_executable(OrthancWSIDicomToTiff
   DicomToTiff.cpp
   ApplicationToolbox.cpp
+  ${DICOM_TO_TIFF_RESOURCES}
   )
 
 target_link_libraries(OrthancWSIDicomToTiff OrthancWSIFramework ${DCMTK_LIBRARIES})