Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for setting OSX plat_name from cmake args #377

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 27 additions & 2 deletions skbuild/setuptools_wrap.py
Expand Up @@ -474,8 +474,33 @@ def setup(*args, **kw): # noqa: C901
# specified
if sys.platform == 'darwin':
if plat_name is None:
# The following code is duplicated in bdist_wheel.finalize_options()
plat_name = "macosx-10.6-x86_64"
# If cmake osx deployment args are set then set plat from them
user_set = False
if cmaker.has_cmake_cache_arg(
cmake_args, 'CMAKE_OSX_DEPLOYMENT_TARGET'):
# The loop here allows for cli flags to overload
# those set in the setup file.
for s in cmake_args:
if 'CMAKE_OSX_DEPLOYMENT_TARGET' in s:
version = s.split('=')[1]
user_set = True
else:
version = '10.6'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now-a-days, I think 10.9 is more common, per

https://github.com/MacPython/wiki/wiki/Spinning-wheels

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I think the primary build chain is still 10.7 on osx, but 10.9 is needed for the latest version. This is the motivation for this patch, but 10.6 was left as the default platform because modifying that is a separate issue.


if cmaker.has_cmake_cache_arg(
cmake_args, 'CMAKE_OSX_ARCHITECTURES'):
for s in cmake_args:
if 'CMAKE_OSX_ARCHITECTURES' in s:
machine = s.split('=')[1]
user_set = True
else:
machine = 'x86_64'

plat_name = "macosx-{}-{}".format(version, machine)
# Set plat_name sys arg so that next command, e.g. bdist_wheel
# inherits this information.
if user_set:
sys.argv += ['--plat-name', plat_name]

(_, version, machine) = plat_name.split('-')
if not cmaker.has_cmake_cache_arg(
Expand Down