diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2015-07-29 14:57:14 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-24 23:43:29 +0100 |
commit | 7c61d022aa9bbba3c2f8a2df46eeb19e2772c89a (patch) | |
tree | 026ec04c1439a2883ca3d5f30eec0a4ba46e62de /meta/classes/cmake.bbclass | |
parent | 3a7d80e50a6683339a8940e12a3c10efd2586518 (diff) | |
download | openembedded-core-7c61d022aa9bbba3c2f8a2df46eeb19e2772c89a.tar.gz openembedded-core-7c61d022aa9bbba3c2f8a2df46eeb19e2772c89a.tar.bz2 openembedded-core-7c61d022aa9bbba3c2f8a2df46eeb19e2772c89a.zip |
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).
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/cmake.bbclass')
-rw-r--r-- | meta/classes/cmake.bbclass | 12 |
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 ?= "" OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY" OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH" +# CMake expects target architectures in the format of uname(2), +# which do not always match TARGET_ARCH, so all the necessary +# conversions should happen here. +def map_target_arch_to_uname_arch(target_arch): + if target_arch == "powerpc": + return "ppc" + if target_arch == "powerpc64": + return "ppc64" + return target_arch + cmake_do_generate_toolchain_file() { cat > ${WORKDIR}/toolchain.cmake <<EOF # CMake system name must be something like "Linux". # This is important for cross-compiling. set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) -set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} ) +set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH', True))} ) set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) |