annotate Common/Resources/Orthanc/CMake/AutoGeneratedCode.cmake @ 117:a3590caf93a3 2.3.0

sync orthanc folder
author Alain Mazy <am@osimis.io>
date Mon, 13 Nov 2023 20:56:41 +0100
parents 37a4b8e2577f
children 40efe821932a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
59
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 # Orthanc - A Lightweight, RESTful DICOM Store
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 # Department, University Hospital of Liege, Belgium
110
37a4b8e2577f sync orthanc + SDK 1.12.1
Alain Mazy <am@osimis.io>
parents: 59
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
37a4b8e2577f sync orthanc + SDK 1.12.1
Alain Mazy <am@osimis.io>
parents: 59
diff changeset
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
59
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 #
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 # modify it under the terms of the GNU Lesser General Public License
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 # as published by the Free Software Foundation, either version 3 of
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 # the License, or (at your option) any later version.
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 #
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful, but
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 # Lesser General Public License for more details.
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 #
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 # You should have received a copy of the GNU Lesser General Public
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 # License along with this program. If not, see
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 # <http://www.gnu.org/licenses/>.
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 set(EMBED_RESOURCES_PYTHON "${CMAKE_CURRENT_LIST_DIR}/../EmbedResources.py"
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 CACHE INTERNAL "Path to the EmbedResources.py script from Orthanc")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 set(AUTOGENERATED_SOURCES)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 include_directories(${AUTOGENERATED_DIR})
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 macro(EmbedResources)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 # Convert a semicolon separated list to a whitespace separated string
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 set(SCRIPT_OPTIONS)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 set(SCRIPT_ARGUMENTS)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 set(DEPENDENCIES)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 set(IS_PATH_NAME false)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 # Loop over the arguments of the function
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 foreach(arg ${ARGN})
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 # Extract the first character of the argument
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 string(SUBSTRING "${arg}" 0 1 FIRST_CHAR)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 if (${FIRST_CHAR} STREQUAL "-")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 # If the argument starts with a dash "-", this is an option to
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 # EmbedResources.py
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 if (${arg} MATCHES "--target=.*")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 # Does the argument starts with "--target="?
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 string(SUBSTRING "${arg}" 9 -1 TARGET) # 9 is the length of "--target="
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 set(TARGET_BASE "${AUTOGENERATED_DIR}/${TARGET}")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 else()
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 list(APPEND SCRIPT_OPTIONS ${arg})
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 endif()
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 else()
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 if (${IS_PATH_NAME})
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 list(APPEND SCRIPT_ARGUMENTS "${arg}")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 list(APPEND DEPENDENCIES "${arg}")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 set(IS_PATH_NAME false)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 else()
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 list(APPEND SCRIPT_ARGUMENTS "${arg}")
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 set(IS_PATH_NAME true)
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 endif()
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 endif()
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 endforeach()
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 add_custom_command(
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 OUTPUT
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 "${TARGET_BASE}.h"
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 "${TARGET_BASE}.cpp"
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 COMMAND ${PYTHON_EXECUTABLE} ${EMBED_RESOURCES_PYTHON}
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ${SCRIPT_OPTIONS} "${TARGET_BASE}" ${SCRIPT_ARGUMENTS}
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 DEPENDS
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 ${EMBED_RESOURCES_PYTHON}
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 ${DEPENDENCIES}
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 )
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 list(APPEND AUTOGENERATED_SOURCES
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 "${TARGET_BASE}.cpp"
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 )
f3c44d61e1e1 AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 endmacro()