mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 14:13:23 +00:00
[CMake] Fix dependencies for generating mem_initializer.cpp
.
Previously CMake was not aware of which headers files the generation of `mem_initializer.cpp` depended on. Consequently this could result in broken incremental builds if * Existing headers that declare memory initializers/finalizers change. * New headers are added that declare memory initializers/finalizer. Now the `z3_add_component()` CMake function has been modifed so that it now takes an optional `MEMORY_INIT_FINALIZER_HEADERS` argument which allows the headers that declare memory initializers/finalizers to be explicitly listed. With this information CMake will now regenerate `mem_initializer.cpp` correctly. This required the `mk_mem_initializer_cpp_internal()` function to be changed to take a list of header files rather than a list of component source directories. The two consumers (CMake and Python/Makefile build systems) of this function have been modified to work with this change. This partially fixes #1030.
This commit is contained in:
parent
6f48a145aa
commit
d00892c9a6
5 changed files with 55 additions and 18 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Scans the source directories for
|
||||
Scans the listed header files for
|
||||
memory initializers and finalizers and
|
||||
emits and implementation of
|
||||
``void mem_initialize()`` and
|
||||
|
@ -17,19 +17,19 @@ def main(args):
|
|||
logging.basicConfig(level=logging.INFO)
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("destination_dir", help="destination directory")
|
||||
parser.add_argument("source_dirs", nargs="+",
|
||||
help="One or more source directories to search")
|
||||
parser.add_argument("header_files", nargs="+",
|
||||
help="One or more header files to parse")
|
||||
pargs = parser.parse_args(args)
|
||||
|
||||
if not mk_genfile_common.check_dir_exists(pargs.destination_dir):
|
||||
return 1
|
||||
|
||||
for source_dir in pargs.source_dirs:
|
||||
if not mk_genfile_common.check_dir_exists(source_dir):
|
||||
return 1
|
||||
h_files_full_path = []
|
||||
for header_file in pargs.header_files:
|
||||
h_files_full_path.append(os.path.abspath(header_file))
|
||||
|
||||
output = mk_genfile_common.mk_mem_initializer_cpp_internal(
|
||||
pargs.source_dirs,
|
||||
h_files_full_path,
|
||||
pargs.destination_dir
|
||||
)
|
||||
logging.info('Generated "{}"'.format(output))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue