Implement precompiled headers in misc/buffer-tests
* I'm still going to try to include what is used in each module. * At some point, I should implement these in the main project. It will need more testing on the various compilers. It really needs to be on-by-default everywhere. If it's off, then at least pch.h should be included everywhere, to minimize configuration differences between my checkout and other people's checkouts. * There should be some way to configure it off to check whether includes are correct. * The change reduces build times from 27.6s to 15.2s on a single-core VM.
This commit is contained in:
parent
2b7df627eb
commit
55bea51430
@ -8,23 +8,34 @@ CFLAGS += -MMD -Wall -Iharness -I../../shared
|
||||
CXXFLAGS += -MMD -Wall -Iharness -I../../shared -std=c++11 -Wno-format
|
||||
LDFLAGS += -static -static-libgcc -static-libstdc++
|
||||
|
||||
# To disable PCH, just comment out these two lines.
|
||||
PCHFLAGS = -include build/pch.h
|
||||
PCHDEPS = build/pch.h.gch
|
||||
|
||||
# Use gmake -n to see the command-lines gmake would run.
|
||||
|
||||
.PHONY : default
|
||||
default : all
|
||||
|
||||
build/pch.h.gch : harness/pch.h
|
||||
@echo Compiling PCH $<
|
||||
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
build/%.o : %.c
|
||||
@echo Compiling $<
|
||||
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
build/%.o : %.cc
|
||||
build/%.o : %.cc $(PCHDEPS)
|
||||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
@$(CXX) $(PCHFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
build/%.o : ../../shared/%.cc
|
||||
build/%.o : ../../shared/%.cc $(PCHDEPS)
|
||||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
@$(CXX) $(PCHFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
build/%.o : harness/%.cc
|
||||
build/%.o : harness/%.cc $(PCHDEPS)
|
||||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
@$(CXX) $(PCHFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
.PRECIOUS : build/%.o
|
||||
|
||||
@ -59,6 +70,6 @@ Worker.exe : $(WORKER_OBJECTS) $(COMMON_OBJECTS)
|
||||
|
||||
.PHONY : clean
|
||||
clean:
|
||||
rm -f build/*.exe build/*.o build/*.d
|
||||
rm -f build/*.exe build/*.o build/*.d build/*.gch
|
||||
|
||||
-include build/*.d
|
||||
|
19
misc/buffer-tests/harness/pch.h
Executable file
19
misc/buffer-tests/harness/pch.h
Executable file
@ -0,0 +1,19 @@
|
||||
// Precompiled Headers.
|
||||
//
|
||||
// Unfortunate evil that speeds up compile times. In principle, compilation
|
||||
// should still work if PCH is turned off.
|
||||
//
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <vector>
|
Loading…
Reference in New Issue
Block a user