view MySQL/CMakeLists.txt @ 352:05aa1bdc32de OrthancPostgreSQL-2.2

closing OrthancPostgreSQL-2.2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Aug 2021 16:09:51 +0200
parents 173176f8cef2
children bc979149e138
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)
project(OrthancMySQL)

set(ORTHANC_PLUGIN_VERSION "mainline")

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_DEFAULT_SOURCE "web")
endif()

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

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

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

add_library(OrthancMySQLIndex SHARED
  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
  Plugins/IndexPlugin.cpp
  Plugins/MySQLIndex.cpp

  ${DATABASES_SOURCES}
  ${AUTOGENERATED_SOURCES}
  )

add_library(OrthancMySQLStorage SHARED
  ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp
  Plugins/MySQLStorageArea.cpp
  Plugins/StoragePlugin.cpp

  ${DATABASES_SOURCES}
  ${AUTOGENERATED_SOURCES}
  )

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

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

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

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

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


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

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