Python CLI tool to print cmake configuration directory

This commit is contained in:
Matthias Hochsteger 2023-09-04 14:36:06 +02:00
parent 125c21b200
commit bcab484095
3 changed files with 20 additions and 1 deletions

View File

@ -10,7 +10,7 @@ configure_file(version_template.py ${CMAKE_CURRENT_BINARY_DIR}/version.py @ONLY)
install(FILES install(FILES
${CMAKE_CURRENT_BINARY_DIR}/config.py ${CMAKE_CURRENT_BINARY_DIR}/config.py
${CMAKE_CURRENT_BINARY_DIR}/version.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 meshing.py csg.py geom2d.py stl.py gui.py NgOCC.py occ.py
read_gmsh.py read_meshio.py read_gmsh.py read_meshio.py
webgui.py webgui.py

10
python/config_cli.py Normal file
View File

@ -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())

View File

@ -57,3 +57,12 @@ PYTHON_VERSION_MAJOR = "@Python3_VERSION_MAJOR@"
PYTHON_VERSION_MINOR = "@Python3_VERSION_MINOR@" PYTHON_VERSION_MINOR = "@Python3_VERSION_MINOR@"
version = NETGEN_VERSION_GIT 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))