Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Alternative CMake Integration #365

Open
psalvaggio opened this issue Nov 21, 2019 · 4 comments
Open

Alternative CMake Integration #365

psalvaggio opened this issue Nov 21, 2019 · 4 comments

Comments

@psalvaggio
Copy link

I have been using ccache for a long time in CMake and have integrated it the following way:

find_program(CCACHE_FOUND ccache)
  if (CCACHE_FOUND)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
  endif()

Doing it this way is nice because it requires no additional user input besides having ccache installed and it being in the user's path. So, I wanted a way to do this with clcache in a similar manner. I installed through pip and changed my original snippet to the following:

# Enable the compiler cache
if (WIN32)
  find_program(CLCACHE_FOUND clcache)
  if (CLCACHE_FOUND)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE
                 "${CMAKE_CURRENT_LIST_DIR}/clcache-launcher.bat")
  endif()
else()
  find_program(CCACHE_FOUND ccache)
  if (CCACHE_FOUND)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
  endif()
endif()

where clcache-launcher.bat was:

@echo off
for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
clcache %ALL_BUT_FIRST%

This got me the same semantics as using ccache, but now I get a cache on Linux/Mac and Windows in the same usage pattern.

It might be useful to add this type of pattern to the wiki for integration for people that are coming over from ccache and are used to that pattern of using a compiler cache.

Best,
Phil

@rweickelt
Copy link

Since early 2019 this ugly workaround should no longer be necessary because clcache now determines whether the first command line argument is a compiler executable. However, the last released version is 4.2.0 which does not support it which makes me believe that this project is abandoned.

@frerich
Copy link
Owner

frerich commented Nov 26, 2019

@rweickelt It's unmaintained, yes - but there are a couple of forks which may be more active. A couple of weeks ago, I mentioned this in another comment:

I never actually used MSBuild myself - in fact, I stopped using clcache many years ago since I'm not working witht Visual Studio and C++ as much as I used to. However, I'd feel a bit bad about blindly merging functionality without having at least tried i myself - which is why this promising PR did not get merged yet.

I believe many users of clcache would appreciate if this project would find a new maintainier - let me know if anyone is interested!

...which, unfortunately, was followed by awkward silence. :-(

@rweickelt
Copy link

Yeah, I know how it is. Great that you have developed it, it seems to work well enough with MS VS 2017. Thanks to #346, integration of clcache was very easy in our project and safes a lot of time on Travis CI.

I'd recommend @psalvaggio to try out clcache from the master branch. Installation with pip is straight forward as shown in the link above.

How to find out the most active fork?

@inorton
Copy link
Contributor

inorton commented Nov 27, 2019

Oh! I didn't know maintenance had slowed/stopped. @rweickelt you might have better luck then with cclash, it doesn't support PDB builds though. https://github.com/inorton/cclash but I did get some very good speedups.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants