Skip to content

Commit e4a627f

Browse files
committed
Update build configuration and make project compile again on all supported platforms
1 parent cad3c1b commit e4a627f

11 files changed

Lines changed: 196 additions & 194 deletions

File tree

.github/workflows/build.yml

Lines changed: 163 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,59 @@ on:
88
- 'v[0-9]+.[0-9]+.[0-9]+'
99

1010
jobs:
11-
# build-windows:
12-
# runs-on: windows-2022
13-
# timeout-minutes: 30
14-
# defaults:
15-
# run:
16-
# shell: cmd
17-
# env:
18-
# RUSTFLAGS: -D warnings # Make Rust compiler fail on warnings
19-
# steps:
20-
# - uses: actions/checkout@v4
21-
# with:
22-
# path: virtualbow
23-
#
24-
# - name: Get dependencies
25-
# run: |
26-
# choco install ninja
27-
# curl -LO https://github.com/bow-simulation/virtualbow-dependencies/releases/download/v1.5.0/windows-mingw_64.zip && 7z x windows-mingw_64.zip
28-
#
29-
# - name: Extract test files
30-
# run: |
31-
# cd virtualbow/rust/virtualbow/data
32-
# 7z x examples.zip -p${{ secrets.UNZIP_PASSWORD }}
33-
#
34-
# - name: Build and test solver
35-
# run: |
36-
# cd virtualbow/rust
37-
# cargo clippy --all-targets
38-
# cargo build --release
39-
# cargo test --release
40-
#
41-
# - name: Build and test application
42-
# run: |
43-
# mkdir build && cd build
44-
# cmake ../virtualbow/gui -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../windows-mingw_64/paths.cmake
45-
# cmake --build . -j4
46-
# cmake --build . --target iss-installer -j4
47-
# virtualbow-test.exe
48-
#
49-
# - uses: actions/upload-artifact@v4
50-
# with:
51-
# name: windows-application
52-
# path: build/application
53-
#
54-
# - uses: actions/upload-artifact@v4
55-
# with:
56-
# name: windows-packages
57-
# path: build/packages
11+
build-windows:
12+
runs-on: windows-2022
13+
timeout-minutes: 30
14+
defaults:
15+
run:
16+
shell: cmd
17+
env:
18+
RUSTFLAGS: -D warnings # Make Rust compiler fail on warnings
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
path: virtualbow
23+
24+
- uses: TheMrMilchmann/setup-msvc-dev@v3 # Setup MSVC build environment
25+
with:
26+
arch: x64
27+
28+
- name: Get dependencies
29+
run: |
30+
choco install ninja
31+
curl -LO https://github.com/bow-simulation/virtualbow-dependencies/releases/download/v1.6.0/windows-msvc_64.zip && 7z x windows-msvc_64.zip
32+
33+
- name: Extract test files
34+
run: |
35+
cd virtualbow/rust/virtualbow/data
36+
7z x examples.zip -p${{ secrets.UNZIP_PASSWORD }}
37+
38+
- name: Build and test solver
39+
run: |
40+
cd virtualbow/rust
41+
cargo clippy --all-targets
42+
cargo build --release
43+
cargo test --release
44+
45+
- name: Build and test application
46+
run: |
47+
mkdir build && cd build
48+
cmake ../virtualbow/gui -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../windows-msvc_64/paths.cmake
49+
cmake --build . -j4
50+
cmake --build . --target iss-installer -j4
51+
virtualbow-test.exe
52+
53+
- uses: actions/upload-artifact@v4
54+
with:
55+
name: windows-application
56+
path: build/application
57+
if-no-files-found: error
58+
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
name: windows-packages
62+
path: build/packages
63+
if-no-files-found: error
5864

5965
build-linux:
6066
runs-on: ubuntu-24.04
@@ -69,7 +75,7 @@ jobs:
6975
- name: Get dependencies
7076
run: |
7177
sudo apt install -y ninja-build qt6-base-dev pkg-config libfreetype6-dev libfontconfig1-dev
72-
curl -LO https://github.com/bow-simulation/virtualbow-dependencies/releases/download/v1.5.0/linux-gcc_64.zip && unzip linux-gcc_64.zip
78+
curl -LO https://github.com/bow-simulation/virtualbow-dependencies/releases/download/v1.6.0/linux-gcc_64.zip && unzip linux-gcc_64.zip
7379
7480
- name: Extract test files
7581
run: |
@@ -96,115 +102,118 @@ jobs:
96102
with:
97103
name: linux-application
98104
path: build/application
105+
if-no-files-found: error
99106

