mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
build-all.py - accomodate pyodide build system automatically
as it's the main way to build the wasm package
This commit is contained in:
+9
-12
@@ -269,9 +269,11 @@ if platform.system() == "Darwin":
|
||||
|
||||
IFCOS_NUM_BUILD_PROCS = os.getenv("IFCOS_NUM_BUILD_PROCS", multiprocessing.cpu_count() + 1)
|
||||
|
||||
CMAKE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "cmake"))
|
||||
SCRIPT_PATH = Path(__file__).parent
|
||||
REPO_PATH = SCRIPT_PATH.parent
|
||||
CMAKE_DIR = (REPO_PATH / "cmake").resolve().__str__()
|
||||
|
||||
build_dir = os.environ.get("BUILD_DIR", os.path.join(os.path.dirname(__file__), "..", "build"))
|
||||
build_dir = os.environ.get("BUILD_DIR", (REPO_PATH / "build").__str__())
|
||||
|
||||
|
||||
if WASM:
|
||||
@@ -716,7 +718,7 @@ def build_dependency(
|
||||
if isinstance(patch, str):
|
||||
patch = [patch]
|
||||
for p in patch:
|
||||
patch_abs = os.path.abspath(os.path.join(os.path.dirname(__file__), p))
|
||||
patch_abs = (SCRIPT_PATH / p).absolute().__str__()
|
||||
if os.path.exists(patch_abs):
|
||||
try:
|
||||
run(["patch", "-p1", "--batch", "--forward", "-i", patch_abs], cwd=extract_dir)
|
||||
@@ -1504,15 +1506,8 @@ if "IfcOpenShell-Python" in targets:
|
||||
+ get_cmake_args_prefix_path(prefix_paths)
|
||||
+ [
|
||||
*([f"-DPYTHON_EXECUTABLE={python_executable}"] if python_executable else []),
|
||||
# *([f"-DPYTHON_MODULE_INSTALL_DIR={os.environ['PYTHONPATH']}/ifcopenshell"] if "wasm" in flags else []),
|
||||
*(
|
||||
[
|
||||
"-DPYTHON_MODULE_INSTALL_DIR="
|
||||
+ os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "package"))
|
||||
]
|
||||
if "wasm" in flags
|
||||
else []
|
||||
),
|
||||
# Needed because pyodide is expecting setup.py to be in the root.
|
||||
*([f"-DPYTHON_MODULE_INSTALL_DIR={REPO_PATH}"] * WASM),
|
||||
f"-DPYTHON_LIBRARY={python_library}",
|
||||
f"-DPYTHON_INCLUDE_DIR={python_include}",
|
||||
f"-DCMAKE_INSTALL_PREFIX={DEPS_DIR}/install/ifcopenshell/tmp",
|
||||
@@ -1557,6 +1552,8 @@ if "IfcOpenShell-Python" in targets:
|
||||
os.environ["PYTHONINCLUDE"],
|
||||
None,
|
||||
)
|
||||
# Copy setup.py where pyodide build system expects it.
|
||||
shutil.copy(REPO_PATH / "pyodide" / "setup.py", REPO_PATH)
|
||||
|
||||
elif USE_CURRENT_PYTHON_VERSION:
|
||||
python_info = sysconfig.get_paths()
|
||||
|
||||
+1
-2
@@ -13,7 +13,7 @@ There are two ways to build pyodide ifcopenshell Python wrapper wheel.
|
||||
- build ifcopenshell and its dependencies
|
||||
- note that rerunning `pyodide build-recipes` will remove previous build folder and rebuild all dependencies.
|
||||
The way to avoid it, if build fails, is to use `pyodide build-recipes-no-deps ifcopenshell --continue` instead.
|
||||
- run `pyodide/setup.py` in `IfcOpenShell` root, producing a wheel in `IfcOpenShell/dist`
|
||||
- run `setup.py` in `IfcOpenShell` root, producing a wheel in `IfcOpenShell/dist`
|
||||
- copy that wheel to `packages/ifcopenshell/dist`
|
||||
- `--install` it to current build envrionment
|
||||
- copy the wheel next to `dist` folder (in root directory, next to `packages`)
|
||||
@@ -29,6 +29,5 @@ since it's pure cmake without any additional moving parts.
|
||||
- setup debug build environment using `source pyodide/debug_build_env.sh /path/to/pyodide_root`
|
||||
- run `python nix/build-all.py -wasm -py-313` in `IfcOpenShell`
|
||||
- it will produce Python package in `IfcOpenShell/ifcopenshell`
|
||||
- move `IfcOpenShell/pyodide/setup.py` to `IfcOpenShell` root
|
||||
- run `pyodide build`
|
||||
- it will produce a wheel in `IfcOpenShell/dist`
|
||||
|
||||
@@ -9,8 +9,6 @@ source:
|
||||
build:
|
||||
script: |
|
||||
BUILD_CFG=Release python nix/build-all.py -v --wasm --py313
|
||||
mv package/ifcopenshell .
|
||||
cp pyodide/setup.py .
|
||||
|
||||
about:
|
||||
home: http://ifcopenshell.org
|
||||
|
||||
Reference in New Issue
Block a user