comparison OrthancServer/CMakeLists.txt @ 5080:d7274e43ea7c attach-custom-data

allow plugins to store a customData in the Attachments table to e.g. store custom paths without requiring an external DB
author Alain Mazy <am@osimis.io>
date Thu, 08 Sep 2022 17:42:08 +0200
parents 6ad2bea0e07e
children 75e949689c08
comparison
equal deleted inserted replaced
5079:4366b4c41441 5080:d7274e43ea7c
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_HOUSEKEEPER ON CACHE BOOL "Whether to build the Housekeeper plugin") 62 SET(BUILD_HOUSEKEEPER ON CACHE BOOL "Whether to build the Housekeeper plugin")
63 SET(BUILD_DELAYED_DELETION ON CACHE BOOL "Whether to build the DelayedDeletion plugin") 63 SET(BUILD_DELAYED_DELETION ON CACHE BOOL "Whether to build the DelayedDeletion plugin")
64 SET(BUILD_ADVANCED_STORAGE ON CACHE BOOL "Whether to build the AdvancedStorage plugin")
64 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins") 65 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins")
65 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") 66 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")
66 67
67 68
68 ##################################################################### 69 #####################################################################
226 FONT_UBUNTU_MONO_BOLD_16 ${CMAKE_SOURCE_DIR}/Resources/Fonts/UbuntuMonoBold-16.json 227 FONT_UBUNTU_MONO_BOLD_16 ${CMAKE_SOURCE_DIR}/Resources/Fonts/UbuntuMonoBold-16.json
227 LUA_TOOLBOX ${CMAKE_SOURCE_DIR}/Resources/Toolbox.lua 228 LUA_TOOLBOX ${CMAKE_SOURCE_DIR}/Resources/Toolbox.lua
228 PREPARE_DATABASE ${CMAKE_SOURCE_DIR}/Sources/Database/PrepareDatabase.sql 229 PREPARE_DATABASE ${CMAKE_SOURCE_DIR}/Sources/Database/PrepareDatabase.sql
229 UPGRADE_DATABASE_3_TO_4 ${CMAKE_SOURCE_DIR}/Sources/Database/Upgrade3To4.sql 230 UPGRADE_DATABASE_3_TO_4 ${CMAKE_SOURCE_DIR}/Sources/Database/Upgrade3To4.sql
230 UPGRADE_DATABASE_4_TO_5 ${CMAKE_SOURCE_DIR}/Sources/Database/Upgrade4To5.sql 231 UPGRADE_DATABASE_4_TO_5 ${CMAKE_SOURCE_DIR}/Sources/Database/Upgrade4To5.sql
232 UPGRADE_DATABASE_6_TO_7 ${CMAKE_SOURCE_DIR}/Sources/Database/Upgrade6To7.sql
231 233
232 INSTALL_TRACK_ATTACHMENTS_SIZE 234 INSTALL_TRACK_ATTACHMENTS_SIZE
233 ${CMAKE_SOURCE_DIR}/Sources/Database/InstallTrackAttachmentsSize.sql 235 ${CMAKE_SOURCE_DIR}/Sources/Database/InstallTrackAttachmentsSize.sql
234 ) 236 )
235 237
316 # Macros for the plugins 318 # Macros for the plugins
317 -DHAS_ORTHANC_EXCEPTION=0 319 -DHAS_ORTHANC_EXCEPTION=0
318 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}" 320 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}"
319 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}" 321 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}"
320 -DHOUSEKEEPER_VERSION="${ORTHANC_VERSION}" 322 -DHOUSEKEEPER_VERSION="${ORTHANC_VERSION}"
323 -DADVANCED_STORAGE_VERSION="${ORTHANC_VERSION}"
321 ) 324 )
322 325
323 326
324 # Setup precompiled headers for Microsoft Visual Studio 327 # Setup precompiled headers for Microsoft Visual Studio
325 328
428 ##################################################################### 431 #####################################################################
429 ## Build a static library to share code between the plugins 432 ## Build a static library to share code between the plugins
430 ##################################################################### 433 #####################################################################
431 434
432 if (ENABLE_PLUGINS AND 435 if (ENABLE_PLUGINS AND
433 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_HOUSEKEEPER)) 436 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_HOUSEKEEPER OR BUILD_ADVANCED_STORAGE))
434 add_library(ThirdPartyPlugins STATIC 437 add_library(ThirdPartyPlugins STATIC
435 ${BOOST_SOURCES} 438 ${BOOST_SOURCES}
436 ${JSONCPP_SOURCES} 439 ${JSONCPP_SOURCES}
437 ${LIBICONV_SOURCES} 440 ${LIBICONV_SOURCES}
438 ${LIBICU_SOURCES} 441 ${LIBICU_SOURCES}
728 ) 731 )
729 endif() 732 endif()
730 733
731 734
732 ##################################################################### 735 #####################################################################
736 ## Build the "AdvancedStorage" plugin
737 #####################################################################
738
739 if (ENABLE_PLUGINS AND BUILD_ADVANCED_STORAGE)
740
741 set(AdvancedStorageFlags)
742
743 if (CMAKE_TOOLCHAIN_FILE)
744 # Take absolute path to the toolchain
745 get_filename_component(TMP ${CMAKE_TOOLCHAIN_FILE} REALPATH BASE ${CMAKE_SOURCE_DIR})
746 list(APPEND AdvancedStorageFlags -DCMAKE_TOOLCHAIN_FILE=${TMP})
747 endif()
748
749 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
750 list(APPEND AdvancedStorageFlags
751 -DLSB_CC=${CMAKE_LSB_CC}
752 -DLSB_CXX=${CMAKE_LSB_CXX}
753 )
754 endif()
755
756 externalproject_add(AdvancedStorage
757 SOURCE_DIR "${CMAKE_SOURCE_DIR}/Plugins/Samples/AdvancedStorage"
758
759 # We explicitly provide a build directory, in order to avoid paths
760 # that are too long on our Visual Studio 2008 CIS
761 BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/AdvancedStorage-build"
762
763 # this helps triggering build when changing the external project
764 BUILD_ALWAYS 1
765
766 CMAKE_ARGS
767 -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
768 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}
769 -DPLUGIN_VERSION=${ORTHANC_VERSION}
770 -DSTATIC_BUILD=${STATIC_BUILD}
771 -DALLOW_DOWNLOADS=${ALLOW_DOWNLOADS}
772 -DUSE_SYSTEM_BOOST=${USE_SYSTEM_BOOST}
773 -DUSE_LEGACY_JSONCPP=${USE_LEGACY_JSONCPP}
774 -DUSE_LEGACY_BOOST=${USE_LEGACY_BOOST}
775 ${AdvancedStorageFlags}
776
777 -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
778 -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
779 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
780 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
781 -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
782 -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
783 )
784
785 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
786 if (MSVC)
787 set(Prefix "")
788 else()
789 set(Prefix "lib") # MinGW
790 endif()
791
792 install(FILES
793 ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}AdvancedStorage.dll
794 DESTINATION "lib")
795 else()
796 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix)
797 list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix)
798 install(FILES
799 ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}AdvancedStorage${Suffix}
800 ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}AdvancedStorage${Suffix}.${ORTHANC_VERSION}
801 DESTINATION "share/orthanc/plugins")
802 endif()
803 endif()
804
805
806 #####################################################################
733 ## Build the companion tool to recover files compressed using Orthanc 807 ## Build the companion tool to recover files compressed using Orthanc
734 ##################################################################### 808 #####################################################################
735 809
736 if (BUILD_RECOVER_COMPRESSED_FILE) 810 if (BUILD_RECOVER_COMPRESSED_FILE)
737 set(RECOVER_COMPRESSED_SOURCES 811 set(RECOVER_COMPRESSED_SOURCES