Giter VIP home page Giter VIP logo

Comments (4)

sakra avatar sakra commented on May 19, 2024 1

It is possible to make cotire work in that scenario by setting the COTIRE_PREFIX_HEADER_INCLUDE_PATH property on the target or on the containing directory before invoking cotire, i.e.:

set_target_properties(mytarget PROPERTIES
   COTIRE_PREFIX_HEADER_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/easylogging++.h")
...
cotire(mytarget)

Cotire will then select the easylogging++.h header for inclusion in the prefix header while other header files in CMAKE_SOURCE_DIR will continue to be ignored.

from cotire.

EgbertW avatar EgbertW commented on May 19, 2024

Thanks, that fixes it and properly includes the file. The results are somewhat disappointed, I once experienced the precompiled headers in MSVC on Windows which gave me an incredible speedup while this shaves of a couple of seconds of the total compile time, but that's not cotire's fault of course.

At least I managed to establish for certain that the header is only included once. The main drawback of course is that even though the precompiled headers are included and processed first, when handling the source files, the same headers are still located in the filesystem and scanned but only skipped thanks to their include guards. But I guess that's nearly impossible to avoid except by adding the include guards around the respective #include statements in the source files already, in other words, manually preparing the sources for precompiled headers.

Anyway, thanks for the module and the help on this issue, I'll be looking into a way to make more efficient use of it!

from cotire.

sakra avatar sakra commented on May 19, 2024

Try adding #pragma once to the easylogging++.h header file. This should prevent the compile from re-opening the header.

from cotire.

EgbertW avatar EgbertW commented on May 19, 2024

Well, yes, that might help for this specific instance of course, but it's a non-standard practice so I'd rather avoid it. And while I'm at it I would like to reduce the compile time for all the system includes, too.

I now managed to fix this by creating a new dependencies.h header file that contains all my system / library headers in one spot, with include guards, and include that file in all the other source code instead of the separate files. When the PCH is loaded, this file is skipped and therefore all the dependent files are never even touched.

This shaved another 20 seconds compile time off. Still not as impressive as what MSVC showed me, but at least an improvement.

from cotire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.