maya-py 0.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. maya_py-0.1.5/.github/workflows/wheels.yml +120 -0
  2. maya_py-0.1.5/.gitignore +9 -0
  3. maya_py-0.1.5/CMakeLists.txt +238 -0
  4. maya_py-0.1.5/PKG-INFO +611 -0
  5. maya_py-0.1.5/README.md +579 -0
  6. maya_py-0.1.5/docs/api-reference.md +249 -0
  7. maya_py-0.1.5/docs/apps.md +343 -0
  8. maya_py-0.1.5/docs/distribution.md +119 -0
  9. maya_py-0.1.5/docs/getting-started.md +180 -0
  10. maya_py-0.1.5/docs/index.md +85 -0
  11. maya_py-0.1.5/docs/layout.md +180 -0
  12. maya_py-0.1.5/docs/low-level.md +224 -0
  13. maya_py-0.1.5/docs/performance.md +146 -0
  14. maya_py-0.1.5/docs/program.md +184 -0
  15. maya_py-0.1.5/docs/rendering.md +154 -0
  16. maya_py-0.1.5/docs/text-and-style.md +141 -0
  17. maya_py-0.1.5/docs/widgets.md +332 -0
  18. maya_py-0.1.5/examples/_halfblock.py +51 -0
  19. maya_py-0.1.5/examples/agent.py +169 -0
  20. maya_py-0.1.5/examples/agent_session.py +174 -0
  21. maya_py-0.1.5/examples/bench.py +290 -0
  22. maya_py-0.1.5/examples/bench_live.py +122 -0
  23. maya_py-0.1.5/examples/boids.py +340 -0
  24. maya_py-0.1.5/examples/breakout.py +250 -0
  25. maya_py-0.1.5/examples/canvas.py +96 -0
  26. maya_py-0.1.5/examples/chat.py +133 -0
  27. maya_py-0.1.5/examples/clock.py +174 -0
  28. maya_py-0.1.5/examples/counter.py +40 -0
  29. maya_py-0.1.5/examples/counter_program.py +65 -0
  30. maya_py-0.1.5/examples/dashboard.py +79 -0
  31. maya_py-0.1.5/examples/deploy.py +148 -0
  32. maya_py-0.1.5/examples/doom_fire.py +161 -0
  33. maya_py-0.1.5/examples/fluid.py +134 -0
  34. maya_py-0.1.5/examples/fps.py +183 -0
  35. maya_py-0.1.5/examples/gravity.py +403 -0
  36. maya_py-0.1.5/examples/hacker.py +125 -0
  37. maya_py-0.1.5/examples/hello.py +16 -0
  38. maya_py-0.1.5/examples/ide.py +229 -0
  39. maya_py-0.1.5/examples/inline_progress.py +71 -0
  40. maya_py-0.1.5/examples/life.py +196 -0
  41. maya_py-0.1.5/examples/live_spinner.py +37 -0
  42. maya_py-0.1.5/examples/mandelbrot.py +74 -0
  43. maya_py-0.1.5/examples/markup.py +96 -0
  44. maya_py-0.1.5/examples/matrix.py +164 -0
  45. maya_py-0.1.5/examples/maze.py +432 -0
  46. maya_py-0.1.5/examples/messenger.py +160 -0
  47. maya_py-0.1.5/examples/music.py +152 -0
  48. maya_py-0.1.5/examples/paint.py +119 -0
  49. maya_py-0.1.5/examples/particles.py +130 -0
  50. maya_py-0.1.5/examples/raymarch.py +157 -0
  51. maya_py-0.1.5/examples/scroll.py +130 -0
  52. maya_py-0.1.5/examples/scroll_2d.py +70 -0
  53. maya_py-0.1.5/examples/scroll_clip.py +64 -0
  54. maya_py-0.1.5/examples/scroll_slice.py +92 -0
  55. maya_py-0.1.5/examples/scroll_styles.py +68 -0
  56. maya_py-0.1.5/examples/smoke_all.py +59 -0
  57. maya_py-0.1.5/examples/snake.py +137 -0
  58. maya_py-0.1.5/examples/sorts.py +201 -0
  59. maya_py-0.1.5/examples/space.py +105 -0
  60. maya_py-0.1.5/examples/space3d.py +160 -0
  61. maya_py-0.1.5/examples/spectrum.py +117 -0
  62. maya_py-0.1.5/examples/stocks.py +110 -0
  63. maya_py-0.1.5/examples/stopwatch.py +91 -0
  64. maya_py-0.1.5/examples/sysmon.py +119 -0
  65. maya_py-0.1.5/examples/todo.py +57 -0
  66. maya_py-0.1.5/examples/widgets.py +119 -0
  67. maya_py-0.1.5/examples/widgets_gallery.py +142 -0
  68. maya_py-0.1.5/pyproject.toml +115 -0
  69. maya_py-0.1.5/scripts/cibw_before_all.sh +56 -0
  70. maya_py-0.1.5/scripts/golden_snapshot.py +64 -0
  71. maya_py-0.1.5/src/_maya.cpp +799 -0
  72. maya_py-0.1.5/src/_program.cpp +483 -0
  73. maya_py-0.1.5/src/_pyevent.hpp +14 -0
  74. maya_py-0.1.5/src/_widgets.cpp +957 -0
  75. maya_py-0.1.5/src/maya_py/__init__.py +267 -0
  76. maya_py-0.1.5/src/maya_py/easy.py +894 -0
  77. maya_py-0.1.5/src/maya_py/program.py +148 -0
  78. maya_py-0.1.5/src/maya_py/widgets.py +640 -0
  79. maya_py-0.1.5/tests/test_basic.py +58 -0
  80. maya_py-0.1.5/tests/test_easy.py +183 -0
  81. maya_py-0.1.5/tests/test_mouse.py +211 -0
  82. maya_py-0.1.5/tests/test_power.py +168 -0
  83. maya_py-0.1.5/tests/test_program.py +121 -0
  84. maya_py-0.1.5/tests/test_program_pty.py +84 -0
  85. maya_py-0.1.5/tests/test_robustness.py +353 -0
  86. maya_py-0.1.5/tests/test_scroll.py +224 -0
  87. maya_py-0.1.5/tests/test_widgets.py +301 -0
