changeset 2391:233d6eeef799

fix pch
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Aug 2017 12:29:48 +0200
parents cf0eb76c5e81
children a88c3ea0c96d
files CMakeLists.txt Resources/CMake/OrthancFrameworkConfiguration.cmake Resources/CMake/VisualStudioPrecompiledHeaders.cmake
diffstat 3 files changed, 32 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Aug 30 12:05:49 2017 +0200
+++ b/CMakeLists.txt	Wed Aug 30 12:29:48 2017 +0200
@@ -59,8 +59,6 @@
 #####################################################################
 
 set(ORTHANC_SERVER_SOURCES
-  ${ORTHANC_DICOM_SOURCES}
-  
   OrthancServer/DatabaseWrapper.cpp
   OrthancServer/DatabaseWrapperBase.cpp
   OrthancServer/DicomInstanceToStore.cpp
@@ -147,6 +145,7 @@
   # cross-compiling DCMTK 3.6.0
   set(ORTHANC_ALL_SOURCES
     ${ORTHANC_CORE_SOURCES_INTERNAL}
+    ${ORTHANC_DICOM_SOURCES_INTERNAL}
     ${ORTHANC_SERVER_SOURCES}
     ${ORTHANC_UNIT_TESTS_SOURCES}
     Plugins/Samples/ServeFolders/Plugin.cpp
@@ -249,14 +248,22 @@
 if (MSVC)
   add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
 
+  set(TMP
+    ${ORTHANC_CORE_SOURCES_INTERNAL}
+    ${ORTHANC_DICOM_SOURCES_INTERNAL}
+    )
+  
   ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
-    "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" ORTHANC_CORE_SOURCES_INTERNAL)
+    "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp"
+    TMP ORTHANC_CORE_PCH)
 
   ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
-    "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp" ORTHANC_SERVER_SOURCES)
+    "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp"
+    ORTHANC_SERVER_SOURCES ORTHANC_SERVER_PCH)
 
   ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
-    "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp" ORTHANC_UNIT_TESTS_SOURCES)
+    "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp"
+    ORTHANC_UNIT_TESTS_SOURCES ORTHANC_UNIT_TESTS_PCH)
 endif()
 
 
@@ -275,8 +282,8 @@
 # content of the "Core" folder, but not OpenSSL, nor DCMTK.
 add_library(CoreLibrary
   STATIC
-  ${ORTHANC_CORE_SOURCES_INTERNAL}
-  ${ORTHANC_CORE_SOURCES_DEPENDENCIES}
+  ${ORTHANC_CORE_PCH}
+  ${ORTHANC_CORE_SOURCES}
   ${AUTOGENERATED_SOURCES}
   )  
 
@@ -288,8 +295,9 @@
 # "ServerLibrary" contains DCMTK
 add_library(ServerLibrary
   STATIC
-  ${DCMTK_SOURCES}
+  ${ORTHANC_SERVER_PCH}
   ${ORTHANC_SERVER_SOURCES}
+  ${ORTHANC_DICOM_SOURCES}
   )
 
 # Ensure autogenerated code is built before building ServerLibrary
@@ -319,6 +327,7 @@
 
 add_executable(UnitTests
   ${GTEST_SOURCES}
+  ${ORTHANC_UNIT_TESTS_PCH}
   ${ORTHANC_UNIT_TESTS_SOURCES}
   )
 
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake	Wed Aug 30 12:05:49 2017 +0200
+++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake	Wed Aug 30 12:29:48 2017 +0200
@@ -325,7 +325,7 @@
     add_definitions(-DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=0)
   endif()
 
-  set(ORTHANC_DICOM_SOURCES
+  set(ORTHANC_DICOM_SOURCES_INTERNAL
     ${ORTHANC_ROOT}/Core/DicomParsing/DicomDirWriter.cpp
     ${ORTHANC_ROOT}/Core/DicomParsing/DicomModification.cpp
     ${ORTHANC_ROOT}/Core/DicomParsing/FromDcmtkBridge.cpp
@@ -334,13 +334,11 @@
 
     ${ORTHANC_ROOT}/Core/DicomParsing/Internals/DicomFrameIndex.cpp
     ${ORTHANC_ROOT}/Core/DicomParsing/Internals/DicomImageDecoder.cpp
-
-    ${DCMTK_SOURCES}
     )
 
   if (ENABLE_DCMTK_NETWORKING)
     add_definitions(-DORTHANC_ENABLE_DCMTK_NETWORKING=1)
-    list(APPEND ORTHANC_DICOM_SOURCES
+    list(APPEND ORTHANC_DICOM_SOURCES_INTERNAL
       ${ORTHANC_ROOT}/Core/DicomNetworking/DicomFindAnswers.cpp
       ${ORTHANC_ROOT}/Core/DicomNetworking/DicomServer.cpp
       ${ORTHANC_ROOT}/Core/DicomNetworking/DicomUserConnection.cpp
@@ -430,3 +428,14 @@
   ${ORTHANC_CORE_SOURCES_INTERNAL}
   ${ORTHANC_CORE_SOURCES_DEPENDENCIES}
   )
+
+if (ENABLE_DCMTK)
+  set(ORTHANC_DICOM_SOURCES_DEPENDENCIES
+    ${DCMTK_SOURCES}
+    )
+  
+  set(ORTHANC_DICOM_SOURCES
+    ${ORTHANC_DICOM_SOURCES_INTERNAL}
+    ${ORTHANC_DICOM_SOURCES_DEPENDENCIES}
+    )
+endif()
--- a/Resources/CMake/VisualStudioPrecompiledHeaders.cmake	Wed Aug 30 12:05:49 2017 +0200
+++ b/Resources/CMake/VisualStudioPrecompiledHeaders.cmake	Wed Aug 30 12:29:48 2017 +0200
@@ -1,4 +1,4 @@
-macro(ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS PrecompiledHeaders PrecompiledSource Sources)
+macro(ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS PrecompiledHeaders PrecompiledSource Sources Target)
   get_filename_component(PrecompiledBasename ${PrecompiledHeaders} NAME_WE)
   set(PrecompiledBinary "${PrecompiledBasename}_$(ConfigurationName).pch")
 
@@ -10,5 +10,5 @@
     PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeaders}\" /FI\"${PrecompiledHeaders}\" /Fp\"${PrecompiledBinary}\""
     OBJECT_DEPENDS "${PrecompiledBinary}")
 
-  list(APPEND ${Sources} ${PrecompiledSource})
+  set(${Target} ${PrecompiledSource})
 endmacro()