From 6b90403550dc6776b77c3dd8a913364e476149d1 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 17 Feb 2026 17:11:54 -0500 Subject: [PATCH 1/5] build(cmake): don't duplicate resources to launcher sources Signed-off-by: Seth Flynn --- launcher/CMakeLists.txt | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index acecf8700..361baa26d 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -818,23 +818,6 @@ SET(LAUNCHER_SOURCES KonamiCode.h KonamiCode.cpp - # Bundled resources - resources/backgrounds/backgrounds.qrc - resources/multimc/multimc.qrc - resources/pe_dark/pe_dark.qrc - resources/pe_light/pe_light.qrc - resources/pe_colored/pe_colored.qrc - resources/pe_blue/pe_blue.qrc - resources/breeze_dark/breeze_dark.qrc - resources/breeze_light/breeze_light.qrc - resources/OSX/OSX.qrc - resources/iOS/iOS.qrc - resources/flat/flat.qrc - resources/flat_white/flat_white.qrc - resources/documents/documents.qrc - resources/shaders/shaders.qrc - "${CMAKE_CURRENT_BINARY_DIR}/../${Launcher_Branding_LogoQRC}" - # Icons icons/MMCIcon.h icons/MMCIcon.cpp @@ -1305,6 +1288,7 @@ qt_add_resources(LAUNCHER_RESOURCES resources/OSX/OSX.qrc resources/iOS/iOS.qrc resources/flat/flat.qrc + resources/flat_white/flat_white.qrc resources/documents/documents.qrc resources/shaders/shaders.qrc "${CMAKE_CURRENT_BINARY_DIR}/../${Launcher_Branding_LogoQRC}" From 25387c5b6c4990769f95e1d77a0d609a53d03369 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 17 Feb 2026 16:57:18 -0500 Subject: [PATCH 2/5] build(cmake): add support for clang-tidy Signed-off-by: Seth Flynn --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c6202581..01c50aa56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,19 @@ if(CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR MATCHES "^Ninja" set(CMAKE_EXPORT_COMPILE_COMMANDS ON) endif() +option(USE_CLANG_TIDY "Enable the use of clang-tidy during compilation" OFF) + +if(USE_CLANG_TIDY) + find_program(CLANG_TIDY clang-tidy OPTIONAL) + if(CLANG_TIDY) + message(STATUS "Using clang-tidy during compilation") + set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy") + set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_COMMAND}) + else() + message(WARNING "Unable to find `clang-tidy`. Not using during compilation") + endif() +endif() + option(DEBUG_ADDRESS_SANITIZER "Enable Address Sanitizer in Debug builds" OFF) # If this is a Debug build turn on address sanitiser From 720ea089b3dadc2aff2e0aae272789d7c0017213 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 17 Feb 2026 17:49:14 -0500 Subject: [PATCH 3/5] chore(nix): add clang-tidy-diff wrapper Signed-off-by: Seth Flynn --- flake.nix | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 6e0fa5844..c8779909c 100644 --- a/flake.nix +++ b/flake.nix @@ -86,6 +86,7 @@ let pkgs = nixpkgsFor.${system}; llvm = pkgs.llvmPackages_19; + python = pkgs.python3; mkShell = pkgs.mkShell.override { inherit (llvm) stdenv; }; packages' = self.packages.${system}; @@ -137,10 +138,27 @@ inputsFrom = [ packages'.prismlauncher-unwrapped ]; - packages = with pkgs; [ - ccache + packages = [ + pkgs.ccache llvm.clang-tools - python3 # Required for `run-clang-tidy`, etc. + python # NOTE(@getchoo): Required for run-clang-tidy, etc. + + (pkgs.stdenvNoCC.mkDerivation { + pname = "clang-tidy-diff"; + inherit (llvm.clang) version; + + nativeBuildInputs = [ + pkgs.installShellFiles + python.pkgs.wrapPython + ]; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + postInstall = "installBin ${llvm.libclang.python}/share/clang/clang-tidy-diff.py"; + postFixup = "wrapPythonPrograms"; + }) ]; cmakeBuildType = "Debug"; From 33056c913dc3eb87fd59c1eb46c05055deb96e31 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 17 Feb 2026 17:24:10 -0500 Subject: [PATCH 4/5] ci: run clang-tidy Co-authored-by: Octol1ttle --- .github/workflows/clang-tidy.yml | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/clang-tidy.yml diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 000000000..75601853a --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,52 @@ +name: Clang-Tidy Code Scanning + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + merge_group: + types: [checks_requested] + pull_request: + +permissions: {} + +jobs: + clang-tidy: + name: Run Clang-Tidy + + runs-on: ubuntu-latest + + permissions: + contents: read + security-events: write + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 # Required for diffing later on + submodules: "true" + + - name: Setup sccache + uses: hendrikmuhs/ccache-action@v1.2.20 + with: + variant: sccache + + - name: Install Nix + uses: cachix/install-nix-action@v31 + + - name: Run build + run: | + nix develop --command bash -c ' + cmake -B build -D CMAKE_CXX_COMPILER_LAUNCHER=sccache && cmake --build build + ' + + # TODO: Use SARIF after https://github.com/psastras/sarif-rs/issues/638 is fixed + - name: Run clang-tidy-diff + env: + BASE_REF: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} + run: | + nix develop --command bash -c ' + git diff -U0 --no-color "$BASE_REF" | clang-tidy-diff.py -p1 + ' From 067a9923782416202940fde3dc0ab8ff1c295795 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sat, 7 Mar 2026 03:25:25 -0500 Subject: [PATCH 5/5] ci(clang-tidy): disable pch This would previously make most of our files error out with `error: __OPTIMIZE__ predefined macro was enabled in PCH file but is currently disabled` Signed-off-by: Seth Flynn --- .github/workflows/clang-tidy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 75601853a..0d9fe85ff 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -37,9 +37,10 @@ jobs: uses: cachix/install-nix-action@v31 - name: Run build + # TODO(@getchoo): Figure out how to make this work with PCH run: | nix develop --command bash -c ' - cmake -B build -D CMAKE_CXX_COMPILER_LAUNCHER=sccache && cmake --build build + cmake -B build -D Launcher_USE_PCH=OFF -D CMAKE_CXX_COMPILER_LAUNCHER=sccache && cmake --build build ' # TODO: Use SARIF after https://github.com/psastras/sarif-rs/issues/638 is fixed