Mercurial > hg > orthanc-databases
annotate MySQL/CMakeLists.txt @ 200:30b210616f4f
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Mar 2021 15:21:17 +0100 |
parents | 031aee96d2da |
children | c7dc70a0a477 |
rev | line source |
---|---|
0 | 1 cmake_minimum_required(VERSION 2.8) |
2 project(OrthancMySQL) | |
3 | |
192 | 4 set(ORTHANC_PLUGIN_VERSION "mainline") |
0 | 5 |
129
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
6 set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) |
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
7 set(ORTHANC_OPTIMAL_VERSION_MINOR 5) |
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
8 set(ORTHANC_OPTIMAL_VERSION_REVISION 4) |
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
9 |
0 | 10 if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") |
11 set(ORTHANC_FRAMEWORK_VERSION "mainline") | |
12 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
13 else() | |
182
e01322c61094
integration PostgreSQL-3.3 -> mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
180
diff
changeset
|
14 set(ORTHANC_FRAMEWORK_VERSION "4a3ba4bf4ba7") # This is Orthanc Framework pre-1.8.2 (includes a fix for OpenSSL on MSVC) |
0 | 15 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") |
16 endif() | |
17 | |
18 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake) | |
19 | |
20 set(ENABLE_MYSQL_BACKEND ON) | |
183
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
182
diff
changeset
|
21 set(OPENSSL_STATIC_VERSION "1.1.1" CACHE STRING "Force the use of OpenSSL 1.1.1" FORCE) |
0 | 22 |
23 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake) | |
24 | |
38 | 25 |
26 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
27 execute_process( | |
28 COMMAND | |
167 | 29 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py |
38 | 30 ${ORTHANC_PLUGIN_VERSION} "MySQL storage area plugin" OrthancMySQLStorage.dll |
31 "MySQL as a database back-end to Orthanc (storage area)" | |
32 ERROR_VARIABLE Failure | |
33 OUTPUT_FILE ${AUTOGENERATED_DIR}/StorageVersion.rc | |
34 ) | |
35 | |
36 if (Failure) | |
37 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
38 endif() | |
39 | |
40 execute_process( | |
41 COMMAND | |
167 | 42 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py |
38 | 43 ${ORTHANC_PLUGIN_VERSION} "MySQL index plugin" OrthancMySQLIndex.dll |
44 "MySQL as a database back-end to Orthanc (index)" | |
45 ERROR_VARIABLE Failure | |
46 OUTPUT_FILE ${AUTOGENERATED_DIR}/IndexVersion.rc | |
47 ) | |
48 | |
49 if (Failure) | |
50 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
51 endif() | |
52 | |
53 set(INDEX_RESOURCES ${AUTOGENERATED_DIR}/IndexVersion.rc) | |
54 set(STORAGE_RESOURCES ${AUTOGENERATED_DIR}/StorageVersion.rc) | |
55 endif() | |
56 | |
57 | |
0 | 58 EmbedResources( |
87
48d445f756db
new extension implemented for MySQL: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
59 MYSQL_PREPARE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/PrepareIndex.sql |
48d445f756db
new extension implemented for MySQL: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
60 MYSQL_GET_LAST_CHANGE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/GetLastChangeIndex.sql |
110
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
93
diff
changeset
|
61 MYSQL_CREATE_INSTANCE ${CMAKE_SOURCE_DIR}/Plugins/CreateInstance.sql |
0 | 62 ) |
63 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
64 add_custom_target( |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
65 AutogeneratedTarget |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
66 DEPENDS |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
67 ${AUTOGENERATED_SOURCES} |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
68 ) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
69 |
0 | 70 add_library(OrthancMySQLIndex SHARED |
38 | 71 ${INDEX_RESOURCES} |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
72 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
73 Plugins/IndexPlugin.cpp |
0 | 74 Plugins/MySQLIndex.cpp |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
75 |
0 | 76 ${DATABASES_SOURCES} |
77 ${AUTOGENERATED_SOURCES} | |
78 ) | |
79 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
80 add_dependencies(OrthancMySQLIndex AutogeneratedTarget) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
81 |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
82 add_library(OrthancMySQLStorage SHARED |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
83 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
38 | 84 ${STORAGE_RESOURCES} |
17 | 85 Plugins/MySQLStorageArea.cpp |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
86 Plugins/StoragePlugin.cpp |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
87 |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
88 ${DATABASES_SOURCES} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
89 ${AUTOGENERATED_SOURCES} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
90 ) |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
91 |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
92 add_dependencies(OrthancMySQLStorage AutogeneratedTarget) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
93 |
0 | 94 message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}") |
95 | |
96 add_definitions( | |
97 -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}" | |
98 ) | |
99 | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
100 set_target_properties(OrthancMySQLStorage PROPERTIES |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
101 VERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
102 SOVERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
103 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
104 ) |
0 | 105 |
106 set_target_properties(OrthancMySQLIndex PROPERTIES | |
107 VERSION ${ORTHANC_PLUGIN_VERSION} | |
108 SOVERSION ${ORTHANC_PLUGIN_VERSION} | |
109 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 | |
110 ) | |
111 | |
112 install( | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
113 TARGETS OrthancMySQLIndex OrthancMySQLStorage |
0 | 114 RUNTIME DESTINATION lib # Destination for Windows |
115 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
116 ) | |
117 | |
118 | |
119 add_executable(UnitTests | |
120 Plugins/MySQLIndex.cpp | |
17 | 121 Plugins/MySQLStorageArea.cpp |
0 | 122 UnitTests/UnitTestsMain.cpp |
17 | 123 |
0 | 124 ${DATABASES_SOURCES} |
125 ${GOOGLE_TEST_SOURCES} | |
126 ${AUTOGENERATED_SOURCES} | |
127 ) | |
128 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
129 add_dependencies(UnitTests AutogeneratedTarget) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
130 |
0 | 131 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) |
132 set_target_properties(UnitTests PROPERTIES | |
133 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
134 ) |