100107
- uses: actions/upload-artifact@v4
101108
with:
102109
name: linux-packages
103110
path: build/packages
111+
if-no-files-found: error
112+
113+
build-macos:
114+
runs-on: macos-13
115+
timeout-minutes: 30
116+
env:
117+
RUSTFLAGS: -D warnings # Make Rust compiler fail on warnings
118+
steps:
119+
- uses: actions/checkout@v4
120+
with:
121+
path: virtualbow
122+
123+
- name: Get dependencies
124+
run: |
125+
npm install -g [email protected] --no-audit
126+
curl -LO https://github.com/bow-simulation/virtualbow-dependencies/releases/download/v1.6.0/macos-clang_64.zip && unzip macos-clang_64.zip
127+
chmod -R 755 macos-clang_64
128+
129+
- name: Extract test files
130+
run: |
131+
cd virtualbow/rust/virtualbow/data
132+
7z x examples.zip -p${{ secrets.UNZIP_PASSWORD }}
133+
134+
- name: Build and test solver
135+
run: |
136+
cd virtualbow/rust
137+
cargo clippy --all-targets
138+
cargo build --release
139+
cargo test --release
140+
141+
- name: Build and test application
142+
run: |
143+
mkdir build && cd build
144+
cmake ../virtualbow/gui -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../macos-clang_64/paths.cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
145+
cmake --build . -j4
146+
cmake --build . --target dmg-installer -j4
147+
./virtualbow-test
148+
149+
- uses: actions/upload-artifact@v4
150+
with:
151+
name: macos-application
152+
path: build/application
153+
if-no-files-found: error
154+
155+
- uses: actions/upload-artifact@v4
156+
with:
157+
name: macos-packages
158+
path: build/packages
159+
if-no-files-found: error
160+
161+
develop-release:
162+
if: github.ref == 'refs/heads/develop'
163+
runs-on: ubuntu-latest
164+
needs: [build-windows, build-linux, build-macos]
165+
steps:
166+
- uses: actions/download-artifact@v4
167+
with:
168+
name: windows-packages
169+
- uses: actions/download-artifact@v4
170+
with:
171+
name: linux-packages
172+
- uses: actions/download-artifact@v4
173+
with:
174+
name: macos-packages
175+
176+
- name: Rename packages
177+
run: |
178+
mv virtualbow-setup.exe virtualbow-${GITHUB_SHA::7}-win64.exe
179+
mv virtualbow.deb virtualbow-${GITHUB_SHA::7}-linux64.deb
180+
mv virtualbow.rpm virtualbow-${GITHUB_SHA::7}-linux64.rpm
181+
mv virtualbow.dmg virtualbow-${GITHUB_SHA::7}-mac64.dmg
104182
105-
# build-macos:
106-
# runs-on: macos-13
107-
# timeout-minutes: 30
108-
# env:
109-
# RUSTFLAGS: -D warnings # Make Rust compiler fail on warnings
110-
# steps:
111-
# - uses: actions/checkout@v4
112-
# with:
113-
# path: virtualbow
114-
#
115-
# - name: Get dependencies
116-
# run: |
117-
# brew install ninja
118-
# npm install -g [email protected] --no-audit
119-
# curl -LO https://github.com/bow-simulation/virtualbow-dependencies/releases/download/v1.5.0/macos-clang_64.zip && unzip macos-clang_64.zip
120-
# chmod -R 755 macos-clang_64
121-
#
122-
# - name: Extract test files
123-
# run: |
124-
# cd virtualbow/rust/virtualbow/data
125-
# 7z x examples.zip -p${{ secrets.UNZIP_PASSWORD }}
126-
#
127-
# - name: Build and test solver
128-
# run: |
129-
# cd virtualbow/rust
130-
# cargo clippy --all-targets
131-
# cargo build --release
132-
# cargo test --release
133-
#
134-
# - name: Build and test application
135-
# run: |
136-
# mkdir build && cd build
137-
# cmake ../virtualbow/gui -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../macos-clang_64/paths.cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
138-
# cmake --build . -j4
139-
# cmake --build . --target dmg-installer -j4
140-
# ./virtualbow-test
141-
#
142-
# - uses: actions/upload-artifact@v4
143-
# with:
144-
# name: macos-application
145-
# path: build/application
146-
#
147-
# - uses: actions/upload-artifact@v4
148-
# with:
149-
# name: macos-packages
150-
# path: build/packages
151-
152-
# develop-release:
153-
# if: github.ref == 'refs/heads/develop'
154-
# runs-on: ubuntu-latest
155-
# needs: [build-windows, build-linux, build-macos]
156-
# steps:
157-
# - uses: actions/download-artifact@v4
158-
# with:
159-
# name: windows-packages
160-
# - uses: actions/download-artifact@v4
161-
# with:
162-
# name: linux-packages
163-
# - uses: actions/download-artifact@v4
164-
# with:
165-
# name: macos-packages
166-
#
167-
# - name: Rename packages
168-
# run: |
169-
# mv virtualbow-setup.exe virtualbow-${GITHUB_SHA::7}-win64.exe
170-
# mv virtualbow.deb virtualbow-${GITHUB_SHA::7}-linux64.deb
171-
# mv virtualbow.rpm virtualbow-${GITHUB_SHA::7}-linux64.rpm
172-
# mv virtualbow.dmg virtualbow-${GITHUB_SHA::7}-mac64.dmg
173-
#
174-
# - name: Create release
175-
# uses: marvinpinto/[email protected]
176-
# with:
177-
# repo_token: ${{ secrets.RELEASE_TOKEN }}
178-
# automatic_release_tag: latest
179-
# prerelease: true
180-
# title: Development Build
181-
# files: virtualbow*
182-
183-
# tagged-release:
184-
# if: startsWith(github.ref, 'refs/tags')
185-
# runs-on: ubuntu-latest
186-
# needs: [build-windows, build-linux, build-macos]
187-
# steps:
188-
# - uses: actions/download-artifact@v4
189-
# with:
190-
# name: windows-packages
191-
# - uses: actions/download-artifact@v4
192-
# with:
193-
# name: linux-packages
194-
# - uses: actions/download-artifact@v4
195-
# with:
196-
# name: macos-packages
197-
#
198-
# - name: Rename packages
199-
# run: |
200-
# mv virtualbow-setup.exe virtualbow-${{github.ref_name}}-win64.exe
201-
# mv virtualbow.deb virtualbow-${{github.ref_name}}-linux64.deb
202-
# mv virtualbow.rpm virtualbow-${{github.ref_name}}-linux64.rpm
203-
# mv virtualbow.dmg virtualbow-${{github.ref_name}}-mac64.dmg
204-
#
205-
# - name: Create release
206-
# uses: marvinpinto/action-automatic-releases@latest
207-
# with:
208-
# repo_token: ${{ secrets.RELEASE_TOKEN }}
209-
# draft: true
210-
# files: virtualbow*
183+
- name: Create release
184+
uses: marvinpinto/[email protected]
185+
with:
186+
repo_token: ${{ secrets.RELEASE_TOKEN }}
187+
automatic_release_tag: latest
188+
prerelease: true
189+
title: Development Build
190+
files: virtualbow*
191+
192+
tagged-release:
193+
if: startsWith(github.ref, 'refs/tags')
194+
runs-on: ubuntu-latest
195+
needs: [build-windows, build-linux, build-macos]
196+
steps:
197+
- uses: actions/download-artifact@v4
198+
with:
199+
name: windows-packages
200+
- uses: actions/download-artifact@v4
201+
with:
202+
name: linux-packages
203+
- uses: actions/download-artifact@v4
204+
with:
205+
name: macos-packages
206+
207+
- name: Rename packages
208+
run: |
209+
mv virtualbow-setup.exe virtualbow-${{github.ref_name}}-win64.exe
210+
mv virtualbow.deb virtualbow-${{github.ref_name}}-linux64.deb
211+
mv virtualbow.rpm virtualbow-${{github.ref_name}}-linux64.rpm
212+
mv virtualbow.dmg virtualbow-${{github.ref_name}}-mac64.dmg
213+
214+
- name: Create release
215+
uses: marvinpinto/action-automatic-releases@latest
216+
with:
217+
repo_token: ${{ secrets.RELEASE_TOKEN }}
218+
draft: true
219+
files: virtualbow*

