Mercurial > hg > orthanc-databases
annotate PostgreSQL/CMakeLists.txt @ 57:f4d5c2c70f98
Suggestion by Karsten Hilbert: CREATE EXTENSION IF NOT EXISTS pg_trgm
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Sep 2018 08:56:42 +0200 |
parents | 23761c478d86 |
children | e78d7077ee1c |
rev | line source |
---|---|
0 | 1 cmake_minimum_required(VERSION 2.8) |
2 project(OrthancPostgreSQL) | |
3 | |
35
199af032e6e7
fix mainline version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
33
diff
changeset
|
4 set(ORTHANC_PLUGIN_VERSION "mainline") |
0 | 5 |
6 if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") | |
7 set(ORTHANC_FRAMEWORK_VERSION "mainline") | |
8 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
9 else() | |
27
173176f8cef2
jobs branch has disappeared in orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
24
diff
changeset
|
10 set(ORTHANC_FRAMEWORK_VERSION "1.4.0") |
0 | 11 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") |
12 endif() | |
13 | |
14 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake) | |
15 | |
16 set(ENABLE_POSTGRESQL_BACKEND ON) | |
17 | |
18 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake) | |
19 | |
36 | 20 |
21 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
22 execute_process( | |
23 COMMAND | |
24 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py | |
25 ${ORTHANC_PLUGIN_VERSION} "PostgreSQL storage area plugin" OrthancPostgreSQLStorage.dll | |
26 "PostgreSQL as a database back-end to Orthanc (storage area)" | |
27 ERROR_VARIABLE Failure | |
28 OUTPUT_FILE ${AUTOGENERATED_DIR}/StorageVersion.rc | |
29 ) | |
30 | |
31 if (Failure) | |
32 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
33 endif() | |
34 | |
35 execute_process( | |
36 COMMAND | |
37 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py | |
38 ${ORTHANC_PLUGIN_VERSION} "PostgreSQL index plugin" OrthancPostgreSQLIndex.dll | |
39 "PostgreSQL as a database back-end to Orthanc (index)" | |
40 ERROR_VARIABLE Failure | |
41 OUTPUT_FILE ${AUTOGENERATED_DIR}/IndexVersion.rc | |
42 ) | |
43 | |
44 if (Failure) | |
45 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
46 endif() | |
47 | |
48 set(INDEX_RESOURCES ${AUTOGENERATED_DIR}/IndexVersion.rc) | |
49 set(STORAGE_RESOURCES ${AUTOGENERATED_DIR}/StorageVersion.rc) | |
50 endif() | |
51 | |
52 | |
0 | 53 EmbedResources( |
54 POSTGRESQL_PREPARE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/PrepareIndex.sql | |
55 ) | |
56 | |
57 add_library(OrthancPostgreSQLIndex SHARED | |
36 | 58 ${INDEX_RESOURCES} |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
59 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
60 Plugins/IndexPlugin.cpp |
0 | 61 Plugins/PostgreSQLIndex.cpp |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
62 |
0 | 63 ${DATABASES_SOURCES} |
64 ${AUTOGENERATED_SOURCES} | |
65 ) | |
66 | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
67 add_library(OrthancPostgreSQLStorage SHARED |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
68 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
36 | 69 ${STORAGE_RESOURCES} |
14
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
70 Plugins/PostgreSQLStorageArea.cpp |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
71 Plugins/StoragePlugin.cpp |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
14
diff
changeset
|
72 |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
73 ${DATABASES_SOURCES} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
74 ${AUTOGENERATED_SOURCES} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
75 ) |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
76 |
0 | 77 message("Setting the version of the libraries to ${ORTHANC_PLUGIN_VERSION}") |
78 | |
79 add_definitions( | |
80 -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}" | |
81 -DHAS_ORTHANC_EXCEPTION=1 | |
82 ) | |
83 | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
84 set_target_properties(OrthancPostgreSQLStorage PROPERTIES |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
85 VERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
86 SOVERSION ${ORTHANC_PLUGIN_VERSION} |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
87 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 |
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
88 ) |
0 | 89 |
90 set_target_properties(OrthancPostgreSQLIndex PROPERTIES | |
91 VERSION ${ORTHANC_PLUGIN_VERSION} | |
92 SOVERSION ${ORTHANC_PLUGIN_VERSION} | |
93 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 | |
94 ) | |
95 | |
96 install( | |
2
17bce6a07b2b
storage plugin skeletons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
97 TARGETS OrthancPostgreSQLIndex OrthancPostgreSQLStorage |
0 | 98 RUNTIME DESTINATION lib # Destination for Windows |
99 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
100 ) | |
101 | |
102 | |
103 add_executable(UnitTests | |
104 Plugins/PostgreSQLIndex.cpp | |
14
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
105 Plugins/PostgreSQLStorageArea.cpp |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2
diff
changeset
|
106 UnitTests/PostgreSQLTests.cpp |
0 | 107 UnitTests/UnitTestsMain.cpp |
108 ${DATABASES_SOURCES} | |
109 ${GOOGLE_TEST_SOURCES} | |
110 ${AUTOGENERATED_SOURCES} | |
111 ) | |
112 | |
113 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) | |
114 set_target_properties(UnitTests PROPERTIES | |
115 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
116 ) |