build: use PCH to reduce compile time (#3095)

This commit is contained in:
memchr 2023-09-04 17:56:02 +00:00 committed by GitHub
parent 4eecb8bffc
commit 8e9f010ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View file

@ -71,6 +71,7 @@ endif()
include_directories(
.
"src/"
"subprojects/wlroots/include/"
"subprojects/wlroots/build/include/"
"subprojects/udis86/"
@ -168,6 +169,10 @@ set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
message(STATUS "Setting precompiled headers")
target_precompile_headers(Hyprland PRIVATE $<$<COMPILE_LANGUAGE:CXX>:src/pch/pch.hpp>)
message(STATUS "Setting link libraries")
target_link_libraries(Hyprland rt PkgConfig::deps)

View file

@ -4,6 +4,7 @@ src = globber.stdout().strip().split('\n')
executable('Hyprland', src,
cpp_args: ['-DWLR_USE_UNSTABLE'],
link_args: '-rdynamic',
cpp_pch: 'pch/pch.hpp',
dependencies: [
server_protos,
dependency('wayland-server'),

29
src/pch/pch.hpp Normal file
View file

@ -0,0 +1,29 @@
#include "Compositor.hpp"
#include <algorithm>
#include <any>
#include <array>
#include <chrono>
#include <concepts>
#include <deque>
#include <filesystem>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <random>
#include <ranges>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <thread>
#include <tuple>
#include <unordered_map>
#include <vector>