File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,3 +177,12 @@ py_test(
177177 ],
178178 }),
179179)
180+
181+ platform (
182+ name = "macos_x86_64" ,
183+ constraint_values = [
184+ "@platforms//os:osx" ,
185+ "@platforms//cpu:x86_64" ,
186+ ],
187+ visibility = ["//visibility:public" ],
188+ )
Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ container-engine = "docker; disable_host_mount: True"
5454before-all = " git config --global http.sslVerify false && echo 'Installing bazelisk' && cp {project}/bazelisk-linux-amd64 /usr/local/bin/bazel"
5555
5656[tool .cibuildwheel .macos ]
57+ archs = [" x86_64" , " arm64" ]
5758before-all = " echo 'Installing bazelisk'; brew install bazelisk"
59+ environment = { MACOSX_DEPLOYMENT_TARGET = " 10.13" }
5860
5961[tool .cibuildwheel .windows ]
6062# Bazel is expected to be already installed and in the PATH on Windows.
Original file line number Diff line number Diff line change 1616
1717import glob
1818import os
19+ import platform
1920import re
2021import shutil
2122import subprocess
@@ -163,6 +164,26 @@ def platform_config_macos(self, cmd):
163164 """Applies macOS-specific Bazel configurations."""
164165 cmd .extend (['--macos_minimum_os=10.13' , '--cxxopt=-faligned-allocation' ])
165166
167+ archflags = os .environ .get ('ARCHFLAGS' , '' )
168+ if 'x86_64' in archflags :
169+ target_arch = 'x86_64'
170+ elif 'arm64' in archflags :
171+ target_arch = 'arm64'
172+ else :
173+ machine = platform .machine ()
174+ if machine in ('AMD64' , 'x86_64' ):
175+ target_arch = 'x86_64'
176+ elif machine in ('arm64' , 'aarch64' ):
177+ target_arch = 'arm64'
178+ else :
179+ target_arch = machine
180+
181+ print (f'Target architecture for macOS: { target_arch } ' , flush = True )
182+ cmd .append (f'--macos_cpus={ target_arch } ' )
183+ cmd .append (f'--cpu=darwin_{ target_arch } ' )
184+ if target_arch == 'x86_64' :
185+ cmd .append ('--platforms=//cel_expr_python:macos_x86_64' )
186+
166187
167188setuptools .setup (
168189 name = 'cel-expr-python' ,
You can’t perform that action at this time.
0 commit comments