view SQLite/CMakeLists.txt @ 161:2ccde9c7311b optimized-routes

added new optimized REST routes. this is a temporary work to try to speed up some routes (used by LRO). This way, we avoid another app to access the Orthanc DB and we skip the plugin SDK update for a very specific route
author Alain Mazy <alain@mazy.be>
date Fri, 10 Jul 2020 13:26:47 +0200
parents 23cf7def8e44
children 0f01eaf17232
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)
project(OrthancSQLite)

set(ORTHANC_PLUGIN_VERSION "mainline")

set(ORTHANC_OPTIMAL_VERSION_MAJOR    1)
set(ORTHANC_OPTIMAL_VERSION_MINOR    5)
set(ORTHANC_OPTIMAL_VERSION_REVISION 4)

if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline")
  set(ORTHANC_FRAMEWORK_VERSION "mainline")
  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
else()
  set(ORTHANC_FRAMEWORK_VERSION "1.4.0")
  set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}")
endif()

include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake)

set(ENABLE_SQLITE_BACKEND ON)
  
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake)

EmbedResources(
  SQLITE_PREPARE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/PrepareIndex.sql
  )

add_custom_target(
  AutogeneratedTarget
  DEPENDS 
  ${AUTOGENERATED_SOURCES}
  )

add_library(OrthancSQLiteIndex SHARED
  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
  Plugins/IndexPlugin.cpp
  Plugins/SQLiteIndex.cpp

  ${DATABASES_SOURCES}
  ${AUTOGENERATED_SOURCES}
  )

add_dependencies(OrthancSQLiteIndex AutogeneratedTarget)

message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}")

add_definitions(
  -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}"
  )

#set_target_properties(OrthancSQLiteStorage PROPERTIES 
#  VERSION ${ORTHANC_PLUGIN_VERSION} 
#  SOVERSION ${ORTHANC_PLUGIN_VERSION}
#  COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1
#  )

set_target_properties(OrthancSQLiteIndex PROPERTIES 
  VERSION ${ORTHANC_PLUGIN_VERSION} 
  SOVERSION ${ORTHANC_PLUGIN_VERSION}
  COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1
  )

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

add_executable(UnitTests
  Plugins/SQLiteIndex.cpp
  UnitTests/UnitTestsMain.cpp
  ${DATABASES_SOURCES}
  ${GOOGLE_TEST_SOURCES}
  ${AUTOGENERATED_SOURCES}
  )

add_dependencies(UnitTests AutogeneratedTarget)

target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES})
set_target_properties(UnitTests PROPERTIES
  COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0
  )