annotate OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake @ 4944:f377d5643538 more-tags

new Warnings configuration + InstanceAvailability tag
author Alain Mazy <am@osimis.io>
date Thu, 17 Mar 2022 17:03:59 +0100
parents 43e613a7756b
children 0ea402b4d901
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4870
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
4 # Copyright (C) 2017-2022 Osimis S.A., Belgium
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
6 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
7 # 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
8 # 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
9 # 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
10 # the License, or (at your option) any later version.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 # 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
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
14 # 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
15 # Lesser General Public License for more details.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
16 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 # 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
18 # License along with this program. If not, see
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 # <http://www.gnu.org/licenses/>.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21
4034
78ee0155ec67 trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4030
diff changeset
22 set(EMBED_RESOURCES_PYTHON "${CMAKE_CURRENT_LIST_DIR}/../EmbedResources.py"
78ee0155ec67 trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4030
diff changeset
23 CACHE INTERNAL "Path to the EmbedResources.py script from Orthanc")
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 set(AUTOGENERATED_SOURCES)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 include_directories(${AUTOGENERATED_DIR})
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 macro(EmbedResources)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 # Convert a semicolon separated list to a whitespace separated string
1469
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
32 set(SCRIPT_OPTIONS)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 set(SCRIPT_ARGUMENTS)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 set(DEPENDENCIES)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 set(IS_PATH_NAME false)
1469
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
36
4030
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
37 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
38
1469
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
39 # Loop over the arguments of the function
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 foreach(arg ${ARGN})
1469
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
41 # Extract the first character of the argument
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
42 string(SUBSTRING "${arg}" 0 1 FIRST_CHAR)
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
43 if (${FIRST_CHAR} STREQUAL "-")
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
44 # If the argument starts with a dash "-", this is an option to
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
45 # EmbedResources.py
4030
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
46 if (${arg} MATCHES "--target=.*")
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
47 # Does the argument starts with "--target="?
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
48 string(SUBSTRING "${arg}" 9 -1 TARGET) # 9 is the length of "--target="
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
49 set(TARGET_BASE "${AUTOGENERATED_DIR}/${TARGET}")
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
50 else()
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
51 list(APPEND SCRIPT_OPTIONS ${arg})
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
52 endif()
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 else()
1469
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
54 if (${IS_PATH_NAME})
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
55 list(APPEND SCRIPT_ARGUMENTS "${arg}")
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
56 list(APPEND DEPENDENCIES "${arg}")
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
57 set(IS_PATH_NAME false)
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
58 else()
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
59 list(APPEND SCRIPT_ARGUMENTS "${arg}")
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
60 set(IS_PATH_NAME true)
bf9b8bfea0e7 more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1418
diff changeset
61 endif()
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 endif()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 endforeach()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 add_custom_command(
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 OUTPUT
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 "${TARGET_BASE}.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 "${TARGET_BASE}.cpp"
4034
78ee0155ec67 trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4030
diff changeset
69 COMMAND ${PYTHON_EXECUTABLE} ${EMBED_RESOURCES_PYTHON}
78ee0155ec67 trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4030
diff changeset
70 ${SCRIPT_OPTIONS} "${TARGET_BASE}" ${SCRIPT_ARGUMENTS}
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 DEPENDS
4034
78ee0155ec67 trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4030
diff changeset
72 ${EMBED_RESOURCES_PYTHON}
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 ${DEPENDENCIES}
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 )
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 list(APPEND AUTOGENERATED_SOURCES
4030
100fbe970762 DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1469
diff changeset
77 "${TARGET_BASE}.cpp"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 )
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 endmacro()