Pre-Compiled headers and GCC - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: Pre-Compiled headers and GCC (/thread-328.html) |
Pre-Compiled headers and GCC - FakeTruth - 02-04-2012 After madmaxoft enabled precompiled headers in the Windows builds, compile time was reduced a lot. I'm trying to do the same for *nix users by enabling precompiled headers. However, it seems using precompiled headers actually slows down compile time O.o How I understood the precompiled headers with GCC is that you compile a .h file the same way you compile a .cpp file and it will create a .h.gch file, place that file in the same folder as the .h file and GCC will use the .h.gch file instead of the .h file. I checked it if works with the -H GCC parameter, and it works, but it seems to take longer to compile the project even if it's slightly slower. There's definitely no improvement though. Am I doing something wrong? RE: Pre-Compiled headers and GCC - xoft - 02-04-2012 Are you precompiling the right header? VS works by precompiling one specific header and then including that header as the first one in every cpp file (that's why I added the Globals.h header). I think with gcc you want to do the same thing - precompile the Globals.h header and then proceed with normal compilation. I'm having a friend help me with makefiles now, so you might want to postpone this a bit until we have a better makefile (that is, if he can help us Right now a worse problem with *nix is that a change in the header doesn't force "make" to recompile all cpps that are affected; also i'd like to have three builds - debug, release and profiling. He said he might manage all this, but it'll take some time. RE: Pre-Compiled headers and GCC - FakeTruth - 02-04-2012 Ahh great, that would be superb And I was compiling Globals.h yup I could see it was including less header files by using -H. -H prints all headers that are included, and it was (a lot) less when I used the precompiled header, but slower nonetheless. RE: Pre-Compiled headers and GCC - xoft - 02-06-2012 Well you can always use at least the parallel make (make -j <number of processes>) RE: Pre-Compiled headers and GCC - FakeTruth - 02-06-2012 I know and I do RE: Pre-Compiled headers and GCC - AlterEgo - 03-29-2012 Ever consider Cmake implementation? You can set the optimization for each platform and have it generate the build files for each users situation. I know it looks intimidating at first but it's not that hard to implement. When I get some extra time I will make a patch to share then you can see it's many advantages. RE: Pre-Compiled headers and GCC - xoft - 03-29-2012 I've seen CMake used in MineServer and it didn't work that well there. And it doesn't support customizations to the project files - for example I group the source files by category (os support, packets, world generating, mobs etc.). That doesn't seem possible with cmake. I think the status quo is sufficient - there are two active developers, each maintains their VS's project files, and the *nix makefile is generic enough to pick up anything in the right paths BUT if CMake can show us how to make gcc use precompiled headers for the project, that might be a piece of information worth extracting. Not the entire management, just the parameters / exclusions to use. RE: Pre-Compiled headers and GCC - AlterEgo - 03-30-2012 Fair enough. But MineServer just didn't work well for anything Far as the custom scripts. Cmake can me made to recognize custom scripts being added without modifying any cmake file long as they use a designated directory for there scripts. It works well in my project but I not here to discuss my project. But if you need an example just PM me and I will give you the link. |