diff --git a/.github/workflows/clang-tidy-check.yml b/.github/workflows/clang-tidy-check.yml new file mode 100644 index 00000000..cebb61d8 --- /dev/null +++ b/.github/workflows/clang-tidy-check.yml @@ -0,0 +1,26 @@ +name: clang-tidy-review + +# You can be more specific, but it currently only works on pull requests +on: [ pull_request ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Optionally generate compile_commands.json + + - uses: ZedThree/clang-tidy-review@v0.14.0 + id: review + + # Uploads an artefact containing clang_fixes.json + - uses: ZedThree/clang-tidy-review/upload@v0.14.0 + id: upload-review + with: + max_comments: 10 + + # If there are any comments, fail the check + - if: steps.review.outputs.total_comments > 0 + run: exit 1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9d41004..67f6f270 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,86 +1,69 @@ +name: Compile -name: main-before - -on: +on: merge_group: pull_request: -# linux-gcc jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - os: ubuntu-latest + compiler: gcc + generator: Ninja + deps_cmdline: sudo apt-get update && sudo apt-get -y install gcc cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev + - os: ubuntu-latest + compiler: clang + generator: Ninja + deps_cmdline: sudo apt-get update && sudo apt-get -y install clang cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev + - os: windows-latest + compiler: msvc + generator: Visual Studio 17 2022 + - os: windows-latest + compiler: mingw + generator: MinGW Makefiles + - os: macos-latest + compiler: clang + generator: Ninja + deps_cmdline: brew install cmake ninja mesa-glu mesa xorg-server - - name: Installing Dependencies - run: | - sudo apt-get update - sudo apt-get -y install gcc cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev + steps: + - if: matrix.config.os == 'windows-latest' && matrix.config.compiler == 'mingw' + name: "Set Windows-MinGW-Compiler" + uses: seanmiddleditch/gha-setup-ninja@master - - name: Checkout Repository - uses: actions/checkout@v3 + - name: "Checkout Repository" + uses: actions/checkout@v4 with: submodules: recursive - - name: Building Project - if: matrix.os == 'ubuntu-latest' - env: - CC: gcc - CXX: g++ + - name: Install Dependencies + shell: bash run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - cmake --build build - -# jobs: -# build: -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# os: [ubuntu-latest] -# compiler: [{ cc: gcc, cxx: g++ }, { cc: clang, cxx: clang++ }] -# build_type: [Debug] -# binary: [linux-binary] -# include: -# - os: windows-latest -# build_type: Debug -# binary: windows-binary - -# steps: -# - if: matrix.os == 'ubuntu-latest' -# name: Installing Dependencies -# run: | -# sudo apt-get update -# sudo apt-get -y install ${{ matrix.compiler.cc }} cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev - -# - name: Checkout Repository -# uses: actions/checkout@v3 -# with: -# submodules: recursive + if [[ ! -z "${{ matrix.config.deps_cmdline }}" ]]; then + eval ${{ matrix.config.deps_cmdline }} + fi -# - name: Check Format -# if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' -# run: | -# find src/ include/ test/ assets/shaders/ -name "*.*" -print0 | \ -# xargs -0 clang-format --dry-run --Werror --ferror-limit=15 - -# - name: Building Project -# if: matrix.os == 'ubuntu-latest' -# env: -# CC: ${{ matrix.compiler.cc }} -# CXX: ${{ matrix.compiler.cxx }} -# run: | -# cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -# cmake --build build - -# - name: Run Linter -# if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' -# run: | -# find src/ include/ test/ -name "*.*" -print0 | \ -# xargs -0 run-clang-tidy true -p build + - name: "Setup cmake" + run: | + cmake -B build -DCMAKE_BUILD_TYPE=Debug -G "${{ matrix.config.generator }}" + cmake --build build -# - name: Building Project -# if: matrix.os == 'windows-latest' -# run: | -# cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -# cmake --build build --config ${{ matrix.build_type }} + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + strategy: + matrix: + path: + - "src" + - "include" + steps: + - uses: actions/checkout@v3 + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.11.0 + with: + clang-format-version: "18" + check-path: ${{ matrix.path }} diff --git a/.github/workflows/multi_system.yml b/.github/workflows/multi_system.yml deleted file mode 100644 index b1a1ccc1..00000000 --- a/.github/workflows/multi_system.yml +++ /dev/null @@ -1,115 +0,0 @@ - -name: main - -on: - merge_group: - pull_request: - -jobs: - - windows-visual-studio: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - name: "Setup Visual Studio" - uses: egor-tensin/vs-shell@v2 - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: "Setup cmake" - run: | - cmake -B build -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - windows-mingw: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: seanmiddleditch/gha-setup-ninja@master - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: "Build" - run: | - cmake -B build -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles" - # cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - macos: - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - - name: "Setup required packages" - run: brew install cmake ninja mesa-glu mesa xorg-server - - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Building Project - run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - linux-clang: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: "Setup required packages" - run: | - sudo apt-get update - sudo apt-get -y install clang cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev - - - name: "Setup clang" - uses: egor-tensin/setup-clang@v1 - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Building Project - env: - CC: clang - CXX: clang++ - run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - linux-gcc: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Installing Dependencies - run: | - sudo apt-get update - sudo apt-get -y install gcc cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Building Project - env: - CC: gcc - CXX: g++ - run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - # CXX: g++ - # run: | - # cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - # cmake --build build diff --git a/.gitignore b/.gitignore index 84caa0a0..b516ccdc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,10 @@ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +# Doxygen's file +doxydoc/ + +# some plugins 3rdparty/ # User-specific stuff diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 00000000..188f0c5e --- /dev/null +++ b/Doxyfile @@ -0,0 +1,11 @@ + PROJECT_NAME = "something" + OUTPUT_DIRECTORY = ./doxydoc/ + BUILTIN_STL_SUPPORT = YES + EXTRACT_ALL = YES + INPUT = ./src ./include + RECURSIVE = YES + HIDE_UNDOC_RELATIONS = NO + HAVE_DOT = YES + UML_LOOK = YES + CALL_GRAPH = YES + CALLER_GRAPH = YES diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 9163e27f..3046bd83 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -23,6 +23,7 @@ FetchContent_Declare( PTSD GIT_REPOSITORY https://github.com/NTUT-FUCK-PTSD/practical-tools-for-simple-design.git GIT_TAG v1.2.5 + URL_HASH MD5=c3e956114176a1cd8903b84f326d12c9 SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/PTSD ) FetchContent_MakeAvailable(PTSD) @@ -33,7 +34,6 @@ message(STATUS "soloud NOT FOUND, fetching from source!") FetchContent_Declare( soloud GIT_REPOSITORY https://github.com/onon1101/soloud.git - # GIT_TAG noinst GIT_TAG onon1101-patch-2 SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/soloud @@ -42,6 +42,8 @@ FetchContent_Declare( FetchContent_GetProperties(soloud) if (NOT soloud_POPULATED) FetchContent_Populate(soloud) + + set(SDL2_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/PTSD/3rdparty/sdl2/include) add_subdirectory(${soloud_SOURCE_DIR}/contrib) endif() diff --git a/include/Player/Equipment/Shovel/SComponent.h b/include/Player/Equipment/Shovel/SComponent.h index ec725a47..5ccead87 100644 --- a/include/Player/Equipment/Shovel/SComponent.h +++ b/include/Player/Equipment/Shovel/SComponent.h @@ -15,7 +15,7 @@ namespace ToolSystem { // Dig Level struct DigLevel { explicit DigLevel(std::vector _level) - : level(_level) {}; + : level(_level){}; std::vector level; }; diff --git a/include/Player/Equipment/Weapon/Component.h b/include/Player/Equipment/Weapon/Component.h index 258d069f..fddc29fa 100644 --- a/include/Player/Equipment/Weapon/Component.h +++ b/include/Player/Equipment/Weapon/Component.h @@ -35,7 +35,7 @@ struct Damage { struct Settings { explicit Settings(std::string &path, bool isThrow) : imagePath(path), - isThrow(isThrow) {}; + isThrow(isThrow){}; std::string imagePath; bool isThrow; @@ -48,7 +48,7 @@ struct TBaseWeapon : Damage, Settings { std::string obsidian, int16t titan, std::string path, bool isThrow) : Damage(nor, blood, glass, golden, obsidian, titan), - Settings(path, isThrow) {}; + Settings(path, isThrow){}; }; }; // namespace ToolSystem diff --git a/src/Player/Equipment/Shovel/EntityShovel.cpp b/src/Player/Equipment/Shovel/EntityShovel.cpp index 2e756a8e..a5e13b5d 100644 --- a/src/Player/Equipment/Shovel/EntityShovel.cpp +++ b/src/Player/Equipment/Shovel/EntityShovel.cpp @@ -4,4 +4,4 @@ #include "Equipment/Shovel/EntityShovel.h" ToolSystem::EntityShovel::EntityShovel() - : TBaseShovel(level, ImagePath, m_IsThrow) {}; + : TBaseShovel(level, ImagePath, m_IsThrow){}; diff --git a/src/Player/Equipment/Weapon/EntityBroadsword.cpp b/src/Player/Equipment/Weapon/EntityBroadsword.cpp index 3493e953..3ae58ed9 100644 --- a/src/Player/Equipment/Weapon/EntityBroadsword.cpp +++ b/src/Player/Equipment/Weapon/EntityBroadsword.cpp @@ -5,4 +5,4 @@ ToolSystem::EntityBroadsword::EntityBroadsword() : TBaseWeapon(normal, blood, glass, golden, obsidian, titanium, ImagePath, - m_IsThrow) {}; + m_IsThrow){}; diff --git a/src/Player/Equipment/Weapon/EntityDagger.cpp b/src/Player/Equipment/Weapon/EntityDagger.cpp index 558c4797..84708d6e 100644 --- a/src/Player/Equipment/Weapon/EntityDagger.cpp +++ b/src/Player/Equipment/Weapon/EntityDagger.cpp @@ -6,4 +6,4 @@ ToolSystem::EntityDagger::EntityDagger() : TBaseWeapon(normal, blood, glass, golden, obsidian, titanium, ImagePath, - isThrow) {}; + isThrow){}; diff --git a/src/Player/Equipment/Weapon/EntityRapier.cpp b/src/Player/Equipment/Weapon/EntityRapier.cpp index b00479e3..3084bd96 100644 --- a/src/Player/Equipment/Weapon/EntityRapier.cpp +++ b/src/Player/Equipment/Weapon/EntityRapier.cpp @@ -6,4 +6,4 @@ ToolSystem::EntityRapier::EntityRapier() : TBaseWeapon(normal, blood, glass, golden, obsidian, titanium, ImagePath, - isThrow) {}; + isThrow){};