From 51c7ba1c5083d2f0e8efa3196050550ef356db17 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 25 Sep 2020 11:06:55 +0200 Subject: [PATCH] Use a precompiled header for many std includes. --- CMakeLists.txt | 3 ++- src/Assert.hpp | 3 --- src/Collections/Dictionary.hpp | 2 -- src/Collections/List.hpp | 4 ---- src/Enum.hpp | 6 ------ src/Exception.hpp | 4 ---- src/Memory/BorrowedPtr.hpp | 1 - src/Memory/UniquePtrList.hpp | 4 ---- src/Precompiled.hxx | 21 +++++++++++++++++++++ src/String/BasicStringView.hpp | 3 +-- src/String/StringView.cpp | 1 - src/String/StringView.hpp | 5 ----- src/String/StringViewLiteral.hpp | 1 - 13 files changed, 24 insertions(+), 34 deletions(-) create mode 100644 src/Precompiled.hxx diff --git a/CMakeLists.txt b/CMakeLists.txt index daa0f96..4765f81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.16) project(Arbutils) # Enable all warnings, and make them error when occurring. @@ -30,6 +30,7 @@ endif() # Grab all cpp and hpp files in our source directories. file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp" "CInterface/*.cpp" "CInterface/*.hpp") add_library(Arbutils ${LIBTYPE} ${SRC_FILES}) +target_precompile_headers(Arbutils PUBLIC src/Precompiled.hxx) # If we are building for Windows we need to set some specific variables. if (WINDOWS) diff --git a/src/Assert.hpp b/src/Assert.hpp index 9e390e5..3b40cd3 100644 --- a/src/Assert.hpp +++ b/src/Assert.hpp @@ -1,7 +1,4 @@ /** @file */ -#include -#include -#include #include "Exception.hpp" #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) diff --git a/src/Collections/Dictionary.hpp b/src/Collections/Dictionary.hpp index 83f26fe..9aab849 100644 --- a/src/Collections/Dictionary.hpp +++ b/src/Collections/Dictionary.hpp @@ -1,7 +1,5 @@ #ifndef ARBUTILS_DICTIONARY_HPP #define ARBUTILS_DICTIONARY_HPP -#include -#include #include "../Assert.hpp" namespace ArbUt { diff --git a/src/Collections/List.hpp b/src/Collections/List.hpp index f0b5fae..1cc59df 100644 --- a/src/Collections/List.hpp +++ b/src/Collections/List.hpp @@ -1,9 +1,5 @@ #ifndef ARBUTILS_LIST_HPP #define ARBUTILS_LIST_HPP -#include -#include -#include -#include #include "../Exception.hpp" namespace ArbUt { diff --git a/src/Enum.hpp b/src/Enum.hpp index 7670dac..aa759e5 100644 --- a/src/Enum.hpp +++ b/src/Enum.hpp @@ -1,9 +1,3 @@ -#include -#include -#include -#include -#include -#include #include "MacroUtils.hpp" #include "StringView.hpp" diff --git a/src/Exception.hpp b/src/Exception.hpp index be70c8c..3fabf2b 100644 --- a/src/Exception.hpp +++ b/src/Exception.hpp @@ -1,10 +1,6 @@ #ifndef ARBUTILS_EXCEPTION_HPP #define ARBUTILS_EXCEPTION_HPP -#include -#include -#include -#include #if !WINDOWS #if PRETTYTRACES #define BACKWARD_HAS_DW 1 diff --git a/src/Memory/BorrowedPtr.hpp b/src/Memory/BorrowedPtr.hpp index a3961bb..b95649d 100644 --- a/src/Memory/BorrowedPtr.hpp +++ b/src/Memory/BorrowedPtr.hpp @@ -1,7 +1,6 @@ #ifndef ARBUTILS_BORROWEDPTR_HPP #define ARBUTILS_BORROWEDPTR_HPP -#include #include "../Assert.hpp" namespace ArbUt { diff --git a/src/Memory/UniquePtrList.hpp b/src/Memory/UniquePtrList.hpp index 693526a..8e62177 100644 --- a/src/Memory/UniquePtrList.hpp +++ b/src/Memory/UniquePtrList.hpp @@ -1,10 +1,6 @@ #ifndef ARBUTILS_UNIQUEPTRLIST_HPP #define ARBUTILS_UNIQUEPTRLIST_HPP -#include -#include -#include -#include #include "BorrowedPtr.hpp" namespace ArbUt { diff --git a/src/Precompiled.hxx b/src/Precompiled.hxx new file mode 100644 index 0000000..ca56084 --- /dev/null +++ b/src/Precompiled.hxx @@ -0,0 +1,21 @@ +#ifndef ARBUTILS_PRECOMPILED_HXX +#define ARBUTILS_PRECOMPILED_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // ARBUTILS_PRECOMPILED_HXX diff --git a/src/String/BasicStringView.hpp b/src/String/BasicStringView.hpp index 2307bee..ce2a659 100644 --- a/src/String/BasicStringView.hpp +++ b/src/String/BasicStringView.hpp @@ -1,7 +1,6 @@ #ifndef ARBUTILS_BASICSTRINGVIEW_HPP #define ARBUTILS_BASICSTRINGVIEW_HPP -#include -#include + /// \defgroup Strings Strings /// \brief Group of non-editable strings with faster hashing. diff --git a/src/String/StringView.cpp b/src/String/StringView.cpp index d176e18..bca93e8 100644 --- a/src/String/StringView.cpp +++ b/src/String/StringView.cpp @@ -1,5 +1,4 @@ #include "StringView.hpp" -#include namespace ArbUt { std::shared_ptr<__ConstStringCharHolder> StringView::__emptyString = diff --git a/src/String/StringView.hpp b/src/String/StringView.hpp index 6f936fb..d97ce42 100644 --- a/src/String/StringView.hpp +++ b/src/String/StringView.hpp @@ -1,11 +1,6 @@ #ifndef ARBUTILS_STRINGVIEW_HPP #define ARBUTILS_STRINGVIEW_HPP -#include -#include -#include -#include -#include #include "BasicStringView.hpp" #if WINDOWS diff --git a/src/String/StringViewLiteral.hpp b/src/String/StringViewLiteral.hpp index 5a1bdc9..29cfeed 100644 --- a/src/String/StringViewLiteral.hpp +++ b/src/String/StringViewLiteral.hpp @@ -1,7 +1,6 @@ #ifndef ARBUTILS_STRINGVIEWLITERAL_HPP #define ARBUTILS_STRINGVIEWLITERAL_HPP -#include #include "BasicStringView.hpp" #include "StringView.hpp"