From d2378d978153414571098608eb61ac5b6d6d7375 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Mon, 7 Feb 2022 19:04:26 +0100 Subject: [PATCH] pyngcore as package (staying backward compatible) --- libsrc/core/CMakeLists.txt | 2 +- python/CMakeLists.txt | 6 ++++++ python/pyngcore/__init__.py | 1 + setup.py | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 python/pyngcore/__init__.py diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index 802f9663..0f6706d2 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -87,6 +87,6 @@ if(USE_PYTHON) pybind11_add_module(pyngcore SHARED python_ngcore_export.cpp) target_link_libraries(pyngcore PUBLIC ngcore netgen_python) set_target_properties(pyngcore PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/${NETGEN_PYTHON_RPATH}") - install(TARGETS pyngcore DESTINATION ${NG_INSTALL_DIR_PYTHON} COMPONENT netgen) + install(TARGETS pyngcore DESTINATION ${NG_INSTALL_DIR_PYTHON}/pyngcore COMPONENT netgen) endif(USE_PYTHON) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index c6c5279f..b4f46866 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -18,6 +18,12 @@ install(FILES COMPONENT netgen ) +install(FILES + pyngcore/__init__.py + DESTINATION ${NG_INSTALL_DIR_PYTHON}/pyngcore + COMPONENT netgen + ) + # build stub files for pybind11 packages if(BUILD_STUB_FILES) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pybind11_stubgen; print(pybind11_stubgen.__file__)" OUTPUT_VARIABLE stubgen_path RESULT_VARIABLE pybind11_stubgen) diff --git a/python/pyngcore/__init__.py b/python/pyngcore/__init__.py new file mode 100644 index 00000000..29580174 --- /dev/null +++ b/python/pyngcore/__init__.py @@ -0,0 +1 @@ +from .pyngcore import * diff --git a/setup.py b/setup.py index a1edc903..a8a98000 100644 --- a/setup.py +++ b/setup.py @@ -73,6 +73,8 @@ elif 'linux' in sys.platform: ] packages = [] +packages.append("pyngcore") + cmake_args += [ '-DUSE_SUPERBUILD:BOOL=ON', '-DUSE_CCACHE:BOOL=ON',