[MacPorts] #54752: cmake 1.1 PG : ccache support

MacPorts noreply at macports.org
Tue Sep 5 07:26:43 UTC 2017


#54752: cmake 1.1 PG : ccache support
-------------------------+-----------------
 Reporter:  RJVB         |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  ports        |    Version:
 Keywords:               |       Port:
-------------------------+-----------------
 I keep evolving my cmake 1.1 PG
 (https://github.com/RJVB/macstrop/blob/master/_resources/port1.0/group/cmake-1.1.tcl);
 yesterday I figured out how to support ccache:

 {{{
 options                             cmake.ccache

 # we support ccache via our own cache variable (which incompatible
 projects can turn off).
 default cmake.ccache                [tbool configure.ccache]

 # tell CMake to use ccache via the CMAKE_<LANG>_COMPILER_LAUNCHER variable
 # and unset the global configure.ccache option which is not compatible
 # with CMake.
 # See https://stackoverflow.com/questions/1815688/how-to-use-ccache-with-
 cmake
 proc cmake::ccaching {} {
     global cmake.ccache prefix
     if {[tbool cmake.ccache] && [file exists ${prefix}/bin/ccache]} {
         return [list \
             -DCMAKE_C_COMPILER_LAUNCHER=${prefix}/bin/ccache \
             -DCMAKE_CXX_COMPILER_LAUNCHER=${prefix}/bin/ccache]
     }
 }

 configure.ccache    no

 default configure.pre_args {[list \
                     -DCMAKE_BUILD_TYPE=${cmake.build_type} \
                     -DCMAKE_INSTALL_PREFIX="${cmake.install_prefix}" \
                     -DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib"
 \
                     {*}[cmake::system_prefix_path] \
                     {*}[cmake::ccaching] \
                     {-DCMAKE_C_COMPILER="$CC"} \
                     {-DCMAKE_CXX_COMPILER="$CXX"} \
 <snip>
 }}}

 FWIW, I did this thinking it could speed up building llvm and clang from
 source as the latter seems to rebuild a good part of the former. No such
 luck, I got barely more than 1% cache hits.

--
Ticket URL: <https://trac.macports.org/ticket/54752>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list