poky/meta/recipes-devtools/cmake/cmake_3.28.3.bb
Moritz Haase b8f8125f05 cmake: Correctly handle cost data of tests with arbitrary chars in name
ctest automatically optimizes the order of (parallel) test execution based on
historic test case runtime via the COST property (see [0]), which can have a
significant impact on overall test run times. Sadly this feature is broken in
CMake < 4.0.0 for test cases that have spaces in their name (see [1]).

This commit is a backport of f24178f3 (which itself backports the upstream fix).
The patch was adapted slightly to apply cleanly to the older CMake version in
scarthgap. As repeated test runs are expected to mainly take place inside the
SDK, the patch is only applied to 'nativesdk' builds.

[0]: https://cmake.org/cmake/help/latest/prop_test/COST.html
[1]: https://gitlab.kitware.com/cmake/cmake/-/issues/26594

Reported-By: John Drouhard <john@drouhard.dev>
(From OE-Core rev: cfa97a50e06fb0fcc7cbc0ada54ce7ad5ba29ebe)

Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-06-25 08:35:10 -07:00

70 lines
2.4 KiB
BlitzBasic

require cmake.inc
inherit cmake bash-completion
DEPENDS += "curl expat zlib libarchive xz ncurses bzip2"
SRC_URI:append:class-nativesdk = " \
file://0001-ctest-Allow-arbitrary-characters-in-test-names-of-CT.patch \
file://OEToolchainConfig.cmake \
file://SDKToolchainConfig.cmake.template \
file://cmake-setup.py \
file://environment.d-cmake.sh \
"
LICENSE:append = " & BSD-1-Clause & MIT"
LIC_FILES_CHKSUM:append = " \
file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \
file://Utilities/cmlibrhash/COPYING;md5=a8c2a557a5c53b1c12cddbee98c099af \
file://Utilities/cmlibuv/LICENSE;md5=ad93ca1fffe931537fcf64f6fcce084d \
"
# Strip ${prefix} from ${docdir}, set result into docdir_stripped
python () {
prefix=d.getVar("prefix")
docdir=d.getVar("docdir")
if not docdir.startswith(prefix):
bb.fatal('docdir must contain prefix as its prefix')
docdir_stripped = docdir[len(prefix):]
if len(docdir_stripped) > 0 and docdir_stripped[0] == '/':
docdir_stripped = docdir_stripped[1:]
d.setVar("docdir_stripped", docdir_stripped)
}
EXTRA_OECMAKE=" \
-DCMAKE_DOC_DIR=${docdir_stripped}/cmake-${CMAKE_MAJOR_VERSION} \
-DCMAKE_USE_SYSTEM_LIBRARIES=1 \
-DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_CPPDAP=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \
-DKWSYS_CHAR_IS_SIGNED=1 \
-DBUILD_CursesDialog=0 \
-DKWSYS_LFS_WORKS=1 \
-DCMake_ENABLE_DEBUGGER=0 \
"
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
# install cmake-setup.py to create arch-specific toolchain cmake file from template
install -m 0644 ${WORKDIR}/SDKToolchainConfig.cmake.template ${D}${datadir}/cmake/
install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d
install -m 0755 ${WORKDIR}/cmake-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
}
FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}"
FILES:${PN} += "${datadir}/cmake-${CMAKE_MAJOR_VERSION} ${datadir}/cmake ${datadir}/aclocal ${datadir}/emacs ${datadir}/vim"
FILES:${PN}-doc += "${docdir}/cmake-${CMAKE_MAJOR_VERSION}"
FILES:${PN}-dev = ""
BBCLASSEXTEND = "nativesdk"