GeezerVison is showing github.com — Fix macOS wheel version compatibility warning · latchdevel/pyPiCode@3e70245
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: CMakeLists.txt +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -99,6 +99,7 @@ set_property( TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE TRUE ) |
99 | 99 | if (APPLE) |
100 | 100 | set_property( TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS "-arch arm64 -arch x86_64" ) |
101 | 101 | set_property( TARGET ${PROJECT_NAME} PROPERTY LINK_FLAGS "-arch arm64 -arch x86_64" ) |
| 102 | + set( CMAKE_OSX_DEPLOYMENT_TARGET "11.0" ) |
102 | 103 | endif() |
103 | 104 |
|
104 | 105 | # Add cPiCode library static link |
|
Collapse file
Copy file name to clipboardExpand all lines: setup.py +19-1Lines changed: 19 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
7 | 7 | License GNU Lesser General Public License v3.0. |
8 | 8 | """ |
9 | 9 |
|
| 10 | +import os |
| 11 | +import platform |
| 12 | +import sysconfig |
| 13 | + |
| 14 | +# Ensure macOS deployment target is at least the version Python was built with |
| 15 | +if platform.system() == "Darwin": |
| 16 | + # Get the version Python was compiled against or default to 11.0 |
| 17 | + python_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or "11.0" |
| 18 | + |
| 19 | + # Get existing deployment target from environment or default to 11.0 |
| 20 | + current_target = os.environ.get("MACOSX_DEPLOYMENT_TARGET", "11.0") |
| 21 | + |
| 22 | + # Use the higher version to avoid warnings and ensure compatibility |
| 23 | + if float(python_target) > float(current_target): |
| 24 | + os.environ["MACOSX_DEPLOYMENT_TARGET"] = python_target |
| 25 | + else: |
| 26 | + os.environ["MACOSX_DEPLOYMENT_TARGET"] = current_target |
| 27 | + |
10 | 28 | from setuptools import setup, Extension |
11 | 29 | from setuptools.command.build_ext import build_ext |
12 | | -import os, pathlib, subprocess |
| 30 | +import pathlib, subprocess |
13 | 31 |
|
14 | 32 | # Add cmake_lists_dir to Extension |
15 | 33 | class CMakeExtension(Extension): |
|