Skip to content

Commit

Permalink
Restructuring for release 3
Browse files Browse the repository at this point in the history
  • Loading branch information
hbatagelo committed Sep 16, 2022
1 parent 302394a commit 6056040
Show file tree
Hide file tree
Showing 1,499 changed files with 291,460 additions and 6,582 deletions.
3 changes: 1 addition & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
# Use defaults from the Google style
BasedOnStyle: Google
BasedOnStyle: LLVM
23 changes: 10 additions & 13 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
---
# Configure clang-tidy for this project

Checks: '*,
-abseil*,
-android*,
-fuchsia*,
-altera*,
-android*,
-fuchsia*,
-google*,
-llvm*,
-llvm*,
-zircon*,
-*braces-around-statements,
-*magic-numbers,
-*braces-around-statements,
-*magic-numbers,
-*use-trailing-return-type,
-*reinterpret-cast,
-*signed-bitwise,
-*type-union-access,
-*vararg,
-*uppercase-literal-suffix'

-*uppercase-literal-suffix,
-*readability-identifier-name,
-*swappable-parameters'
WarningsAsErrors: '*'

HeaderFilterRegex: '.*'

AnalyzeTemporaryDtors: false

FormatStyle: google
FormatStyle: llvm
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Ensure that text files will not have their line endings normalized
* -text
abcg/doc/** linguist-vendored
73 changes: 73 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Linux CI

on: [push]

jobs:
linux-build:
strategy:
fail-fast: false
matrix:
build-type: [Release]
compiler: [GCC, Clang]
cmake-var: [ENABLE_CONAN=ON, ENABLE_CONAN=OFF]

runs-on: ubuntu-latest
env:
BUILD_TYPE: ${{matrix.build-type}}

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Install dependencies (ENABLE_CONAN=ON)
if: matrix.cmake-var == 'ENABLE_CONAN=ON'
run: |
sudo apt-get install cmake pkg-config
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
sudo apt-get install libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev
sudo apt-get install python3 pip
pip install conan
- name: Install dependencies (ENABLE_CONAN=OFF)
if: matrix.cmake-var == 'ENABLE_CONAN=OFF'
run: |
sudo apt-get install cmake
sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev
- name: Install GCC
if: matrix.compiler == 'GCC'
run: |
echo "CC=/usr/bin/gcc-11" >> $GITHUB_ENV
echo "CXX=/usr/bin/g++-11" >> $GITHUB_ENV
sudo update-alternatives --remove-all cc
sudo update-alternatives --remove-all c++
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install -y gcc-11 g++-11
sudo update-alternatives --install /usr/bin/cc gcc /usr/bin/gcc-11 1000 \
--slave /usr/bin/c++ g++ /usr/bin/g++-11
- name: Install Clang
if: matrix.compiler == 'Clang'
run: |
echo "CC=/usr/bin/clang-13" >> $GITHUB_ENV
echo "CXX=/usr/bin/clang++-13" >> $GITHUB_ENV
sudo update-alternatives --remove-all cc
sudo update-alternatives --remove-all c++
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-13 main"
sudo apt-get install -y clang-13 lld-13
sudo update-alternatives --install /usr/bin/cc clang /usr/bin/clang-13 1000 \
--slave /usr/bin/ld lld /usr/bin/lld-13
sudo update-alternatives --install /usr/bin/c++ clang++ /usr/bin/clang++-13 1000
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D${{matrix.cmake-var}} -DCMAKE_C_COMPILER=${{env.CC}} -DCMAKE_CXX_COMPILER=${{env.CXX}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j $(nproc)

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
46 changes: 46 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: macOS CI

on: [push]

jobs:
macOS-build:
strategy:
fail-fast: false
matrix:
build-type: [Release]
cmake-var: [ENABLE_CONAN=ON, ENABLE_CONAN=OFF]

runs-on: macos-latest
env:
BUILD_TYPE: ${{matrix.build-type}}

steps:
- uses: actions/checkout@v3

- name: Install dependencies (ENABLE_CONAN=ON)
if: matrix.cmake-var == 'ENABLE_CONAN=ON'
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install conan
- name: Install dependencies (ENABLE_CONAN=OFF)
if: matrix.cmake-var == 'ENABLE_CONAN=OFF'
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install glew sdl2 sdl2_image
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D${{matrix.cmake-var}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j $(sysctl -n hw.ncpu)

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
38 changes: 38 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: WASM CI

on: [push]

jobs:
wasm-build:
runs-on: ubuntu-latest
env:
BUILD_TYPE: Release

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Install Emscripten
run: |
sudo apt-get install git cmake
sudo apt-get install python3 pip
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
- name: Configure CMake
run: |
source ./emsdk/emsdk_env.sh
emcmake cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: |
source ./emsdk/emsdk_env.sh
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j $(nproc)
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
40 changes: 40 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Windows CI

on: [push]

jobs:
windows-build:
strategy:
fail-fast: false
matrix:
build-type: [Release]

runs-on: windows-latest
env:
BUILD_TYPE: ${{matrix.build-type}}

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- run: |
python -m pip install --upgrade pip
pip install wheel
- name: Install Conan
run: pip install conan

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_CONAN=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
# Visual Studio and VS Code
.vs
.vscode
.devcontainer

# Build directories
build
out
cmake-build*

# Doxygen documentation
Dox

# Conan imports for imgui
# Conan imports for Dear ImGui
bindings

# CMake build configuration
Expand All @@ -27,4 +26,7 @@ compile_commands.json
# Emscripten output
public/*.data
public/*.js
public/*.wasm
public/*.wasm

# Git
*.stackdump
90 changes: 90 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Release notes

## v3.0.0

### New features

- Added support for building in Visual Studio with MSVC. For that to work, GLEW, SDL2 and SDL2_image development libraries must be installed and set up as follows: the GLEW installation directory must be added to the system \_Path_ variable; the environment variables `SDL2DIR` and `SDL2IMAGEDIR` must be set to the installation directory of SDL2 and SDL2_image, respectively. Debugging is also supported. However, **building multiple executables is not supported in VS**. Thus, make sure to use a single `add_subdirectory()` command in the `CMakeLists.txt` of the root directory. Also notice that the default output directory will be `out/build` instead of `build` if the project is built in the IDE.

- Added support for building with MSVC in VS Code. Multiple executables are supported, as well as debugging. Below is an example of a `launch.json` for debugging the "Hello, World!" project:

{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (Windows)",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/helloworld/helloworld.exe",
"symbolSearchPath": "${workspaceFolder}/build/bin/Debug",
"console": "integratedTerminal",
"args": [],
"stopAtEntry": false
}
]
}

- Updated `abcg::createOpenGLProgram` with support for additional shader types and no dependance on `abcg::OpenGLWindow`. The function now accepts an object of type `abcg::ShaderSource` containing the paths or codes of any combination of shaders supported by OpenGL (vertex, fragment, geometry, tess control/evaluation, and compute shaders). The function also accepts a boolean as a second argument to toggle on/off exceptions on build errors. By default, exception throwing is enabled.

- As an alternative to `abcg::createOpenGLProgram`, it is possible to split the build process into smaller parts by calling `abcg::triggerOpenGLShaderCompile`, `abcg::checkOpenGLShaderCompile`, `abcg::triggerOpenGLShaderLink`, and `abcg::checkOpenGLShaderLink` in sequence. This can be useful to prevent halting the application when building complex programs.

- Added `abcg::Application::getBasePath` and `abcg::Application::getAssetsPath` as static member functions.

- The HTML element ID used for registering the fullscreen callback function can now be set with `abcg::WindowSettings::fullscreenElementID` (default is `#canvas`).

- `abcg::loadOpenGLTexture` and `abcg::loadOpenGLCubemap` now accepts creation info structures `abcg::OpenGLTextureCreateInfo` and `abcg::OpenGLCubemapCreateInfo`, respectively.

- Added `abcg::hashCombine` and `abcg::hashCombineSeed` functions to easily combine hash values.

- Added support for Vulkan.

### Breaking changes

- ABCg filenames changed to camel case.
- `abcg::OpenGLWindow::getAssetsPath` replaced with `abcg::Application::getAssetsPath`.
- `abcg::OpenGLWindow::createProgramFromFile` and `abcg::OpenGLWindow::createProgramFromString` removed. Use `abcg::createOpenGLProgram` instead.
- `abcg::OpenGLWindow::handleEvent` renamed to `abcg::OpenGLWindow::onEvent`.
- `abcg::OpenGLWindow::initializeGL` renamed to `abcg::OpenGLWindow::onCreate`.
- `abcg::OpenGLWindow::paintGL` renamed to `abcg::OpenGLWindow::onPaint`.
- `abcg::OpenGLWindow::paintUI` renamed to `abcg::OpenGLWindow::onPaintUI`.
- `abcg::OpenGLWindow::resizeGL` renamed to `abcg::OpenGLWindow::onResize`.
- `abcg::OpenGLWindow::terminateGL` renamed to `abcg::OpenGLWindow::onDestroy`.
- Namespace `abcg::opengl` removed.
- `abcg::opengl::loadTexture` renamed to `abcg::loadOpenGLTexture`.
- `abcg::opengl::loadCubemap` renamed to `abcg::loadOpenGLCubemap`.
- `abcg::Application` does not take ownership of `abcg::OpenGLWindow` anymore. `abcg::Application::run` now accepts an lvalue reference to `abcg::OpenGLWindow`.
- `abcg_string.hpp` and `abcg_string.cpp` removed.
- The static member functions of `abcg::Exception`, namely `Runtime`, `OpenGL`, `SDL`, and `SDLImage`, are now classes of their own: `abcg::RuntimeError`, `abcg::OpenGLError`, `abcg::SDLError`, and `abcg::SDLImageError`. This simplifies the syntax for throwing ABCg exceptions. For instance, `throw abcg::Exception{abcg::Exception::runtime(...)}` now becomes `throw abcg::RuntimeError(...)`.
- Default value of `abcg::OpenGLSettings::stencilBufferSize` changed from 8 to 0.
- `abcg::OpenGLSettings::vsync` renamed to `abcg::OpenGLSettings::vSync`.
- `abcg::OpenGLWindow::onResize` parameters changed from `int width, int height` to `glm::ivec2 size`.

### Other changes

- Updated external libraries (Dear ImGui v1.86; {fmt} 8.1.1; GSL 4.0.0).
- Minimum required version for CMake increased to 3.21.
- `abcg::OpenGLWindow::getDeltaTime()` marked `noexcept`.

## v2.0.1

### Bug Fixes

- Fixed flickering effect when `glClear` is not called for each frame. For this fix to work, `abcg::OpenGLSettings::preserveWebGLDrawingBuffer` must be `true` even when building for desktop.

## v2.0.0

### Breaking changes

- `abcg::Application::run` now takes by value a unique pointer to `abcg::OpenGLWindow`. Since `std::unique_ptr` cannot be copied, the caller must either use `std::move` or pass the pointer as an rvalue. This makes clear the intent of transferring ownership of the pointer, which was not explicit in the previous version that takes an lvalue reference.
- Support for running multiple windows has been dropped. Multiple windows weren't working properly on Emscripten builds and aren't used in the course.
- `abcg::opengl::loadCubemap` now transforms the cube map textures to a right-handed coordinate system by default. A small loading overhead is incurred because some of the bitmaps are flipped vertically and horizontally. This behavior can be disabled by setting the (new) parameter `rightHandedSystem` to `false`.

### Other changes

- `abcg::Exception::OpenGL` now generates a string describing all OpenGL error messages returned by `glGetError` when there are multiple errors.
- All OpenGL functions from OpenGL ES 2.0 and ES 3.0 can now be qualified with the `abcg` namespace (e.g. `abcg::glActiveTexture(0)`) for automatic error handling in debug builds. This is an alternative to the `GL_CHECK` macro used in many engines to check for errors before and after each GL call.
- Updated external libraries (Dear ImGui v1.84; cppitertools v2.1; {fmt} 8.0.1).

## v1.0.0

- Initial release, used during the first academic term of 2021.
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.11)
cmake_minimum_required(VERSION 3.21)

project(abcg)

Expand Down
Loading

0 comments on commit 6056040

Please sign in to comment.