From a731db46e4f59840eeb73ea4742a0675c06efbd7 Mon Sep 17 00:00:00 2001 From: Jacob Wilkins Date: Thu, 7 Nov 2024 16:15:29 +0000 Subject: [PATCH] Experiment with MSVC --- .github/workflows/run_tests.yml | 9 +++++++++ meson.build | 7 +++---- pyproject.toml | 3 +++ tox.ini | 15 ++++++++------- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index ae2fc05ca..c785dd68c 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -31,6 +31,15 @@ jobs: if: startsWith(matrix.os, 'macos') run: | brew install llvm + echo CC="/opt/homebrew/opt/llvm/bin/clang" >> $GITHUB_ENV + echo LDFLAGS="-L/opt/homebrew/opt/llvm/lib $LDFLAGS" >> $GITHUB_ENV + echo CPPFLAGS="-I/opt/homebrew/opt/llvm/include $CPPFLAGS" >> $GITHUB_ENV + - name: Setup MSVC env on Windows + if: startsWith(matrix.os, 'windows') + shell: bash + run: | + echo "CC=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\cl.exe" >> $GITHUB_ENV + echo "CC_LD=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\link.exe" >> $GITHUB_ENV - name: Update pip and install dependencies shell: bash -l {0} run: | diff --git a/meson.build b/meson.build index fe5040a2c..d183edfcc 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('euphonic', 'c', version: run_command('python', 'build_utils/version.py', check: true).stdout().strip(), - meson_version: '>=1.6') # AppleClang with OpenMP + meson_version: '>=1.6') build = get_option('python_only') ? disabler() : [] @@ -30,14 +30,14 @@ foreach folder, sources : py_src foreach source : sources inc += folder / source endforeach - py.install_sources(inc, subdir : folder) + py.install_sources(inc, subdir: folder) endforeach version = configure_file(input: 'build_utils/version.py.in', output: 'version.py', configuration: {'VERSION': meson.project_version()}) -py.install_sources(version, 'CITATION.cff', 'LICENSE', subdir : 'euphonic') +py.install_sources(version, 'CITATION.cff', 'LICENSE', subdir: 'euphonic') src = ['c/_euphonic.c', 'c/dyn_mat.c', 'c/util.c', 'c/py_util.c', 'c/load_libs.c'] @@ -55,5 +55,4 @@ py.extension_module( dependencies: [build, py_dep, np, openmp], install: true, subdir: 'euphonic', - override_options: {'default_library': 'shared'}, ) diff --git a/pyproject.toml b/pyproject.toml index 0d6b36754..25cf3a3db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,9 @@ requires = ["meson-python", "packaging", "numpy>=1.24.0"] +[tool.meson-python.args] +setup = ['--vsenv'] + [project] name = "Euphonic" description = "Euphonic calculates phonon bandstructures and inelastic neutron scattering intensities from modelling code output (e.g. CASTEP)" diff --git a/tox.ini b/tox.ini index 6b269588a..9607f2834 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ skipsdist = True [testenv] changedir = tests_and_analysis/test test_command = python run_tests.py --report +passenv = CC CC_LD LDFLAGS CPPFLAGS [testenv:{py310,py311,py312}] install_command = @@ -21,7 +22,7 @@ deps = numpy -r{toxinidir}/tests_and_analysis/tox_requirements.txt commands_pre = - python -m pip install -vvv \ + python -m pip install \ --upgrade \ --upgrade-strategy eager \ '{toxinidir}[matplotlib,phonopy_reader,brille]' @@ -33,7 +34,7 @@ commands = install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install -vvv \ + python -m pip install \ --upgrade \ --upgrade-strategy eager \ '{toxinidir}' @@ -44,7 +45,7 @@ commands = {[testenv]test_command} --cov -m "not (phonopy_reader or matplotlib o install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install -vvv \ + python -m pip install \ --upgrade \ --upgrade-strategy eager \ '{toxinidir}[matplotlib]' @@ -55,7 +56,7 @@ commands = {[testenv]test_command} --cov -m "matplotlib and not multiple_extras" install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install -vvv \ + python -m pip install \ --upgrade \ --upgrade-strategy eager \ '{toxinidir}[phonopy_reader]' @@ -66,7 +67,7 @@ commands = {[testenv]test_command} --cov -m "phonopy_reader and not multiple_ext install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install -vvv \ + python -m pip install \ --upgrade \ --upgrade-strategy eager \ '{toxinidir}[brille]' @@ -77,7 +78,7 @@ commands = {[testenv]test_command} --cov -m "brille and not multiple_extras" install_command = {[testenv:py310]install_command} deps = {[testenv:py310]deps} commands_pre = - python -m pip install -vvv \ + python -m pip install \ --upgrade \ --upgrade-strategy eager \ '{toxinidir}[phonopy_reader,matplotlib,brille]' @@ -100,5 +101,5 @@ commands_pre = -r{toxinidir}/tests_and_analysis/tox_requirements.txt # Force rebuild of euphonic extension to avoid Numpy clash rm -rf {toxinidir}/build - python -m pip install -vvv '{toxinidir}[matplotlib,phonopy_reader,brille]' + python -m pip install '{toxinidir}[matplotlib,phonopy_reader,brille]' commands = {[testenv]test_command}