# HG changeset patch # User sjodogne # Date 1466512185 -7200 # Node ID 235319b3ddf0cb89b47647aa3ba15050b17821d8 # Parent 661c75c7ff8f5de3e421c6abac8d7c7a2fb40f34 fix diff -r 661c75c7ff8f -r 235319b3ddf0 CMakeLists.txt --- a/CMakeLists.txt Tue Jun 21 13:52:22 2016 +0200 +++ b/CMakeLists.txt Tue Jun 21 14:29:45 2016 +0200 @@ -296,6 +296,7 @@ include(${CMAKE_SOURCE_DIR}/Resources/CMake/PugixmlConfiguration.cmake) include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) +include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) # These are the two most heavyweight dependencies. We put them as the # last includes to quickly spot problems when configuring static @@ -392,26 +393,14 @@ ## Configuration of the C/C++ macros ##################################################################### -# Setup precompiled headers for Microsoft Visual Studio -if (MSVC) - add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1) - - ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( - "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" ORTHANC_CORE_SOURCES) - - ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( - "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp" ORTHANC_SERVER_SOURCES) - - ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( - "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp" ORTHANC_UNIT_TESTS_SOURCES) -endif() - if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) else() add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) endif() +include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include) + add_definitions( -DORTHANC_VERSION="${ORTHANC_VERSION}" -DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION} @@ -425,6 +414,26 @@ ) +# Setup precompiled headers for Microsoft Visual Studio + +# WARNING: There must be NO MORE "add_definitions()", "include()" or +# "include_directories()" below, otherwise the generated precompiled +# headers might get broken! + +if (MSVC) + add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1) + + ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( + "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" ORTHANC_CORE_SOURCES) + + ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( + "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp" ORTHANC_SERVER_SOURCES) + + ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( + "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp" ORTHANC_UNIT_TESTS_SOURCES) +endif() + + ##################################################################### ## Build the core of Orthanc @@ -435,6 +444,8 @@ add_library(OpenSSL STATIC ${OPENSSL_SOURCES}) endif() +# "CodeLibrary" contains all the third-party dependencies and the +# content of the "Core" folder, but not OpenSSL, nor DCMTK. add_library(CoreLibrary STATIC ${ORTHANC_CORE_SOURCES} @@ -465,6 +476,7 @@ ## Build the Orthanc server ##################################################################### +# "ServerLibrary" contains DCMTK add_library(ServerLibrary STATIC ${DCMTK_SOURCES} @@ -496,11 +508,11 @@ ## Build the unit tests ##################################################################### -include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake) add_executable(UnitTests ${GTEST_SOURCES} ${ORTHANC_UNIT_TESTS_SOURCES} ) + target_link_libraries(UnitTests ServerLibrary CoreLibrary ${DCMTK_LIBRARIES}) if (${OPENSSL_SOURCES_LENGTH} GREATER 0) @@ -530,8 +542,6 @@ list(APPEND SERVE_FOLDERS_RESOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc) endif() - include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include) - add_library(ServeFolders SHARED ${BOOST_SOURCES} ${JSONCPP_SOURCES} @@ -575,8 +585,6 @@ list(APPEND MODALITY_WORKLISTS_RESOURCES ${AUTOGENERATED_DIR}/ModalityWorklists.rc) endif() - include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include) - add_library(ModalityWorklists SHARED ${BOOST_SOURCES} ${JSONCPP_SOURCES} @@ -606,21 +614,6 @@ if (BUILD_RECOVER_COMPRESSED_FILE) set(RECOVER_COMPRESSED_SOURCES Resources/Samples/Tools/RecoverCompressedFile.cpp - - ${CMAKE_SOURCE_DIR}/Core/ChunkedBuffer.cpp - ${CMAKE_SOURCE_DIR}/Core/Compression/DeflateBaseCompressor.cpp - ${CMAKE_SOURCE_DIR}/Core/Compression/ZlibCompressor.cpp - ${CMAKE_SOURCE_DIR}/Core/Enumerations.cpp - ${CMAKE_SOURCE_DIR}/Core/Logging.cpp - ${CMAKE_SOURCE_DIR}/Core/Toolbox.cpp - ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/base64/base64.cpp - ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/md5/md5.c - - ${BOOST_SOURCES} - ${JSONCPP_SOURCES} - ${PUGIXML_SOURCES} - ${RECOVER_COMPRESSED_SOURCES} - ${ZLIB_SOURCES} ) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") @@ -644,6 +637,8 @@ add_executable(OrthancRecoverCompressedFile ${RECOVER_COMPRESSED_SOURCES}) + target_link_libraries(OrthancRecoverCompressedFile CoreLibrary) + install( TARGETS OrthancRecoverCompressedFile RUNTIME DESTINATION bin diff -r 661c75c7ff8f -r 235319b3ddf0 Resources/Samples/Tools/RecoverCompressedFile.cpp --- a/Resources/Samples/Tools/RecoverCompressedFile.cpp Tue Jun 21 13:52:22 2016 +0200 +++ b/Resources/Samples/Tools/RecoverCompressedFile.cpp Tue Jun 21 14:29:45 2016 +0200 @@ -18,7 +18,6 @@ **/ -#include "../../../Core/PrecompiledHeaders.h" #include "../../../Core/Compression/ZlibCompressor.h" #include "../../../Core/Toolbox.h" #include "../../../Core/OrthancException.h"