Skip to content

Commit

Permalink
Merge pull request #4 from Haydnspass/macos_sdk
Browse files Browse the repository at this point in the history
macOS SDK for Conda
  • Loading branch information
Haydnspass authored Mar 29, 2023
2 parents 227067c + a4a6ae4 commit 8121182
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 23 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build_upload_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
include:
# Windows2019 & VS 2019 supports 10.1+
- os: ubuntu-18.04
- os: ubuntu-22.04
os_base: ubuntu
shell: bash -l {0}

Expand Down Expand Up @@ -48,16 +48,20 @@ jobs:
run: |
conda install conda-build conda-verify anaconda-client
- name: Install macOS SDK
if: contains( matrix.os, 'macos')
working-directory: /Users/runner
run: |
curl -fsSL https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.9.sdk.tar.xz > ~/MacOSX10.9.sdk.tar.xz
tar -xzf ~/MacOSX10.9.sdk.tar.xz
rm ~/MacOSX10.9.sdk.tar.xz
- uses: Jimver/[email protected]
if: ${{ matrix.os_base != 'macos' }}
id: cuda-toolkit
with:
cuda: '11.7.0'

# - name: Choose Mac OS SDK
# if: ${{ matrix.os_base == 'macos'}}
# run: sudo xcode-select --switch /Applications/Xcode_11.5.app/Contents/Developer

- name: Build SplinePSF (UNIX)
if: ${{ matrix.os_base == 'ubuntu' || matrix.os_base == 'macos'}}
run: |
Expand Down Expand Up @@ -107,7 +111,7 @@ jobs:


build-linux-pip:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down
11 changes: 7 additions & 4 deletions dist_tools/conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ cxx_compiler:
- vs2017 # [win]

c_compiler_version:
- 9 # [linux]
- 9 # [osx and x86_64]
- 10 # [linux]
- 10 # [osx and x86_64]
- 13 # [osx and arm64]

cxx_compiler_version:
- 9 # [linux]
- 9 # [osx and x86_64]
- 10 # [linux]
- 10 # [osx and x86_64]
- 13 # [osx and arm64]

python:
Expand All @@ -29,3 +29,6 @@ numpy:
# - 1.19 # [not arm64]
# - 1.20 # [not arm64]
- 1.21

CONDA_BUILD_SYSROOT:
- /Users/runner/MacOSX10.9.sdk # [osx and x86_64]
2 changes: 1 addition & 1 deletion dist_tools/conda/spline/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cd python
${PYTHON} setup.py clean --all install --prefix=${PREFIX}
${PYTHON} -m pip install --prefix ${PREFIX} -v .
18 changes: 10 additions & 8 deletions dist_tools/conda/spline/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requirements:
- python
- cmake =3.23
- ninja
- setuptools
- pip
- nvcc_linux-64 =11.7.0 # [linux]

host:
Expand All @@ -29,13 +29,15 @@ requirements:
- python
- {{ pin_compatible('numpy', max_pin='x.x') }}

test:
requires:
- pytest
source-files:
- python/test/test_basic.py
commands:
- pytest -s python/test/test_basic.py
test:
imports:
- spline
# requires:
# - pytest
# source-files:
# - python/test/test_basic.py
# commands:
# - pytest -s python/test/test_basic.py

about:
home: https://rieslab.de
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ channels:
dependencies:
- bump2version
- python # gh runner will pin automatically
- numpy =1.21
- numpy <1.24
- cmake =3.23
- ninja
- setuptools
- pybind11 >=2.8
- gcc =9
- gxx =9
- gcc =10
- gxx =10
5 changes: 4 additions & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import os
import re
import sys
import platform
import subprocess

Expand Down Expand Up @@ -51,6 +50,10 @@ def build_extension(self, ext):
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir]
if "CONDA_BUILD" in env:
cmake_args += [f'-DPython_EXECUTABLE={env["PYTHON"]}']
sysroot = os.environ.get("CONDA_BUILD_SYSROOT", None)
import sys
if sysroot and sys.platform == "darwin":
cmake_args += [f"-DCMAKE_OSX_SYSROOT={sysroot}"]
cmake_args += [f'-DPYBIND11_PYTHON_VERSION={py_ver}']
cmake_args += ["-GNinja"]

Expand Down

0 comments on commit 8121182

Please sign in to comment.