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:46:58 +0100 |
| commit | c89a1eb877050557af3ef5cd24b7d772068dbc2e (patch) | |
| tree | 0f9d1fb577ba60464aa50267974348d7ef32d985 | |
| parent | 2b46af7ad018ce64e158ee30b5f0fd4f5988e75c (diff) | |
| download | poky-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.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 ?= "" | |||
| 30 | OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY" | 30 | OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY" |
| 31 | OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH" | 31 | OECMAKE_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. | ||
| 36 | def 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 | |||
| 33 | cmake_do_generate_toolchain_file() { | 43 | cmake_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. |
| 37 | set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) | 47 | set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) |
| 38 | set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} ) | 48 | set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH', True))} ) |
| 39 | set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) | 49 | set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) |
| 40 | set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) | 50 | set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) |
| 41 | set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) | 51 | set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) |
