[CI] Build Python wheels for MacOS (x86_64 and arm64) (#7621)

* Build Python wheels for OSX (x86_64 and arm64)

* Use Conda's libomp when running Python tests

* fix

* Add comment to explain CIBW_TARGET_OSX_ARM64

* Update release script

* Add comments in build_python_wheels.sh

* Document wheel pipeline
This commit is contained in:
Philip Hyunsu Cho
2022-02-02 17:35:48 -08:00
committed by GitHub
parent 271a7c5d43
commit f6e6d0b2c0
8 changed files with 123 additions and 32 deletions

View File

@@ -119,6 +119,13 @@ class BuildExt(build_ext.build_ext): # pylint: disable=too-many-ancestors
continue
cmake_cmd.append('-D' + arg + '=' + value)
# Flag for cross-compiling for Apple Silicon
# We use environment variable because it's the only way to pass down custom flags
# through the cibuildwheel package, which otherwise calls `python setup.py bdist_wheel`
# command.
if 'CIBW_TARGET_OSX_ARM64' in os.environ:
cmake_cmd.append("-DCMAKE_OSX_ARCHITECTURES=arm64")
self.logger.info('Run CMake command: %s', str(cmake_cmd))
subprocess.check_call(cmake_cmd, cwd=build_dir)