Skip to content

Commit

Permalink
Adjustign archs + compilers right before build
Browse files Browse the repository at this point in the history
  • Loading branch information
peekxc committed Dec 5, 2023
1 parent 01feabf commit e6a739e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ jobs:
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
# should also be able to do multi-archs on a single entry, e.g.
# [windows-2019, win*, "AMD64 x86"]. However, those two require a different compiler setup
# so easier to separate out here.
- [ubuntu-22.04, manylinux, x86_64]
- [ubuntu-22.04, musllinux, x86_64]
- [macos-11, macosx, x86_64]
- [windows-2019, AMD64]
# [os-image, os-name, os-arch]
- [ubuntu-latest, manylinux, x86_64]
- [ubuntu-latest, musllinux, x86_64]
- [macos-latest, macosx, x86_64]
- [windows-latest, win, AMD64]
# os: [windows-latest]
# cibw_arch: ["AMD64"]
# cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
Expand All @@ -45,16 +44,26 @@ jobs:
run: |
python -m pip install cibuildwheel
- name: Set compiler
run: |
if [ ${{ matrix.buildplat[1] }} == 'macosx' ]; then
echo "CC=/usr/local/opt/llvm/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/local/opt/llvm/bin/clang++" >> $GITHUB_ENV
elif [ ${{ matrix.buildplat[1] }} == 'win' ]; then
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
fi
$CXX --version
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
# define CC, CXX so meson will use clang-cl instead of MSVC
# CC: clang-cl
# CXX: clang-cl
# CC: gcc
# CXX: g++
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
# -Wl,-S equivalent to gcc's -Wl,--strip-debug
# LDFLAGS: "-Wl,-S"

Expand Down
17 changes: 15 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,28 @@ _cpp_args = compiler.get_supported_arguments(
'-Wno-conversion',
'-Wno-misleading-indentation',
'-Wno-unused-lambda-capture',
'-Wno-unused-parameter',
'-std=c++20',
'-Wno-unused-parameter',
'-fPIC',
'-fvisibility=hidden',
# '-flto=thin' # release only: thin LTO
# '-flto' # release only: monolithic LTO
'-Wno-deprecated-anon-enum-enum-conversion' # to silence Eigen 3.4 warnings
)

## Require C++20 for concepts
concept_code = '''
#include <concepts>
#include <type_traits>
template <class T>
concept integral = std::is_integral_v<T>;
'''
concepts_check = compiler.compiles(concept_code, name : 'concepts check')
if concepts_check
_cpp_args += compiler.get_supported_arguments('-std=c++20')
else
error('A C++20-compliant compiler is required')
endif

## Add Xclang
_cpp_args += compiler.get_supported_arguments('-Xclang')

Expand Down

0 comments on commit e6a739e

Please sign in to comment.