Skip to content

Commit

Permalink
Merge pull request #39 from osqp/im/macos
Browse files Browse the repository at this point in the history
Update build wheels to build both arm and x86 macos wheels
  • Loading branch information
AmitSolomonPrinceton committed Jun 17, 2024
2 parents 71edfe1 + 6aeee6e commit 6e9ff58
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2022]
# Include macos-13 to get Intel x86_64 macs and maos-latest to get the Aaarch64 macs
os: [ubuntu-latest, macos-latest, macos-13, windows-2022]

# Build on the native architectures (macos-latest is arm64. macos-13 is x86_64)
include:
- os: macos-latest
osx_arch: 'arm64'
- os: macos-13
osx_arch: 'x86_64'
steps:
- uses: actions/checkout@master
with:
Expand Down Expand Up @@ -38,9 +45,12 @@ jobs:
CIBW_MANYLINUX_X86_64_IMAGE: "dockcross/manylinux2014-x64"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest {project}/tests"
# Skip testing on arm64 Python 3.8 because it uses the x86_64 executable, not the arm executable
CIBW_TEST_SKIP: "cp38-macosx_*:arm64"
CIBW_ENVIRONMENT_LINUX: CMAKE_GENERATOR="Unix Makefiles"
CIBW_ENVIRONMENT_MACOS: CMAKE_GENERATOR="Unix Makefiles"
CIBW_ENVIRONMENT_MACOS: CMAKE_GENERATOR="Unix Makefiles" CMAKE_OSX_ARCHITECTURES=${{ matrix.osx_arch }}
CIBW_ENVIRONMENT_WINDOWS: CMAKE_GENERATOR="Visual Studio 17 2022" CMAKE_GENERATOR_PLATFORM=x64
CIBW_BUILD_VERBOSITY: 1
run: |
python -m pip install cibuildwheel build
python -m cibuildwheel --output-dir wheelhouse
Expand Down
6 changes: 5 additions & 1 deletion c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
cmake_minimum_required (VERSION 3.2)
cmake_minimum_required (VERSION 3.5)

# Project name
project (qdldl_amd)

if(APPLE)
message(STATUS "Building for Apple arches: ${CMAKE_OSX_ARCHITECTURES}")
endif()

# Needed for compilation to succeed
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ def __str__(self):

cmake_args = []
# What variables from the environment do we wish to pass on to cmake as variables?
cmake_env_vars = ('CMAKE_GENERATOR', 'CMAKE_GENERATOR_PLATFORM')
cmake_env_vars = ('CMAKE_GENERATOR', 'CMAKE_GENERATOR_PLATFORM', 'CMAKE_OSX_ARCHITECTURES')
for cmake_env_var in cmake_env_vars:
cmake_var = os.environ.get(cmake_env_var)
if cmake_var:
cmake_args.extend([f'-D{cmake_env_var}={cmake_var}'])

# Add parameters to cmake_args and define_macros
cmake_args += ["-DUNITTESTS=OFF"]
cmake_args += ["-DQDLDL_UNITTESTS=OFF"]
cmake_build_flags = []
lib_subdir = []

Expand Down

0 comments on commit 6e9ff58

Please sign in to comment.