Skip to content

Adding windows support through conan #30

Adding windows support through conan

Adding windows support through conan #30

Workflow file for this run

name: CD
on: [push, workflow_dispatch]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
#jobs:
# build-and-push-image:
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
#
# - name: Log in to the Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
#
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
jobs:
native-build:
name:
native-build-${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [macos-13, windows-latest, ubuntu-latest, macos-14]
runs-on: ${{ matrix.platform }}
steps:
- name: checkout vcell-solvers repo
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Windows Dependencies (Part 0 - Setup LLVM-style)
if: ${{ matrix.os == 'windows-latest'}}
uses: llvm/actions/setup-windows@main
with:
arch: amd64
- name: Install Windows Dependencies (Part 1 - Configure Conan)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
choco install conan -y
$conanDir = "C:\Program Files\Conan\conan"
$env:PATH = "$conanDir;$env:PATH"
$conanDir | Set-Content -Path $env:GITHUB_PATH
$env:CONAN_HOME = "C:\.conan"
"CONAN_HOME=C:\.conan" | Out-File -FilePath $env:GITHUB_ENV -Append
conan --version
conan profile detect --force
- name: Install Intel MacOS dependencies
if: matrix.platform == 'macos-13'
shell: bash
run: |
brew install conan
conan --version
mkdir -p ~/.conan2/profiles/
touch ~/.conan2/profiles/default # if we don't make a file first, cp thinks its a folder that doesn't exist
cp conan-profiles/CI-CD/MacOS-AMD64_profile.txt ~/.conan2/profiles/default
- name: Install ARM MacOS dependencies
if: matrix.platform == 'macos-14'
shell: bash
run: |
brew install conan
conan --version
mkdir -p ~/.conan2/profiles/
touch ~/.conan2/profiles/default # if we don't make a file first, cp thinks its a folder that doesn't exist
cp conan-profiles/CI-CD/MacOS-ARM8_profile.txt ~/.conan2/profiles/default
- name: Install Linux Dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install -y wget
wget --version
wget https://github.com/conan-io/conan/releases/download/2.17.0/conan-2.17.0-amd64.deb
sudo apt install -y ./conan-*.deb
conan --version
mkdir -p ~/.conan2/profiles/
touch ~/.conan2/profiles/default # if we don't make a file first, cp thinks its a folder that doesn't exist
cp conan-profiles/CI-CD/Linux-AMD64_profile.txt ~/.conan2/profiles/default
- name: Install Dependencies through Conan on Unix
shell: bash
run: |
conan install . --output-folder build --build SundialsSolverStandalone_x64
- name: Build Windows
if: matrix.platform == 'windows-latest'
run: |
cd build
cmake -B . -S .. -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
cmake --build .
- name: Build Unix
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
run: |
echo "working dir is $PWD"
cd build
cmake -B . -S .. -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
cmake --build .
- name: Test Unix
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14' || matrix.platform == 'ubuntu-latest'
run: |
cd build
ctest -VV
echo "------ running SundialsSolverStandalone_x64 ------"
./bin/SundialsSolverStandalone_x64 || true
# - name: Build Windows
# if: matrix.platform == 'windows-latest'
# shell: msys2 {0}
# run: |
# platform=windows
# echo "working dir is $PWD"
#
# mkdir build
# cd build
#
# export PATH="/c/Program\ Files/LLVM/bin:$PATH"
#
# cmake \
# -G Ninja \
# -DCMAKE_C_COMPILER="clang.exe" \
# -DCMAKE_CXX_COMPILER="clang++.exe" \
# -DOPTION_TARGET_MESSAGING=OFF \
# -DOPTION_TARGET_DOCS=OFF \
# -B . -S ..
#
# ninja -j 1
- name: Test Windows
if: matrix.platform == 'windows-latest'
run: |
cd build
ctest -VV
./bin/SundialsSolverStandalone_x64 || true
- name: fix Macos shared object paths
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
shell: bash
run: |
mkdir build/upload
cd build/bin
rm hello_test TestVCellStoch testzip ziptool || true
ls *_x64 | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
chmod u+w,+x *
tar czvf ../upload/mac64_bad_paths.tgz .
../../.github/scripts/install_name_tool_macos.sh
tar czvf ../upload/mac64.tgz --dereference .
- name: handle shared object paths for Windows native build
if: matrix.platform == 'windows-latest'
shell: bash
run: |
mkdir build/upload
cd build/bin
rm hello_test TestVCellStoch testzip ziptool || true
ls *.exe | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
chmod u+w,+x *
zip ../upload/win64.zip ./*
cd ../..
# fi
- name: handle shared object paths for Linux native build
if: matrix.platform == 'ubuntu-latest'
shell: bash
run: |
mkdir build/upload
cd build/bin
rm hello_test TestVCellStoch testzip ziptool || true
ls *_x64 | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
chmod u+w,+x *
tar czvf ../upload/linux64.tgz --dereference .
cd ../..
- name: Upload Intel Macos binaries
if: matrix.platform == 'macos-13'
uses: actions/upload-artifact@v4
with:
name: macos_x86_64.tgz
path: build/upload/mac64.tgz
- name: Upload ARM Macos binaries
if: matrix.platform == 'macos-14'
uses: actions/upload-artifact@v4
with:
name: macos_arm64.tgz
path: build/upload/mac64.tgz
- name: Upload Windows binaries
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: win64.zip
path: build/upload/win64.zip
- name: Upload Linux binaries
if: matrix.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: linux64.tgz
path: build/upload/linux64.tgz
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: false