mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add precompiled header support
Note: the <filesystem> header is not included in the default precompiled_headers.txt, because we don't use it yet, and it might be big
This commit is contained in:
parent
cdbbac5b6d
commit
9da5c5e2d0
3 changed files with 132 additions and 0 deletions
|
@ -20,6 +20,8 @@ General options and their default values:
|
||||||
SemiDebug - Partially optimized debug build
|
SemiDebug - Partially optimized debug build
|
||||||
RelWithDebInfo - Release build with debug information
|
RelWithDebInfo - Release build with debug information
|
||||||
MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible
|
MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible
|
||||||
|
PRECOMPILE_HEADERS=FALSE - Precompile some headers (experimental; requires CMake 3.16 or later)
|
||||||
|
PRECOMPILED_HEADERS_PATH= - Path to a file listing all headers to precompile (default points to src/precompiled_headers.txt)
|
||||||
ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
|
ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
|
||||||
ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
|
ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
|
||||||
ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations
|
ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations
|
||||||
|
|
|
@ -48,6 +48,25 @@ if(NOT (BUILD_CLIENT OR BUILD_SERVER))
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
option(PRECOMPILE_HEADERS "Precompile some headers (experimental; requires CMake 3.16 or later)" FALSE)
|
||||||
|
set(PRECOMPILED_HEADERS_PATH "" CACHE FILEPATH "Path to a file listing all headers to precompile")
|
||||||
|
|
||||||
|
if(PRECOMPILE_HEADERS)
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS 3.16)
|
||||||
|
message(FATAL_ERROR "PRECOMPILE_HEADERS is on, but precompiled headers require at least CMake 3.16.")
|
||||||
|
endif()
|
||||||
|
if(PRECOMPILED_HEADERS_PATH)
|
||||||
|
set(PRECOMPILED_HEADERS ${PRECOMPILED_HEADERS_PATH})
|
||||||
|
else()
|
||||||
|
set(PRECOMPILED_HEADERS "${CMAKE_SOURCE_DIR}/src/precompiled_headers.txt")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Reading headers to precompile from: ${PRECOMPILED_HEADERS}")
|
||||||
|
# ignore lines that begin with # and empty lines
|
||||||
|
file(STRINGS ${PRECOMPILED_HEADERS} PRECOMPILED_HEADERS_LIST REGEX "^[^#].*$")
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PRECOMPILED_HEADERS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
option(ENABLE_CURL "Enable cURL support for fetching media" TRUE)
|
option(ENABLE_CURL "Enable cURL support for fetching media" TRUE)
|
||||||
set(USE_CURL FALSE)
|
set(USE_CURL FALSE)
|
||||||
|
|
||||||
|
@ -619,6 +638,10 @@ if(BUILD_CLIENT)
|
||||||
if(BUILD_UNITTESTS OR BUILD_BENCHMARKS)
|
if(BUILD_UNITTESTS OR BUILD_BENCHMARKS)
|
||||||
target_link_libraries(${PROJECT_NAME} Catch2::Catch2)
|
target_link_libraries(${PROJECT_NAME} Catch2::Catch2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(PRECOMPILE_HEADERS)
|
||||||
|
target_precompile_headers(${PROJECT_NAME} PRIVATE ${PRECOMPILED_HEADERS_LIST})
|
||||||
|
endif()
|
||||||
endif(BUILD_CLIENT)
|
endif(BUILD_CLIENT)
|
||||||
|
|
||||||
|
|
||||||
|
@ -682,6 +705,10 @@ if(BUILD_SERVER)
|
||||||
if(BUILD_UNITTESTS OR BUILD_BENCHMARKS)
|
if(BUILD_UNITTESTS OR BUILD_BENCHMARKS)
|
||||||
target_link_libraries(${PROJECT_NAME}server Catch2::Catch2)
|
target_link_libraries(${PROJECT_NAME}server Catch2::Catch2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(PRECOMPILE_HEADERS)
|
||||||
|
target_precompile_headers(${PROJECT_NAME}server PRIVATE ${PRECOMPILED_HEADERS_LIST})
|
||||||
|
endif()
|
||||||
endif(BUILD_SERVER)
|
endif(BUILD_SERVER)
|
||||||
|
|
||||||
# See issue #4638
|
# See issue #4638
|
||||||
|
|
103
src/precompiled_headers.txt
Normal file
103
src/precompiled_headers.txt
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
|
||||||
|
# stdlib
|
||||||
|
# ------
|
||||||
|
|
||||||
|
# C stuff:
|
||||||
|
<cassert>
|
||||||
|
<cctype>
|
||||||
|
<cerrno>
|
||||||
|
<cfenv>
|
||||||
|
<cfloat>
|
||||||
|
<cinttypes>
|
||||||
|
<ciso646>
|
||||||
|
<climits>
|
||||||
|
<clocale>
|
||||||
|
<cmath>
|
||||||
|
<csetjmp>
|
||||||
|
<csignal>
|
||||||
|
<cstdarg>
|
||||||
|
<cstdbool>
|
||||||
|
<cstddef>
|
||||||
|
<cstdint>
|
||||||
|
<cstdio>
|
||||||
|
<cstdlib>
|
||||||
|
<cstring>
|
||||||
|
<ctgmath>
|
||||||
|
<ctime>
|
||||||
|
<cuchar>
|
||||||
|
<cwchar>
|
||||||
|
<cwctype>
|
||||||
|
|
||||||
|
# Containers:
|
||||||
|
<array>
|
||||||
|
<deque>
|
||||||
|
<forward_list>
|
||||||
|
<list>
|
||||||
|
<map>
|
||||||
|
<queue>
|
||||||
|
<set>
|
||||||
|
<stack>
|
||||||
|
<unordered_map>
|
||||||
|
<unordered_set>
|
||||||
|
<vector>
|
||||||
|
|
||||||
|
# Input/Output:
|
||||||
|
<fstream>
|
||||||
|
<iomanip>
|
||||||
|
<ios>
|
||||||
|
<iosfwd>
|
||||||
|
<iostream>
|
||||||
|
<istream>
|
||||||
|
<ostream>
|
||||||
|
<sstream>
|
||||||
|
<streambuf>
|
||||||
|
|
||||||
|
# Multi-threading:
|
||||||
|
<atomic>
|
||||||
|
<condition_variable>
|
||||||
|
<future>
|
||||||
|
<mutex>
|
||||||
|
<shared_mutex>
|
||||||
|
<thread>
|
||||||
|
|
||||||
|
# Other:
|
||||||
|
<algorithm>
|
||||||
|
<any>
|
||||||
|
<bitset>
|
||||||
|
<charconv>
|
||||||
|
<chrono>
|
||||||
|
<codecvt>
|
||||||
|
<complex>
|
||||||
|
<exception>
|
||||||
|
<execution>
|
||||||
|
<functional>
|
||||||
|
<initializer_list>
|
||||||
|
<iterator>
|
||||||
|
<limits>
|
||||||
|
<locale>
|
||||||
|
<memory>
|
||||||
|
<memory_resource>
|
||||||
|
<new>
|
||||||
|
<numeric>
|
||||||
|
<optional>
|
||||||
|
<random>
|
||||||
|
<ratio>
|
||||||
|
<regex>
|
||||||
|
<stdexcept>
|
||||||
|
<string>
|
||||||
|
<string_view>
|
||||||
|
<system_error>
|
||||||
|
<tuple>
|
||||||
|
<typeindex>
|
||||||
|
<typeinfo>
|
||||||
|
<type_traits>
|
||||||
|
<utility>
|
||||||
|
<valarray>
|
||||||
|
<variant>
|
||||||
|
|
||||||
|
|
||||||
|
# libs
|
||||||
|
# ----
|
||||||
|
|
||||||
|
# jsoncpp
|
||||||
|
<json/json.h>
|
Loading…
Add table
Add a link
Reference in a new issue