summaryrefslogtreecommitdiffstats
path: root/meta/classes/cmake.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/cmake.bbclass')
-rw-r--r--meta/classes/cmake.bbclass20
1 files changed, 18 insertions, 2 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 55698e60e5..74a952142f 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -7,6 +7,23 @@ B = "${WORKDIR}/build"
7# We need to unset CCACHE otherwise cmake gets too confused 7# We need to unset CCACHE otherwise cmake gets too confused
8CCACHE = "" 8CCACHE = ""
9 9
10# What CMake generator to use.
11# The supported options are "Unix Makefiles" or "Ninja".
12OECMAKE_GENERATOR ?= "Unix Makefiles"
13
14python() {
15 generator = d.getVar("OECMAKE_GENERATOR")
16 if generator == "Unix Makefiles":
17 args = "-G 'Unix Makefiles' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE")
18 d.setVar("OECMAKE_GENERATOR_ARGS", args)
19 d.setVarFlag("do_compile", "progress", "percent")
20 elif generator == "Ninja":
21 d.appendVar("DEPENDS", " ninja-native")
22 d.setVar("OECMAKE_GENERATOR_ARGS", "-G Ninja -DCMAKE_MAKE_PROGRAM=ninja")
23 d.setVarFlag("do_compile", "progress", "outof:^\[(\d+)/(\d+)\]\s+")
24 else:
25 bb.fatal("Unknown CMake Generator %s" % generator)
26}
10# C/C++ Compiler (without cpu arch/tune arguments) 27# C/C++ Compiler (without cpu arch/tune arguments)
11OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`" 28OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`"
12OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`" 29OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`"
@@ -121,9 +138,9 @@ cmake_do_configure() {
121 fi 138 fi
122 139
123 cmake \ 140 cmake \
141 ${OECMAKE_GENERATOR_ARGS} \
124 $oecmake_sitefile \ 142 $oecmake_sitefile \
125 ${OECMAKE_SOURCEPATH} \ 143 ${OECMAKE_SOURCEPATH} \
126 -DCMAKE_MAKE_PROGRAM=${MAKE} \
127 -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ 144 -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
128 -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix'))} \ 145 -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix'))} \
129 -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix'))} \ 146 -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix'))} \
@@ -142,7 +159,6 @@ cmake_do_configure() {
142 -Wno-dev 159 -Wno-dev
143} 160}
144 161
145do_compile[progress] = "percent"
146cmake_do_compile() { 162cmake_do_compile() {
147 bbnote VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD} 163 bbnote VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD}
148 VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD} 164 VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD}