feat(initial): added portable mfem build system
This commit is contained in:
46
python/meson_mfem_template/__init__.py
Normal file
46
python/meson_mfem_template/__init__.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _native_search_paths() -> list[Path]:
|
||||
package = Path(__file__).resolve().parent
|
||||
return [package / "lib", package / "lib64", package / "bin"]
|
||||
|
||||
|
||||
_dll_directory_handles = []
|
||||
if os.name == "nt" and hasattr(os, "add_dll_directory"):
|
||||
for _directory in _native_search_paths():
|
||||
if _directory.is_dir():
|
||||
_dll_directory_handles.append(os.add_dll_directory(str(_directory)))
|
||||
|
||||
from ._core import capabilities, mfem_version, serial_poisson_dofs
|
||||
|
||||
__all__ = [
|
||||
"capabilities",
|
||||
"get_cmake_prefix",
|
||||
"get_include",
|
||||
"get_lib",
|
||||
"mfem_version",
|
||||
"serial_poisson_dofs",
|
||||
]
|
||||
|
||||
|
||||
def _package_dir() -> Path:
|
||||
return Path(__file__).resolve().parent
|
||||
|
||||
|
||||
def get_include() -> str:
|
||||
"""Return the wheel-local include directory containing MFEM headers."""
|
||||
return str(_package_dir() / "include")
|
||||
|
||||
|
||||
def get_lib() -> str:
|
||||
"""Return the wheel-local directory containing MFEM runtime libraries."""
|
||||
return str(_package_dir() / "lib")
|
||||
|
||||
|
||||
def get_cmake_prefix() -> str:
|
||||
"""Return the prefix that can be appended to CMAKE_PREFIX_PATH."""
|
||||
return str(_package_dir())
|
||||
4
python/meson_mfem_template/_core.pyi
Normal file
4
python/meson_mfem_template/_core.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
def mfem_version() -> str: ...
|
||||
def capabilities() -> dict[str, bool]: ...
|
||||
def serial_poisson_dofs(cells: int = 4, order: int = 2) -> int: ...
|
||||
|
||||
1
python/meson_mfem_template/py.typed
Normal file
1
python/meson_mfem_template/py.typed
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user