igcc
igcc copied to clipboard
PCH setup
One of the ways to cut down on the overhead of repeated compilation is to make a precompiled header. The current set up is basically ready: boilerplate.h
is always included, and with bits/stdc++.h
it's got almost the entire standard library.
In fact, bits/stdc++.h
states plainly at the top:
/** @file stdc++.h
* This is an implementation file for a precompiled header.
*/
That's how it's supposed to be used!
But how do we really do it?
- The config file needs a new pch_command option to run
gcc -x c++-header $header -o $pcheader
. This helps interaction with #10. - Use
-include
(or-include-pch
in clang) in the compiler invocation to get it to include. Doing it via command line lets us avoid writing to the igcc install directory, which can have permission issues. It does prevent users from opting out the boilerplate though.