From 2a432397f4766cbccde31e12dc169fdc87aea350 Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Wed, 1 Jan 2025 22:12:45 -0700 Subject: [PATCH] [SCons] Enable clib_experimental flag Also, add README.md for clib_experimental interface --- SConstruct | 11 +++++++++ include/cantera/clib_experimental/.gitignore | 1 + include/cantera/clib_experimental/README.md | 25 ++++++++++++++++++++ src/SConscript | 2 ++ src/clib_experimental/.gitignore | 1 + 5 files changed, 40 insertions(+) create mode 100644 include/cantera/clib_experimental/.gitignore create mode 100644 include/cantera/clib_experimental/README.md create mode 100644 src/clib_experimental/.gitignore diff --git a/SConstruct b/SConstruct index 7d910dd10..c8c8ede28 100644 --- a/SConstruct +++ b/SConstruct @@ -134,6 +134,10 @@ if "clean" in COMMAND_LINE_TARGETS: remove_file(name) for name in Path("site_scons").glob("**/*.pyc"): remove_file(name) + for name in Path("include/cantera/clib_experimental").glob("*.h"): + remove_file(name) + for name in Path("src/clib_experimental").glob("*.cpp"): + remove_file(name) logger.status("Done removing output files.", print_level=False) @@ -364,6 +368,13 @@ config_options = [ "sphinx_docs", "Build HTML documentation for Cantera using Sphinx.", False), + BoolOption( + "clib_experimental", + """Build experimental CLib. Requires running 'scons doxygen' and CLib code + generation via 'python3 interfaces/sourcegen/run.py --api=clib --output=.' + prior to 'scons build' command. + """, + False), BoolOption( "run_examples", """Run examples to generate plots and outputs for Sphinx Gallery. Disable to diff --git a/include/cantera/clib_experimental/.gitignore b/include/cantera/clib_experimental/.gitignore new file mode 100644 index 000000000..424c745c1 --- /dev/null +++ b/include/cantera/clib_experimental/.gitignore @@ -0,0 +1 @@ +*.h diff --git a/include/cantera/clib_experimental/README.md b/include/cantera/clib_experimental/README.md new file mode 100644 index 000000000..17b4e3014 --- /dev/null +++ b/include/cantera/clib_experimental/README.md @@ -0,0 +1,25 @@ +# Cantera – Experimental CLib Interface + +This directory and the associated `src/clib_experimental` folder contain an +experimental re-implementation of Cantera's traditional CLib interface. + +## Code Generation + +Run the following command from the Cantera root folder: + +``` +scons doxygen +python3 interfaces/sourcegen/run.py --api=clib --output=. +scons build clib_experimental=y +``` + +A rudimentary test suite ensures that code performs as expected: + +``` +scons test-clib-experimental +``` + +## Status + +The experimental CLib Interface is in preview and still missing many features +needed for parity with the traditional CLib interface. diff --git a/src/SConscript b/src/SConscript index 004180aac..d958e0a51 100644 --- a/src/SConscript +++ b/src/SConscript @@ -39,6 +39,8 @@ libs = [('base', ['cpp'], baseSetup), ('zeroD', ['cpp'], defaultSetup), ('clib', ['cpp'], defaultSetup), ] +if env['clib_experimental']: + libs.append(('clib_experimental', ['cpp'], defaultSetup)) localenv = env.Clone() localenv.Prepend(CPPPATH=[Dir('#include'), Dir('.')]) diff --git a/src/clib_experimental/.gitignore b/src/clib_experimental/.gitignore new file mode 100644 index 000000000..ce1da4c53 --- /dev/null +++ b/src/clib_experimental/.gitignore @@ -0,0 +1 @@ +*.cpp