Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake @ 4105:c02a2d9efbc2
move FromDcmtkBridge::ExecuteToDicom() to LuaFunctionCall, to remove dependency of DCMTK on Lua
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 06 Jul 2020 13:48:10 +0200 |
parents | d25f4c0fa160 |
children | 304842a0d152 |
rev | line source |
---|---|
4034
78ee0155ec67
trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
1 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
|
2 CACHE INTERNAL "Path to the EmbedResources.py script from Orthanc") |
0 | 3 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED") |
4 set(AUTOGENERATED_SOURCES) | |
5 | |
6 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR}) | |
7 include_directories(${AUTOGENERATED_DIR}) | |
8 | |
9 macro(EmbedResources) | |
10 # 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
|
11 set(SCRIPT_OPTIONS) |
0 | 12 set(SCRIPT_ARGUMENTS) |
13 set(DEPENDENCIES) | |
14 set(IS_PATH_NAME false) | |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
15 |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
16 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources") |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
17 |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
18 # Loop over the arguments of the function |
0 | 19 foreach(arg ${ARGN}) |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
20 # Extract the first character of the argument |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
21 string(SUBSTRING "${arg}" 0 1 FIRST_CHAR) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
22 if (${FIRST_CHAR} STREQUAL "-") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
23 # 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
|
24 # EmbedResources.py |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
25 if (${arg} MATCHES "--target=.*") |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
26 # Does the argument starts with "--target="? |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
27 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
|
28 set(TARGET_BASE "${AUTOGENERATED_DIR}/${TARGET}") |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
29 else() |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
30 list(APPEND SCRIPT_OPTIONS ${arg}) |
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
31 endif() |
0 | 32 else() |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
33 if (${IS_PATH_NAME}) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
34 list(APPEND SCRIPT_ARGUMENTS "${arg}") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
35 list(APPEND DEPENDENCIES "${arg}") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
36 set(IS_PATH_NAME false) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
37 else() |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
38 list(APPEND SCRIPT_ARGUMENTS "${arg}") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
39 set(IS_PATH_NAME true) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
40 endif() |
0 | 41 endif() |
42 endforeach() | |
43 | |
44 add_custom_command( | |
45 OUTPUT | |
46 "${TARGET_BASE}.h" | |
47 "${TARGET_BASE}.cpp" | |
4034
78ee0155ec67
trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
48 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
|
49 ${SCRIPT_OPTIONS} "${TARGET_BASE}" ${SCRIPT_ARGUMENTS} |
0 | 50 DEPENDS |
4034
78ee0155ec67
trying to use orthanc frameworking with web-viewer plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4030
diff
changeset
|
51 ${EMBED_RESOURCES_PYTHON} |
0 | 52 ${DEPENDENCIES} |
53 ) | |
54 | |
55 list(APPEND AUTOGENERATED_SOURCES | |
4030
100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1469
diff
changeset
|
56 "${TARGET_BASE}.cpp" |
0 | 57 ) |
58 endmacro() |