-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathmanage_generated.cmake.in
More file actions
102 lines (94 loc) · 5.44 KB
/
manage_generated.cmake.in
File metadata and controls
102 lines (94 loc) · 5.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Inherit the parent CMake setting
set(CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(LEMON_EXECUTABLE "@LEMON_EXECUTABLE@")
set(RE2C_EXECUTABLE "@RE2C_EXECUTABLE@")
set(PERPLEX_EXECUTABLE "@PERPLEX_EXECUTABLE@")
set(SYNC_SCRIPT "@SYNC_SCRIPT@")
set(SYNC_TARGET_NAME "@SYNC_TARGET_NAME@")
set(DEBUGGING_GENERATED_SOURCES "@DEBUGGING_GENERATED_SOURCES@")
if(NOT DEBUGGING_GENERATED_SOURCES)
# Include the file the provides the baseline against which
# current files will be compared
include("@BASELINE_INFORMATION_FILE@")
# Define a variety of convenience routines
include("@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake")
# The following need to be checked:
#
# 1. baseline input MD5 hashes against the current input
# hashes. If the cached sources were generated using
# inputs other than the current inputs, note they are
# out of sync but don't stop. Templates used by perplex
# and lemon are part of this group.
#
# 2. baseline cached source MD5 hashes against current
# cached source MD5 hashes. Making sure no changes
# have been made to the generated sources. If the
# cached sources need to be updated (see #1, for example)
# their MD5 hashes need to be updated at the same time.
#
# 3. MD5 hashes of output generated by the tools against
# the MD5 hashes of the equalivent cached sources, if
# a) the tool versions are the same b) the input MD5
# hash comparisions were the same and c) the baseline
# test from #2 passed. This is done to detect platform
# differences in output sources, but is only valid if
# the input files are in their "pristine" state and the
# toolchain is equalivent to that used for the baseline.
# Individually verify all of the files in question.
set(input_files "@INPUT_FILELIST@")
VERIFY_FILES("${input_files}" 0 input_unchanged)
set(template_files "@TEMPLATE_FILELIST@")
VERIFY_FILES("${template_files}" 1 templates_unchanged)
set(cached_files "@CACHED_FILELIST@")
VERIFY_FILES("${cached_files}" 1 cached_unchanged)
if(cached_unchanged)
message( "Cached generated source code has not been modified.")
else()
message(FATAL_ERROR "Cached generated sources do not match the MD5 hashes present in /home/mark/step/sc/src/express/generated/verification_info.cmake - if updating cached sources, remember that the build enforces the requirement that associated MD5 hashes in /home/mark/step/sc/src/express/generated/verification_info.cmake are current as well. Cached generated sources should not be directly edited.")
endif(cached_unchanged)
GET_GENERATOR_EXEC_VERSIONS()
if("${lemon_version}" VERSION_EQUAL "${baseline_lemon_version}" AND "${perplex_version}" VERSION_EQUAL "${baseline_perplex_version}" AND "${re2c_version}" VERSION_EQUAL "${baseline_re2c_version}")
set(tool_versions_equal 1)
else()
set(tool_versions_equal 0)
endif()
if(NOT input_unchanged)
if(templates_unchanged AND tool_versions_equal)
message("Input files changed - syncing cached outputs")
execute_process(COMMAND ${CMAKE_COMMAND} -P ${SYNC_SCRIPT} OUTPUT_VARIABLE output)
else(templates_unchanged AND tool_versions_equal)
if(NOT templates_unchanged AND NOT tool_versions_equal)
message("Input files have been updated, but templates and current tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
else(NOT templates_unchanged AND NOT tool_versions_equal)
if(NOT templates_unchanged)
message("Input files have been updated, but templates do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
endif(NOT templates_unchanged)
if(NOT tool_versions_equal)
message("Input files have been updated, but tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
endif(NOT tool_versions_equal)
endif(NOT templates_unchanged AND NOT tool_versions_equal)
endif(templates_unchanged AND tool_versions_equal)
else(NOT input_unchanged)
if(templates_unchanged AND cached_unchanged AND tool_versions_equal)
# Under these conditions, the uncached generated output should be equal to the cached files.
# Check if it is - a difference here may indicate a platform-specific behavior in one of the
# generators.
set(build_files "@BUILD_OUTPUT_FILELIST@")
VERIFY_FILES("${build_files}" 1 platform_unchanged)
if(NOT platform_unchanged)
message("Note: give these build inputs and tools, source files should be identical to generated files. Differences were still observed - possible indiciation of platform-specific generator behavior.")
endif(NOT platform_unchanged)
endif(templates_unchanged AND cached_unchanged AND tool_versions_equal)
endif(NOT input_unchanged)
else(NOT DEBUGGING_GENERATED_SOURCES)
message("\nNote: DEBUGGING_GENERATED_SOURCES is enabled - generated outputs will contain configuration-specific debugging information, so syncing cached output files is not possible. To restore normal behavior, disable DEBUGGING_GENERATED_SOURCES.\n")
endif(NOT DEBUGGING_GENERATED_SOURCES)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8