@@ -0,0 +1,120 @@
1
+ name: wheels
2
+
3
+ # Build STANDALONE binary wheels (no compiler needed to install them).
4
+ # Runs on tags (vX.Y.Z) and on manual dispatch. Artifacts are uploaded and,
5
+ # on a tagged release, attached to the GitHub Release.
6
+
7
+ on:
8
+ push:
9
+ tags: ["v*"]
10
+ workflow_dispatch:
11
+ pull_request:
12
+ paths: ["CMakeLists.txt", "pyproject.toml", "scripts/**", ".github/workflows/wheels.yml"]
13
+
14
+ jobs:
15
+ build_wheels:
16
+ name: wheels on ${{ matrix.os }}
17
+ runs-on: ${{ matrix.os }}
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ # Reliable, fast-scheduling runners that GATE the PyPI publish:
22
+ # Linux (manylinux), macOS arm64 (macos-14, Apple Silicon), Windows
23
+ # x64. Per-OS build details live in pyproject.toml's
24
+ # [tool.cibuildwheel.*] tables; the env below is Linux-scoped.
25
+ os: [ubuntu-latest, macos-14, windows-2022]
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ with:
29
+ submodules: recursive
30
+
31
+ - name: Build wheels
32
+ uses: pypa/cibuildwheel@v3.1
33
+ env:
34
+ # maya uses C++23 features (views::enumerate, std::expected,
35
+ # std::format, deducing-this) — all present in GCC 14. The
36
+ # manylinux_2_28 image ships gcc-toolset-14, so use it directly
37
+ # (fast, reliable) instead of building a newer GCC from source.
38
+ # before_all symlinks the toolset's gcc/g++ into /usr/local/bin.
39
+ CIBW_ENVIRONMENT_LINUX: "MAYA_PY_GCC_BUILD=0 CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++"
40
+ # CPython 3.9 → 3.14 (cibuildwheel 3.x builds cp314 by default).
41
+ CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
42
+
43
+ - uses: actions/upload-artifact@v4
44
+ with:
45
+ name: wheels-${{ matrix.os }}
46
+ path: ./wheelhouse/*.whl
47
+
48
+ # Intel-mac (x86_64) wheels. The GitHub macos-13 runner pool is scarce and
49
+ # can queue 30-60+ min, so this is a SEPARATE, NON-BLOCKING job: the PyPI
50
+ # publish does NOT wait on it (see publish_pypi `needs`). When it does
51
+ # finish its wheels attach to the GitHub Release; Intel-mac users otherwise
52
+ # build from source (CMakeLists auto-picks Homebrew GCC). `|| true` keeps a
53
+ # runner-queue timeout from failing the overall run.
54
+ build_wheels_macos_intel:
55
+ name: wheels on macos-13 (intel, non-blocking)
56
+ runs-on: macos-13
57
+ continue-on-error: true
58
+ steps:
59
+ - uses: actions/checkout@v4
60
+ with:
61
+ submodules: recursive
62
+ - name: Build wheels
63
+ uses: pypa/cibuildwheel@v3.1
64
+ env:
65
+ CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
66
+ - uses: actions/upload-artifact@v4
67
+ with:
68
+ name: wheels-macos-13
69
+ path: ./wheelhouse/*.whl
70
+
71
+ build_sdist:
72
+ name: source distribution
73
+ runs-on: ubuntu-latest
74
+ steps:
75
+ - uses: actions/checkout@v4
76
+ - name: Build sdist
77
+ run: pipx run build --sdist
78
+ - uses: actions/upload-artifact@v4
79
+ with:
80
+ name: sdist
81
+ path: dist/*.tar.gz
82
+
83
+ release:
84
+ name: attach to release
85
+ needs: [build_wheels, build_sdist]
86
+ runs-on: ubuntu-latest
87
+ if: startsWith(github.ref, 'refs/tags/')
88
+ permissions:
89
+ contents: write # needed to create the GitHub Release + upload assets
90
+ steps:
91
+ - uses: actions/download-artifact@v4
92
+ with:
93
+ path: dist
94
+ merge-multiple: true
95
+ - uses: softprops/action-gh-release@v2
96
+ with:
97
+ files: dist/*
98
+
99
+ publish_pypi:
100
+ name: publish to PyPI
101
+ needs: [build_wheels, build_sdist]
102
+ runs-on: ubuntu-latest
103
+ if: startsWith(github.ref, 'refs/tags/')
104
+ environment:
105
+ name: pypi
106
+ url: https://pypi.org/project/maya-py/
107
+ permissions:
108
+ id-token: write # OIDC token for PyPI Trusted Publishing (no secret)
109
+ steps:
110
+ - uses: actions/download-artifact@v4
111
+ with:
112
+ path: dist
113
+ merge-multiple: true
114
+ - name: Publish to PyPI
115
+ uses: pypa/gh-action-pypi-publish@release/v1
116
+ with:
117
+ packages-dir: dist
118
+ # Don't fail the whole release if a re-run hits an already-uploaded
119
+ # file (e.g. re-tagging the same version).
120
+ skip-existing: true
@@ -0,0 +1,9 @@
1
+ build/
2
+ dist/
3
+ *.egg-info/
4
+ __pycache__/
5
+ *.so
6
+ *.pyc
7
+ .pytest_cache/
8
+ _deps/
9
+ maya-src/
@@ -0,0 +1,238 @@
1
+ cmake_minimum_required(VERSION 3.28)
2
+
3
+ # macOS deployment floor — must be set BEFORE project() so the compiler probe
4
+ # and every target inherit it. 11.0 is the oldest arm64-capable release and
5
+ # is fine for x86_64 too. cibuildwheel / the caller can override via the
6
+ # MACOSX_DEPLOYMENT_TARGET env var or -DCMAKE_OSX_DEPLOYMENT_TARGET.
7
+ if(APPLE AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
8
+ if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
9
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}"
10
+ CACHE STRING "Minimum macOS version")
11
+ else()
12
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum macOS version")
13
+ endif()
14
+ endif()
15
+
16
+ # ── macOS: prefer real GNU GCC over AppleClang ───────────────────────
17
+ # maya is C++26. AppleClang lags upstream LLVM and (depending on the Xcode
18
+ # version) misses C++26 / late-C++23 library bits maya leans on, so on macOS
19
+ # we build with Homebrew GCC instead. This MUST run before project() so the
20
+ # compiler-id probe picks GCC.
21
+ #
22
+ # We only auto-pick when the user hasn't already chosen a compiler — an
23
+ # explicit -DCMAKE_CXX_COMPILER=..., a CXX env var, or a cached entry always
24
+ # wins (escape hatch for someone who really wants Clang).
25
+ if(APPLE
26
+ AND NOT DEFINED CMAKE_CXX_COMPILER
27
+ AND NOT DEFINED ENV{CXX}
28
+ AND NOT DEFINED CACHE{CMAKE_CXX_COMPILER})
29
+ # Newest first. Homebrew installs versioned binaries (g++-15, g++-14, ...);
30
+ # plain `g++` on macOS is an AppleClang shim, so we do NOT trust it here.
31
+ find_program(_maya_brew_gxx
32
+ NAMES g++-15 g++-14 g++-13
33
+ HINTS /opt/homebrew/bin /usr/local/bin)
34
+ if(_maya_brew_gxx)
35
+ set(CMAKE_CXX_COMPILER "${_maya_brew_gxx}" CACHE FILEPATH
36
+ "C++ compiler (Homebrew GCC, auto-selected on macOS)")
37
+ message(STATUS "maya_py: macOS — using GNU GCC at ${_maya_brew_gxx}")
38
+ else()
39
+ message(WARNING
40
+ "maya_py: no Homebrew GCC (g++-15/14/13) found on PATH — falling "
41
+ "back to the default toolchain. maya needs C++26; if the build "
42
+ "fails, install GCC with `brew install gcc` (or pass "
43
+ "-DCMAKE_CXX_COMPILER=/opt/homebrew/bin/g++-15).")
44
+ endif()
45
+ endif()
46
+
47
+ project(maya_py LANGUAGES CXX)
48
+
49
+ set(CMAKE_CXX_STANDARD 26)
50
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
51
+
52
+ # ── Compiler preflight ───────────────────────────────────────────────
53
+ # maya compiles at C++26 but the features it actually uses (views::enumerate,
54
+ # std::expected, std::format, deducing-this) all landed in GCC 14 / Clang 18.
55
+ # If we got here we're COMPILING FROM SOURCE — no prebuilt wheel matched this
56
+ # platform. On an old toolchain the compile fails deep inside maya with
57
+ # inscrutable template errors, so fail FAST with an actionable message.
58
+ #
59
+ # The intended install path on old machines is a PREBUILT WHEEL (no compiler
60
+ # needed at all). If you're seeing this, a wheel for your Python/platform
61
+ # wasn't available and pip fell back to building the source distribution.
62
+ set(_maya_min_gcc 14)
63
+ set(_maya_ok TRUE)
64
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
65
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_maya_min_gcc})
66
+ set(_maya_ok FALSE)
67
+ endif()
68
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
69
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
70
+ # AppleClang is NOT supported: it lags upstream LLVM and misses the
71
+ # C++26 / late-C++23 library bits maya leans on, so it fails deep in
72
+ # maya's templates. On macOS the build auto-selects Homebrew GCC
73
+ # (see the pre-project() block); if we still ended up on AppleClang
74
+ # it's because no Homebrew GCC was found — reject it here with the
75
+ # actionable `brew install gcc` hint rather than crash mid-compile.
76
+ set(_maya_ok FALSE)
77
+ elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
78
+ # Plain upstream LLVM/Clang >= 18 is fine.
79
+ set(_maya_ok FALSE)
80
+ endif()
81
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
82
+ # maya's C++23 feature set needs VS 2022 17.10+ (cl 19.40). Earlier
83
+ # toolsets miss std::expected / deducing-this and fail deep in maya.
84
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.40)
85
+ set(_maya_ok FALSE)
86
+ endif()
87
+ endif()
88
+
89
+ if(NOT _maya_ok)
90
+ if(WIN32)
91
+ set(_maya_toolchain_hint
92
+ " 3. If you truly must build from source, install Visual Studio\n"
93
+ " 2022 17.10+ (the \"Desktop development with C++\" workload)\n"
94
+ " so cl.exe is >= 19.40, then re-run pip install .\n")
95
+ elseif(APPLE)
96
+ set(_maya_toolchain_hint
97
+ " 3. If you truly must build from source, install GNU GCC — maya\n"
98
+ " is C++26 and is built with GCC on macOS, not AppleClang:\n"
99
+ " brew install gcc # provides g++-15 / g++-14\n"
100
+ " # the build auto-picks Homebrew g++; or force it with\n"
101
+ " # pip install . -C cmake.define.CMAKE_CXX_COMPILER=$(brew --prefix)/bin/g++-15\n")
102
+ else()
103
+ set(_maya_toolchain_hint
104
+ " 3. If you truly must build from source, install a modern GCC:\n"
105
+ " # Ubuntu: sudo apt install g++-14\n"
106
+ " # then: pip install . -C cmake.define.CMAKE_CXX_COMPILER=g++-14\n")
107
+ endif()
108
+ message(FATAL_ERROR
109
+ "\n"
110
+ "==============================================================\n"
111
+ " maya-py: your C++ compiler is too old to BUILD from source.\n"
112
+ "\n"
113
+ " found: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}\n"
114
+ " required: GCC >= ${_maya_min_gcc}, Clang >= 18, or\n"
115
+ " MSVC >= 19.40 (VS 2022 17.10). AppleClang is NOT\n"
116
+ " supported — on macOS build with Homebrew GCC.\n"
117
+ "\n"
118
+ " You should NOT need to compile maya-py at all — it ships\n"
119
+ " PRECOMPILED standalone wheels that install with no compiler.\n"
120
+ " pip only reached this point because no wheel matched your\n"
121
+ " Python version / platform.\n"
122
+ "\n"
123
+ " Fixes, easiest first:\n"
124
+ " 1. Upgrade pip so it can find more wheels:\n"
125
+ " python -m pip install --upgrade pip\n"
126
+ " 2. Install the prebuilt wheel directly from a GitHub release:\n"
127
+ " pip install <url-to-the-.whl-for-your-platform>\n"
128
+ ${_maya_toolchain_hint}
129
+ "==============================================================\n")
130
+ endif()
131
+
132
+ # maya needs -march=native OFF for a portable extension; it also force-enables
133
+ # IPO which we don't want fighting pybind11. Keep the build lean.
134
+ set(MAYA_NATIVE_TUNING OFF CACHE BOOL "" FORCE)
135
+ set(MAYA_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
136
+ set(MAYA_BUILD_TESTS OFF CACHE BOOL "" FORCE)
137
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "" FORCE)
138
+
139
+ include(FetchContent)
140
+
141
+ # ── maya ──────────────────────────────────────────────────────────────────
142
+ # Prefer a sibling checkout if present (offline / hacking), else clone.
143
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../maya-src/CMakeLists.txt")
144
+ message(STATUS "maya_py: using local maya at ../maya-src")
145
+ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../maya-src" maya_build)
146
+ else()
147
+ FetchContent_Declare(maya
148
+ GIT_REPOSITORY https://github.com/1ay1/maya.git
149
+ GIT_TAG master)
150
+ FetchContent_MakeAvailable(maya)
151
+ endif()
152
+
153
+ # ── pybind11 ──────────────────────────────────────────────────────────────
154
+ find_package(pybind11 CONFIG QUIET)
155
+ if(NOT pybind11_FOUND)
156
+ FetchContent_Declare(pybind11
157
+ GIT_REPOSITORY https://github.com/pybind/pybind11.git
158
+ GIT_TAG v2.13.6)
159
+ FetchContent_MakeAvailable(pybind11)
160
+ endif()
161
+
162
+ # When pulled in via add_subdirectory / FetchContent the target is plain
163
+ # `maya` (the maya:: namespace only exists on the installed export).
164
+ if(NOT TARGET maya::maya)
165
+ add_library(maya::maya ALIAS maya)
166
+ endif()
167
+
168
+ # maya builds a static lib; linking it into a shared Python module needs PIC.
169
+ set_property(TARGET maya PROPERTY POSITION_INDEPENDENT_CODE ON)
170
+
171
+ # maya's CMakeLists forces cxx_std_26 via target_compile_features(PUBLIC),
172
+ # which propagates through the link interface and raises the EXTENSION to
173
+ # -std=c++26 too. The features maya actually uses are all C++23, and GCC 14
174
+ # only offers C++26 as experimental -std=c++2c. Strip the propagated feature
175
+ # requirement and pin both targets to C++23 so the build is stable on
176
+ # gcc-toolset-14. Harmless on newer compilers.
177
+ set_property(TARGET maya PROPERTY INTERFACE_COMPILE_FEATURES "")
178
+ set_property(TARGET maya PROPERTY COMPILE_FEATURES "")
179
+ set_target_properties(maya PROPERTIES CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
180
+
181
+ # ── the extension ─────────────────────────────────────────────────────────
182
+ pybind11_add_module(_maya src/_maya.cpp src/_widgets.cpp src/_program.cpp)
183
+ set_target_properties(_maya PROPERTIES CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
184
+ target_link_libraries(_maya PRIVATE maya::maya)
185
+
186
+ # ── MSVC / Windows build hygiene ───────────────────────────────────────────
187
+ # maya's sources are UTF-8 and contain large templated TUs; MSVC needs to be
188
+ # told both. NOMINMAX / WIN32_LEAN_AND_MEAN keep <windows.h> (pulled in by
189
+ # maya's win32 platform layer) from defining min/max macros and bloating the
190
+ # include. UNICODE makes the Win32 console APIs take wide strings, matching
191
+ # maya's win32 backend.
192
+ if(MSVC)
193
+ target_compile_options(maya PRIVATE /utf-8 /bigobj /EHsc)
194
+ target_compile_options(_maya PRIVATE /utf-8 /bigobj /EHsc)
195
+ target_compile_definitions(_maya PRIVATE
196
+ NOMINMAX WIN32_LEAN_AND_MEAN _CRT_SECURE_NO_WARNINGS)
197
+ target_compile_definitions(maya PRIVATE
198
+ NOMINMAX WIN32_LEAN_AND_MEAN _CRT_SECURE_NO_WARNINGS)
199
+ endif()
200
+
201
+ # ── Self-contained runtime (works on machines without the build toolchain) ─
202
+ #
203
+ # maya is C++26, so the extension is built with a modern GCC and pulls in very
204
+ # new libstdc++ symbols. An end-user machine won't have that libstdc++ (on
205
+ # Linux it'd be too old; on macOS it lives only in the builder's Homebrew),
206
+ # so by default the wheel would fail to LOAD even though no compiler runs at
207
+ # install time.
208
+ #
209
+ # Fix: statically link libstdc++ and libgcc INTO the extension. It then
210
+ # carries its own C++ runtime and depends only on the platform's baseline
211
+ # system libraries. The wheel becomes truly standalone: download, unzip,
212
+ # import; the builder's GCC is irrelevant to the user.
213
+ #
214
+ # Opt out with -DMAYA_PY_STATIC_CXX=OFF (e.g. a manylinux wheel where
215
+ # auditwheel + the manylinux libstdc++ already provide portability).
216
+ option(MAYA_PY_STATIC_CXX "Statically link libstdc++/libgcc into the extension" ON)
217
+
218
+ if(MAYA_PY_STATIC_CXX AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
219
+ # -static-libstdc++/-static-libgcc are GCC driver flags and work on both
220
+ # Linux (GNU ld) and macOS (when building with Homebrew GCC) — they bake
221
+ # the C++ runtime into the module so it doesn't chase the builder's
222
+ # libstdc++ at load time.
223
+ target_link_options(_maya PRIVATE -static-libstdc++ -static-libgcc)
224
+ # --exclude-libs hides the statically-linked C++ symbols so they can't
225
+ # clash with a different libstdc++ already loaded in the host process.
226
+ # It's a GNU-ld feature; Apple's ld64 doesn't understand it, so gate it
227
+ # to non-Apple (Linux) builds only.
228
+ if(NOT APPLE)
229
+ target_link_options(_maya PRIVATE -Wl,--exclude-libs,ALL)
230
+ endif()
231
+ endif()
232
+
233
+ # Install into the package dir (scikit-build-core picks this up). The
234
+ # extension is LIBRARY on POSIX (.so/.dylib) and RUNTIME on Windows (.pyd is
235
+ # treated as a DLL), so list both destinations for a portable install rule.
236
+ install(TARGETS _maya
237
+ LIBRARY DESTINATION maya_py
238
+ RUNTIME DESTINATION maya_py)