comparison OrthancServer/CMakeLists.txt @ 4961:1b76853e1797 more-tags

DbOptimizer plugin
author Alain Mazy <am@osimis.io>
date Wed, 23 Mar 2022 11:56:28 +0100
parents 6eff25f70121
children d68b3a2cea17
comparison
equal deleted inserted replaced
4960:c68265bf1f94 4961:1b76853e1797
57 set(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)") 57 set(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
58 SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists") 58 SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists")
59 SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc") 59 SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc")
60 SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Whether to build the ServeFolders plugin") 60 SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Whether to build the ServeFolders plugin")
61 SET(BUILD_CONNECTIVITY_CHECKS ON CACHE BOOL "Whether to build the ConnectivityChecks plugin") 61 SET(BUILD_CONNECTIVITY_CHECKS ON CACHE BOOL "Whether to build the ConnectivityChecks plugin")
62 SET(BUILD_DB_OPTIMIZER ON CACHE BOOL "Whether to build the DbOptimizer plugin")
62 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins") 63 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins")
63 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") 64 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
64 65
65 66
66 ##################################################################### 67 #####################################################################
313 314
314 # Macros for the plugins 315 # Macros for the plugins
315 -DHAS_ORTHANC_EXCEPTION=0 316 -DHAS_ORTHANC_EXCEPTION=0
316 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}" 317 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}"
317 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}" 318 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}"
319 -DDB_OPTIMIZER_VERSION="${ORTHANC_VERSION}"
318 ) 320 )
319 321
320 322
321 # Setup precompiled headers for Microsoft Visual Studio 323 # Setup precompiled headers for Microsoft Visual Studio
322 324
425 ##################################################################### 427 #####################################################################
426 ## Build a static library to share code between the plugins 428 ## Build a static library to share code between the plugins
427 ##################################################################### 429 #####################################################################
428 430
429 if (ENABLE_PLUGINS AND 431 if (ENABLE_PLUGINS AND
430 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS)) 432 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_DB_OPTIMIZER))
431 add_library(ThirdPartyPlugins STATIC 433 add_library(ThirdPartyPlugins STATIC
432 ${BOOST_SOURCES} 434 ${BOOST_SOURCES}
433 ${JSONCPP_SOURCES} 435 ${JSONCPP_SOURCES}
434 ${LIBICONV_SOURCES} 436 ${LIBICONV_SOURCES}
435 ${LIBICU_SOURCES} 437 ${LIBICU_SOURCES}
596 endif() 598 endif()
597 599
598 600
599 601
600 ##################################################################### 602 #####################################################################
603 ## Build the "DbOptimizer" plugin
604 #####################################################################
605
606 if (ENABLE_PLUGINS AND BUILD_DB_OPTIMIZER)
607 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
608 execute_process(
609 COMMAND
610 ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/WindowsResources.py
611 ${ORTHANC_VERSION} DbOptimizer DbOptimizer.dll "Sample Orthanc plugin to optimizer/clean the DB/Storage"
612 ERROR_VARIABLE Failure
613 OUTPUT_FILE ${AUTOGENERATED_DIR}/DbOptimizer.rc
614 )
615
616 if (Failure)
617 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
618 endif()
619
620 list(APPEND DB_OPTIMIZER_RESOURCES ${AUTOGENERATED_DIR}/DbOptimizer.rc)
621 endif()
622
623 add_library(DbOptimizer SHARED
624 ${CMAKE_SOURCE_DIR}/Plugins/Samples/DbOptimizer/Plugin.cpp
625 ${DB_OPTIMIZER_RESOURCES}
626 )
627
628 target_link_libraries(DbOptimizer
629 ThirdPartyPlugins
630 )
631
632 set_target_properties(
633 DbOptimizer PROPERTIES
634 VERSION ${ORTHANC_VERSION}
635 SOVERSION ${ORTHANC_VERSION}
636 )
637
638 install(
639 TARGETS DbOptimizer
640 RUNTIME DESTINATION lib # Destination for Windows
641 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
642 )
643 endif()
644
645
646 #####################################################################
601 ## Build the companion tool to recover files compressed using Orthanc 647 ## Build the companion tool to recover files compressed using Orthanc
602 ##################################################################### 648 #####################################################################
603 649
604 if (BUILD_RECOVER_COMPRESSED_FILE) 650 if (BUILD_RECOVER_COMPRESSED_FILE)
605 set(RECOVER_COMPRESSED_SOURCES 651 set(RECOVER_COMPRESSED_SOURCES