Mercurial > hg > orthanc-databases
view MySQL/CMakeLists.txt @ 316:1c2cd90418c9
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 19 Jul 2021 14:59:36 +0200 |
parents | 11641063ddb2 |
children | be8b0ac774e2 |
line wrap: on
line source
cmake_minimum_required(VERSION 2.8) project(OrthancMySQL) set(ORTHANC_PLUGIN_VERSION "mainline") set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) set(ORTHANC_OPTIMAL_VERSION_MINOR 9) set(ORTHANC_OPTIMAL_VERSION_REVISION 2) if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() set(ORTHANC_FRAMEWORK_VERSION "1.9.4") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") endif() include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake) set(ENABLE_MYSQL_BACKEND ON) set(OPENSSL_STATIC_VERSION "1.1.1" CACHE STRING "Force the use of OpenSSL 1.1.1" FORCE) include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") execute_process( COMMAND ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py ${ORTHANC_PLUGIN_VERSION} "MySQL storage area plugin" OrthancMySQLStorage.dll "MySQL as a database back-end to Orthanc (storage area)" ERROR_VARIABLE Failure OUTPUT_FILE ${AUTOGENERATED_DIR}/StorageVersion.rc ) if (Failure) message(FATAL_ERROR "Error while computing the version information: ${Failure}") endif() execute_process( COMMAND ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py ${ORTHANC_PLUGIN_VERSION} "MySQL index plugin" OrthancMySQLIndex.dll "MySQL as a database back-end to Orthanc (index)" ERROR_VARIABLE Failure OUTPUT_FILE ${AUTOGENERATED_DIR}/IndexVersion.rc ) if (Failure) message(FATAL_ERROR "Error while computing the version information: ${Failure}") endif() set(INDEX_RESOURCES ${AUTOGENERATED_DIR}/IndexVersion.rc) set(STORAGE_RESOURCES ${AUTOGENERATED_DIR}/StorageVersion.rc) endif() EmbedResources( MYSQL_PREPARE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/PrepareIndex.sql MYSQL_GET_LAST_CHANGE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/GetLastChangeIndex.sql MYSQL_CREATE_INSTANCE ${CMAKE_SOURCE_DIR}/Plugins/CreateInstance.sql ) add_custom_target( AutogeneratedTarget DEPENDS ${AUTOGENERATED_SOURCES} ) add_library(FrameworkForPlugins STATIC ${AUTOGENERATED_SOURCES} ${DATABASES_SOURCES} ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp Plugins/MySQLIndex.cpp Plugins/MySQLStorageArea.cpp ) set_target_properties(FrameworkForPlugins PROPERTIES POSITION_INDEPENDENT_CODE ON COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 ) add_library(OrthancMySQLIndex SHARED ${INDEX_RESOURCES} Plugins/IndexPlugin.cpp ) add_library(OrthancMySQLStorage SHARED ${STORAGE_RESOURCES} Plugins/StoragePlugin.cpp ) target_link_libraries(OrthancMySQLIndex FrameworkForPlugins) target_link_libraries(OrthancMySQLStorage FrameworkForPlugins) add_dependencies(OrthancMySQLIndex AutogeneratedTarget) add_dependencies(OrthancMySQLStorage AutogeneratedTarget) message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}") add_definitions( -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}" ) 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} ) add_dependencies(UnitTests AutogeneratedTarget) target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) set_target_properties(UnitTests PROPERTIES COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0 ) if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") # Explicitly adding "-lstdc++ -lm" during linking for LSB had to be # introduced on the BuildBot server for LSB Release builds between # "OrthancMySQL-4.0" and "OrthancMySQL-4.1", for unclear # reasons. Without this option, many symbols are left undefined # while linking "UnitTests" in release mode. Similar to: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14001 # # NB: This will be automatically added in Orthanc Framework > 1.9.5 target_link_libraries(UnitTests stdc++ m) endif()