]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
classes/cmake: add arch conversion routine
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>
Wed, 29 Jul 2015 11:57:14 +0000 (14:57 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 24 Aug 2015 22:43:29 +0000 (23:43 +0100)
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>
meta/classes/cmake.bbclass

index c1742461abf96e8de1a0247464b77ac94ab7fd8b..ae3cc025e8ebd218b8868c70ea7ad3d4f8c91363 100644 (file)
@@ -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} )