Skip to content

Commit bc6abca

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

File tree

3 files changed

+87
-79
lines changed

3 files changed

+87
-79
lines changed

.github/workflows/cd.yml

Lines changed: 68 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ 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

@@ -58,6 +57,32 @@ jobs:
5857
with:
5958
python-version: '3.10'
6059

60+
- name: Install Windows Dependencies (Part 0 - Setup LLVM-style)
61+
if: matrix.platform == 'windows-latest'
62+
uses: llvm/actions/setup-windows@main
63+
with:
64+
arch: amd64
65+
66+
- name: Install Windows Dependencies (Part 1 - Configure Conan)
67+
if: matrix.platform == 'windows-latest'
68+
shell: powershell
69+
run: |
70+
choco install strawberryperl -y
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,25 @@ 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: bash
123+
run: |
124+
set PERL=C:\Strawberry\perl\bin\perl.exe
125+
conan install . --output-folder build --build=missing
126+
95127
- name: Install Dependencies through Conan on Unix
128+
if: matrix.platform != 'windows-latest'
96129
shell: bash
97130
run: |
98-
conan install . --output-folder build --build SundialsSolverStandalone_x64
131+
conan install . --output-folder build --build=missing
99132
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 .
133+
- name: Build Windows
134+
if: matrix.platform == 'windows-latest'
135+
run: |
136+
cd build
137+
cmake -B . -S .. -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
138+
cmake --build .
110139
111140
- name: Build Unix
112141
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
@@ -127,36 +156,6 @@ jobs:
127156
echo "------ running SundialsSolverStandalone_x64 ------"
128157
./bin/SundialsSolverStandalone_x64 || true
129158
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
160159
161160
# - name: Build Windows
162161
# if: matrix.platform == 'windows-latest'
@@ -180,22 +179,12 @@ jobs:
180179
#
181180
# ninja -j 1
182181

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
182+
- name: Test Windows
183+
if: matrix.platform == 'windows-latest'
184+
run: |
185+
cd build
186+
ctest -VV
187+
./bin/SundialsSolverStandalone_x64 || true
199188
200189
201190
- name: fix Macos shared object paths
@@ -213,20 +202,20 @@ jobs:
213202
../../.github/scripts/install_name_tool_macos.sh
214203
tar czvf ../upload/mac64.tgz --dereference .
215204
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
205+
- name: handle shared object paths for Windows native build
206+
if: matrix.platform == 'windows-latest'
207+
shell: bash
208+
run: |
209+
mkdir build/upload
210+
cd build/bin
211+
rm hello_test TestVCellStoch testzip ziptool || true
212+
ls *.exe | 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+
ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
215+
chmod u+w,+x *
216+
zip ../upload/win64.zip ./*
217+
cd ../..
218+
# fi
230219
231220
- name: handle shared object paths for Linux native build
232221
if: matrix.platform == 'ubuntu-latest'
@@ -256,12 +245,12 @@ jobs:
256245
name: macos_arm64.tgz
257246
path: build/upload/mac64.tgz
258247

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
248+
- name: Upload Windows binaries
249+
if: matrix.platform == 'windows-latest'
250+
uses: actions/upload-artifact@v4
251+
with:
252+
name: win64.zip
253+
path: build/upload/win64.zip
265254

266255
- name: Upload Linux binaries
267256
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
13+
[buildenv]
14+
CC=clang
15+
CXX=clang++

0 commit comments

Comments
 (0)