view Plugins/Samples/DatabasePlugin/CMakeLists.txt @ 2345:0bf31956345c

mingw
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Jul 2017 23:52:08 +0200
parents a979ded1dbb1
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")

set(SAMPLES_ROOT ${CMAKE_SOURCE_DIR}/..)
include(${SAMPLES_ROOT}/Common/OrthancPlugins.cmake)

include(${ORTHANC_ROOT}/Resources/CMake/BoostConfiguration.cmake)
include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake)
include(${ORTHANC_ROOT}/Resources/CMake/SQLiteConfiguration.cmake)

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

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

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

add_library(SampleDatabase SHARED 
  ${BOOST_SOURCES}
  ${JSONCPP_SOURCES}
  ${SQLITE_SOURCES}
  ${AUTOGENERATED_SOURCES}

  ${ORTHANC_ROOT}/Core/DicomFormat/DicomArray.cpp
  ${ORTHANC_ROOT}/Core/DicomFormat/DicomMap.cpp
  ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp
  ${ORTHANC_ROOT}/Core/DicomFormat/DicomValue.cpp
  ${ORTHANC_ROOT}/Core/Enumerations.cpp
  ${ORTHANC_ROOT}/Core/SQLite/Connection.cpp
  ${ORTHANC_ROOT}/Core/SQLite/FunctionContext.cpp
  ${ORTHANC_ROOT}/Core/SQLite/Statement.cpp
  ${ORTHANC_ROOT}/Core/SQLite/StatementId.cpp
  ${ORTHANC_ROOT}/Core/SQLite/StatementReference.cpp
  ${ORTHANC_ROOT}/Core/SQLite/Transaction.cpp
  ${ORTHANC_ROOT}/Core/Toolbox.cpp
  ${ORTHANC_ROOT}/OrthancServer/DatabaseWrapperBase.cpp
  ${ORTHANC_ROOT}/Plugins/Engine/PluginsEnumerations.cpp

  Database.cpp
  Plugin.cpp
  )

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
  )