Skip to content

Commit d4e5269

Browse files
Adding windows support through conan
1 parent 5a8d2fd commit d4e5269

File tree

3 files changed

+91
-82
lines changed

3 files changed

+91
-82
lines changed

.github/workflows/cd.yml

Lines changed: 70 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,44 @@ jobs:
4545
strategy:
4646
fail-fast: false
4747
matrix:
48-
# platform: [macos-13, windows-latest, ubuntu-latest, macos-14]
49-
platform: [macos-13, ubuntu-latest, macos-14]
48+
platform: [macos-13, windows-latest, ubuntu-latest, macos-14]
5049

5150
runs-on: ${{ matrix.platform }}
5251

5352
steps:
54-
- name: checkout vcell-solvers repo
53+
- name: checkout vcell-ode repo
5554
uses: actions/checkout@v4
5655

57-
- uses: actions/setup-python@v5
56+
- name: Install Python 3.10
57+
uses: actions/setup-python@v5
5858
with:
5959
python-version: '3.10'
6060

61+
- name: Install Windows Dependencies (Part 0 - Setup LLVM-style)
62+
if: matrix.platform == 'windows-latest'
63+
uses: llvm/actions/setup-windows@main
64+
with:
65+
arch: amd64
66+
67+
- name: Install Windows Dependencies (Part 1 - Configure Conan)
68+
if: matrix.platform == 'windows-latest'
69+
shell: powershell
70+
run: |
71+
choco install conan -y
72+
$conanDir = "C:\Program Files\Conan\conan"
73+
$env:PATH = "$conanDir;$env:PATH"
74+
$conanDir | Set-Content -Path $env:GITHUB_PATH
75+
$env:CONAN_HOME = "C:\.conan"
76+
"CONAN_HOME=C:\.conan" | Out-File -FilePath $env:GITHUB_ENV -Append
77+
conan --version
78+
conan profile detect --force
79+
80+
- name: Install Windows Dependencies (Part 2 - Reconfigure Conan)
81+
if: matrix.platform == 'windows-latest'
82+
shell: bash
83+
run: |
84+
cp conan-profiles/CI-CD/Windows-AMD64_profile.txt $CONAN_HOME/profiles/default
85+
6186
- name: Install Intel MacOS dependencies
6287
if: matrix.platform == 'macos-13'
6388
shell: bash
@@ -92,21 +117,24 @@ jobs:
92117
touch ~/.conan2/profiles/default # if we don't make a file first, cp thinks its a folder that doesn't exist
93118
cp conan-profiles/CI-CD/Linux-AMD64_profile.txt ~/.conan2/profiles/default
94119
120+
- name: Install Dependencies through Conan on Windows
121+
if: matrix.platform == 'windows-latest'
122+
shell: powershell
123+
run: |
124+
conan install . --output-folder build --build=missing
125+
95126
- name: Install Dependencies through Conan on Unix
127+
if: matrix.platform != 'windows-latest'
96128
shell: bash
97129
run: |
98-
conan install . --output-folder build --build SundialsSolverStandalone_x64
130+
conan install . --output-folder build --build=missing
99131
100-
# - name: Build on Macos
101-
# if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
102-
# run: |
103-
# platform=macos
104-
# echo "working dir is $PWD"
105-
#
106-
# cd build
107-
# export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
108-
# cmake -B . -S .. -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
109-
# cmake --build .
132+
- name: Build Windows
133+
if: matrix.platform == 'windows-latest'
134+
run: |
135+
cd build
136+
cmake -B . -S .. -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
137+
cmake --build .
110138
111139
- name: Build Unix
112140
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
@@ -117,6 +145,13 @@ jobs:
117145
cmake -B . -S .. -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
118146
cmake --build .
119147
148+
- name: Test Windows
149+
if: matrix.platform == 'windows-latest'
150+
run: |
151+
cd build
152+
ctest -VV
153+
./bin/SundialsSolverStandalone_x64 || true
154+
120155
- name: Test Unix
121156
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14' || matrix.platform == 'ubuntu-latest'
122157
run: |
@@ -127,36 +162,6 @@ jobs:
127162
echo "------ running SundialsSolverStandalone_x64 ------"
128163
./bin/SundialsSolverStandalone_x64 || true
129164
130-
# - name: Setup tmate session
131-
# uses: mxschmitt/action-tmate@v3
132-
# with:
133-
# limit-access-to-actor: false
134-
135-
136-
# - name: Install Windows Dependencies
137-
# if: matrix.platform == 'windows-latest'
138-
# uses: msys2/setup-msys2@v2
139-
# with:
140-
# msystem: CLANG64
141-
# update: true
142-
# install: >
143-
# zip
144-
# git
145-
# mingw-w64-clang-x86_64-curl
146-
# mingw-w64-clang-x86_64-toolchain
147-
# mingw-w64-clang-x86_64-flang
148-
# mingw-w64-clang-x86_64-cmake
149-
# mingw-w64-clang-x86_64-boost
150-
# mingw-w64-clang-x86_64-hdf5
151-
# mingw-w64-clang-x86_64-libzip
152-
# mingw-w64-clang-x86_64-netcdf
153-
# mingw-w64-clang-x86_64-zlib
154-
# mingw-w64-clang-x86_64-libaec
155-
156-
# - name: Setup tmate session
157-
# uses: mxschmitt/action-tmate@v3
158-
# with:
159-
# limit-access-to-actor: false
160165
161166
# - name: Build Windows
162167
# if: matrix.platform == 'windows-latest'
@@ -180,23 +185,6 @@ jobs:
180185
#
181186
# ninja -j 1
182187

