Mercurial > hg > orthanc-databases
annotate MySQL/CMakeLists.txt @ 419:d468033284ef
preparing PG 5.1
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 27 Jun 2023 15:28:02 +0200 |
parents | afb30d17f090 |
children | f0462b26af84 95c413106a66 c1b0f3c4e1f5 |
rev | line source |
---|---|
329
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
389
3d6886f3e5b3
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
372
diff
changeset
|
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
3d6886f3e5b3
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
372
diff
changeset
|
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
329
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
6 # |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
7 # This program is free software: you can redistribute it and/or |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
8 # modify it under the terms of the GNU Affero General Public License |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
9 # as published by the Free Software Foundation, either version 3 of |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
10 # the License, or (at your option) any later version. |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
11 # |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, but |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
13 # WITHOUT ANY WARRANTY; without even the implied warranty of |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
15 # Affero General Public License for more details. |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
16 # |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
19 |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
328
diff
changeset
|
20 |
0 | 21 cmake_minimum_required(VERSION 2.8) |
22 project(OrthancMySQL) | |
23 | |
413 | 24 set(ORTHANC_PLUGIN_VERSION "mainline") |
0 | 25 |
129
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
26 set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) |
372
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
27 set(ORTHANC_OPTIMAL_VERSION_MINOR 12) |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
28 set(ORTHANC_OPTIMAL_VERSION_REVISION 0) |
129
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
29 |
0 | 30 if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") |
31 set(ORTHANC_FRAMEWORK_VERSION "mainline") | |
32 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
33 else() | |
372
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
34 set(ORTHANC_FRAMEWORK_VERSION "1.12.0") |
0 | 35 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") |
36 endif() | |
37 | |
38 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake) | |
39 | |
40 set(ENABLE_MYSQL_BACKEND ON) | |
358
1280b40d6696
switch to OpenSSL 3.0.x
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
329
diff
changeset
|
41 set(OPENSSL_STATIC_VERSION "3.0" CACHE STRING "Force the use of OpenSSL 3.0.x" FORCE) |
0 | 42 |
43 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake) | |
44 | |
38 | 45 |
46 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
47 execute_process( | |
48 COMMAND | |
167 | 49 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py |
38 | 50 ${ORTHANC_PLUGIN_VERSION} "MySQL storage area plugin" OrthancMySQLStorage.dll |
51 "MySQL as a database back-end to Orthanc (storage area)" | |
52 ERROR_VARIABLE Failure | |
53 OUTPUT_FILE ${AUTOGENERATED_DIR}/StorageVersion.rc | |
54 ) | |
55 | |
56 if (Failure) | |
57 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
58 endif() | |
59 | |
60 execute_process( | |
61 COMMAND | |
167 | 62 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py |
38 | 63 ${ORTHANC_PLUGIN_VERSION} "MySQL index plugin" OrthancMySQLIndex.dll |
64 "MySQL as a database back-end to Orthanc (index)" | |
65 ERROR_VARIABLE Failure | |
66 OUTPUT_FILE ${AUTOGENERATED_DIR}/IndexVersion.rc | |
67 ) | |
68 | |
69 if (Failure) | |
70 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
71 endif() | |
72 | |
73 set(INDEX_RESOURCES ${AUTOGENERATED_DIR}/IndexVersion.rc) | |
74 set(STORAGE_RESOURCES ${AUTOGENERATED_DIR}/StorageVersion.rc) | |
75 endif() | |
76 | |
77 | |
0 | 78 EmbedResources( |
87
48d445f756db
new extension implemented for MySQL: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
79 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
|
80 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
|
81 MYSQL_CREATE_INSTANCE ${CMAKE_SOURCE_DIR}/Plugins/CreateInstance.sql |
0 | 82 ) |
83 | |
372
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
84 if (EXISTS ${ORTHANC_SDK_ROOT}/orthanc/OrthancDatabasePlugin.proto) |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
85 add_custom_command( |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
86 COMMAND |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
87 ${PROTOC_EXECUTABLE} ${ORTHANC_SDK_ROOT}/orthanc/OrthancDatabasePlugin.proto --cpp_out=${AUTOGENERATED_DIR} -I${ORTHANC_SDK_ROOT}/orthanc/ |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
88 DEPENDS |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
89 ProtobufCompiler |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
90 ${ORTHANC_SDK_ROOT}/orthanc/OrthancDatabasePlugin.proto |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
91 OUTPUT |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
92 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
93 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.h |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
94 ) |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
95 |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
96 list(APPEND AUTOGENERATED_SOURCES |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
97 ${AUTOGENERATED_DIR}/OrthancDatabasePlugin.pb.cc |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
98 ) |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
99 endif() |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
100 |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
101 |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
102 add_custom_target( |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
103 AutogeneratedTarget |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
104 DEPENDS |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
105 ${AUTOGENERATED_SOURCES} |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
106 ) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
107 |
315
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
108 add_library(FrameworkForPlugins STATIC |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
109 ${AUTOGENERATED_SOURCES} |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
110 ${DATABASES_SOURCES} |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
111 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
112 Plugins/MySQLIndex.cpp |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
113 Plugins/MySQLStorageArea.cpp |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
114 ) |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
115 |
316 | 116 set_target_properties(FrameworkForPlugins PROPERTIES |
117 POSITION_INDEPENDENT_CODE ON | |
118 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 | |
315
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
119 ) |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
120 |
0 | 121 add_library(OrthancMySQLIndex SHARED |
38 | 122 ${INDEX_RESOURCES} |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
123 Plugins/IndexPlugin.cpp |
315
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
124 ) |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
17
diff
changeset
|
125 |
315
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
126 add_library(OrthancMySQLStorage SHARED |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
127 ${STORAGE_RESOURCES} |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
128 Plugins/StoragePlugin.cpp |
0 | 129 ) |
130 | |
318
4a4087a79b9b
fix dependencies between targets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
131 add_dependencies(FrameworkForPlugins AutogeneratedTarget) |
4a4087a79b9b
fix dependencies between targets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
132 |
315
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
133 target_link_libraries(OrthancMySQLIndex FrameworkForPlugins) |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
134 target_link_libraries(OrthancMySQLStorage FrameworkForPlugins) |
11641063ddb2
speed up compilation by sharing library between plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
301
diff
changeset
|
135 |
0 | 136 message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}") |
137 | |
138 add_definitions( | |
139 -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}" | |
140 ) | |
141 | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
142 set_target_properties(OrthancMySQLStorage PROPERTIES |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
143 VERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
144 SOVERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
145 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
146 ) |
0 | 147 |
148 set_target_properties(OrthancMySQLIndex PROPERTIES | |
149 VERSION ${ORTHANC_PLUGIN_VERSION} | |
150 SOVERSION ${ORTHANC_PLUGIN_VERSION} | |
151 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 | |
152 ) | |
153 | |
154 install( | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
155 TARGETS OrthancMySQLIndex OrthancMySQLStorage |
0 | 156 RUNTIME DESTINATION lib # Destination for Windows |
157 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
158 ) | |
159 | |
160 | |
161 add_executable(UnitTests | |
162 Plugins/MySQLIndex.cpp | |
17 | 163 Plugins/MySQLStorageArea.cpp |
0 | 164 UnitTests/UnitTestsMain.cpp |
17 | 165 |
0 | 166 ${DATABASES_SOURCES} |
167 ${GOOGLE_TEST_SOURCES} | |
168 ${AUTOGENERATED_SOURCES} | |
169 ) | |
170 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
171 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
|
172 |
0 | 173 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) |
174 set_target_properties(UnitTests PROPERTIES | |
175 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
176 ) |