diff options
author | Tobias C. Berner <tcberner@FreeBSD.org> | 2017-06-25 21:07:58 +0000 |
---|---|---|
committer | Tobias C. Berner <tcberner@FreeBSD.org> | 2017-06-25 21:07:58 +0000 |
commit | 5e373eaa92fd3a243e1bc7a8e3eaf114ab1eeabf (patch) | |
tree | 3291541f3b73432c893dec35f4f23770dd07732a /Mk/Uses/cmake.mk | |
parent | update to 20170510 (diff) |
Make ninja opt-out in cmake.mk
Using ninja instead of make (1) can lead to significant speed ups while building.
Therefore switch from having the ninja generator opt-in to having it opt-out.
Previously cmake-ports that wanted to use ninja could set
CMAKE_NINJA=yes
now, ports that do not work with ninja can set
cmake:<existing args>,noninja
Note, that needing this should be an exception and most often points to a broken
cmake of the port.
The ports using cmake were modified
* removed USES=gmake, if ninja is used
* removed MAKE_ARGS, if ninja is used
* added the cmake-argument noninja if necessary
PR: 219629
PR: 213331
Exp-run by: antoine
Reviewed by: rakuco
Differential Revision: https://reviews.freebsd.org/D10748
Notes
Notes:
svn path=/head/; revision=444324
Diffstat (limited to 'Mk/Uses/cmake.mk')
-rw-r--r-- | Mk/Uses/cmake.mk | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk index e880100d9d08..80bf800561f4 100644 --- a/Mk/Uses/cmake.mk +++ b/Mk/Uses/cmake.mk @@ -4,9 +4,18 @@ # # Feature: cmake # Usage: USES=cmake or USES=cmake:ARGS -# Valid ARGS: outsource +# Valid ARGS: outsource, run, noninja # ARGS description: # outsource perform an out-of-source build +# noninja don't use ninja instead of make +# Setting this should be an exception, and hints to an issue +# inside the ports build system. +# A few corner cases never use ninja, and are handled, to reduce +# the usage of 'noninja'.: +# 1) fortran ports +# 2) ports that set BUILD_- or INSTALL_WRKSRC to +# something different than CONFIGURE_WRKSRC +# run add a runtime dependency on cmake # # # Additional variables that affect cmake behaviour: @@ -14,7 +23,6 @@ # User defined variables: # CMAKE_NOCOLOR - Disable colour build output # Default: not set, unless BATCH or PACKAGE_BUILDING is defined -# CMAKE_NINJA - Use ninja instead of make(1) # # Variables for ports: # CMAKE_ARGS - Arguments passed to cmake @@ -36,7 +44,7 @@ .if !defined(_INCLUDE_USES_CMAKE_MK) _INCLUDE_USES_CMAKE_MK= yes -_valid_ARGS= outsource run +_valid_ARGS= outsource run noninja # Sanity check .for arg in ${cmake_ARGS} @@ -91,10 +99,6 @@ CMAKE_NOCOLOR= yes CMAKE_ARGS+= -DCMAKE_COLOR_MAKEFILE:BOOL=OFF .endif -.if defined(CMAKE_NINJA) -.include "${USESDIR}/ninja.mk" -.endif - _CMAKE_MSG= "===> Performing in-source build" CMAKE_SOURCE_PATH?= ${WRKSRC} @@ -106,6 +110,20 @@ INSTALL_WRKSRC?= ${CONFIGURE_WRKSRC} TEST_WRKSRC?= ${CONFIGURE_WRKSRC} .endif +# By default we use the ninja generator. +# Except, if cmake:run is set (cmake not wanted as generator) +# fortran is used, as the ninja-generator does not handle it. +# or if CONFIGURE_WRKSRC does not match BUILD_WRKSRC or INSTALL_WRKSRC +# as the build.ninja file won't be where ninja expects it. +.if empty(cmake_ARGS:Mnoninja) && empty(cmake_ARGS:Mrun) && empty(USES:Mfortran) +. if "${CONFIGURE_WRKSRC}" == "${BUILD_WRKSRC}" && "${CONFIGURE_WRKSRC}" == "${INSTALL_WRKSRC}" +. if ! empty(USES:Mgmake) +BROKEN= USES=gmake is incompatible with cmake's ninja-generator +. endif +. include "${USESDIR}/ninja.mk" +. endif +.endif + .if !target(do-configure) do-configure: @${ECHO_MSG} ${_CMAKE_MSG} |