cmake: add support for compiling bitpit with MSVC #53
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous integration | |
on: | |
workflow_dispatch: | |
inputs: | |
pull_request: | |
branches: [ "master" ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
# setup-lnux: | |
# runs-on: ubuntu | |
# name: Setup - Linux | |
# steps: | |
# - name: Checkout build environment information | |
# uses: actions/checkout@v3 | |
# with: | |
# path: bitpit | |
# sparse-checkout: | | |
# environments | |
# - name: Build environment | |
# shell: bash | |
# run: | | |
# DOCKER_BUILDKIT=1 docker buildx build \ | |
# --builder=container \ | |
# --cache-from type=local,src=/home/bob/products/bitpit/ubuntu-cache \ | |
# --cache-to type=local,dest=/home/bob/products/bitpit/ubuntu-cache \ | |
# --rm \ | |
# --target bitpit-environment \ | |
# -f bitpit/environments/ubuntu/Dockerfile . | |
# - name: Cleanup build environment information | |
# run: | | |
# rm -rf bitpit | |
# tests-linux: | |
# runs-on: ubuntu | |
# needs: setup-linux | |
# name: Linux - (${{ matrix.compiler }}) MPI ${{ matrix.mpi }} - Debug ${{ matrix.debug }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# include: | |
# - compiler: gcc | |
# mpi: ON | |
# debug: ON | |
# - compiler: gcc | |
# mpi: ON | |
# debug: OFF | |
# - compiler: gcc | |
# mpi: OFF | |
# debug: ON | |
# - compiler: gcc | |
# mpi: OFF | |
# debug: OFF | |
# - compiler: clang | |
# mpi: ON | |
# debug: OFF | |
# steps: | |
# - name: Checkout bitpit | |
# uses: actions/checkout@v3 | |
# - name: Build bitpit | |
# shell: bash | |
# run: | | |
# DOCKER_BUILDKIT=1 docker buildx build \ | |
# --builder=container \ | |
# --cache-from type=local,src=/home/bob/products/bitpit/ubuntu-cache \ | |
# --rm \ | |
# --build-arg COMPILER=${{ matrix.compiler }} \ | |
# --build-arg MPI=${{ matrix.mpi }} \ | |
# --build-arg DEBUG=${{ matrix.debug }} \ | |
# --target bitpit-build \ | |
# -f environments/ubuntu/Dockerfile . | |
# - name: Run bitpit tests | |
# shell: bash | |
# run: | | |
# DOCKER_BUILDKIT=1 docker buildx build \ | |
# --builder=container \ | |
# --cache-from type=local,src=/home/bob/products/bitpit/ubuntu-cache \ | |
# --rm \ | |
# --build-arg COMPILER=${{ matrix.compiler }} \ | |
# --build-arg MPI=${{ matrix.mpi }} \ | |
# --build-arg DEBUG=${{ matrix.debug }} \ | |
# --target bitpit-test \ | |
# -f environments/ubuntu/Dockerfile . | |
tests-windows: | |
runs-on: Windows | |
name: Windows - (MSVC) MPI ${{ matrix.mpi }} - Debug ${{ matrix.debug }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- mpi: ON | |
debug: ON | |
- mpi: ON | |
debug: OFF | |
- mpi: OFF | |
debug: ON | |
- mpi: OFF | |
debug: OFF | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build bitpit | |
shell: cmd | |
run: | | |
echo OFF | |
echo preloading the mkl environment variable | |
REM calling setvars.bat works properly only if called with call statement. | |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
echo "MKL loaded..... " %SETVARS_COMPLETED% | |
IF "${{ matrix.mpi }}" == "1" (echo "Parallel paradigms... MPI") else (echo "Parallel paradigms... Serial") | |
IF "${{ matrix.debug }}" == "1" (set "buildtype=Debug") ELSE (set "buildtype=Release") | |
echo "Build type..... " %buildtype% | |
set "petscdir=C:\petsc\3_19_5" | |
IF "${{ matrix.mpi }}" == "0" (set "petscdir=%petscdir%SERIAL") | |
echo "PETSc directory..... " %petscdir% | |
echo Set cmake configuration command | |
set "cmake-command="C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 17 2022"" | |
set "cmake-command=%cmake-command% -DBITPIT_BUILD_EXAMPLES=ON | |
set "cmake-command=%cmake-command% -DBITPIT_BUILD_SHARED_LIBS=ON | |
set "cmake-command=%cmake-command% -DBITPIT_ENABLE_INTEGRATION_TESTS=ON \ | |
set "cmake-command=%cmake-command% -DBITPIT_ENABLE_MPI=${{ matrix.mpi }} \ | |
set "cmake-command=%cmake-command% -DBITPIT_ENABLE_UNIT_TESTS=ON \ | |
set "cmake-command=%cmake-command% -DBUILD_TESTING=ON \ | |
set "cmake-command=%cmake-command% -DCMAKE_BUILD_TYPE=%buildtype%"" | |
set "cmake-command=%cmake-command% -DCMAKE_CONFIGURATION_TYPES=%buildtype%"" | |
set "cmake-command=%cmake-command% -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON" | |
set "cmake-command=%cmake-command% -DMETIS_DIR=C:\optimad-dependencies\metis-5.1.0-win\dynamic\" | |
set "cmake-command=%cmake-command% -DPETSC_DIR=%petscdir%" \ | |
set "cmake-command=%cmake-command% .." | |
%cmake-command% | |
echo Build bitpit | |
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" bitpit.sln /t:ALL_BUILD /p:Configuration=Release /p:Platform=x64 | |
- name: Run bitpit tests | |
shell: powershell | |
run: | | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
# Copy dependencies and add them to PATH | |
# TODO: put the dependencies find and copy inside cmake files (everything apart mkl and curl can be found) | |
$WORKDIR ="$PWD\.." | |
Write-Host "MPI IS ? ${{ matrix.mpi }}" | |
if ("${{ matrix.mpi }}" -eq "1"){ | |
$BITPIT_LIBS = "C:\bitpit\bitpit-libraries" | |
}else{ | |
$BITPIT_LIBS = "C:\bitpit\bitpit-libraries-serial" | |
} | |
Write-Host "Collecting bitpit deps in $BITPIT_LIBS" | |
$BITPIT_DEPS = "C:\optimad-dependencies\" | |
if(Test-Path -Path $BITPIT_LIBS){ | |
#removing forcefully the old libraries folder | |
Remove-Item $BITPIT_LIBS -Recurse -Force | |
} | |
#create an empty library folder | |
New-Item -Path $BITPIT_LIBS -ItemType Directory | |
cp "$BITPIT_DEPS\boost\lib\*.dll" $BITPIT_LIBS | |
cp -r "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\redist\intel64\*" $BITPIT_LIBS | |
cp "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\redist\intel64_win\compiler\*.dll" $BITPIT_LIBS | |
if ("${{ matrix.mpi }}" -eq "1"){ | |
Write-Host "copying mpi, metis and MPI petsc" | |
cp "C:\Windows\System32\msmpi.dll" $BITPIT_LIBS | |
cp "$BITPIT_DEPS\metis-5.1.0-win\dynamic\lib\*.dll" $BITPIT_LIBS | |
cp "C:\petsc\3_19_5\lib\*.dll" $BITPIT_LIBS | |
}else{ | |
Write-Host "copying serial petsc" | |
cp "C:\petsc\3_19_5SERIAL\lib\*.dll" $BITPIT_LIBS | |
} | |
cp "$WORKDIR\bitpit-install\bin\*.dll" $BITPIT_LIBS | |
# Set environment PATH | |
$env:Path += ";$BITPIT_LIBS" | |
# Run tests | |
cd build | |
$ctest_command = "ctest.exe -C Release" | |
Invoke-Expression $ctest_command |