annotate MySQL/CMakeLists.txt @ 172:8c7bb94adff7

trying upgrade from libpq 9.6.1 to 13.1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Dec 2020 12:49:33 +0100
parents 0f01eaf17232
children 5e604adfd41f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 cmake_minimum_required(VERSION 2.8)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 project(OrthancMySQL)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
113
7cac47fd4d09 back to mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
4 set(ORTHANC_PLUGIN_VERSION "mainline")
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 set(ORTHANC_FRAMEWORK_VERSION "mainline")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 else()
129
534759b0cf14 use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 123
diff changeset
14 set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}")
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 endif()
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 set(ENABLE_MYSQL_BACKEND ON)
143
33467fb6aee8 force the use of OpenSSL 1.0.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 129
diff changeset
21 set(OPENSSL_STATIC_VERSION "1.0.2" CACHE STRING "TODO - Upgrade to OpenSSL 1.1.1" FORCE)
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake)
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
38
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
25
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
26 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
27 execute_process(
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
28 COMMAND
167
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 155
diff changeset
29 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py
38
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
30 ${ORTHANC_PLUGIN_VERSION} "MySQL storage area plugin" OrthancMySQLStorage.dll
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
31 "MySQL as a database back-end to Orthanc (storage area)"
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
32 ERROR_VARIABLE Failure
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
33 OUTPUT_FILE ${AUTOGENERATED_DIR}/StorageVersion.rc
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
34 )
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
35
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
36 if (Failure)
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
37 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
38 endif()
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
39
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
40 execute_process(
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
41 COMMAND
167
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 155
diff changeset
42 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py
38
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
43 ${ORTHANC_PLUGIN_VERSION} "MySQL index plugin" OrthancMySQLIndex.dll
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
44 "MySQL as a database back-end to Orthanc (index)"
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
45 ERROR_VARIABLE Failure
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
46 OUTPUT_FILE ${AUTOGENERATED_DIR}/IndexVersion.rc
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
47 )
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
48
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
49 if (Failure)
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
50 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
51 endif()
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
52
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
53 set(INDEX_RESOURCES ${AUTOGENERATED_DIR}/IndexVersion.rc)
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
54 set(STORAGE_RESOURCES ${AUTOGENERATED_DIR}/StorageVersion.rc)
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
55 endif()
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
56
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
57
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 add_library(OrthancMySQLIndex SHARED
38
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
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
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 Plugins/MySQLIndex.cpp
24
17f849b2af34 sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 17
diff changeset
75
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 ${DATABASES_SOURCES}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ${AUTOGENERATED_SOURCES}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
bc979149e138 dll versioning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
84 ${STORAGE_RESOURCES}
17
54ea251aed70 unit test
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
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
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}")
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 add_definitions(
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}"
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 set_target_properties(OrthancMySQLIndex PROPERTIES
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 VERSION ${ORTHANC_PLUGIN_VERSION}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 SOVERSION ${ORTHANC_PLUGIN_VERSION}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 install(
2
17bce6a07b2b storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
113 TARGETS OrthancMySQLIndex OrthancMySQLStorage
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 RUNTIME DESTINATION lib # Destination for Windows
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 add_executable(UnitTests
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 Plugins/MySQLIndex.cpp
17
54ea251aed70 unit test
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
121 Plugins/MySQLStorageArea.cpp
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 UnitTests/UnitTestsMain.cpp
17
54ea251aed70 unit test
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2
diff changeset
123
0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 ${DATABASES_SOURCES}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 ${GOOGLE_TEST_SOURCES}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 ${AUTOGENERATED_SOURCES}
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 )
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES})
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 set_target_properties(UnitTests PROPERTIES
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0
7cea966b6829 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 )