183-
# - name: Test Windows
184-
# if: matrix.platform == 'windows-latest'
185-
# shell: msys2 {0}
186-
# run: |
187-
# platform=windows
188-
# echo "working dir is $PWD"
189-
#
190-
# cd build
191-
#
192-
# export PATH="/d/a/_temp/msys64/clang64/bin:$PATH"
193-
# pacman -Sy --noconfirm diffutils
194-
#
195-
# ctest -VV
196-
#
197-
# echo "------ running SundialsSolverStandalone_x64 ------"
198-
# ./bin/SundialsSolverStandalone_x64 || true
199-
200188

201189
- name: fix Macos shared object paths
202190
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
@@ -213,20 +201,20 @@ jobs:
213201
../../.github/scripts/install_name_tool_macos.sh
214202
tar czvf ../upload/mac64.tgz --dereference .
215203
216-
# - name: handle shared object paths for Windows native build
217-
# if: matrix.platform == 'windows-latest'
218-
# shell: msys2 {0}
219-
# run: |
220-
# mkdir build/upload
221-
# cd build/bin
222-
# rm hello_test TestVCellStoch testzip ziptool || true
223-
# ls *.exe | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
224-
# ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
225-
# ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
226-
# chmod u+w,+x *
227-
# zip ../upload/win64.zip ./*
228-
# cd ../..
229-
# # fi
204+
- name: handle shared object paths for Windows native build
205+
if: matrix.platform == 'windows-latest'
206+
shell: bash
207+
run: |
208+
mkdir build/upload
209+
cd build/bin
210+
rm hello_test TestVCellStoch testzip ziptool || true
211+
ls *.exe | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
212+
ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
213+
ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
214+
chmod u+w,+x *
215+
zip ../upload/win64.zip ./*
216+
cd ../..
217+
# fi
230218
231219
- name: handle shared object paths for Linux native build
232220
if: matrix.platform == 'ubuntu-latest'
@@ -256,12 +244,12 @@ jobs:
256244
name: macos_arm64.tgz
257245
path: build/upload/mac64.tgz
258246

259-
# - name: Upload Windows binaries
260-
# if: matrix.platform == 'windows-latest'
261-
# uses: actions/upload-artifact@v4
262-
# with:
263-
# name: win64.zip
264-
# path: build/upload/win64.zip
247+
- name: Upload Windows binaries
248+
if: matrix.platform == 'windows-latest'
249+
uses: actions/upload-artifact@v4
250+
with:
251+
name: win64.zip
252+
path: build/upload/win64.zip
265253

266254
- name: Upload Linux binaries
267255
if: matrix.platform == 'ubuntu-latest'

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ if(POLICY CMP0057)
1717
cmake_policy(SET CMP0057 NEW)
1818
endif()
1919

20+
if (WINDOWS)
21+
cmake_policy(SET CMP0091 NEW)
22+
endif ()
23+
2024
#############################################
2125
# Display extra CMAKE info while configuring
2226
##############################################
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[settings]
2+
os=Windows
3+
arch=x86_64
4+
compiler=clang
5+
compiler.version=16
6+
compiler.libcxx=libc++
7+
compiler.cppstd=17
8+
build_type=Release
9+
10+
[conf]
11+
tools.cmake.cmaketoolchain:generator=Ninja
12+
tools.microsoft.bash:path="C:\Program Files\Git\bin\bash.exe"
13+
14+
[buildenv]
15+
PERL=/c/Strawberry/perl/bin/perl.exe
16+
CC=clang
17+
CXX=clang++

0 commit comments

Comments
 (0)