comparison CMakeLists.txt @ 2038:235319b3ddf0

fix
author sjodogne
date Tue, 21 Jun 2016 14:29:45 +0200
parents 661c75c7ff8f
children 8fdeb348f72b
comparison
equal deleted inserted replaced
2037:661c75c7ff8f 2038:235319b3ddf0
294 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake) 294 include(${CMAKE_SOURCE_DIR}/Resources/CMake/LuaConfiguration.cmake)
295 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake) 295 include(${CMAKE_SOURCE_DIR}/Resources/CMake/MongooseConfiguration.cmake)
296 include(${CMAKE_SOURCE_DIR}/Resources/CMake/PugixmlConfiguration.cmake) 296 include(${CMAKE_SOURCE_DIR}/Resources/CMake/PugixmlConfiguration.cmake)
297 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake) 297 include(${CMAKE_SOURCE_DIR}/Resources/CMake/SQLiteConfiguration.cmake)
298 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake) 298 include(${CMAKE_SOURCE_DIR}/Resources/CMake/ZlibConfiguration.cmake)
299 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
299 300
300 # These are the two most heavyweight dependencies. We put them as the 301 # These are the two most heavyweight dependencies. We put them as the
301 # last includes to quickly spot problems when configuring static 302 # last includes to quickly spot problems when configuring static
302 # builds. 303 # builds.
303 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake) 304 include(${CMAKE_SOURCE_DIR}/Resources/CMake/BoostConfiguration.cmake)
390 391
391 ##################################################################### 392 #####################################################################
392 ## Configuration of the C/C++ macros 393 ## Configuration of the C/C++ macros
393 ##################################################################### 394 #####################################################################
394 395
395 # Setup precompiled headers for Microsoft Visual Studio
396 if (MSVC)
397 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
398
399 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
400 "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" ORTHANC_CORE_SOURCES)
401
402 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
403 "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp" ORTHANC_SERVER_SOURCES)
404
405 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
406 "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp" ORTHANC_UNIT_TESTS_SOURCES)
407 endif()
408
409 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) 396 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS)
410 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) 397 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1)
411 else() 398 else()
412 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) 399 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0)
413 endif() 400 endif()
401
402 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include)
414 403
415 add_definitions( 404 add_definitions(
416 -DORTHANC_VERSION="${ORTHANC_VERSION}" 405 -DORTHANC_VERSION="${ORTHANC_VERSION}"
417 -DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION} 406 -DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION}
418 -DORTHANC_ENABLE_LOGGING=1 407 -DORTHANC_ENABLE_LOGGING=1
423 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}" 412 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}"
424 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}" 413 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}"
425 ) 414 )
426 415
427 416
417 # Setup precompiled headers for Microsoft Visual Studio
418
419 # WARNING: There must be NO MORE "add_definitions()", "include()" or
420 # "include_directories()" below, otherwise the generated precompiled
421 # headers might get broken!
422
423 if (MSVC)
424 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
425
426 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
427 "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" ORTHANC_CORE_SOURCES)
428
429 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
430 "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp" ORTHANC_SERVER_SOURCES)
431
432 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
433 "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp" ORTHANC_UNIT_TESTS_SOURCES)
434 endif()
435
436
428 437
429 ##################################################################### 438 #####################################################################
430 ## Build the core of Orthanc 439 ## Build the core of Orthanc
431 ##################################################################### 440 #####################################################################
432 441
433 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH) 442 list(LENGTH OPENSSL_SOURCES OPENSSL_SOURCES_LENGTH)
434 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) 443 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
435 add_library(OpenSSL STATIC ${OPENSSL_SOURCES}) 444 add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
436 endif() 445 endif()
437 446
447 # "CodeLibrary" contains all the third-party dependencies and the
448 # content of the "Core" folder, but not OpenSSL, nor DCMTK.
438 add_library(CoreLibrary 449 add_library(CoreLibrary
439 STATIC 450 STATIC
440 ${ORTHANC_CORE_SOURCES} 451 ${ORTHANC_CORE_SOURCES}
441 ${AUTOGENERATED_SOURCES} 452 ${AUTOGENERATED_SOURCES}
442 453
463 474
464 ##################################################################### 475 #####################################################################
465 ## Build the Orthanc server 476 ## Build the Orthanc server
466 ##################################################################### 477 #####################################################################
467 478
479 # "ServerLibrary" contains DCMTK
468 add_library(ServerLibrary 480 add_library(ServerLibrary
469 STATIC 481 STATIC
470 ${DCMTK_SOURCES} 482 ${DCMTK_SOURCES}
471 ${ORTHANC_SERVER_SOURCES} 483 ${ORTHANC_SERVER_SOURCES}
472 ) 484 )
494 506
495 ##################################################################### 507 #####################################################################
496 ## Build the unit tests 508 ## Build the unit tests
497 ##################################################################### 509 #####################################################################
498 510
499 include(${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleTestConfiguration.cmake)
500 add_executable(UnitTests 511 add_executable(UnitTests
501 ${GTEST_SOURCES} 512 ${GTEST_SOURCES}
502 ${ORTHANC_UNIT_TESTS_SOURCES} 513 ${ORTHANC_UNIT_TESTS_SOURCES}
503 ) 514 )
515
504 target_link_libraries(UnitTests ServerLibrary CoreLibrary ${DCMTK_LIBRARIES}) 516 target_link_libraries(UnitTests ServerLibrary CoreLibrary ${DCMTK_LIBRARIES})
505 517
506 if (${OPENSSL_SOURCES_LENGTH} GREATER 0) 518 if (${OPENSSL_SOURCES_LENGTH} GREATER 0)
507 target_link_libraries(UnitTests OpenSSL) 519 target_link_libraries(UnitTests OpenSSL)
508 endif() 520 endif()
528 endif() 540 endif()
529 541
530 list(APPEND SERVE_FOLDERS_RESOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc) 542 list(APPEND SERVE_FOLDERS_RESOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc)
531 endif() 543 endif()
532 544
533 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include)
534
535 add_library(ServeFolders SHARED 545 add_library(ServeFolders SHARED
536 ${BOOST_SOURCES} 546 ${BOOST_SOURCES}
537 ${JSONCPP_SOURCES} 547 ${JSONCPP_SOURCES}
538 Plugins/Samples/ServeFolders/Plugin.cpp 548 Plugins/Samples/ServeFolders/Plugin.cpp
539 ${SERVE_FOLDERS_RESOURCES} 549 ${SERVE_FOLDERS_RESOURCES}
573 endif() 583 endif()
574 584
575 list(APPEND MODALITY_WORKLISTS_RESOURCES ${AUTOGENERATED_DIR}/ModalityWorklists.rc) 585 list(APPEND MODALITY_WORKLISTS_RESOURCES ${AUTOGENERATED_DIR}/ModalityWorklists.rc)
576 endif() 586 endif()
577 587
578 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include)
579
580 add_library(ModalityWorklists SHARED 588 add_library(ModalityWorklists SHARED
581 ${BOOST_SOURCES} 589 ${BOOST_SOURCES}
582 ${JSONCPP_SOURCES} 590 ${JSONCPP_SOURCES}
583 Plugins/Samples/ModalityWorklists/Plugin.cpp 591 Plugins/Samples/ModalityWorklists/Plugin.cpp
584 ${MODALITY_WORKLISTS_RESOURCES} 592 ${MODALITY_WORKLISTS_RESOURCES}
604 ##################################################################### 612 #####################################################################
605 613
606 if (BUILD_RECOVER_COMPRESSED_FILE) 614 if (BUILD_RECOVER_COMPRESSED_FILE)
607 set(RECOVER_COMPRESSED_SOURCES 615 set(RECOVER_COMPRESSED_SOURCES
608 Resources/Samples/Tools/RecoverCompressedFile.cpp 616 Resources/Samples/Tools/RecoverCompressedFile.cpp
609
610 ${CMAKE_SOURCE_DIR}/Core/ChunkedBuffer.cpp
611 ${CMAKE_SOURCE_DIR}/Core/Compression/DeflateBaseCompressor.cpp
612 ${CMAKE_SOURCE_DIR}/Core/Compression/ZlibCompressor.cpp
613 ${CMAKE_SOURCE_DIR}/Core/Enumerations.cpp
614 ${CMAKE_SOURCE_DIR}/Core/Logging.cpp
615 ${CMAKE_SOURCE_DIR}/Core/Toolbox.cpp
616 ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/base64/base64.cpp
617 ${CMAKE_SOURCE_DIR}/Resources/ThirdParty/md5/md5.c
618
619 ${BOOST_SOURCES}
620 ${JSONCPP_SOURCES}
621 ${PUGIXML_SOURCES}
622 ${RECOVER_COMPRESSED_SOURCES}
623 ${ZLIB_SOURCES}
624 ) 617 )
625 618
626 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 619 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
627 execute_process( 620 execute_process(
628 COMMAND 621 COMMAND
642 ) 635 )
643 endif() 636 endif()
644 637
645 add_executable(OrthancRecoverCompressedFile ${RECOVER_COMPRESSED_SOURCES}) 638 add_executable(OrthancRecoverCompressedFile ${RECOVER_COMPRESSED_SOURCES})
646 639
640 target_link_libraries(OrthancRecoverCompressedFile CoreLibrary)
641
647 install( 642 install(
648 TARGETS OrthancRecoverCompressedFile 643 TARGETS OrthancRecoverCompressedFile
649 RUNTIME DESTINATION bin 644 RUNTIME DESTINATION bin
650 ) 645 )
651 endif() 646 endif()