diff --git a/CMakeLists.txt b/CMakeLists.txt index 60a67b5..e1804f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,23 @@ xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets # ---------------------------------------------------------------- +# Install the generator script +install( + PROGRAMS codegen/genfacet + DESTINATION share/xo-facet/codegen + COMPONENT codegen +) + +# Install all .j2 template files +install( + DIRECTORY codegen/ + DESTINATION share/xo-facet/codegen + COMPONENT codegen + FILES_MATCHING PATTERN "*.j2" +) + +# ---------------------------------------------------------------- + # docs targets depend on other library/utest/exec targets above, # --> must come after them. # diff --git a/codegen/facet.hpp b/codegen/facet.hpp deleted file mode 100644 index e69de29..0000000 diff --git a/codegen/genfacet.py b/codegen/genfacet similarity index 97% rename from codegen/genfacet.py rename to codegen/genfacet index d45dc70..6af2f4a 100755 --- a/codegen/genfacet.py +++ b/codegen/genfacet @@ -1,6 +1,5 @@ #! /usr/bin/env python3 # -# genfacet.py import json5 import argparse @@ -54,6 +53,7 @@ def format_args_routing(args): def main(): parser = argparse.ArgumentParser() + parser.add_argument('--templates', required=True, help='.j2 template directory') parser.add_argument('--input', required=True, help='input IDL JSON5 file') parser.add_argument('--output-impl-hpp', required=True, help='.hpp detail subdir') parser.add_argument('--output-hpp', required=True, help='.hpp output directory') @@ -75,7 +75,8 @@ def main(): output_cpp_dir.mkdir(parents=False, exist_ok=True) # setup jinja2 - template_dir = Path(__file__).parent + template_dir = Path(args.templates) + #template_dir = Path(__file__).parent #template_dir = Path(__file__).parent / 'codegen' print(f'template_dir: [{template_dir}]') diff --git a/codegen/iface_facet_any.cpp.j2 b/codegen/iface_facet_any.cpp.j2 index 2f11e38..603686c 100644 --- a/codegen/iface_facet_any.cpp.j2 +++ b/codegen/iface_facet_any.cpp.j2 @@ -2,7 +2,7 @@ * **/ -#include "{{iface_facet_any_hpp_fname}}" +#include "{{impl_hpp_subdir}}/{{iface_facet_any_hpp_fname}}" #include namespace {{facet_ns1}} {