summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2015-07-29 14:57:14 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-24 23:46:58 +0100
commitc89a1eb877050557af3ef5cd24b7d772068dbc2e (patch)
tree0f9d1fb577ba60464aa50267974348d7ef32d985
parent2b46af7ad018ce64e158ee30b5f0fd4f5988e75c (diff)
downloadpoky-c89a1eb877050557af3ef5cd24b7d772068dbc2e.tar.gz
classes/cmake: add arch conversion routine
cmake expects target architecture strings in the format of uname(2), which do not always match TARGET_ARCH (e.g. powerpc vs ppc). (From OE-Core rev: 7c61d022aa9bbba3c2f8a2df46eeb19e2772c89a) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/cmake.bbclass12
1 files changed, 11 insertions, 1 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index c1742461ab..ae3cc025e8 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -30,12 +30,22 @@ OECMAKE_EXTRA_ROOT_PATH ?= ""
30OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY" 30OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY"
31OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH" 31OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH"
32 32
33# CMake expects target architectures in the format of uname(2),
34# which do not always match TARGET_ARCH, so all the necessary
35# conversions should happen here.
36def map_target_arch_to_uname_arch(target_arch):
37 if target_arch == "powerpc":
38 return "ppc"
39 if target_arch == "powerpc64":
40 return "ppc64"
41 return target_arch
42
33cmake_do_generate_toolchain_file() { 43cmake_do_generate_toolchain_file() {
34 cat > ${WORKDIR}/toolchain.cmake <<EOF 44 cat > ${WORKDIR}/toolchain.cmake <<EOF
35# CMake system name must be something like "Linux". 45# CMake system name must be something like "Linux".
36# This is important for cross-compiling. 46# This is important for cross-compiling.
37set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) 47set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` )
38set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} ) 48set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH', True))} )
39set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) 49set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
40set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) 50set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
41set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) 51set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )