Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/cmake.mk
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# Provide support for CMake based projects | # Provide support for CMake based projects | ||||
# | # | ||||
# Feature: cmake | # Feature: cmake | ||||
# Usage: USES=cmake or USES=cmake:ARGS | # Usage: USES=cmake or USES=cmake:ARGS | ||||
# Valid ARGS: outsource | # Valid ARGS: outsource, run, noninja | ||||
# ARGS description: | # ARGS description: | ||||
# outsource perform an out-of-source build | # outsource perform an out-of-source build | ||||
# noninja don't use ninja instead of make | |||||
# run add a runtime dependency on cmake | |||||
# | # | ||||
# | # | ||||
# Additional variables that affect cmake behaviour: | # Additional variables that affect cmake behaviour: | ||||
# | # | ||||
# User defined variables: | # User defined variables: | ||||
# CMAKE_NOCOLOR - Disable colour build output | # CMAKE_NOCOLOR - Disable colour build output | ||||
# Default: not set, unless BATCH or PACKAGE_BUILDING is defined | # Default: not set, unless BATCH or PACKAGE_BUILDING is defined | ||||
# CMAKE_NINJA - Use ninja instead of make(1) | |||||
# | # | ||||
# Variables for ports: | # Variables for ports: | ||||
# CMAKE_ARGS - Arguments passed to cmake | # CMAKE_ARGS - Arguments passed to cmake | ||||
# Default: see below | # Default: see below | ||||
# CMAKE_BUILD_TYPE - Type of build (cmake predefined build types). | # CMAKE_BUILD_TYPE - Type of build (cmake predefined build types). | ||||
# Projects may have their own build profiles. | # Projects may have their own build profiles. | ||||
# CMake supports the following types: Debug, | # CMake supports the following types: Debug, | ||||
# Release, RelWithDebInfo and MinSizeRel. | # Release, RelWithDebInfo and MinSizeRel. | ||||
# Debug and Release profiles respect system | # Debug and Release profiles respect system | ||||
# CFLAGS, RelWithDebInfo and MinSizeRel will set | # CFLAGS, RelWithDebInfo and MinSizeRel will set | ||||
# CFLAGS to "-O2 -g" and "-Os -DNDEBUG". | # CFLAGS to "-O2 -g" and "-Os -DNDEBUG". | ||||
# Default: Release, if WITH_DEBUG is not set, | # Default: Release, if WITH_DEBUG is not set, | ||||
# Debug otherwise | # Debug otherwise | ||||
# CMAKE_SOURCE_PATH - Path to the source directory | # CMAKE_SOURCE_PATH - Path to the source directory | ||||
# Default: ${WRKSRC} | # Default: ${WRKSRC} | ||||
# | # | ||||
# MAINTAINER: kde@FreeBSD.org | # MAINTAINER: kde@FreeBSD.org | ||||
.if !defined(_INCLUDE_USES_CMAKE_MK) | .if !defined(_INCLUDE_USES_CMAKE_MK) | ||||
_INCLUDE_USES_CMAKE_MK= yes | _INCLUDE_USES_CMAKE_MK= yes | ||||
_valid_ARGS= outsource run | _valid_ARGS= outsource run noninja | ||||
# Sanity check | # Sanity check | ||||
.for arg in ${cmake_ARGS} | .for arg in ${cmake_ARGS} | ||||
. if empty(_valid_ARGS:M${arg}) | . if empty(_valid_ARGS:M${arg}) | ||||
IGNORE= Incorrect 'USES+= cmake:${cmake_ARGS}' usage: argument [${arg}] is not recognized | IGNORE= Incorrect 'USES+= cmake:${cmake_ARGS}' usage: argument [${arg}] is not recognized | ||||
. endif | . endif | ||||
.endfor | .endfor | ||||
Show All 38 Lines | |||||
.if defined(BATCH) || defined(PACKAGE_BUILDING) | .if defined(BATCH) || defined(PACKAGE_BUILDING) | ||||
CMAKE_NOCOLOR= yes | CMAKE_NOCOLOR= yes | ||||
.endif | .endif | ||||
.if defined(CMAKE_NOCOLOR) | .if defined(CMAKE_NOCOLOR) | ||||
CMAKE_ARGS+= -DCMAKE_COLOR_MAKEFILE:BOOL=OFF | CMAKE_ARGS+= -DCMAKE_COLOR_MAKEFILE:BOOL=OFF | ||||
.endif | .endif | ||||
.if defined(CMAKE_NINJA) | .if empty(cmake_ARGS:Mnoninja) && empty(USES:Mfortran) | ||||
.include "${USESDIR}/ninja.mk" | .include "${USESDIR}/ninja.mk" | ||||
.endif | .endif | ||||
mat: remove empty line. | |||||
_CMAKE_MSG= "===> Performing in-source build" | _CMAKE_MSG= "===> Performing in-source build" | ||||
CMAKE_SOURCE_PATH?= ${WRKSRC} | CMAKE_SOURCE_PATH?= ${WRKSRC} | ||||
.if ${cmake_ARGS:Moutsource} | .if ${cmake_ARGS:Moutsource} | ||||
_CMAKE_MSG= "===> Performing out-of-source build" | _CMAKE_MSG= "===> Performing out-of-source build" | ||||
CONFIGURE_WRKSRC= ${WRKDIR}/.build | CONFIGURE_WRKSRC= ${WRKDIR}/.build | ||||
BUILD_WRKSRC?= ${CONFIGURE_WRKSRC} | BUILD_WRKSRC?= ${CONFIGURE_WRKSRC} | ||||
INSTALL_WRKSRC?= ${CONFIGURE_WRKSRC} | INSTALL_WRKSRC?= ${CONFIGURE_WRKSRC} | ||||
Show All 11 Lines |
remove empty line.