gui/CMakeLists.txt

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
cmake_minimum_required(VERSION 3.10.2)
1+
cmake_minimum_required(VERSION 3.13)
22
project(virtualbow)
3-
set(CMAKE_CXX_STANDARD 17)
3+
set(CMAKE_CXX_STANDARD 20)
44
set(CMAKE_CXX_STANDARD_REQUIRED ON)
55

6-
include(CheckCXXCompilerFlag)
7-
86
# Parameters
97

108
set(APPLICATION_NAME "VirtualBow")
@@ -36,10 +34,6 @@ include_directories(source ${PROJECT_BINARY_DIR})
3634
include_directories("../rust/virtualbow_ffi")
3735
link_directories("../rust/target/release")
3836

39-
# Compiler flags
40-
41-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-math-errno") # Don't make standard math functions set error flags
42-
4337
# Target: Solver library
4438

4539
add_library(
@@ -49,11 +43,8 @@ add_library(
4943
source/solver/Defaults.cpp
5044
)
5145

52-
target_link_libraries(
53-
virtualbow-lib
54-
virtualbow_ffi
55-
nlohmann_json::nlohmann_json
56-
)
46+
target_link_libraries(virtualbow-lib virtualbow_ffi nlohmann_json::nlohmann_json)
47+
target_link_libraries(virtualbow-lib $<$<PLATFORM_ID:Windows>:ws2_32.lib;Userenv.lib;ntdll.lib;>) # Add missing Windows libraries
5748

5849
# Target: Gui executable
5950

@@ -197,9 +188,7 @@ add_executable(
197188

198189
target_compile_definitions(virtualbow-gui PRIVATE JSON_HAS_CPP_17)
199190

200-
target_link_libraries(
201-
virtualbow-gui
202-
virtualbow-lib
191+
target_link_libraries(virtualbow-gui virtualbow-lib
203192
Threads::Threads
204193
${OPENGL_gl_LIBRARY}
205194
Qt6::Widgets
@@ -314,7 +303,7 @@ add_custom_command(
314303
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../rust/target/release/virtualbow_cli.exe ${CMAKE_BINARY_DIR}/application/virtualbow-cli.exe
315304
)
316305

317-
# Platform specifics
306+
# Platform-specific build targets
318307

319308
if(WIN32)
320309
add_subdirectory(platforms/windows)

0 commit comments

Comments
 (0)