Optional cotire support to speed up builds (disabled by default)

This commit is contained in:
Andrei "Akari" Alexeyev 2017-04-20 07:44:31 +03:00
parent 01e7f221c6
commit 654f80bcfc
5 changed files with 17 additions and 3 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "cotire"]
path = cotire
url = https://github.com/sakra/cotire

View file

@ -16,6 +16,7 @@ option(NO_AUDIO "Build without audio support" OFF)
option(DEBUG_USE_UBSAN "Enable the Undefined Behaviour Sanitizer (UBSan) in debug builds. Only disable if the compiler or target platform doesn't support it." ON)
option(DEBUG_USE_ASAN "Enable the Address Sanitizer (ASan) and leak detection in debug builds." OFF)
option(RELEASE_USE_LTO "Enable Link Time Optimization in release builds." ON)
option(USE_COTIRE "Use cotire (COmpile TIme REducer) to speed up builds" OFF)
add_subdirectory(src)

1
cotire Submodule

@ -0,0 +1 @@
Subproject commit 3d63330c99fde1844e3ad63c98025d18d38019f2

View file

@ -1,4 +1,10 @@
if(USE_COTIRE)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cotire/CMake")
cmake_policy(SET CMP0011 NEW)
include(cotire)
endif()
find_package(PkgConfig REQUIRED)
if(LINK_TO_LIBGL)
@ -261,3 +267,7 @@ elseif(RELATIVE)
else()
install(TARGETS taisei RUNTIME DESTINATION bin)
endif()
if(USE_COTIRE)
cotire(taisei)
endif()

View file

@ -333,14 +333,13 @@ char* read_all(const char *filename, int *outsize) {
}
bool parse_keyvalue_stream_cb(SDL_RWops *strm, KVCallback callback, void *data) {
static const size_t bufsize = 256;
static const char separator[] = "= ";
char buffer[bufsize];
char buffer[256];
int lineno = 0;
int errors = 0;
loopstart: while(SDL_RWgets(strm, buffer, bufsize)) {
loopstart: while(SDL_RWgets(strm, buffer, sizeof(buffer))) {
char *ptr = buffer;
char *sep, *key, *val;