Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/SQLiteConfiguration.cmake @ 4720:85102d5cc936 Orthanc-1.9.4
Orthanc-1.9.4
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Jun 2021 08:08:18 +0200 |
parents | d9473bd5ed43 |
children | 7053502fbf97 |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
5 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
6 # This program is free software: you can redistribute it and/or |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
7 # modify it under the terms of the GNU Lesser General Public License |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 # as published by the Free Software Foundation, either version 3 of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, but |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
14 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 # You should have received a copy of the GNU Lesser General Public |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 |
1475 | 21 if (APPLE) |
22 # Under OS X, the binaries must always be linked against the | |
23 # system-wide version of SQLite. Otherwise, if some Orthanc plugin | |
24 # also uses its own version of SQLite (such as orthanc-webviewer), | |
25 # this results in a crash in "sqlite3_mutex_enter(db->mutex);" (the | |
26 # mutex is not initialized), probably because the EXE and the DYNLIB | |
27 # share the same memory location for this mutex. | |
28 set(SQLITE_STATIC OFF) | |
29 | |
30 elseif (STATIC_BUILD OR NOT USE_SYSTEM_SQLITE) | |
31 set(SQLITE_STATIC ON) | |
32 else() | |
33 set(SQLITE_STATIC OFF) | |
34 endif() | |
35 | |
36 | |
37 if (SQLITE_STATIC) | |
3291
508fa367c493
upgrade to sqlite amalgamation 3.27.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
38 SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3270100) |
508fa367c493
upgrade to sqlite amalgamation 3.27.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
39 SET(SQLITE_MD5 "16717b26358ba81f0bfdac07addc77da") |
508fa367c493
upgrade to sqlite amalgamation 3.27.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
40 SET(SQLITE_URL "http://orthanc.osimis.io/ThirdPartyDownloads/sqlite-amalgamation-3270100.zip") |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1475
diff
changeset
|
41 |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
42 set(ORTHANC_SQLITE_VERSION 3027001) |
2302
f31dfb131dee
fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2186
diff
changeset
|
43 |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1475
diff
changeset
|
44 DownloadPackage(${SQLITE_MD5} ${SQLITE_URL} "${SQLITE_SOURCES_DIR}") |
735 | 45 |
1414 | 46 set(SQLITE_SOURCES |
735 | 47 ${SQLITE_SOURCES_DIR}/sqlite3.c |
48 ) | |
49 | |
50 add_definitions( | |
51 # For SQLite to run in the "Serialized" thread-safe mode | |
52 # http://www.sqlite.org/threadsafe.html | |
53 -DSQLITE_THREADSAFE=1 | |
54 -DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins | |
55 ) | |
56 | |
57 include_directories( | |
58 ${SQLITE_SOURCES_DIR} | |
59 ) | |
60 | |
61 source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*) | |
62 | |
63 else() | |
3833
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3291
diff
changeset
|
64 CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H) |
735 | 65 if (NOT HAVE_SQLITE_H) |
66 message(FATAL_ERROR "Please install the libsqlite3-dev package") | |
67 endif() | |
68 | |
3833
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3291
diff
changeset
|
69 find_path(SQLITE_INCLUDE_DIR |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3291
diff
changeset
|
70 NAMES sqlite3.h |
a3e38994d95a
compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3291
diff
changeset
|
71 PATHS |
1335
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
72 /usr/include |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
73 /usr/local/include |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
74 ) |
1334 | 75 message("SQLite include dir: ${SQLITE_INCLUDE_DIR}") |
76 | |
735 | 77 # Autodetection of the version of SQLite |
1334 | 78 file(STRINGS "${SQLITE_INCLUDE_DIR}/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$") |
2302
f31dfb131dee
fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2186
diff
changeset
|
79 string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER2 ${SQLITE_VERSION_NUMBER1}) |
f31dfb131dee
fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2186
diff
changeset
|
80 |
f31dfb131dee
fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2186
diff
changeset
|
81 # Remove the trailing spaces to convert the string to a proper integer |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
82 string(STRIP ${SQLITE_VERSION_NUMBER2} ORTHANC_SQLITE_VERSION) |
735 | 83 |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
84 message("Detected version of SQLite: ${ORTHANC_SQLITE_VERSION}") |
735 | 85 |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
86 IF (${ORTHANC_SQLITE_VERSION} LESS 3007000) |
735 | 87 # "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0 |
88 message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_SYSTEM_SQLITE to OFF.") | |
89 ENDIF() | |
90 | |
91 link_libraries(sqlite3) | |
92 endif() | |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
93 |
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
94 |
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
95 add_definitions( |
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
96 -DORTHANC_SQLITE_VERSION=${ORTHANC_SQLITE_VERSION} |
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3833
diff
changeset
|
97 ) |