comparison OrthancServer/CMakeLists.txt @ 5266:a856daf71745 db-protobuf

integration mainline->db-protobuf
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Apr 2023 17:56:13 +0200
parents afe92108f463 0e8dfba67ac9
children cdeb7f027c1b
comparison
equal deleted inserted replaced
5258:afe92108f463 5266:a856daf71745
335 # WARNING: There must be NO MORE "add_definitions()", "include()" or 335 # WARNING: There must be NO MORE "add_definitions()", "include()" or
336 # "include_directories()" below, otherwise the generated precompiled 336 # "include_directories()" below, otherwise the generated precompiled
337 # headers might get broken! 337 # headers might get broken!
338 338
339 if (MSVC) 339 if (MSVC)
340 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
341
342 set(TMP 340 set(TMP
343 ${ORTHANC_CORE_SOURCES_INTERNAL} 341 ${ORTHANC_CORE_SOURCES_INTERNAL}
344 ${ORTHANC_DICOM_SOURCES_INTERNAL} 342 ${ORTHANC_DICOM_SOURCES_INTERNAL}
345 ) 343 )
346 344
375 ${ORTHANC_CORE_PCH} 373 ${ORTHANC_CORE_PCH}
376 ${ORTHANC_CORE_SOURCES} 374 ${ORTHANC_CORE_SOURCES}
377 ${ORTHANC_DICOM_SOURCES} 375 ${ORTHANC_DICOM_SOURCES}
378 ${AUTOGENERATED_SOURCES} 376 ${AUTOGENERATED_SOURCES}
379 ) 377 )
378
379 if (MSVC)
380 set_target_properties(
381 CoreLibrary
382 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1"
383 )
384 endif()
380 385
381 add_dependencies(CoreLibrary AutogeneratedTarget) 386 add_dependencies(CoreLibrary AutogeneratedTarget)
382 387
383 if (LIBICU_LIBRARIES) 388 if (LIBICU_LIBRARIES)
384 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES}) 389 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES})
417 STATIC 422 STATIC
418 ${ORTHANC_SERVER_PCH} 423 ${ORTHANC_SERVER_PCH}
419 ${ORTHANC_SERVER_SOURCES} 424 ${ORTHANC_SERVER_SOURCES}
420 ) 425 )
421 426
427 if (MSVC)
428 set_target_properties(
429 ServerLibrary
430 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1"
431 )
432 endif()
433
422 # Ensure autogenerated code is built before building ServerLibrary 434 # Ensure autogenerated code is built before building ServerLibrary
423 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf) 435 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf)
424 436
425 add_executable(Orthanc 437 add_executable(Orthanc
426 ${CMAKE_SOURCE_DIR}/Sources/main.cpp 438 ${CMAKE_SOURCE_DIR}/Sources/main.cpp
455 ${ORTHANC_FRAMEWORK_UNIT_TESTS} 467 ${ORTHANC_FRAMEWORK_UNIT_TESTS}
456 ${ORTHANC_SERVER_UNIT_TESTS} 468 ${ORTHANC_SERVER_UNIT_TESTS}
457 ${BOOST_EXTENDED_SOURCES} 469 ${BOOST_EXTENDED_SOURCES}
458 ) 470 )
459 471
472 if (MSVC)
473 set_target_properties(
474 UnitTests
475 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1"
476 )
477 endif()
478
460 target_link_libraries(UnitTests 479 target_link_libraries(UnitTests
461 ServerLibrary 480 ServerLibrary
462 CoreLibrary 481 CoreLibrary
463 ${DCMTK_LIBRARIES} 482 ${DCMTK_LIBRARIES}
464 ${GOOGLE_TEST_LIBRARIES} 483 ${GOOGLE_TEST_LIBRARIES}
470 ##################################################################### 489 #####################################################################
471 490
472 if (ENABLE_PLUGINS AND 491 if (ENABLE_PLUGINS AND
473 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_HOUSEKEEPER OR 492 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_HOUSEKEEPER OR
474 BUILD_DELAYED_DELETION)) 493 BUILD_DELAYED_DELETION))
475 set(PLUGINS_FRAMEWORK_SOURCES 494 set(PLUGINS_DEPENDENCIES_SOURCES
476 ${BOOST_SOURCES} 495 ${BOOST_SOURCES}
477 ${JSONCPP_SOURCES} 496 ${JSONCPP_SOURCES}
478 ${LIBICONV_SOURCES} 497 ${LIBICONV_SOURCES}
479 ${LIBICU_SOURCES} 498 ${LIBICU_SOURCES}
499 ${PUGIXML_SOURCES}
500 ${UUID_SOURCES}
501 ${ZLIB_SOURCES}
502
503 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/base64/base64.cpp
504 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/md5/md5.c
480 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp 505 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
481 ) 506 )
482 507
483 if (BUILD_DELAYED_DELETION) 508 if (BUILD_DELAYED_DELETION)
484 list(APPEND PLUGINS_FRAMEWORK_SOURCES 509 list(APPEND PLUGINS_DEPENDENCIES_SOURCES
485 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/base64/base64.cpp
486 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/ThirdParty/md5/md5.c
487 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/ChunkedBuffer.cpp
488 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/DeflateBaseCompressor.cpp
489 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/GzipCompressor.cpp
490 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp
491 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/IBufferCompressor.cpp
492 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/ZipReader.cpp
493 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/ZipWriter.cpp
494 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Compression/ZlibCompressor.cpp
495 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/DicomFormat/DicomTag.cpp
496 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Enumerations.cpp
497 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp
498 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Logging.cpp
499 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.cpp
500 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/OrthancException.cpp
501 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/Connection.cpp
502 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/FunctionContext.cpp
503 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/Statement.cpp
504 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/StatementId.cpp
505 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/StatementReference.cpp
506 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SQLite/Transaction.cpp
507 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/StringMemoryBuffer.cpp
508 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/SystemToolbox.cpp
509 ${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/Toolbox.cpp
510 ${DCMTK_SOURCES} 510 ${DCMTK_SOURCES}
511 ${PUGIXML_SOURCES}
512 ${UUID_SOURCES}
513 ${ZLIB_SOURCES}
514 ${SQLITE_SOURCES} 511 ${SQLITE_SOURCES}
515 ) 512 )
516 endif() 513 endif()
517 514
518 add_library(PluginsFramework STATIC 515 add_library(PluginsDependencies STATIC
519 ${PLUGINS_FRAMEWORK_SOURCES} 516 ${PLUGINS_DEPENDENCIES_SOURCES}
520 )
521
522 # Remove the dependency upon ICU in plugins, as this greatly
523 # increase the size of the resulting binaries, since they must
524 # embed the ICU dictionary.
525 set_target_properties(
526 PluginsFramework
527 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_ENABLE_ICU=0"
528 ) 517 )
529 518
530 # Add the "-fPIC" option as this static library must be embedded 519 # Add the "-fPIC" option as this static library must be embedded
531 # inside shared libraries (important on UNIX) 520 # inside shared libraries (important on UNIX)
532 set_target_properties( 521 set_target_properties(
533 PluginsFramework 522 PluginsDependencies
534 PROPERTIES POSITION_INDEPENDENT_CODE ON 523 PROPERTIES POSITION_INDEPENDENT_CODE ON
535 ) 524 )
536 endif() 525 endif()
537 526
538 527
565 add_library(ServeFolders SHARED 554 add_library(ServeFolders SHARED
566 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ServeFolders/Plugin.cpp 555 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ServeFolders/Plugin.cpp
567 ${SERVE_FOLDERS_RESOURCES} 556 ${SERVE_FOLDERS_RESOURCES}
568 ) 557 )
569 558
570 target_link_libraries(ServeFolders PluginsFramework) 559 target_link_libraries(ServeFolders PluginsDependencies)
571 560
572 set_target_properties( 561 set_target_properties(
573 ServeFolders PROPERTIES 562 ServeFolders PROPERTIES
574 VERSION ${ORTHANC_VERSION} 563 VERSION ${ORTHANC_VERSION}
575 SOVERSION ${ORTHANC_VERSION} 564 SOVERSION ${ORTHANC_VERSION}
613 add_library(ModalityWorklists SHARED 602 add_library(ModalityWorklists SHARED
614 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ModalityWorklists/Plugin.cpp 603 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ModalityWorklists/Plugin.cpp
615 ${MODALITY_WORKLISTS_RESOURCES} 604 ${MODALITY_WORKLISTS_RESOURCES}
616 ) 605 )
617 606
618 target_link_libraries(ModalityWorklists PluginsFramework) 607 target_link_libraries(ModalityWorklists PluginsDependencies)
619 608
620 set_target_properties( 609 set_target_properties(
621 ModalityWorklists PROPERTIES 610 ModalityWorklists PROPERTIES
622 VERSION ${ORTHANC_VERSION} 611 VERSION ${ORTHANC_VERSION}
623 SOVERSION ${ORTHANC_VERSION} 612 SOVERSION ${ORTHANC_VERSION}
665 set_source_files_properties( 654 set_source_files_properties(
666 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/Plugin.cpp 655 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/Plugin.cpp
667 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_PLUGIN_NAME=\"connectivity-checks\";ORTHANC_PLUGIN_VERSION=\"${ORTHANC_VERSION}\"" 656 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_PLUGIN_NAME=\"connectivity-checks\";ORTHANC_PLUGIN_VERSION=\"${ORTHANC_VERSION}\""
668 ) 657 )
669 658
659 # The "OrthancFrameworkDependencies.cpp" file is used to bypass the
660 # precompiled headers if compiling with Visual Studio
670 add_library(ConnectivityChecks SHARED 661 add_library(ConnectivityChecks SHARED
671 ${AUTOGENERATED_DIR}/ConnectivityChecksResources.cpp 662 ${AUTOGENERATED_DIR}/ConnectivityChecksResources.cpp
672 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/Plugin.cpp 663 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/Plugin.cpp
664 ${CMAKE_SOURCE_DIR}/Plugins/Samples/ConnectivityChecks/OrthancFrameworkDependencies.cpp
673 ${CONNECTIVITY_CHECKS_RESOURCES} 665 ${CONNECTIVITY_CHECKS_RESOURCES}
674 ) 666 )
675 667
676 target_link_libraries(ConnectivityChecks PluginsFramework) 668 target_link_libraries(ConnectivityChecks PluginsDependencies)
677 669
678 set_target_properties( 670 set_target_properties(
679 ConnectivityChecks PROPERTIES 671 ConnectivityChecks PROPERTIES
680 VERSION ${ORTHANC_VERSION} 672 VERSION ${ORTHANC_VERSION}
681 SOVERSION ${ORTHANC_VERSION} 673 SOVERSION ${ORTHANC_VERSION}
712 704
713 set_source_files_properties( 705 set_source_files_properties(
714 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/Plugin.cpp 706 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/Plugin.cpp
715 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_PLUGIN_NAME=\"delayed-deletion\";ORTHANC_PLUGIN_VERSION=\"${ORTHANC_VERSION}\"" 707 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_PLUGIN_NAME=\"delayed-deletion\";ORTHANC_PLUGIN_VERSION=\"${ORTHANC_VERSION}\""
716 ) 708 )
717 709
710 # The "OrthancFrameworkDependencies.cpp" file is used to bypass the
711 # precompiled headers if compiling with Visual Studio
718 add_library(DelayedDeletion SHARED 712 add_library(DelayedDeletion SHARED
719 ${CMAKE_SOURCE_DIR}/Plugins/Engine/PluginsEnumerations.cpp
720 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/PendingDeletionsDatabase.cpp 713 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/PendingDeletionsDatabase.cpp
721 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/Plugin.cpp 714 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/Plugin.cpp
715 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DelayedDeletion/OrthancFrameworkDependencies.cpp
722 ${DELAYED_DELETION_RESOURCES} 716 ${DELAYED_DELETION_RESOURCES}
723 ) 717 )
724 718
725 target_link_libraries(DelayedDeletion PluginsFramework ${DCMTK_LIBRARIES}) 719 target_link_libraries(DelayedDeletion PluginsDependencies ${DCMTK_LIBRARIES})
726 720
727 set_target_properties( 721 set_target_properties(
728 DelayedDeletion PROPERTIES 722 DelayedDeletion PROPERTIES
729 VERSION ${ORTHANC_VERSION} 723 VERSION ${ORTHANC_VERSION}
730 SOVERSION ${ORTHANC_VERSION} 724 SOVERSION ${ORTHANC_VERSION}
767 add_library(Housekeeper SHARED 761 add_library(Housekeeper SHARED
768 ${CMAKE_SOURCE_DIR}/Plugins/Samples/Housekeeper/Plugin.cpp 762 ${CMAKE_SOURCE_DIR}/Plugins/Samples/Housekeeper/Plugin.cpp
769 ${HOUSEKEEPER_RESOURCES} 763 ${HOUSEKEEPER_RESOURCES}
770 ) 764 )
771 765
772 target_link_libraries(Housekeeper 766 target_link_libraries(Housekeeper PluginsDependencies)
773 PluginsFramework
774 )
775 767
776 set_target_properties( 768 set_target_properties(
777 Housekeeper PROPERTIES 769 Housekeeper PROPERTIES
778 VERSION ${ORTHANC_VERSION} 770 VERSION ${ORTHANC_VERSION}
779 SOVERSION ${ORTHANC_VERSION} 771 SOVERSION ${ORTHANC_VERSION}