diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index ce71d204..9223cc1c 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -10,7 +10,7 @@ configure_file(version_template.py ${CMAKE_CURRENT_BINARY_DIR}/version.py @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.py ${CMAKE_CURRENT_BINARY_DIR}/version.py - __main__.py __init__.py + __main__.py __init__.py config_cli.py meshing.py csg.py geom2d.py stl.py gui.py NgOCC.py occ.py read_gmsh.py read_meshio.py webgui.py diff --git a/python/config_cli.py b/python/config_cli.py new file mode 100644 index 00000000..572f9750 --- /dev/null +++ b/python/config_cli.py @@ -0,0 +1,10 @@ +import netgen.config + +if __name__=="__main__": + import argparse + parser = argparse.ArgumentParser() + parser.add_argument("--cmake-dir", help="print path to CMake config files", action='store_true') + args = parser.parse_args() + if(args.cmake_dir): + print(netgen.config.get_cmake_dir()) + diff --git a/python/config_template.py b/python/config_template.py index c4232dff..ba1dd6e1 100644 --- a/python/config_template.py +++ b/python/config_template.py @@ -57,3 +57,12 @@ PYTHON_VERSION_MAJOR = "@Python3_VERSION_MAJOR@" PYTHON_VERSION_MINOR = "@Python3_VERSION_MINOR@" version = NETGEN_VERSION_GIT + +def get_cmake_dir(): + import os.path as p + d_python = p.dirname(p.dirname(__file__)) + py_to_cmake = p.relpath( + NG_INSTALL_DIR_CMAKE, + NG_INSTALL_DIR_PYTHON + ) + return p.normpath(p.join(d_python,py_to_cmake))