From da8c70dbc6c2c0eb7f418a45fb59350ff068a08b Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Thu, 12 May 2022 12:16:16 +0200 Subject: [PATCH 1/6] Improve CI Add ubuntu 18.04 and 20.04, add debug and relase config... Signed-off-by: Bensuperpc --- .github/workflows/Tests.yml | 47 +++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 9da9346..62a88ec 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -1,28 +1,55 @@ -name: Tests +name: Build and tests -on: [push, pull_request] +on: + push: + branches: + - '*' + paths-ignore: + - '**/README.md' + pull_request: + branches: + - '*' + workflow_dispatch: jobs: - Test: + build: + name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }} + runs-on: ${{ matrix.platform.os }} - runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + platform: + # - { name: Windows VS2019, os: windows-2019 } + # - { name: Windows VS2022, os: windows-2022 } + - { name: Linux GCC, os: ubuntu-20.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ } + - { name: Linux Clang, os: ubuntu-20.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } + - { name: Linux GCC, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ } + - { name: Linux Clang, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } + # - { name: MacOS XCode, os: macos-latest } + config: + - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE } + - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } + type: + - { name: Release, flags: -DCMAKE_BUILD_TYPE=Release } + - { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug } steps: - uses: actions/checkout@v2 with: submodules: recursive - - - name: Update Packages - run: sudo apt-get update - - name: Install Dependencies + - name: Install Linux Dependencies + if: runner.os == 'Linux' run: sudo apt-get install xorg-dev libglu1-mesa-dev -y - name: Configure - run: cmake -B build . + run: | + cmake -B build -S . -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic" + ${{ matrix.platform.flags }} ${{ matrix.type.flags }} ${{ matrix.config.flags }} - name: Build run: cmake --build build - name: Test - run: ./build/tests/raylib_cpp_test + run: ctest --verbose --test-dir build \ No newline at end of file From 927809ecffa2bbdf60cac551bb54162b72bfbcc2 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Thu, 12 May 2022 12:31:57 +0200 Subject: [PATCH 2/6] Fix build fail Fix build fail Signed-off-by: Bensuperpc --- .github/workflows/Tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 62a88ec..0bb9389 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -13,7 +13,7 @@ on: jobs: build: - name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }} + name: ${{ matrix.platform.os }} ${{ matrix.config.name }} ${{ matrix.type.name }} runs-on: ${{ matrix.platform.os }} strategy: @@ -44,9 +44,7 @@ jobs: run: sudo apt-get install xorg-dev libglu1-mesa-dev -y - name: Configure - run: | - cmake -B build -S . -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic" - ${{ matrix.platform.flags }} ${{ matrix.type.flags }} ${{ matrix.config.flags }} + run: cmake -B build -S . -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic" ${{ matrix.platform.flags }} ${{ matrix.type.flags }} ${{ matrix.config.flags }} - name: Build run: cmake --build build From 07612b1a903d95138c6cdbe0f22cf8f6e2121470 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Thu, 12 May 2022 12:48:05 +0200 Subject: [PATCH 3/6] Set C++14 and 17 set C++14 and 17 Signed-off-by: Bensuperpc --- .github/workflows/Tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 0bb9389..b70ee19 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -22,10 +22,10 @@ jobs: platform: # - { name: Windows VS2019, os: windows-2019 } # - { name: Windows VS2022, os: windows-2022 } - - { name: Linux GCC, os: ubuntu-20.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ } - - { name: Linux Clang, os: ubuntu-20.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } - - { name: Linux GCC, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ } - - { name: Linux Clang, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } + - { name: Linux GCC, os: ubuntu-20.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_STANDARD=17 } + - { name: Linux Clang, os: ubuntu-20.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 } + - { name: Linux GCC, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_STANDARD=14 } + - { name: Linux Clang, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=14 } # - { name: MacOS XCode, os: macos-latest } config: - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE } From 770b1f290ce328a5f33389c25d3998c235698a49 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Thu, 12 May 2022 13:00:53 +0200 Subject: [PATCH 4/6] Fix no newline of file Fix no newline of file Signed-off-by: Bensuperpc --- .github/workflows/Tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index b70ee19..6613b2b 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -50,4 +50,4 @@ jobs: run: cmake --build build - name: Test - run: ctest --verbose --test-dir build \ No newline at end of file + run: ctest --verbose --test-dir build From 4624cef3422840ad9c87138d50ebb4b9737f95d9 Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Thu, 12 May 2022 22:59:24 +0200 Subject: [PATCH 5/6] Move operator should not unload this if == other --- include/Material.hpp | 2 +- include/Mesh.hpp | 2 +- include/Model.hpp | 2 +- include/ModelAnimation.hpp | 2 +- include/Shader.hpp | 2 +- include/Wave.hpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Material.hpp b/include/Material.hpp index fbb5dfe..af436f7 100644 --- a/include/Material.hpp +++ b/include/Material.hpp @@ -60,7 +60,7 @@ class Material : public ::Material { Material& operator=(const Material&) = delete; Material& operator=(Material&& other) { - if (this != &other) { + if (this == &other) { return *this; } diff --git a/include/Mesh.hpp b/include/Mesh.hpp index 9e7ae93..6f47daa 100644 --- a/include/Mesh.hpp +++ b/include/Mesh.hpp @@ -162,7 +162,7 @@ class Mesh : public ::Mesh { Mesh& operator=(const Mesh&) = delete; Mesh& operator=(Mesh&& other) { - if (this != &other) { + if (this == &other) { return *this; } diff --git a/include/Model.hpp b/include/Model.hpp index 894aa33..3b0c39f 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -66,7 +66,7 @@ class Model : public ::Model { Model& operator=(const Model&) = delete; Model& operator=(Model&& other) { - if (this != &other) { + if (this == &other) { return *this; } diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index 91f46c8..4a069ff 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -59,7 +59,7 @@ class ModelAnimation : public ::ModelAnimation { ModelAnimation& operator=(const ModelAnimation&) = delete; ModelAnimation& operator=(ModelAnimation&& other) { - if (this != &other) { + if (this == &other) { return *this; } diff --git a/include/Shader.hpp b/include/Shader.hpp index 68687e7..6fac4f4 100644 --- a/include/Shader.hpp +++ b/include/Shader.hpp @@ -65,7 +65,7 @@ class Shader : public ::Shader { Shader& operator=(const Shader&) = delete; Shader& operator=(Shader&& other) { - if (this != &other) { + if (this == &other) { return *this; } diff --git a/include/Wave.hpp b/include/Wave.hpp index 3e3efb2..9ec6b6f 100644 --- a/include/Wave.hpp +++ b/include/Wave.hpp @@ -77,7 +77,7 @@ class Wave : public ::Wave { } Wave& operator=(const Wave& other) { - if (&other != this) { + if (this == &other) { return *this; } From c5fbd521848c03b0a54cb2ac1d82e545ba907f81 Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Thu, 12 May 2022 23:08:49 +0200 Subject: [PATCH 6/6] Move operators should be marked noexcept https://clang.llvm.org/extra/clang-tidy/checks/performance-noexcept-move-constructor.html --- include/AudioStream.hpp | 2 +- include/Font.hpp | 2 +- include/Image.hpp | 2 +- include/Material.hpp | 2 +- include/Mesh.hpp | 2 +- include/Model.hpp | 2 +- include/ModelAnimation.hpp | 2 +- include/Music.hpp | 2 +- include/RenderTexture.hpp | 2 +- include/Shader.hpp | 2 +- include/Sound.hpp | 2 +- include/Texture.hpp | 2 +- include/Wave.hpp | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/AudioStream.hpp b/include/AudioStream.hpp index f70c6a7..c280c83 100644 --- a/include/AudioStream.hpp +++ b/include/AudioStream.hpp @@ -60,7 +60,7 @@ class AudioStream : public ::AudioStream { AudioStream& operator=(const AudioStream&) = delete; - AudioStream& operator=(AudioStream&& other) { + AudioStream& operator=(AudioStream&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Font.hpp b/include/Font.hpp index 6df7e51..e755a3c 100644 --- a/include/Font.hpp +++ b/include/Font.hpp @@ -122,7 +122,7 @@ class Font : public ::Font { Font& operator=(const Font&) = delete; - Font& operator=(Font&& other) { + Font& operator=(Font&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Image.hpp b/include/Image.hpp index f6967c1..65fdf4d 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -203,7 +203,7 @@ class Image : public ::Image { return *this; } - Image& operator=(Image&& other) { + Image& operator=(Image&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Material.hpp b/include/Material.hpp index af436f7..02c87ee 100644 --- a/include/Material.hpp +++ b/include/Material.hpp @@ -59,7 +59,7 @@ class Material : public ::Material { Material& operator=(const Material&) = delete; - Material& operator=(Material&& other) { + Material& operator=(Material&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Mesh.hpp b/include/Mesh.hpp index 6f47daa..0104072 100644 --- a/include/Mesh.hpp +++ b/include/Mesh.hpp @@ -161,7 +161,7 @@ class Mesh : public ::Mesh { Mesh& operator=(const Mesh&) = delete; - Mesh& operator=(Mesh&& other) { + Mesh& operator=(Mesh&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Model.hpp b/include/Model.hpp index 3b0c39f..9b26fba 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -65,7 +65,7 @@ class Model : public ::Model { Model& operator=(const Model&) = delete; - Model& operator=(Model&& other) { + Model& operator=(Model&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index 4a069ff..3ad91be 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -58,7 +58,7 @@ class ModelAnimation : public ::ModelAnimation { ModelAnimation& operator=(const ModelAnimation&) = delete; - ModelAnimation& operator=(ModelAnimation&& other) { + ModelAnimation& operator=(ModelAnimation&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Music.hpp b/include/Music.hpp index 37c22d5..094848b 100644 --- a/include/Music.hpp +++ b/include/Music.hpp @@ -82,7 +82,7 @@ class Music : public ::Music { Music& operator=(const Music&) = delete; - Music& operator=(Music&& other) { + Music& operator=(Music&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/RenderTexture.hpp b/include/RenderTexture.hpp index dd43729..fbbb41e 100644 --- a/include/RenderTexture.hpp +++ b/include/RenderTexture.hpp @@ -51,7 +51,7 @@ class RenderTexture : public ::RenderTexture { RenderTexture& operator=(const RenderTexture&) = delete; - RenderTexture& operator=(RenderTexture&& other) { + RenderTexture& operator=(RenderTexture&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Shader.hpp b/include/Shader.hpp index 6fac4f4..146248f 100644 --- a/include/Shader.hpp +++ b/include/Shader.hpp @@ -64,7 +64,7 @@ class Shader : public ::Shader { Shader& operator=(const Shader&) = delete; - Shader& operator=(Shader&& other) { + Shader& operator=(Shader&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Sound.hpp b/include/Sound.hpp index 283a76d..7049f43 100644 --- a/include/Sound.hpp +++ b/include/Sound.hpp @@ -66,7 +66,7 @@ class Sound : public ::Sound { GETTERSETTER(unsigned int, FrameCount, frameCount) GETTERSETTER(::AudioStream, Stream, stream) - Sound& operator=(Sound&& other) { + Sound& operator=(Sound&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Texture.hpp b/include/Texture.hpp index 5d39b91..cb2e6aa 100644 --- a/include/Texture.hpp +++ b/include/Texture.hpp @@ -97,7 +97,7 @@ class Texture : public ::Texture { Texture& operator=(const Texture&) = delete; - Texture& operator=(Texture&& other) { + Texture& operator=(Texture&& other) noexcept { if (this == &other) { return *this; } diff --git a/include/Wave.hpp b/include/Wave.hpp index 9ec6b6f..fe1f50b 100644 --- a/include/Wave.hpp +++ b/include/Wave.hpp @@ -87,7 +87,7 @@ class Wave : public ::Wave { return *this; } - Wave& operator=(Wave&& other) { + Wave& operator=(Wave&& other) noexcept { if (this != &other) { return *this; }