Mercurial > hg > orthanc-databases
annotate Resources/CMake/MariaDBConfiguration.cmake @ 401:a8774581adfc db-protobuf
replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 07 Apr 2023 22:32:15 +0200 |
parents | 3d6886f3e5b3 |
children | 1938ba8fba35 |
rev | line source |
---|---|
0 | 1 # Orthanc - A Lightweight, RESTful DICOM Store |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
389
3d6886f3e5b3
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
3d6886f3e5b3
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
359
diff
changeset
|
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 6 # |
7 # This program is free software: you can redistribute it and/or | |
8 # modify it under the terms of the GNU Affero General Public License | |
9 # as published by the Free Software Foundation, either version 3 of | |
10 # the License, or (at your option) any later version. | |
11 # | |
12 # This program is distributed in the hope that it will be useful, but | |
13 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 # Affero General Public License for more details. | |
16 # | |
17 # You should have received a copy of the GNU Affero General Public License | |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
20 | |
21 if (STATIC_BUILD OR NOT USE_SYSTEM_MYSQL_CLIENT) | |
22 set(MARIADB_CLIENT_VERSION_MAJOR "10") | |
184
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
23 set(MARIADB_CLIENT_VERSION_MINOR "5") |
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
24 set(MARIADB_CLIENT_VERSION_PATCH "5") |
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
25 set(MARIADB_PACKAGE_VERSION "3.1.11") |
0 | 26 set(MARIADB_CLIENT_SOURCES_DIR ${CMAKE_BINARY_DIR}/mariadb-connector-c-${MARIADB_PACKAGE_VERSION}-src) |
184
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
27 set(MARIADB_CLIENT_MD5 "cf9da5f0ac9ec72dd8309bdc1d1c6c2f") |
91
1bd538a5a783
moving third-party dependencies to another server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
28 set(MARIADB_CLIENT_URL "http://orthanc.osimis.io/ThirdPartyDownloads/mariadb-connector-c-${MARIADB_PACKAGE_VERSION}-src.tar.gz") |
0 | 29 |
30 if (IS_DIRECTORY "${MARIADB_CLIENT_SOURCES_DIR}") | |
31 set(FirstRun OFF) | |
32 else() | |
33 set(FirstRun ON) | |
34 endif() | |
35 | |
36 DownloadPackage(${MARIADB_CLIENT_MD5} ${MARIADB_CLIENT_URL} "${MARIADB_CLIENT_SOURCES_DIR}") | |
37 | |
38 if (FirstRun) | |
39 execute_process( | |
40 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i | |
184
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
41 ${CMAKE_CURRENT_LIST_DIR}/../MariaDB/mariadb-connector-c-${MARIADB_PACKAGE_VERSION}.patch |
0 | 42 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
43 RESULT_VARIABLE Failure | |
44 ) | |
45 | |
46 if (Failure) | |
47 message(FATAL_ERROR "Error while patching a file") | |
48 endif() | |
49 endif() | |
50 | |
51 | |
52 include(${MARIADB_CLIENT_SOURCES_DIR}/cmake/CheckIncludeFiles.cmake) | |
53 include(${MARIADB_CLIENT_SOURCES_DIR}/cmake/CheckFunctions.cmake) | |
54 include(${MARIADB_CLIENT_SOURCES_DIR}/cmake/CheckTypes.cmake) | |
55 | |
184
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
56 set(MARIADB_CLIENT_VERSION "${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}") |
0 | 57 set(MARIADB_BASE_VERSION "mariadb-${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}") |
58 math(EXPR MARIADB_VERSION_ID "${MARIADB_CLIENT_VERSION_MAJOR} * 10000 + | |
59 ${MARIADB_CLIENT_VERSION_MINOR} * 100 + | |
60 ${MARIADB_CLIENT_VERSION_PATCH}") | |
184
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
61 |
185 | 62 add_definitions(-DHAVE_DLOPEN=1) |
63 #set(HAVE_DLOPEN 1) # Replaced by the C macro above in 3.1.11 | |
64 | |
0 | 65 set(PROTOCOL_VERSION ${MARIADB_CLIENT_VERSION_MAJOR}) |
66 set(MARIADB_PORT 3306) | |
67 set(MARIADB_UNIX_ADDR "/var/run/mysqld/mysqld.sock") | |
68 set(DEFAULT_CHARSET "latin1") | |
184
e8c3c92f2532
upgade to mariadb-connector-c 3.1.11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
69 set(ENABLED_LOCAL_INFILE "AUTO") |
0 | 70 |
71 FOREACH(plugin mysql_native_password mysql_old_password pvio_socket) | |
72 set(EXTERNAL_PLUGINS "${EXTERNAL_PLUGINS} extern struct st_mysql_client_plugin ${plugin}_client_plugin;\n") | |
73 set(BUILTIN_PLUGINS "${BUILTIN_PLUGINS} (struct st_mysql_client_plugin *)&${plugin}_client_plugin,\n") | |
74 ENDFOREACH() | |
75 | |
76 configure_file( | |
77 ${MARIADB_CLIENT_SOURCES_DIR}/include/ma_config.h.in | |
78 ${MARIADB_CLIENT_SOURCES_DIR}/include/ma_config.h | |
79 ) | |
80 | |
81 configure_file( | |
82 ${MARIADB_CLIENT_SOURCES_DIR}/include/mariadb_version.h.in | |
83 ${MARIADB_CLIENT_SOURCES_DIR}/include/mariadb_version.h | |
84 ) | |
85 | |
86 configure_file( | |
87 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_client_plugin.c.in | |
88 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_client_plugin.c | |
89 ) | |
90 | |
91 include_directories( | |
92 ${MARIADB_CLIENT_SOURCES_DIR}/include | |
93 ) | |
94 | |
95 set(MYSQL_CLIENT_SOURCES | |
96 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_alloc.c | |
97 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_array.c | |
98 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_charset.c | |
99 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_client_plugin.c | |
100 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_compress.c | |
101 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_context.c | |
102 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_default.c | |
103 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_dtoa.c | |
104 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_errmsg.c | |
105 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_hash.c | |
106 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_init.c | |
107 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_io.c | |
108 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_list.c | |
109 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_ll2str.c | |
110 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_loaddata.c | |
111 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_net.c | |
112 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_password.c | |
113 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_pvio.c | |
114 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_sha1.c | |
115 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_stmt_codec.c | |
116 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_string.c | |
117 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_time.c | |
118 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/ma_tls.c | |
119 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/mariadb_async.c | |
120 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/mariadb_charset.c | |
121 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/mariadb_dyncol.c | |
122 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/mariadb_lib.c | |
123 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/mariadb_stmt.c | |
124 ${MARIADB_CLIENT_SOURCES_DIR}/libmariadb/secure/openssl.c | |
125 ${MARIADB_CLIENT_SOURCES_DIR}/plugins/auth/my_auth.c | |
126 ${MARIADB_CLIENT_SOURCES_DIR}/plugins/auth/old_password.c | |
127 ${MARIADB_CLIENT_SOURCES_DIR}/plugins/pvio/pvio_socket.c | |
128 ) | |
129 | |
7 | 130 set_property( |
131 SOURCE ${MYSQL_CLIENT_SOURCES} | |
132 PROPERTY COMPILE_DEFINITIONS "HAVE_OPENSSL=1;HAVE_TLS=1;HAVE_REMOTEIO=1;HAVE_COMPRESS=1;LIBMARIADB;THREAD" | |
133 ) | |
134 | |
0 | 135 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") |
136 link_libraries(shlwapi) | |
183
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
137 |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
138 # MariaDB connector requires the fibers API (file "fibersapi.h", |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
139 # e.g. function "IsThreadAFiber()"), that was introduced in |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
140 # Windows Vista. This is done by redefining the "_WIN32_WINNT" |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
141 # macro that is initially set to 0x501 (Windows XP) in |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
142 # "OrthancFramework/Resources/CMake/Compiler.cmake". |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
143 # https://docs.microsoft.com/en-us/windows/win32/api/fibersapi/nf-fibersapi-isthreadafiber |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
144 remove_definitions( |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
145 -DWINVER=0x0501 |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
146 -D_WIN32_WINNT=0x0501 |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
147 ) |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
148 add_definitions( |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
149 -DWINVER=0x0600 |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
150 -D_WIN32_WINNT=0x0600 |
2f94b2046d7c
upgrade to openssl 1.1.1, fix build if using MinGW 32bits
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
150
diff
changeset
|
151 ) |
0 | 152 endif() |
153 | |
154 else() | |
155 find_path(MYSQLCLIENT_INCLUDE_DIR mysql.h | |
156 /usr/local/include/mysql | |
157 /usr/include/mysql | |
158 ) | |
159 | |
160 if (MYSQLCLIENT_INCLUDE_DIR) | |
161 include_directories(${MYSQLCLIENT_INCLUDE_DIR}) | |
162 set(CMAKE_REQUIRED_INCLUDES "${MYSQLCLIENT_INCLUDE_DIR}") | |
163 endif() | |
164 | |
165 check_include_file(mysql.h HAVE_MYSQL_CLIENT_H) | |
166 if (NOT HAVE_MYSQL_CLIENT_H) | |
167 message(FATAL_ERROR "Please install the libmysqlclient-dev package") | |
168 endif() | |
169 | |
150
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
170 find_library(MYSQL_CLIENT_LIB NAMES mysqlclient PATHS |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
171 /usr/lib/mysql |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
172 /usr/local/lib/mysql |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
173 ) |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
174 |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
175 if (MYSQL_CLIENT_LIB) |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
176 check_library_exists(${MYSQL_CLIENT_LIB} mysql_init "" HAVE_MYSQL_CLIENT_LIB) |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
177 if (NOT HAVE_MYSQL_CLIENT_LIB) |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
178 message(FATAL_ERROR "Unable to use mysql_init from mysqlclient library") |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
179 endif() |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
180 get_filename_component(MYSQL_CLIENT_LIB_PATH ${MYSQL_CLIENT_LIB} DIRECTORY) |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
181 link_directories(${MYSQL_CLIENT_LIB_PATH}) |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
182 link_libraries(mysqlclient) |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
183 else() |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
184 message(FATAL_ERROR "Unable to find the mysqlclient library") |
d9101318442d
fix linking MySQL on FreeBSD: https://groups.google.com/d/msg/orthanc-users/BbLvEoHFw18/pu9d8MyvBQAJ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
140
diff
changeset
|
185 endif() |
0 | 186 endif() |