diff options
| -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 | ||
