Skip to content

Commit 1c45a30

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

27 files changed

+288
-202
lines changed

.github/workflows/cd.yml

Lines changed: 87 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,45 @@ 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 ...and zip)
68+
if: matrix.platform == 'windows-latest'
69+
shell: powershell
70+
run: |
71+
choco install zip -y
72+
choco install conan -y
73+
$conanDir = "C:\Program Files\Conan\conan"
74+
$env:PATH = "$conanDir;$env:PATH"
75+
$conanDir | Set-Content -Path $env:GITHUB_PATH
76+
$env:CONAN_HOME = "C:\.conan"
77+
"CONAN_HOME=C:\.conan" | Out-File -FilePath $env:GITHUB_ENV -Append
78+
conan --version
79+
conan profile detect --force
80+
81+
- name: Install Windows Dependencies (Part 2 - Reconfigure Conan)
82+
if: matrix.platform == 'windows-latest'
83+
shell: bash
84+
run: |
85+
cp conan-profiles/CI-CD/Windows-AMD64_profile.txt $CONAN_HOME/profiles/default
86+
6187
- name: Install Intel MacOS dependencies
6288
if: matrix.platform == 'macos-13'
6389
shell: bash
@@ -92,30 +118,54 @@ jobs:
92118
touch ~/.conan2/profiles/default # if we don't make a file first, cp thinks its a folder that doesn't exist
93119
cp conan-profiles/CI-CD/Linux-AMD64_profile.txt ~/.conan2/profiles/default
94120
121+
- name: Install Dependencies through Conan on Windows
122+
if: matrix.platform == 'windows-latest'
123+
shell: powershell
124+
run: |
125+
conan install . --output-folder build --build=missing -o include_messaging=False
126+
95127
- name: Install Dependencies through Conan on Unix
128+
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
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: Install Dependencies through Conan on Unix
134+
if: matrix.platform == 'ubuntu-latest'
135+
shell: bash
136+
run: |
137+
sudo apt --purge remove gcc
138+
sudo ln -s /usr/bin/clang /usr/bin/cc
139+
sudo apt install mold libc++-dev libc++abi-dev
140+
sudo rm /usr/bin/ld
141+
sudo ln -s $(which mold) /usr/bin/ld
142+
conan install . --output-folder build --build=missing
143+
144+
- name: Build Windows
145+
if: matrix.platform == 'windows-latest'
146+
shell: powershell
147+
run: |
148+
cd build
149+
./conanbuild.ps1
150+
cmake -B . -S .. -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug -DOPTION_EXTRA_CONFIG_INFO=ON
151+
cmake --build . --config Release
110152
111153
- name: Build Unix
112154
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
113155
run: |
114156
echo "working dir is $PWD"
115157
116158
cd build
159+
source conanbuild.sh
117160
cmake -B . -S .. -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
118-
cmake --build .
161+
cmake --build . --config Release
162+
163+
- name: Test Windows
164+
if: matrix.platform == 'windows-latest'
165+
run: |
166+
cd build
167+
ctest -VV
168+
./bin/SundialsSolverStandalone_x64 || true
119169
120170
- name: Test Unix
121171
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14' || matrix.platform == 'ubuntu-latest'
@@ -127,76 +177,6 @@ jobs:
127177
echo "------ running SundialsSolverStandalone_x64 ------"
128178
./bin/SundialsSolverStandalone_x64 || true
129179
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
160-
161-
# - name: Build Windows
162-
# if: matrix.platform == 'windows-latest'
163-
# shell: msys2 {0}
164-
# run: |
165-
# platform=windows
166-
# echo "working dir is $PWD"
167-
#
168-
# mkdir build
169-
# cd build
170-
#
171-
# export PATH="/c/Program\ Files/LLVM/bin:$PATH"
172-
#
173-
# cmake \
174-
# -G Ninja \
175-
# -DCMAKE_C_COMPILER="clang.exe" \
176-
# -DCMAKE_CXX_COMPILER="clang++.exe" \
177-
# -DOPTION_TARGET_MESSAGING=OFF \
178-
# -DOPTION_TARGET_DOCS=OFF \
179-
# -B . -S ..
180-
#
181-
# ninja -j 1
182-
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-
200180
201181
- name: fix Macos shared object paths
202182
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
@@ -213,20 +193,21 @@ jobs:
213193
../../.github/scripts/install_name_tool_macos.sh
214194
tar czvf ../upload/mac64.tgz --dereference .
215195
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
196+
- name: handle shared object paths for Windows native build
197+
if: matrix.platform == 'windows-latest'
198+
shell: bash
199+
run: |
200+
mkdir build/upload
201+
cd build/bin
202+
rm hello_test* *.pdb || true
203+
ls *.exe | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
204+
# Currently, Sundials only requires system32 dlls!
205+
# ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
206+
# ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
207+
chmod u+w,+x *
208+
zip ../upload/win64.zip ./*
209+
cd ../..
210+
# fi
230211
231212
- name: handle shared object paths for Linux native build
232213
if: matrix.platform == 'ubuntu-latest'
@@ -256,12 +237,12 @@ jobs:
256237
name: macos_arm64.tgz
257238
path: build/upload/mac64.tgz
258239

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
240+
- name: Upload Windows binaries
241+
if: matrix.platform == 'windows-latest'
242+
uses: actions/upload-artifact@v4
243+
with:
244+
name: win64.zip
245+
path: build/upload/win64.zip
265246

266247
- name: Upload Linux binaries
267248
if: matrix.platform == 'ubuntu-latest'

CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
##############################################
66
cmake_minimum_required(VERSION 3.13)
77
project(vcell-ode-numerics)
8-
set(CMAKE_CXX_STANDARD 17)
8+
set(CMAKE_CXX_STANDARD 20)
9+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
10+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
11+
endif ()
912
enable_language(CXX)
1013
enable_language(C)
1114
#enable_language(Fortran)
@@ -17,10 +20,14 @@ if(POLICY CMP0057)
1720
cmake_policy(SET CMP0057 NEW)
1821
endif()
1922

23+
if (WINDOWS)
24+
cmake_policy(SET CMP0091 NEW)
25+
endif ()
26+
2027
#############################################
2128
# Display extra CMAKE info while configuring
2229
##############################################
23-
option(OPTION_EXTRA_CONFIG_INFO "Print useful cmake debug info while configuring" off)
30+
option(OPTION_EXTRA_CONFIG_INFO "Print useful cmake debug info while configuring" OFF)
2431

2532
#############################################
2633
#
@@ -83,10 +90,9 @@ endif()
8390
#include (CheckCSourceRuns)
8491
#include (CheckSymbolExists)
8592
#include (CheckTypeSize)
86-
include (FindZLIB)
8793

8894
option(OPTION_TARGET_MESSAGING "Messaging (requires libcurl)" off)
89-
option(OPTION_TARGET_DOCS "Generate Doxygen documentation" on)
95+
option(OPTION_TARGET_DOCS "Generate Doxygen documentation" off)
9096

9197

9298
if (${OPTION_TARGET_DOCS})
@@ -225,6 +231,5 @@ if (OPTION_EXTRA_CONFIG_INFO)
225231
cmake_print_variables(CMAKE_SYSTEM_NAME WINDOWS WIN32 MINGW APPLE ARCH_64bit ARCH_32bit)
226232
# cmake_print_variables(CMAKE_CPP_COMPILER CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_Fortran_COMPILER)
227233
cmake_print_variables(CMAKE_CPP_COMPILER CMAKE_C_COMPILER CMAKE_CXX_COMPILER)
228-
cmake_print_variables(HAVE_ZLIB)
229234
endif ()
230235

IDAWin/SundialsSolverStandalone.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void printUsage() {
3838
std::cout << usageMessage << std::endl;
3939
}
4040

41-
void loadJMSInfo(istream& ifsInput, int taskID) {
41+
void loadJMSInfo(std::istream& ifsInput, int taskID) {
4242
char *broker = new char[256];
4343
char *smqusername = new char[256];
4444
char *password = new char[256];
@@ -59,21 +59,32 @@ void loadJMSInfo(istream& ifsInput, int taskID) {
5959
} else if (nextToken == "JMS_PARAM_END") {
6060
break;
6161
} else if (nextToken == "JMS_BROKER") {
62+
std::string brokerStr;
63+
ifsInput >> brokerStr;
6264
memset(broker, 0, 256 * sizeof(char));
63-
ifsInput >> broker;
65+
strncpy(broker, brokerStr.c_str(), 256);
6466
} else if (nextToken == "JMS_USER") {
67+
std::string usernameStr, passwordStr;
68+
ifsInput >> usernameStr >> passwordStr;
6569
memset(smqusername, 0, 256 * sizeof(char));
6670
memset(password, 0, 256 * sizeof(char));
67-
ifsInput >> smqusername >> password;
71+
strncpy(smqusername, usernameStr.c_str(), 256);
72+
strncpy(password, passwordStr.c_str(), 256);
6873
} else if (nextToken == "JMS_QUEUE") {
74+
std::string qnameStr;
75+
ifsInput >> qnameStr;
6976
memset(qname, 0, 256 * sizeof(char));
70-
ifsInput >> qname;
77+
strncpy(qname, qnameStr.c_str(), 256);
7178
} else if (nextToken == "JMS_TOPIC") {
79+
std::string topicStr;
80+
ifsInput >> topicStr;
7281
memset(tname, 0, 256 * sizeof(char));
73-
ifsInput >> tname;
82+
strncpy(tname, topicStr.c_str(), 256);
7483
} else if (nextToken == "VCELL_USER") {
84+
std::string vcusernameStr;
85+
ifsInput >> vcusernameStr;
7586
memset(vcusername, 0, 256 * sizeof(char));
76-
ifsInput >> vcusername;
87+
strncpy(vcusername, vcusernameStr.c_str(), 256);
7788
} else if (nextToken == "SIMULATION_KEY") {
7889
ifsInput >> simKey;
7990
continue;
@@ -217,7 +228,7 @@ int main(int argc, char *argv[]) {
217228
} else if (solver == CVODE_SOLVER) {
218229
vss = new VCellCVodeSolver();
219230
} else {
220-
stringstream ss;
231+
std::stringstream ss;
221232
ss << "Solver " << solver << " not defined!";
222233
throw ss.str();
223234
}

IDAWin/VCellCVodeSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Input format:
176176
ODE x_o INIT 0.0;
177177
RATE ( - ((20.0 * x_o * D_B0) - (50.0 * x_i)) + (1505000.0 * (3.322259136212625E-4 - (3.322259136212625E-4 * x_o) - (3.322259136212625E-4 * x_i))) - (100.0 * x_o));
178178
*/
179-
void VCellCVodeSolver::readEquations(istream& inputstream) {
179+
void VCellCVodeSolver::readEquations(std::istream& inputstream) {
180180
try {
181181
string name;
182182
string exp;

IDAWin/VCellCVodeSolver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class VCellCVodeSolver : public VCellSundialsSolver {
1212
double RHS(double* allValues, int equationIndex);
1313

1414
protected:
15-
void readEquations(istream& inputstream);
15+
void readEquations(std::istream& inputstream);
1616
void initialize();
1717
string getSolverName() { return "CVODE"; }
1818

1919
private:
20-
Expression** rateExpressions;
20+
VCell::Expression** rateExpressions;
2121

2222
int RHS(realtype t, N_Vector y, N_Vector yp);
2323
static int RHS_callback(realtype t, N_Vector y, N_Vector r, void *fdata);

IDAWin/VCellIDASolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ Input format:
292292
((1505000.0 * (3.3222591362126253E-4 - (3.322259136212625E-4 * x_i) - (3.322259136212625E-4 * x_o))) - (100.0 * x_o));
293293
--------------------------------------------------------------*/
294294

295-
void VCellIDASolver::readEquations(istream& inputstream) {
295+
void VCellIDASolver::readEquations(std::istream& inputstream) {
296296
try {
297297
string token;
298298
string exp;

0 commit comments

Comments
 (0)