Mercurial > hg > orthanc
annotate Resources/CMake/AutoGeneratedCode.cmake @ 2007:655489d9165d
DicomMap::ParseDicomMetaInformation()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 09 Jun 2016 15:46:33 +0200 |
parents | bf9b8bfea0e7 |
children | 100fbe970762 |
rev | line source |
---|---|
0 | 1 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED") |
2 set(AUTOGENERATED_SOURCES) | |
3 | |
4 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR}) | |
5 include_directories(${AUTOGENERATED_DIR}) | |
6 | |
7 macro(EmbedResources) | |
8 # 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
|
9 set(SCRIPT_OPTIONS) |
0 | 10 set(SCRIPT_ARGUMENTS) |
11 set(DEPENDENCIES) | |
12 set(IS_PATH_NAME false) | |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
13 |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
14 # Loop over the arguments of the function |
0 | 15 foreach(arg ${ARGN}) |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
16 # Extract the first character of the argument |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
17 string(SUBSTRING "${arg}" 0 1 FIRST_CHAR) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
18 if (${FIRST_CHAR} STREQUAL "-") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
19 # 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
|
20 # EmbedResources.py |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
21 list(APPEND SCRIPT_OPTIONS ${arg}) |
0 | 22 else() |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
23 if (${IS_PATH_NAME}) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
24 list(APPEND SCRIPT_ARGUMENTS "${arg}") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
25 list(APPEND DEPENDENCIES "${arg}") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
26 set(IS_PATH_NAME false) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
27 else() |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
28 list(APPEND SCRIPT_ARGUMENTS "${arg}") |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
29 set(IS_PATH_NAME true) |
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
30 endif() |
0 | 31 endif() |
32 endforeach() | |
33 | |
34 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources") | |
35 add_custom_command( | |
36 OUTPUT | |
37 "${TARGET_BASE}.h" | |
38 "${TARGET_BASE}.cpp" | |
39 COMMAND | |
1339
a87d3288bd39
autodetect python binary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
291
diff
changeset
|
40 ${PYTHON_EXECUTABLE} |
1418 | 41 "${ORTHANC_ROOT}/Resources/EmbedResources.py" |
1469
bf9b8bfea0e7
more generic EmbedResources.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1418
diff
changeset
|
42 ${SCRIPT_OPTIONS} |
0 | 43 "${AUTOGENERATED_DIR}/EmbeddedResources" |
44 ${SCRIPT_ARGUMENTS} | |
45 DEPENDS | |
1418 | 46 "${ORTHANC_ROOT}/Resources/EmbedResources.py" |
0 | 47 ${DEPENDENCIES} |
48 ) | |
49 | |
50 list(APPEND AUTOGENERATED_SOURCES | |
51 "${AUTOGENERATED_DIR}/EmbeddedResources.cpp" | |
52 ) | |
53 endmacro() |