view OrthancServer/Resources/Graveyard/DatabasePluginSample/CMakeLists.txt @ 5808:63c025cf6958 attach-custom-data

cleanup
author Alain Mazy <am@orthanc.team>
date Tue, 24 Sep 2024 12:11:25 +0200
parents cd363608551a
children
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)

project(SampleDatabasePlugin)

# Parameters of the build
SET(SAMPLE_DATABASE_VERSION "0.0" CACHE STRING "Version of the plugin")
SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
SET(STANDALONE_BUILD ON)

# Advanced parameters to fine-tune linking against system libraries
SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
SET(USE_SYSTEM_SQLITE ON CACHE BOOL "Use the system version of SQLite")

include(${CMAKE_SOURCE_DIR}/../../../Plugins/Samples/Common/OrthancPlugins.cmake)

include(${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake)
set(ENABLE_SQLITE ON)
include(${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake)

EmbedResources(
  --system-exception  # Use "std::runtime_error" instead of "OrthancException" for embedded resources
  PREPARE_DATABASE  ${CMAKE_SOURCE_DIR}/../../../Sources/Database/PrepareDatabase.sql
  )

message("Setting the version of the plugin to ${SAMPLE_DATABASE_VERSION}")

add_definitions(
  -DORTHANC_SQLITE_STANDALONE=1
  -DORTHANC_ENABLE_PLUGINS=1
  -DORTHANC_SANDBOXED=0
  -DSAMPLE_DATABASE_VERSION="${SAMPLE_DATABASE_VERSION}"
  )

add_library(SampleDatabase SHARED 
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/DicomFormat/DicomArray.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/DicomFormat/DicomTag.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/DicomFormat/DicomValue.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/Enumerations.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/SQLite/Connection.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/SQLite/FunctionContext.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/SQLite/Statement.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/SQLite/StatementId.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/SQLite/StatementReference.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/SQLite/Transaction.cpp
  ${CMAKE_SOURCE_DIR}/../../../../OrthancFramework/Sources/Toolbox.cpp
  ${CMAKE_SOURCE_DIR}/../../../Plugins/Engine/PluginsEnumerations.cpp

  Database.cpp
  Plugin.cpp
  DatabaseWrapperBase.cpp
  
  ${BOOST_SOURCES}
  ${JSONCPP_SOURCES}
  ${SQLITE_SOURCES}
  ${AUTOGENERATED_SOURCES}
  )

set_target_properties(SampleDatabase PROPERTIES 
  VERSION ${SAMPLE_DATABASE_VERSION} 
  SOVERSION ${SAMPLE_DATABASE_VERSION})

install(
  TARGETS SampleDatabase
  RUNTIME DESTINATION lib    # Destination for Windows
  LIBRARY DESTINATION share/orthanc/plugins    # Destination for Linux
  )