Skip to content

Commit f0d68c4

Browse files
committed
🏂 Python pkg.
1 parent b7d0d71 commit f0d68c4

File tree

7 files changed

+41
-23
lines changed

7 files changed

+41
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ wheelhouse/*
4040
examples/python-examples/*.stl
4141
examples/python-examples/*.obj
4242
examples/python-examples/*.ply
43+
examples/python-examples/*.ctm
4344
/source/MeshSDKC2/include
4445
/source/MeshSDKC2/src
4546
/source/MeshSDKC2/temp

README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,27 @@ Build mrbind from source code:
209209
# At project's root dir
210210
sudo ./scripts/mrbind/install_deps_ubuntu.sh
211211
./scripts/mrbind/install_mrbind_ubuntu.sh
212+
213+
214+
make -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1
215+
# PYTHON_VERSIONS=$(cat scripts/mrbind-pybind11/python_versions.txt | xargs)
216+
make -f scripts/mrbind/generate.mk -B --trace PYTHON_VERSIONS=3.11
217+
make -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1 PYTHON_VERSIONS=3.11
218+
make shims -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1 PYTHON_VERSIONS=3.11
219+
220+
221+
# Create and fix wheel
222+
python -m pip install patchelf
223+
# This will generate the `meshsdk` wheel to `./scripts/wheel/meshsdk`
224+
python ./scripts/wheel/build_wheel.py --version 'v0.0.1'
225+
# Install the built `meshsdk`
226+
cd ./scripts/wheel/meshsdk
227+
pip install .
228+
# Check the installed `meshsdk`
229+
pip list | grep meshsdk
212230
```
213231

214-
Run the generator on different platforms:
232+
> Run the generator on different platforms
215233
216234
* **On Windows:** `scripts\mrbind\generate_win.bat -B --trace` from the VS developer command prompt (use the `x64 Native` one!).
217235

@@ -225,22 +243,21 @@ Run the generator on different platforms:
225243

226244
* **On MacOS:** Same as on Linux, but before running the command you must adjust the PATH. On Arm Macs: `export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"`, and on x86 Macs `/usr/local/...` instead of `/opt/homebrew/...`. This adds the version of Make installed in Homebrew to PATH, because the default one is outdated. Confirm the version with `make --version`, it must be 4.x or newer.
227245

228-
Create Wheel:
246+
#### Some common flags:
229247

230-
```sh
231-
# This will generate the `meshsdk` wheel to `./scripts/wheel/meshsdk`
232-
python ./scripts/wheel/build_wheel.py --version 'v0.0.1'
233-
```
248+
* **`--trace` — enable verbose logs.**
234249

235-
Install the built `meshsdk`:
250+
* **`-B` — force a full rebuild of the bindings.** Incremental builds are not very useful, because they're not perfect and can miss changes. Use incremental builds e.g. when you're fixing linker errors.
236251

237-
```sh
238-
cd ./scripts/wheel/meshsdk
239-
pip install .
252+
The remaining flags are for Python bindings only:
240253

241-
# Check the installed `meshsdk`
242-
pip list | grep meshsdk
243-
```
254+
* **`MODE=none` — disable optimization** for faster build times. The default is `MODE=release`. To enable debug symbols, use `MODE=debug`. To set completely custom compiler flags, set `EXTRA_CFLAGS` and `EXTRA_LDFLAGS`.
255+
256+
* **`NUM_FRAGMENTS=?? -j??` — adjust RAM usage vs build speed tradeoff.** `NUM_FRAGMENTS=??` is how many translation units the bindings are split into. `-j??` is the number of parallel build threads/processes. `NUM_FRAGMENTS=64 -j8` is the default, good for 16 GB of RAM.
257+
258+
Guessing the fastest combination isn't trivial. Usually less fragments and more threads lead to faster builds but more RAM usage, but not always; turns out `NUM_FRAGMENTS=1` isn't optimal even if you have enough RAM for it.
259+
260+
* **`PYTHON_PKGCONF_NAME=python-3.??-embed` — select Python version.** We try to guess this one. You can set this to `python3-embed` to use whatever the OS considers to be the default version.
244261

245262

246263
### Installation

scripts/mrbind/README-generating.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Create and fix Wheel:
112112
113113
```sh
114114
# This will generate the `meshsdk` wheel to `./scripts/wheel/meshsdk`
115-
python ./scripts/wheel/build_wheel.py --version 'v0.0.0.1'
115+
python ./scripts/wheel/build_wheel.py --version 'v0.0.1'
116116
```
117117
118118
Install the built `meshsdk`:

scripts/wheel/build_wheel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def setup_workspace(version, modules, plat_name):
5151

5252
create_stubs.setup_workspace(modules, False)
5353

54-
print("Copying LICENSE and readme.md")
54+
print("Copying LICENSE and README.md")
5555
shutil.copy(SOURCE_DIR / "LICENSE", WHEEL_ROOT_DIR)
56-
shutil.copy(SOURCE_DIR / "readme.md", WHEEL_ROOT_DIR)
56+
shutil.copy(SOURCE_DIR / "README.md", WHEEL_ROOT_DIR)
5757

5858
print("Copying resource files...")
5959
shutil.copy(SOURCE_DIR / "source" / "MRViewer" / "MRDarkTheme.json", WHEEL_SRC_DIR)

scripts/wheel/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "meshsdk"
7-
description = "3d processing library"
7+
description = "3D processing library"
88
authors = [
9-
{ name = "MeshSDK Team", email = "support@meshinspector.com" },
9+
{ name = "alpinebuster", email = "imzqqq@hotmail.com" },
1010
]
11-
readme = "readme.md"
11+
readme = "README.md"
1212
license = { file = "LICENSE" }
1313
classifiers = [
1414
"Programming Language :: Python :: 3.8",

scripts/wheel/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
]
3535

3636
here = pathlib.Path(__file__).parent.resolve()
37-
# Get the long description from the readme file
38-
long_description = (here / "readme.md").read_text(encoding="utf-8")
37+
# Get the long description from the README file
38+
long_description = (here / "README.md").read_text(encoding="utf-8")
3939

4040
setuptools.setup(
4141
name="meshsdk",

scripts/wheel/setup_workspace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def prepare_workspace():
2222
shutil.rmtree(WHEEL_ROOT_DIR)
2323

2424
os.makedirs(WHEEL_SRC_DIR, exist_ok=True)
25-
print("Copying LICENSE and readme.md")
25+
print("Copying LICENSE and README.md")
2626
shutil.copy("LICENSE", WHEEL_ROOT_DIR)
27-
shutil.copy("readme.md", WHEEL_ROOT_DIR)
27+
shutil.copy("README.md", WHEEL_ROOT_DIR)
2828
# create empty file
2929
open(os.path.join(WHEEL_SRC_DIR, "__init__.py"), "w").close()
3030

0 commit comments

Comments
 (0)