Skip to content

Commit

Permalink
Update CMake presets and use newer vcpkg baseline and other CI updates (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
9prady9 authored Mar 25, 2024
1 parent 15dac5d commit d924440
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 68 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/clang-format-lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

name: ci

Expand All @@ -17,15 +17,15 @@ jobs:
uses: actions/checkout@master

- name: Check Sources
uses: DoozyX/clang-format-lint-action@v0.11
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: './src'
extensions: 'h,cpp,hpp'
clangFormatVersion: 11
clangFormatVersion: 17

- name: Check Examples
uses: DoozyX/clang-format-lint-action@v0.11
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: './examples'
extensions: 'h,cpp,hpp'
clangFormatVersion: 11
clangFormatVersion: 17
18 changes: 8 additions & 10 deletions .github/workflows/unix_build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

name: ci

Expand All @@ -13,18 +13,18 @@ jobs:
name: OpenGL
runs-on: ${{ matrix.os }}
env:
CMAKE_VER: 3.5.1
CMAKE_VER: 3.16.3
strategy:
fail-fast: false
matrix:
window_toolkit: [glfw3, sdl2]
os: [ubuntu-18.04, macos-latest]
os: [ubuntu-latest, macos-latest]

steps:
- name: Checkout Repository
uses: actions/checkout@master

- name: Download CMake 3.5.1 for Linux
- name: Download CMake for Linux
if: matrix.os != 'macos-latest'
env:
OS_NAME: ${{ matrix.os }}
Expand All @@ -48,7 +48,7 @@ jobs:
echo "CMAKE_PROGRAM=cmake" >> $GITHUB_ENV
- name: Install Common Dependencies for Ubuntu
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
if: matrix.os == 'ubuntu-latest'
run: |
sudo add-apt-repository ppa:mhier/libboost-latest
sudo apt-get -qq update
Expand All @@ -66,7 +66,7 @@ jobs:
brew install $pkg
- name: Install Linux Window Toolkit
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
if: matrix.os == 'ubuntu-latest'
env:
FG_TOOLKIT: ${{ matrix.window_toolkit }}
run: |
Expand All @@ -79,9 +79,7 @@ jobs:
FG_TOOLKIT: ${{ matrix.window_toolkit }}
run: |
mkdir build && cd build
${CMAKE_PROGRAM} -DCMAKE_C_COMPILER=gcc-6 \
-DCMAKE_CXX_COMPILER=g++-6 \
-DFG_USE_WINDOW_TOOLKIT:STRING=${FG_TOOLKIT} ..
${CMAKE_PROGRAM} -DFG_USE_WINDOW_TOOLKIT:STRING=${FG_TOOLKIT} ..
- name: CMake Configure on OSX
if: matrix.os == 'macos-latest'
Expand Down
42 changes: 6 additions & 36 deletions .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,38 @@
on:
push:
branches:
- master
- main
tags:
- 'v*'
pull_request:
branches:
- master
- main

name: ci

jobs:
build_opengl_backend:
name: OpenGL
runs-on: ${{ matrix.os }}
env:
FREEIMAGE_VER: 3.18.0
FREEIMAGE_VER_STR: 3180
strategy:
fail-fast: false
matrix:
window_toolkit: [glfw3, sdl2]
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@master

- name: FreeImage Cache
uses: actions/cache@v1
id: freeimage-cache
with:
path: freeimage
key: freeimage-${{ env.FREEIMAGE_VER }}

- name: FreeImage Download
if: steps.freeimage-cache.outputs.cache-hit != 'true'
run: |
$url = 'https://nchc.dl.sourceforge.net/project/freeimage/Binary%20Distribution/{0}/FreeImage{1}Win32Win64.zip' -f $env:FREEIMAGE_VER, $env:FREEIMAGE_VER_STR
Invoke-WebRequest -Uri $url -OutFile freeimage.zip
Expand-Archive .\freeimage.zip -DestinationPath .\
Remove-Item -Path .\freeimage.zip
- name: Install Common Dependencies
run: |
$vcpkg_triplet_path = $env:GITHUB_WORKSPACE + "/CMakeModules/ForgeFreetypeVCPKGTriplet.cmake"
Copy-Item -Path $vcpkg_triplet_path -Destination C:/vcpkg/triplets/x64-windows.cmake
vcpkg install --triplet x64-windows boost-functional freetype opencl
- name: Install GLFW3
if: matrix.window_toolkit == 'glfw3'
run: vcpkg install glfw3:x64-windows

- name: Install SDL2
if: matrix.window_toolkit == 'sdl2'
run: vcpkg install sdl2:x64-windows
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11

- name: Configure and Build
env:
FG_TOOLKIT: ${{ matrix.window_toolkit }}
run: |
mkdir build && cd build
cmake `
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:\vcpkg\scripts\buildsystems\vcpkg.cmake `
-DFreeImage_ROOT:PATH=..\freeimage\Dist\x64 `
-DCMAKE_TOOLCHAIN_FILE:FILEPATH="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-DFG_USE_WINDOW_TOOLKIT:STRING=$Env:FG_TOOLKIT ..
cmake --build . --parallel --target ALL_BUILD --config Release
cmake --build . --parallel --target INSTALL --config Release
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ GPATH
include/fg/version.h
src/backend/common/version.hpp
docs/details/examples.dox
.vs/
CMakeUserPresets.CMake
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16.3)

project(Forge VERSION 1.1.0 LANGUAGES C CXX)

Expand Down
28 changes: 21 additions & 7 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"version": 2,
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
"minor": 28,
"patch": 4
},
"configurePresets": [
{
"name": "ninja-gl-glfw3-debug",
"description": "Forge build with OpenGL backend using GLFW in Debug configuration",
"binaryDir": "${sourceDir}/build/${presetName}",
"generator": "Ninja",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "String",
Expand Down Expand Up @@ -76,12 +81,21 @@
}
},
{
"name": "msvc2019-gl-glfw3",
"name": "msvc-gl-glfw3",
"description": "Forge build with OpenGL backend using GLFW",
"binaryDir": "${sourceDir}/build/${presetName}",
"generator": "Visual Studio 16 2019",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "PATH",
"value": "%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake"
},
"FG_RENDERING_BACKEND": {
"type": "String",
"value": "OpenGL"
Expand Down Expand Up @@ -109,9 +123,9 @@
}
},
{
"name": "msvc2019-gl-sdl2",
"name": "msvc-gl-sdl2",
"description": "Forge build with OpenGL backend using SDL",
"inherits": "msvc2019-gl-glfw3",
"inherits": "msvc-gl-glfw3",
"cacheVariables": {
"FG_USE_WINDOW_TOOLKIT": "sdl2"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16.3)

project(Forge-Examples LANGUAGES CXX)

Expand Down
8 changes: 4 additions & 4 deletions src/backend/common/chart_renderables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Histogram : public ChartRenderableBase<detail::histogram_impl> {

Histogram(const fg_histogram pOther)
: ChartRenderableBase<detail::histogram_impl>(
reinterpret_cast<Histogram*>(pOther)->impl()) {}
reinterpret_cast<Histogram *>(pOther)->impl()) {}
};

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

Plot(const fg_plot pOther)
: ChartRenderableBase<detail::plot_impl>(
reinterpret_cast<Plot*>(pOther)->impl()) {}
reinterpret_cast<Plot *>(pOther)->impl()) {}

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

Surface(const fg_surface pOther)
: ChartRenderableBase<detail::surface_impl>(
reinterpret_cast<Surface*>(pOther)->impl()) {}
reinterpret_cast<Surface *>(pOther)->impl()) {}
};

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

VectorField(const fg_vector_field pOther)
: ChartRenderableBase<detail::vector_field_impl>(
reinterpret_cast<VectorField*>(pOther)->impl()) {}
reinterpret_cast<VectorField *>(pOther)->impl()) {}

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

Expand Down
2 changes: 1 addition & 1 deletion src/backend/common/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pair<vec3, float> calcRotationFromArcBall(const vec2& lastPos,
auto project = [](const float pX, const float pY, const float pWidth,
const float pHeight) {
glm::vec3 P = glm::vec3((2.0f * pX) / pWidth - 1.0f,
(2.0f * pY) / pHeight - 1.0f, 0.0f);
(2.0f * pY) / pHeight - 1.0f, 0.0f);
float xySqrdSum = P.x * P.x + P.y * P.y;
float rSqrd = (ARC_BALL_RADIUS * ARC_BALL_RADIUS);
float rSqrdBy2 = rSqrd / 2.0f;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/opengl/gl_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ GLuint screenQuadVAO(const int pWindowId) {

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

GLuint tbo = createBuffer(GL_ARRAY_BUFFER, 8, texcords, GL_STATIC_DRAW);
Expand Down
3 changes: 2 additions & 1 deletion vcpkg/vcpkg.json → vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "forge",
"version": "1.1.0",
"supports": "x64",
"builtin-baseline": "898b728edc5e0d12b50015f9cd18247c4257a3eb",
"dependencies": [
"boost-functional",
"boost-container-hash",
"freetype",
"freeimage",
{
Expand Down

0 comments on commit d924440

Please sign in to comment.