Skip to content

Commit d924440

Browse files
authored
Update CMake presets and use newer vcpkg baseline and other CI updates (#247)
* Update CMake presets and use newer vcpkg baseline * Update main branch name in github workflows * Update cmake version in project and fix boost name in vcpkg manifest * Update all CI jobs to be simple and use new versions
1 parent 15dac5d commit d924440

11 files changed

Lines changed: 53 additions & 68 deletions

File tree

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
on:
22
push:
33
branches:
4-
- master
4+
- main
55
pull_request:
66
branches:
7-
- master
7+
- main
88

99
name: ci
1010

@@ -17,15 +17,15 @@ jobs:
1717
uses: actions/checkout@master
1818

1919
- name: Check Sources
20-
uses: DoozyX/clang-format-lint-action@v0.11
20+
uses: DoozyX/clang-format-lint-action@v0.17
2121
with:
2222
source: './src'
2323
extensions: 'h,cpp,hpp'
24-
clangFormatVersion: 11
24+
clangFormatVersion: 17
2525

2626
- name: Check Examples
27-
uses: DoozyX/clang-format-lint-action@v0.11
27+
uses: DoozyX/clang-format-lint-action@v0.17
2828
with:
2929
source: './examples'
3030
extensions: 'h,cpp,hpp'
31-
clangFormatVersion: 11
31+
clangFormatVersion: 17

.github/workflows/unix_build.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
on:
22
push:
33
branches:
4-
- master
4+
- main
55
pull_request:
66
branches:
7-
- master
7+
- main
88

99
name: ci
1010

@@ -13,18 +13,18 @@ jobs:
1313
name: OpenGL
1414
runs-on: ${{ matrix.os }}
1515
env:
16-
CMAKE_VER: 3.5.1
16+
CMAKE_VER: 3.16.3
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
window_toolkit: [glfw3, sdl2]
21-
os: [ubuntu-18.04, macos-latest]
21+
os: [ubuntu-latest, macos-latest]
2222

2323
steps:
2424
- name: Checkout Repository
2525
uses: actions/checkout@master
2626

27-
- name: Download CMake 3.5.1 for Linux
27+
- name: Download CMake for Linux
2828
if: matrix.os != 'macos-latest'
2929
env:
3030
OS_NAME: ${{ matrix.os }}
@@ -48,7 +48,7 @@ jobs:
4848
echo "CMAKE_PROGRAM=cmake" >> $GITHUB_ENV
4949
5050
- name: Install Common Dependencies for Ubuntu
51-
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
51+
if: matrix.os == 'ubuntu-latest'
5252
run: |
5353
sudo add-apt-repository ppa:mhier/libboost-latest
5454
sudo apt-get -qq update
@@ -66,7 +66,7 @@ jobs:
6666
brew install $pkg
6767
6868
- name: Install Linux Window Toolkit
69-
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
69+
if: matrix.os == 'ubuntu-latest'
7070
env:
7171
FG_TOOLKIT: ${{ matrix.window_toolkit }}
7272
run: |
@@ -79,9 +79,7 @@ jobs:
7979
FG_TOOLKIT: ${{ matrix.window_toolkit }}
8080
run: |
8181
mkdir build && cd build
82-
${CMAKE_PROGRAM} -DCMAKE_C_COMPILER=gcc-6 \
83-
-DCMAKE_CXX_COMPILER=g++-6 \
84-
-DFG_USE_WINDOW_TOOLKIT:STRING=${FG_TOOLKIT} ..
82+
${CMAKE_PROGRAM} -DFG_USE_WINDOW_TOOLKIT:STRING=${FG_TOOLKIT} ..
8583
8684
- name: CMake Configure on OSX
8785
if: matrix.os == 'macos-latest'

.github/workflows/windows_build.yml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,38 @@
11
on:
22
push:
33
branches:
4-
- master
4+
- main
55
tags:
66
- 'v*'
77
pull_request:
88
branches:
9-
- master
9+
- main
1010

1111
name: ci
1212

1313
jobs:
1414
build_opengl_backend:
1515
name: OpenGL
16-
runs-on: ${{ matrix.os }}
17-
env:
18-
FREEIMAGE_VER: 3.18.0
19-
FREEIMAGE_VER_STR: 3180
2016
strategy:
2117
fail-fast: false
2218
matrix:
2319
window_toolkit: [glfw3, sdl2]
2420
os: [windows-latest]
21+
runs-on: ${{ matrix.os }}
2522
steps:
2623
- name: Checkout Repository
2724
uses: actions/checkout@master
2825

29-
- name: FreeImage Cache
30-
uses: actions/cache@v1
31-
id: freeimage-cache
32-
with:
33-
path: freeimage
34-
key: freeimage-${{ env.FREEIMAGE_VER }}
35-
36-
- name: FreeImage Download
37-
if: steps.freeimage-cache.outputs.cache-hit != 'true'
38-
run: |
39-
$url = 'https://nchc.dl.sourceforge.net/project/freeimage/Binary%20Distribution/{0}/FreeImage{1}Win32Win64.zip' -f $env:FREEIMAGE_VER, $env:FREEIMAGE_VER_STR
40-
Invoke-WebRequest -Uri $url -OutFile freeimage.zip
41-
Expand-Archive .\freeimage.zip -DestinationPath .\
42-
Remove-Item -Path .\freeimage.zip
43-
44-
- name: Install Common Dependencies
45-
run: |
46-
$vcpkg_triplet_path = $env:GITHUB_WORKSPACE + "/CMakeModules/ForgeFreetypeVCPKGTriplet.cmake"
47-
Copy-Item -Path $vcpkg_triplet_path -Destination C:/vcpkg/triplets/x64-windows.cmake
48-
vcpkg install --triplet x64-windows boost-functional freetype opencl
49-
50-
- name: Install GLFW3
51-
if: matrix.window_toolkit == 'glfw3'
52-
run: vcpkg install glfw3:x64-windows
53-
54-
- name: Install SDL2
55-
if: matrix.window_toolkit == 'sdl2'
56-
run: vcpkg install sdl2:x64-windows
26+
- name: Setup vcpkg
27+
uses: lukka/run-vcpkg@v11
5728

5829
- name: Configure and Build
5930
env:
6031
FG_TOOLKIT: ${{ matrix.window_toolkit }}
6132
run: |
6233
mkdir build && cd build
6334
cmake `
64-
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:\vcpkg\scripts\buildsystems\vcpkg.cmake `
65-
-DFreeImage_ROOT:PATH=..\freeimage\Dist\x64 `
35+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
6636
-DFG_USE_WINDOW_TOOLKIT:STRING=$Env:FG_TOOLKIT ..
6737
cmake --build . --parallel --target ALL_BUILD --config Release
6838
cmake --build . --parallel --target INSTALL --config Release

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ GPATH
1414
include/fg/version.h
1515
src/backend/common/version.hpp
1616
docs/details/examples.dox
17+
.vs/
18+
CMakeUserPresets.CMake

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.16.3)
22

33
project(Forge VERSION 1.1.0 LANGUAGES C CXX)
44

CMakePresets.json

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
{
2-
"version": 2,
2+
"version": 6,
33
"cmakeMinimumRequired": {
44
"major": 3,
5-
"minor": 20,
6-
"patch": 0
5+
"minor": 28,
6+
"patch": 4
77
},
88
"configurePresets": [
99
{
1010
"name": "ninja-gl-glfw3-debug",
1111
"description": "Forge build with OpenGL backend using GLFW in Debug configuration",
1212
"binaryDir": "${sourceDir}/build/${presetName}",
1313
"generator": "Ninja",
14+
"condition": {
15+
"type": "equals",
16+
"lhs": "${hostSystemName}",
17+
"rhs": "Linux"
18+
},
1419
"cacheVariables": {
1520
"CMAKE_BUILD_TYPE": {
1621
"type": "String",
@@ -76,12 +81,21 @@
7681
}
7782
},
7883
{
79-
"name": "msvc2019-gl-glfw3",
84+
"name": "msvc-gl-glfw3",
8085
"description": "Forge build with OpenGL backend using GLFW",
8186
"binaryDir": "${sourceDir}/build/${presetName}",
82-
"generator": "Visual Studio 16 2019",
87+
"generator": "Visual Studio 17 2022",
8388
"architecture": "x64",
89+
"condition": {
90+
"type": "equals",
91+
"lhs": "${hostSystemName}",
92+
"rhs": "Windows"
93+
},
8494
"cacheVariables": {
95+
"CMAKE_TOOLCHAIN_FILE": {
96+
"type": "PATH",
97+
"value": "%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake"
98+
},
8599
"FG_RENDERING_BACKEND": {
86100
"type": "String",
87101
"value": "OpenGL"
@@ -109,9 +123,9 @@
109123
}
110124
},
111125
{
112-
"name": "msvc2019-gl-sdl2",
126+
"name": "msvc-gl-sdl2",
113127
"description": "Forge build with OpenGL backend using SDL",
114-
"inherits": "msvc2019-gl-glfw3",
128+
"inherits": "msvc-gl-glfw3",
115129
"cacheVariables": {
116130
"FG_USE_WINDOW_TOOLKIT": "sdl2"
117131
}

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.16.3)
22

33
project(Forge-Examples LANGUAGES CXX)
44

src/backend/common/chart_renderables.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Histogram : public ChartRenderableBase<detail::histogram_impl> {
2929

3030
Histogram(const fg_histogram pOther)
3131
: ChartRenderableBase<detail::histogram_impl>(
32-
reinterpret_cast<Histogram*>(pOther)->impl()) {}
32+
reinterpret_cast<Histogram *>(pOther)->impl()) {}
3333
};
3434

3535
class Plot : public ChartRenderableBase<detail::plot_impl> {
@@ -48,7 +48,7 @@ class Plot : public ChartRenderableBase<detail::plot_impl> {
4848

4949
Plot(const fg_plot pOther)
5050
: ChartRenderableBase<detail::plot_impl>(
51-
reinterpret_cast<Plot*>(pOther)->impl()) {}
51+
reinterpret_cast<Plot *>(pOther)->impl()) {}
5252

5353
inline void setMarkerSize(const float pMarkerSize) {
5454
mShrdPtr->setMarkerSize(pMarkerSize);
@@ -82,7 +82,7 @@ class Surface : public ChartRenderableBase<detail::surface_impl> {
8282

8383
Surface(const fg_surface pOther)
8484
: ChartRenderableBase<detail::surface_impl>(
85-
reinterpret_cast<Surface*>(pOther)->impl()) {}
85+
reinterpret_cast<Surface *>(pOther)->impl()) {}
8686
};
8787

8888
class VectorField : public ChartRenderableBase<detail::vector_field_impl> {
@@ -100,7 +100,7 @@ class VectorField : public ChartRenderableBase<detail::vector_field_impl> {
100100

101101
VectorField(const fg_vector_field pOther)
102102
: ChartRenderableBase<detail::vector_field_impl>(
103-
reinterpret_cast<VectorField*>(pOther)->impl()) {}
103+
reinterpret_cast<VectorField *>(pOther)->impl()) {}
104104

105105
inline unsigned dbo() const { return mShrdPtr->directions(); }
106106

src/backend/common/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pair<vec3, float> calcRotationFromArcBall(const vec2& lastPos,
153153
auto project = [](const float pX, const float pY, const float pWidth,
154154
const float pHeight) {
155155
glm::vec3 P = glm::vec3((2.0f * pX) / pWidth - 1.0f,
156-
(2.0f * pY) / pHeight - 1.0f, 0.0f);
156+
(2.0f * pY) / pHeight - 1.0f, 0.0f);
157157
float xySqrdSum = P.x * P.x + P.y * P.y;
158158
float rSqrd = (ARC_BALL_RADIUS * ARC_BALL_RADIUS);
159159
float rSqrdBy2 = rSqrd / 2.0f;

src/backend/opengl/gl_helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ GLuint screenQuadVAO(const int pWindowId) {
9494

9595
if (svaoMap.find(pWindowId) == svaoMap.end()) {
9696
static const float texcords[8] = {0.0, 1.0, 1.0, 1.0,
97-
1.0, 0.0, 0.0, 0.0};
97+
1.0, 0.0, 0.0, 0.0};
9898
static const uint32_t indices[6] = {0, 1, 2, 0, 2, 3};
9999

100100
GLuint tbo = createBuffer(GL_ARRAY_BUFFER, 8, texcords, GL_STATIC_DRAW);

0 commit comments

Comments
 (0)