forked from Cantera/cantera
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConscript
More file actions
60 lines (52 loc) · 2.02 KB
/
Copy pathSConscript
File metadata and controls
60 lines (52 loc) · 2.02 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
"""SConscript file for generated CLib."""
from pathlib import Path
from buildutils import multi_glob, logger
Import("env", "build", "install")
vars = {
"@INCLUDE@": "",
"@ENABLED_SECTIONS@": "",
"@GENERATE_HTML@": "NO",
# Ignore warnings during tag file generation
# (they are turned on for `scons doxygen`)
"@WARNINGS@": "NO",
"@WARN_IF_DOC_ERROR@": "NO",
"@WARN_IF_INCOMPLETE_DOC@": "NO",
"@CANTERA_VERSION@": env["cantera_version"],
}
env.Substfile(
"#build/doc/Doxyfile_xml", "#doc/doxygen/Doxyfile.in", SUBST_DICT=vars)
tags = env.Command(
"#build/doc/Cantera.tag", "#build/doc/Doxyfile_xml", "doxygen $SOURCE")
cxx_files = list(env.Glob("#doc/doxygen/*") +
multi_glob(env, "#include/cantera", "h") +
multi_glob(env, "#include/cantera/*", "h") +
multi_glob(env, "#src/cantera/*", "h", "cpp"))
env.Depends(tags, cxx_files)
env.Alias("doxygen_tags", tags)
# Generated file names can be anticipated
generated_files = []
auto_path = Path(Dir("#interfaces/sourcegen/src/sourcegen/headers").abspath)
yaml_files = sorted(auto_path.glob("ct*.yaml"))
for yaml_file in yaml_files:
base_name = yaml_file.stem
generated_files.extend([
f"#interfaces/clib/include/cantera_clib/{base_name}.h",
f"#interfaces/clib/src/{base_name}.cpp",
])
install("$inst_incdir/../cantera_clib",
f"#interfaces/clib/include/cantera_clib/{base_name}.h")
install(env.RecursiveInstall, "$inst_incdir/../cantera_clib",
"#interfaces/clib/include/cantera_clib")
# Run sourcegen without installation
sourcegen = env.Command(
generated_files,
tags,
("$python_cmd -m interfaces.sourcegen.src.sourcegen "
f"--api=clib --output={Path(Dir('#interfaces/clib').abspath)}")
)
env.Depends(sourcegen, [File(ff) for ff in yaml_files])
env.Depends(sourcegen, env.Glob("#interfaces/sourcegen/src/sourcegen/*.py"))
env.Depends(sourcegen, env.Glob("#interfaces/sourcegen/src/sourcegen/clib/*.*"))
build(tags)
build(sourcegen)
Return('sourcegen')