diff options
| author | Ross Burton <ross.burton@intel.com> | 2013-12-03 15:42:58 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-14 11:33:55 +0000 |
| commit | 6aafc529d7007e4d5646cb76c5f4573d8598602f (patch) | |
| tree | d2018060c15d7dd63efd01baa5239b4e629e0cfa /meta/classes | |
| parent | d4ad8f7119cceff3e7088227e19e80e3485ec2ff (diff) | |
| download | poky-6aafc529d7007e4d5646cb76c5f4573d8598602f.tar.gz | |
cmake: respect ${S} and ${B}
Instead of the class-specific variables OECMAKE_BUILDPATH and
OECMAKE_SOURCEPATH, just use ${B} and ${S}.
If these two paths are different, delete any existing ${B} before running a
build so that previous builds don't taint the current build.
Note that OECMAKE_SOURCEPATH and OECMAKE_BUILDPATH are not respected, so recipes
that manually set these in the past will need to be updated to either use
something along the lines of separatebuilddir.inc or set B themselves. If the
old variables are set, a warning is displayed.
(From OE-Core rev: 43073569cb67d98c11aa71211d77b566b64f9145)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/cmake.bbclass | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index 30c1792ffa..1dc406d253 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass | |||
| @@ -6,15 +6,6 @@ CCACHE = "" | |||
| 6 | # We want the staging and installing functions from autotools | 6 | # We want the staging and installing functions from autotools |
| 7 | inherit autotools | 7 | inherit autotools |
| 8 | 8 | ||
| 9 | # Use in-tree builds by default but allow this to be changed | ||
| 10 | # since some packages do not support them (e.g. llvm 2.5). | ||
| 11 | OECMAKE_SOURCEPATH ?= "." | ||
| 12 | |||
| 13 | # If declaring this, make sure you also set EXTRA_OEMAKE to | ||
| 14 | # "-C ${OECMAKE_BUILDPATH}". So it will run the right makefiles. | ||
| 15 | OECMAKE_BUILDPATH ?= "" | ||
| 16 | B="${S}" | ||
| 17 | |||
| 18 | # C/C++ Compiler (without cpu arch/tune arguments) | 9 | # C/C++ Compiler (without cpu arch/tune arguments) |
| 19 | OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`" | 10 | OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`" |
| 20 | OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`" | 11 | OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`" |
| @@ -73,10 +64,14 @@ EOF | |||
| 73 | addtask generate_toolchain_file after do_patch before do_configure | 64 | addtask generate_toolchain_file after do_patch before do_configure |
| 74 | 65 | ||
| 75 | cmake_do_configure() { | 66 | cmake_do_configure() { |
| 76 | if [ ${OECMAKE_BUILDPATH} ] | 67 | if [ "${OECMAKE_BUILDPATH}" -o "${OECMAKE_SOURCEPATH}" ]; then |
| 77 | then | 68 | bbnote "cmake.bbclass no longer uses OECMAKE_SOURCEPATH and OECMAKE_BUILDPATH. This recipe now will do in-tree builds, to do out-of-tree builds set S and B." |
| 78 | mkdir -p ${OECMAKE_BUILDPATH} | 69 | fi |
| 79 | cd ${OECMAKE_BUILDPATH} | 70 | |
| 71 | if [ "${S}" != "${B}" ]; then | ||
| 72 | rm -rf ${B} | ||
| 73 | mkdir -p ${B} | ||
| 74 | cd ${B} | ||
| 80 | fi | 75 | fi |
| 81 | 76 | ||
| 82 | # Just like autotools cmake can use a site file to cache result that need generated binaries to run | 77 | # Just like autotools cmake can use a site file to cache result that need generated binaries to run |
| @@ -88,7 +83,7 @@ cmake_do_configure() { | |||
| 88 | 83 | ||
| 89 | cmake \ | 84 | cmake \ |
| 90 | ${OECMAKE_SITEFILE} \ | 85 | ${OECMAKE_SITEFILE} \ |
| 91 | ${OECMAKE_SOURCEPATH} \ | 86 | ${S} \ |
| 92 | -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ | 87 | -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ |
| 93 | -DCMAKE_INSTALL_SO_NO_EXE=0 \ | 88 | -DCMAKE_INSTALL_SO_NO_EXE=0 \ |
| 94 | -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \ | 89 | -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \ |
| @@ -98,20 +93,12 @@ cmake_do_configure() { | |||
| 98 | } | 93 | } |
| 99 | 94 | ||
| 100 | cmake_do_compile() { | 95 | cmake_do_compile() { |
| 101 | if [ ${OECMAKE_BUILDPATH} ] | 96 | cd ${B} |
| 102 | then | ||
| 103 | cd ${OECMAKE_BUILDPATH} | ||
| 104 | fi | ||
| 105 | |||
| 106 | base_do_compile | 97 | base_do_compile |
| 107 | } | 98 | } |
| 108 | 99 | ||
| 109 | cmake_do_install() { | 100 | cmake_do_install() { |
| 110 | if [ ${OECMAKE_BUILDPATH} ]; | 101 | cd ${B} |
| 111 | then | ||
| 112 | cd ${OECMAKE_BUILDPATH} | ||
| 113 | fi | ||
| 114 | |||
| 115 | autotools_do_install | 102 | autotools_do_install |
| 116 | } | 103 | } |
| 117 | 104 | ||
