diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 41a442753..b33bc44f2 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -53,6 +53,7 @@ jobs: - name: Prepare CMake dependencies run: | # make sure the precompiled headers exist + make -C cmake.output/cli cmake_pch.hxx.pch make -C cmake.output/gui cmake_pch.hxx.pch make -C cmake.output/lib cmake_pch.hxx.pch make -C cmake.output/test cmake_pch.hxx.pch diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index b4f83e4df..c0b27afad 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -11,6 +11,9 @@ else() target_include_directories(cli_objs SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS}) endif() target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/) +if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS) + target_precompile_headers(cli_objs PRIVATE precompiled.h) +endif() if (BUILD_CORE_DLL) target_compile_definitions(cli_objs PRIVATE CPPCHECKLIB_IMPORT TINYXML2_IMPORT) endif() diff --git a/cli/cli.vcxproj b/cli/cli.vcxproj index d266995de..35d3f9961 100644 --- a/cli/cli.vcxproj +++ b/cli/cli.vcxproj @@ -1,4 +1,4 @@ - + @@ -165,6 +165,9 @@ Level4 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 true + Use + precompiled.h + precompiled.h true stdcpp14 /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) @@ -193,6 +196,9 @@ Level4 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 true + Use + precompiled.h + precompiled.h true stdcpp14 /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) @@ -219,6 +225,9 @@ Level4 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 true + Use + precompiled.h + precompiled.h true stdcpp14 /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) @@ -245,6 +254,9 @@ Level4 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 true + Use + precompiled.h + precompiled.h true stdcpp14 /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) @@ -276,6 +288,9 @@ 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 ProgramDatabase true + Use + precompiled.h + precompiled.h /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) true stdcpp14 @@ -311,6 +326,9 @@ 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 ProgramDatabase true + Use + precompiled.h + precompiled.h /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) true stdcpp14 @@ -347,6 +365,9 @@ 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 ProgramDatabase true + Use + precompiled.h + precompiled.h /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) true stdcpp14 @@ -382,6 +403,9 @@ 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 ProgramDatabase true + Use + precompiled.h + precompiled.h /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) true stdcpp14 @@ -424,7 +448,16 @@ - + + Create + Create + Create + Create + Create + Create + Create + Create + diff --git a/cli/precompiled.h b/cli/precompiled.h new file mode 100644 index 000000000..352f372aa --- /dev/null +++ b/cli/precompiled.h @@ -0,0 +1,23 @@ +/* + * Cppcheck - A tool for static C/C++ code analysis + * Copyright (C) 2007-2023 Cppcheck team. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config.h" +#include "cppcheck.h" +#include "settings.h" diff --git a/tools/dmake.cpp b/tools/dmake.cpp index d486140a3..f895c2561 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -341,7 +341,8 @@ int main(int argc, char **argv) // Visual Studio projects write_vcxproj("cli/cli.vcxproj", [&](std::string &outstr){ for (const std::string &clifile: clifiles) { - outstr += make_vcxproj_cl_entry(clifile.substr(4), Compile); + const std::string c = clifile.substr(4); + outstr += make_vcxproj_cl_entry(c, c == "executor.cpp" ? Precompile : Compile); } }, [&](std::string &outstr){ for (const std::string &clifile_h: clifiles_h) {