diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2014-10-20 23:58:52 -0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2015-01-09 09:18:36 -0800 |
commit | 12c0d4178827475de9557200d6786f4ca12f63a0 (patch) | |
tree | 9d3f47231a31cf17703e191989198666d9e9a9d3 /meta/recipes-devtools | |
parent | 7294984cf641c0e4373984d6135e5686bb74e8dd (diff) | |
download | tizen-distro-12c0d4178827475de9557200d6786f4ca12f63a0.tar.gz tizen-distro-12c0d4178827475de9557200d6786f4ca12f63a0.tar.bz2 tizen-distro-12c0d4178827475de9557200d6786f4ca12f63a0.zip |
nativesdk-cmake: Adjust toolchain paths dynamically
This patch adds a flexible way to configure the CMake in SDKs. It adds
a toolchain configuration script which supports subscripts for
extensions, as for example Qt5.
(From OE-Core rev: 484502e4e062fae1130a60626f39f5512af4c5c8)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake | 18 | ||||
-rw-r--r-- | meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/cmake/cmake_2.8.12.2.bb | 14 |
3 files changed, 33 insertions, 0 deletions
diff --git a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake new file mode 100644 index 0000000000..60014bbf2b --- /dev/null +++ b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake @@ -0,0 +1,18 @@ +set( CMAKE_SYSTEM_NAME Linux ) +set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) +set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE ) +set( CMAKE ASM_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE ) +set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) +set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} ) +set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) +set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) + +string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT}) +string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) + +# Include the toolchain configuration subscripts +file( GLOB toolchain_config_files "${CMAKE_TOOLCHAIN_FILE}.d/*.cmake" ) +foreach(config ${toolchain_config_files}) + include(${config}) +endforeach() diff --git a/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh b/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh new file mode 100644 index 0000000000..0eb56b66fa --- /dev/null +++ b/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh @@ -0,0 +1 @@ +alias cmake="cmake -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake" diff --git a/meta/recipes-devtools/cmake/cmake_2.8.12.2.bb b/meta/recipes-devtools/cmake/cmake_2.8.12.2.bb index de2ac6b219..66a6af629c 100644 --- a/meta/recipes-devtools/cmake/cmake_2.8.12.2.bb +++ b/meta/recipes-devtools/cmake/cmake_2.8.12.2.bb @@ -6,6 +6,10 @@ DEPENDS += "curl expat zlib libarchive" SRC_URI += "file://dont-run-cross-binaries.patch" +SRC_URI_append_class-nativesdk = " \ + file://OEToolchainConfig.cmake \ + file://environment.d-cmake.sh" + SRC_URI[md5sum] = "17c6513483d23590cbce6957ec6d1e66" SRC_URI[sha256sum] = "8c6574e9afabcb9fc66f463bb1f2f051958d86c85c37fccf067eb1a44a120e5e" @@ -32,6 +36,16 @@ EXTRA_OECMAKE=" \ ${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '-DKWSYS_LFS_WORKS=1', '-DKWSYS_LFS_DISABLE=1', d)} \ " +do_install_append_class-nativesdk() { + mkdir -p ${D}${datadir}/cmake + install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/ + + mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d + install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${SDKPATHNATIVE}/environment-setup.d/cmake.sh +} + +FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}" + FILES_${PN} += "${datadir}/cmake-${CMAKE_MAJOR_VERSION}" FILES_${PN}-doc += "${docdir}/cmake-${CMAKE_MAJOR_VERSION}" |