Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/clang-cl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build using clang-cl on Windows

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build_wheels:
runs-on: windows-latest
name: Build wheel using clang-cl on Windows
strategy:
fail-fast: false
matrix:
python: [cp312]
defaults:
run:
shell: bash
env:
BUILD_COMMIT: "main"
CIBW_BUILD: ${{ matrix.python }}-*
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_MACOS: native
CIBW_SKIP: "pp* *-musllinux_* *-win32"
CIBW_TEST_REQUIRES: pytest pytest-xdist
CIBW_TEST_COMMAND: python -c "import randomgen; randomgen.test(['--skip-slow','-n','2'])"
CIBW_ENVIRONMENT: 'CC="clang-cl"'
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
OPENLAS_NUM_THREADS: 1

steps:
- uses: actions/checkout@v5

- name: Get clang-cl version
run: clang-cl --version

- name: Build wheels
uses: pypa/cibuildwheel@v3.2
with:
output-dir: wheelhouse

1 change: 1 addition & 0 deletions .github/workflows/cron-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
CIBW_TEST_REQUIRES: pytest pytest-xdist
CIBW_TEST_COMMAND: python -c "import randomgen; randomgen.test(['--skip-slow','-n','2'])"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'auditwheel repair --strip -w {dest_dir} {wheel}'
CIBW_BUILD_FRONTEND: 'build; args: --config-setting=setup-args=--vsenv'
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
OPENLAS_NUM_THREADS: 1
Expand Down
6 changes: 3 additions & 3 deletions ci/azure/azure_template_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
# defaults for any parameters that are not specified
name: ''
vmImage: ''
BUILD_FLAGS: ''
BUILD_FLAGS: '-Csetup-args=-vsenv'


jobs:
Expand Down Expand Up @@ -50,12 +50,12 @@ jobs:
displayName: 'List Configuration'

- pwsh: |
python -m pip install -ve . --no-build-isolation
python -m pip install -ve . --no-build-isolation -Csetup-args=--vsenv
displayName: 'Install (editable)'
condition: ne(variables['cython.coverage'], 'true')

- pwsh: |
python -m pip install -ve . --no-build-isolation -Csetup-args=-Dcython-coverage=true
python -m pip install -ve . --no-build-isolation -Csetup-args=-Dcython-coverage=true -Csetup-args=--vsenv
python .\ci\azure\cythonize-pyx.py
displayName: 'Install (editable) and Transpile pyx to C for coverage'
condition: eq(variables['cython.coverage'], 'true')
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ repository = "https://github.com/bashtage/randomgen"
changelog = "https://bashtage.github.io/randomgen/change-log.html"

[tool.meson-python.args]
setup = ['--vsenv']


[tool.setuptools_scm]
version_file = "randomgen/_version.py"
Expand Down
11 changes: 10 additions & 1 deletion randomgen/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ cython_c_args = ['-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION']
cython_libs = []
sse2_def = []
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
cython_c_args += cc.get_supported_arguments(['/Zp16','/wd4146', '/GL','/arch:SSE4.2','/arch:AVX2'])
cython_c_args += cc.get_supported_arguments(['/Zp16','/wd4146', '/arch:SSE4.2','/arch:AVX2'])

if cc.get_id() == 'msvc'
cython_c_args += cc.get_supported_arguments(['/GL'])
endif

if cc.get_id() == 'clang-cl'
cython_c_args += cc.get_supported_arguments(['-maes', '-Wno-unused-but-set-variable', '-Wno-unused-function'])
endif

if cc.has_argument('/arch:SSE4.2')
sse2_def += ['-DHAVE_SSE2=1']
endif
Expand Down
2 changes: 1 addition & 1 deletion randomgen/src/common/cpu_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ void feature_flags(int flags[32], int major)
{
int i;
#if defined(HAVE_CPUID) && HAVE_CPUID
#if defined(__clang__) || defined(__GNUC__)
#if (defined(__clang__) || defined(__GNUC__)) && !defined(_MSC_VER)
uint32_t num_ids = 0, reg = 0, eax = 0, ebx = 0, ecx = 0, edx = 0;
num_ids = __get_cpuid_max(0, &ebx);
ebx = 0;
Expand Down
2 changes: 1 addition & 1 deletion randomgen/src/common/randomgen_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* windows msvc */

#ifndef MSVCFORCEINLINE
#ifndef _DEBUG
#if !defined(_DEBUG) && !defined(__clang__)
#define MSVCFORCEINLINE __forceinline
#else
#define MSVCFORCEINLINE
Expand Down
Loading