Mercurial > hg > orthanc-databases
annotate PostgreSQL/CMakeLists.txt @ 179:9b500ad566c0 OrthancPostgreSQL-3.3
OrthancPostgreSQL-3.3
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 14 Dec 2020 15:55:55 +0100 |
parents | 8c7bb94adff7 |
children | 5e604adfd41f 3f4fa9ca637b |
rev | line source |
---|---|
0 | 1 cmake_minimum_required(VERSION 2.8) |
2 project(OrthancPostgreSQL) | |
3 | |
179
9b500ad566c0
OrthancPostgreSQL-3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
172
diff
changeset
|
4 set(ORTHANC_PLUGIN_VERSION "3.3") |
0 | 5 |
129
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
126
diff
changeset
|
6 set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) |
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
126
diff
changeset
|
7 set(ORTHANC_OPTIMAL_VERSION_MINOR 5) |
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
126
diff
changeset
|
8 set(ORTHANC_OPTIMAL_VERSION_REVISION 4) |
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
126
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() | |
179
9b500ad566c0
OrthancPostgreSQL-3.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
172
diff
changeset
|
14 set(ORTHANC_FRAMEWORK_VERSION "1.8.1") |
0 | 15 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") |
16 endif() | |
17 | |
172
8c7bb94adff7
trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
167
diff
changeset
|
18 set(ENABLE_SSL ON) |
0 | 19 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake) |
20 | |
21 set(ENABLE_POSTGRESQL_BACKEND ON) | |
172
8c7bb94adff7
trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
167
diff
changeset
|
22 set(OPENSSL_STATIC_VERSION "1.1.1" CACHE STRING "Force the use of OpenSSL 1.1.1" FORCE) |
8c7bb94adff7
trying upgrade from libpq 9.6.1 to 13.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
167
diff
changeset
|
23 |
0 | 24 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake) |
25 | |
36 | 26 |
27 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
28 execute_process( | |
29 COMMAND | |
167 | 30 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py |
36 | 31 ${ORTHANC_PLUGIN_VERSION} "PostgreSQL storage area plugin" OrthancPostgreSQLStorage.dll |
32 "PostgreSQL as a database back-end to Orthanc (storage area)" | |
33 ERROR_VARIABLE Failure | |
34 OUTPUT_FILE ${AUTOGENERATED_DIR}/StorageVersion.rc | |
35 ) | |
36 | |
37 if (Failure) | |
38 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
39 endif() | |
40 | |
41 execute_process( | |
42 COMMAND | |
167 | 43 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py |
36 | 44 ${ORTHANC_PLUGIN_VERSION} "PostgreSQL index plugin" OrthancPostgreSQLIndex.dll |
45 "PostgreSQL as a database back-end to Orthanc (index)" | |
46 ERROR_VARIABLE Failure | |
47 OUTPUT_FILE ${AUTOGENERATED_DIR}/IndexVersion.rc | |
48 ) | |
49 | |
50 if (Failure) | |
51 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
52 endif() | |
53 | |
54 set(INDEX_RESOURCES ${AUTOGENERATED_DIR}/IndexVersion.rc) | |
55 set(STORAGE_RESOURCES ${AUTOGENERATED_DIR}/StorageVersion.rc) | |
56 endif() | |
57 | |
58 | |
0 | 59 EmbedResources( |
85
1012fe77241c
new extension implemented for PostgreSQL and SQLite: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
79
diff
changeset
|
60 POSTGRESQL_PREPARE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/PrepareIndex.sql |
1012fe77241c
new extension implemented for PostgreSQL and SQLite: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
79
diff
changeset
|
61 POSTGRESQL_CREATE_INSTANCE ${CMAKE_SOURCE_DIR}/Plugins/CreateInstance.sql |
1012fe77241c
new extension implemented for PostgreSQL and SQLite: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
79
diff
changeset
|
62 POSTGRESQL_FAST_TOTAL_SIZE ${CMAKE_SOURCE_DIR}/Plugins/FastTotalSize.sql |
1012fe77241c
new extension implemented for PostgreSQL and SQLite: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
79
diff
changeset
|
63 POSTGRESQL_FAST_COUNT_RESOURCES ${CMAKE_SOURCE_DIR}/Plugins/FastCountResources.sql |
1012fe77241c
new extension implemented for PostgreSQL and SQLite: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
79
diff
changeset
|
64 POSTGRESQL_GET_LAST_CHANGE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/GetLastChangeIndex.sql |
0 | 65 ) |
66 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
67 add_custom_target( |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
68 AutogeneratedTarget |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
69 DEPENDS |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
70 ${AUTOGENERATED_SOURCES} |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
71 ) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
72 |
0 | 73 add_library(OrthancPostgreSQLIndex SHARED |
36 | 74 ${INDEX_RESOURCES} |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
75 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
76 Plugins/IndexPlugin.cpp |
0 | 77 Plugins/PostgreSQLIndex.cpp |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
78 |
0 | 79 ${DATABASES_SOURCES} |
80 ${AUTOGENERATED_SOURCES} | |
81 ) | |
82 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
83 add_dependencies(OrthancPostgreSQLIndex AutogeneratedTarget) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
84 |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
85 add_library(OrthancPostgreSQLStorage SHARED |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
86 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
36 | 87 ${STORAGE_RESOURCES} |
14
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
88 Plugins/PostgreSQLStorageArea.cpp |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
89 Plugins/StoragePlugin.cpp |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
90 |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
91 ${DATABASES_SOURCES} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
92 ${AUTOGENERATED_SOURCES} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
93 ) |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
94 |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
95 add_dependencies(OrthancPostgreSQLStorage AutogeneratedTarget) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
96 |
0 | 97 message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}") |
98 | |
99 add_definitions( | |
100 -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}" | |
101 ) | |
102 | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
103 set_target_properties(OrthancPostgreSQLStorage PROPERTIES |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
104 VERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
105 SOVERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
106 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
107 ) |
0 | 108 |
109 set_target_properties(OrthancPostgreSQLIndex PROPERTIES | |
110 VERSION ${ORTHANC_PLUGIN_VERSION} | |
111 SOVERSION ${ORTHANC_PLUGIN_VERSION} | |
112 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 | |
113 ) | |
114 | |
115 install( | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
116 TARGETS OrthancPostgreSQLIndex OrthancPostgreSQLStorage |
0 | 117 RUNTIME DESTINATION lib # Destination for Windows |
118 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
119 ) | |
120 | |
121 | |
122 add_executable(UnitTests | |
123 Plugins/PostgreSQLIndex.cpp | |
14
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
124 Plugins/PostgreSQLStorageArea.cpp |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
125 UnitTests/PostgreSQLTests.cpp |
0 | 126 UnitTests/UnitTestsMain.cpp |
127 ${DATABASES_SOURCES} | |
128 ${GOOGLE_TEST_SOURCES} | |
129 ${AUTOGENERATED_SOURCES} | |
130 ) | |
131 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
152
diff
changeset
|
132 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
|
133 |
0 | 134 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) |
135 set_target_properties(UnitTests PROPERTIES | |
136 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
137 ) |