cellml / libcellml

Repository for libCellML development.
https://libcellml.org
Apache License 2.0
16 stars 21 forks source link

Add support for `buildcache` #960

Closed agarny closed 3 years ago

agarny commented 3 years ago

Fixes #959.

nickerso commented 3 years ago

I don't know how to test this with Visual Studio. I have buildcache and point CMake at it and I can configure fine, but I'm not seeing any obvious change in the visual studio solution or the build time. I can confirm it doesn't break things, but would be good if there was something obvious I'm missing that would tell me this is having the desire impact on build times...

agarny commented 3 years ago

Normally, all you need is for buildcache to be on your PATH. From there, libCellML's build system should pick it up and make use of it.

Having said this, I have just checked on Windows and it's not taking advantage of buildcache (while it does on Linux and macOS). I know (or, rather, I believe since I am now doubting myself!) that I got it to work with libOpenCOR, so I tried buildcache there and... it's not working either...!?

Ok, will need to look into it in more details... Argh!

agarny commented 3 years ago

I had a quick look and everything works fine when building libCellML in release mode:

When it comes to debug mode, I believe this is due to CMake using the /Zi option (i.e. "enable debugging information") for MSVC by default. I remember having the same issue with OpenCOR when trying to use clcache. In the end, I had to replace the /Zi option with the /Z7 option (i.e. "enable old-style debug info") to be able to take advantage of clcache. Will look into this tomorrow, but that would also explain why things didn't work for libOpenCOR either...

agarny commented 3 years ago

FWIW, to build libCellML with buildcache now works fine... from the command line, but... not using a Visual Studio solution.

REM Initialise VS2017's environment
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

REM Reset buildcache for a cold build
buildcache -C
buildcache -s

REM Or... reset buildcache for a warm build
buildcache -z

REM Configure libCellML
cd [libCellML]
mkdir build
cd build
cmake -G Ninja -DLIBXML2_LIBRARY="C:\Program Files\LibXml2 2.9.6\lib\xml2.lib" ..

REM Build libCellML
ninja

REM Confirm that buildcache has properly cached our libCellML build
buildcache -s

Well, Windows/MSVC is always going to be a real PITA, so as far as I am concerned, I am happy with "just" buildcache working from the command line. IOW, this is ready for re-review.

agarny commented 3 years ago

not really going to be able to test this one if it isn't usable in visual studio...

I have updated my previous comment which should allow you to test things from the command line.

nickerso commented 3 years ago

not really going to be able to test this one if it isn't usable in visual studio...

I have updated my previous comment which should allow you to test things from the command line.

@nickerso hasn't compiled anything from a command line for a long time...