annotate Resources/CMake/AutoGeneratedCode.cmake @ 2442:330349d712f9

fix Toolbox::IsAsciiString
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Dec 2017 21:58:09 +0100
parents bf9b8bfea0e7
children 100fbe970762
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 set(AUTOGENERATED_SOURCES)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 include_directories(${AUTOGENERATED_DIR})
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 macro(EmbedResources)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 set(SCRIPT_ARGUMENTS)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 set(DEPENDENCIES)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 endif()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 endforeach()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 add_custom_command(
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 OUTPUT
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 "${TARGET_BASE}.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 "${TARGET_BASE}.cpp"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 COMMAND
1339
a87d3288bd39 autodetect python binary
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
40 ${PYTHON_EXECUTABLE}
1418
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1339
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 "${AUTOGENERATED_DIR}/EmbeddedResources"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 ${SCRIPT_ARGUMENTS}
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 DEPENDS
1418
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1339
diff changeset
46 "${ORTHANC_ROOT}/Resources/EmbedResources.py"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 ${DEPENDENCIES}
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 )
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 list(APPEND AUTOGENERATED_SOURCES
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 "${AUTOGENERATED_DIR}/EmbeddedResources.cpp"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 )
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 endmacro()