Skip to content

Commit

Permalink
windows build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peekxc committed Dec 8, 2023
1 parent 065640c commit 2e7f843
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CC: clang-cl
# CXX: clang-cl
CC: msvc
CXX: msvc
# LDFLAGS: "-Wl,-S"
strategy:
fail-fast: false
Expand All @@ -36,10 +36,10 @@ jobs:
# platform: x64
# - name: Setup MSVC
# uses: ilammy/[email protected]
# - name: Prepare MSVC
# uses: bus1/cabuild/action/msdevshell@v1
# with:
# architecture: x64
- name: Setup MSVC
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
# - name: Install Clang with OpenMP support using Chocolatey
# run: |
# choco install -y llvm --params "clang;compiler=clang" --version 13.0.0
Expand Down Expand Up @@ -68,22 +68,13 @@ jobs:
- name: Build a wheel
run: |
python -m pip wheel . --no-deps --wheel-dir dist
# $GITHUB_WORKSPACE/wheelhouse .
# delvewheel repair -w dist -v wheelhouse/*.whl
# python -m build --wheel
# $env:wheel_name=Get-ChildItem -Path dist/* -Include *.whl
# delvewheel repair -w dist $env:wheel_name
- name: Repair the wheel
run: |
delvewheel repair dist/*.whl
# bash tools/repair_windows.sh
delvewheel repair dist/*.whl
- name: Uninstall the package
run: |
python -m pip uninstall primate -y
- name: Install the wheel
# python -m pip install $(find "$output_dir" -type f | grep *primate*.whl)
# python -m pip install $env:wheel_name
run: |
python -m pip install dist/*.whl
pip install delvewheel
Expand All @@ -95,8 +86,16 @@ jobs:
run: |
python -m pytest tests/ --cov=primate --benchmark-skip
coverage report -m
# - name: Make wheel w/ delvewheel
# run: |
# bash ./tools/repair_windows.sh
# output_dir="$(mktemp -d)"
# python -m pip wheel . --no-deps --wheel-dir "$output_dir"
# - name: Make wheel w/ delvewheel
# python -m pip install $(find "$output_dir" -type f | grep *primate*.whl)
# python -m pip install $env:wheel_name
# run: |
# bash ./tools/repair_windows.sh
# output_dir="$(mktemp -d)"
# python -m pip wheel . --no-deps --wheel-dir "$output_dir"
# $GITHUB_WORKSPACE/wheelhouse .
# delvewheel repair -w dist -v wheelhouse/*.whl
# python -m build --wheel
# $env:wheel_name=Get-ChildItem -Path dist/* -Include *.whl
# delvewheel repair -w dist $env:wheel_name
23 changes: 11 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ else
error('A C++20-compliant compiler is required')
endif

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

## Include directories
incdir_numpy = run_command(py, ['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'], check : true).stdout().strip()
# incdir_eigen = run_command(py, ['-c', 'import os; os.chdir(".."); import eigenpip; print(eigenpip.get_include())'], check : true).stdout().strip()
Expand All @@ -81,19 +78,21 @@ inc_pkg = include_directories('include')
dependency_map = {}
# subdir('blas') # Configure BLAS / LAPACK

## Include OpenMP, if possible
## Include OpenMP (mandatory)
omp = dependency('openmp', required: false)
openmp_flags = []
if omp.found()
if OS_platform == 'windows'
## Handle msvc, gcc, clang, or clang-cl
if OS_platform == 'windows' and compiler.get_id() == 'msvc'
# https://devblogs.microsoft.com/cppblog/improved-openmp-support-for-cpp-in-visual-studio/
openmp_flags += compiler.get_supported_arguments('/openmp', '/openmp:experimental', '/openmp:llvm')
else
if compiler.get_id() == 'gcc'
openmp_flags += compiler.get_supported_arguments('-fopenmp', '-fopenmp=libgomp', '-lgomp')
elif compiler.get_id() == 'llvm' or compiler.get_id() == 'clang'
openmp_flags = compiler.get_supported_arguments('-fopenmp', '-fopenmp=libomp', '-lomp')
endif
endif
elif compiler.get_id() == 'gcc'
openmp_flags += compiler.get_supported_arguments('-fopenmp', '-fopenmp=libgomp', '-lgomp')
elif compiler.get_id() == 'clang-cl'
openmp_flags += compiler.get_supported_arguments('-Xclang', '-fopenmp')
elif compiler.get_id() == 'llvm' or compiler.get_id() == 'clang'
openmp_flags += compiler.get_supported_arguments('-fopenmp', '-fopenmp=libomp', '-lomp')
endif
add_project_link_arguments(openmp_flags, language : 'cpp')
dependency_map += { 'OpenMP' : omp }
elif compiler.has_argument('-fopenmp')
Expand Down
3 changes: 2 additions & 1 deletion tools/cibw_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
choco install rtools -y --no-progress --force --version=4.3.5550

export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin
export PATH=$PATH:/c:/rtools40/ucrt64/bin:$PATH
export PATH=$PATH:/c:/rtools40/ucrt64/bin
# set PATH=C:\rtools40\ucrt64\bin\;%PATH%
g++ --version


# Create a a set commands to install mingw64 on windows-2019 server for compiling native Python extension modules


Expand Down

0 comments on commit 2e7f843

Please sign in to comment.