Mercurial > hg > orthanc-databases
annotate SQLite/CMakeLists.txt @ 524:48aba35fe64e large-queries
merged BEGIN and SET TRANSACTION statements
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 09 Jul 2024 16:30:52 +0200 |
parents | 586b80ea397c |
children | f18e46d7dbf8 |
rev | line source |
---|---|
329
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
507
54d518dcd74a
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
489
diff
changeset
|
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
54d518dcd74a
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
489
diff
changeset
|
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
459
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
441
diff
changeset
|
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
329
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
7 # |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
8 # This program is free software: you can redistribute it and/or |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
9 # 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:
327
diff
changeset
|
10 # as published by the Free Software Foundation, either version 3 of |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
11 # the License, or (at your option) any later version. |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
12 # |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
13 # 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:
327
diff
changeset
|
14 # WITHOUT ANY WARRANTY; without even the implied warranty of |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
16 # Affero General Public License for more details. |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
17 # |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
18 # 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:
327
diff
changeset
|
19 # 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:
327
diff
changeset
|
20 |
b5fb8b77ce4d
initial commit of ODBC framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
327
diff
changeset
|
21 |
0 | 22 cmake_minimum_required(VERSION 2.8) |
23 project(OrthancSQLite) | |
24 | |
25 set(ORTHANC_PLUGIN_VERSION "mainline") | |
26 | |
489
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
27 # This is the preferred version of the Orthanc SDK for this plugin |
519
586b80ea397c
back to previous default SDK since 1.12.4 is not required for plugin name logging
Alain Mazy <am@orthanc.team>
parents:
511
diff
changeset
|
28 set(ORTHANC_SDK_DEFAULT_VERSION "1.12.0") |
462
bba27bbef7e0
use Orthanc SDK 1.12.3
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
459
diff
changeset
|
29 |
489
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
30 # This is the list of the versions of the Orthanc SDK against which |
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
31 # this plugin will compile |
511
51a78b3f96bb
use Framework 1.12.4 by default
Alain Mazy <am@orthanc.team>
parents:
507
diff
changeset
|
32 set(ORTHANC_SDK_COMPATIBLE_VERSIONS "0.9.5" "1.4.0" "1.5.2" "1.5.4" "1.9.2" "1.12.0" "1.12.3" "1.12.4") |
489
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
33 |
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
34 # This is the minimal version of the Orthanc runtime that will provide |
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
35 # best performance. If the version of the Orthanc runtime is below |
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
36 # this minimal version, a warning message will be printed (but the |
e8b4bb6a33e7
introduction of ORTHANC_SDK_COMPATIBLE_VERSIONS in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
462
diff
changeset
|
37 # plugin will still start). |
129
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
93
diff
changeset
|
38 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
|
39 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
|
40 set(ORTHANC_OPTIMAL_VERSION_REVISION 0) |
129
534759b0cf14
use of macros to report performance warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
93
diff
changeset
|
41 |
0 | 42 if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") |
43 set(ORTHANC_FRAMEWORK_VERSION "mainline") | |
44 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
45 else() | |
511
51a78b3f96bb
use Framework 1.12.4 by default
Alain Mazy <am@orthanc.team>
parents:
507
diff
changeset
|
46 set(ORTHANC_FRAMEWORK_VERSION "1.12.4") |
180 | 47 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") |
0 | 48 endif() |
49 | |
50 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake) | |
51 | |
52 set(ENABLE_SQLITE_BACKEND ON) | |
53 | |
54 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginConfiguration.cmake) | |
55 | |
56 EmbedResources( | |
57 SQLITE_PREPARE_INDEX ${CMAKE_SOURCE_DIR}/Plugins/PrepareIndex.sql | |
58 ) | |
59 | |
372
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
60 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
|
61 add_custom_command( |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
62 COMMAND |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
63 ${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
|
64 DEPENDS |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
65 ProtobufCompiler |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
66 ${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
|
67 OUTPUT |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
68 ${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
|
69 ${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
|
70 ) |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
71 |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
72 list(APPEND AUTOGENERATED_SOURCES |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
73 ${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
|
74 ) |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
75 endif() |
b5e2c1e48828
created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
76 |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
77 add_custom_target( |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
78 AutogeneratedTarget |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
79 DEPENDS |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
80 ${AUTOGENERATED_SOURCES} |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
81 ) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
82 |
0 | 83 add_library(OrthancSQLiteIndex SHARED |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
84 ${ORTHANC_DATABASES_ROOT}/Framework/Plugins/PluginInitialization.cpp |
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
85 Plugins/IndexPlugin.cpp |
0 | 86 Plugins/SQLiteIndex.cpp |
24
17f849b2af34
sharing plugin initialization code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
87 |
0 | 88 ${DATABASES_SOURCES} |
89 ${AUTOGENERATED_SOURCES} | |
90 ) | |
91 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
92 add_dependencies(OrthancSQLiteIndex AutogeneratedTarget) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
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 | |
100 #set_target_properties(OrthancSQLiteStorage PROPERTIES | |
101 # VERSION ${ORTHANC_PLUGIN_VERSION} | |
102 # SOVERSION ${ORTHANC_PLUGIN_VERSION} | |
103 # COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 | |
104 # ) | |
105 | |
106 set_target_properties(OrthancSQLiteIndex PROPERTIES | |
107 VERSION ${ORTHANC_PLUGIN_VERSION} | |
108 SOVERSION ${ORTHANC_PLUGIN_VERSION} | |
109 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1 | |
110 ) | |
111 | |
112 install( | |
113 TARGETS OrthancSQLiteIndex # OrthancSQLiteStorage TODO | |
114 RUNTIME DESTINATION lib # Destination for Windows | |
115 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
116 ) | |
117 | |
118 add_executable(UnitTests | |
119 Plugins/SQLiteIndex.cpp | |
120 UnitTests/UnitTestsMain.cpp | |
121 ${DATABASES_SOURCES} | |
122 ${GOOGLE_TEST_SOURCES} | |
123 ${AUTOGENERATED_SOURCES} | |
124 ) | |
125 | |
155
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
126 add_dependencies(UnitTests AutogeneratedTarget) |
23cf7def8e44
use of OrthancPluginsExports.cmake, avoid race conditions with EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
127 |
0 | 128 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) |
129 set_target_properties(UnitTests PROPERTIES | |
130 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
131 ) | |
425 | 132 |
441
2b797871eff6
handling of DefineSourceBasenameForTarget for MySQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
425
diff
changeset
|
133 if (COMMAND DefineSourceBasenameForTarget) |
2b797871eff6
handling of DefineSourceBasenameForTarget for MySQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
425
diff
changeset
|
134 DefineSourceBasenameForTarget(OrthancSQLiteIndex) |
2b797871eff6
handling of DefineSourceBasenameForTarget for MySQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
425
diff
changeset
|
135 DefineSourceBasenameForTarget(UnitTests) |
2b797871eff6
handling of DefineSourceBasenameForTarget for MySQL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
425
diff
changeset
|
136 endif() |