diff mbox series

[02/10] arm/trusted-services: pass through CMake generator

Message ID 20230929152128.3401009-2-ross.burton@arm.com
State New
Headers show
Series [01/10] arm/apply_local_src_patches: allow use in multiple directories | expand

Commit Message

Ross Burton Sept. 29, 2023, 3:21 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

Pass through the choice of CMake Generator when starting sub-cmakes for
the external components, so that they use Ninja instead of Make.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 ...ch-allow-setting-the-cmake-generator.patch | 46 +++++++++++++++++++
 .../trusted-services/trusted-services-src.inc |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta-arm/recipes-security/trusted-services/files/0001-LazyFetch-allow-setting-the-cmake-generator.patch
diff mbox series

Patch

diff --git a/meta-arm/recipes-security/trusted-services/files/0001-LazyFetch-allow-setting-the-cmake-generator.patch b/meta-arm/recipes-security/trusted-services/files/0001-LazyFetch-allow-setting-the-cmake-generator.patch
new file mode 100644
index 00000000..6664fd05
--- /dev/null
+++ b/meta-arm/recipes-security/trusted-services/files/0001-LazyFetch-allow-setting-the-cmake-generator.patch
@@ -0,0 +1,46 @@ 
+From e62709f8e6f586ace7975b58b8a1c726d120759f Mon Sep 17 00:00:00 2001
+From: Gyorgy Szing <Gyorgy.Szing@arm.com>
+Date: Thu, 31 Aug 2023 18:24:50 +0200
+Subject: [PATCH] LazyFetch: allow setting the cmake generator
+
+Allow configuring the CMake generator used for external components. By
+default use the generator the main project is using.
+For details see the documentation in tools/cmake/common/LazyFetch.cmake.
+
+Change-Id: Ie01ea1ae533cf7a40c1f09808de2ad2e83a09db3
+Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ tools/cmake/common/LazyFetch.cmake | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/tools/cmake/common/LazyFetch.cmake b/tools/cmake/common/LazyFetch.cmake
+index 68e790e..7676201 100644
+--- a/tools/cmake/common/LazyFetch.cmake
++++ b/tools/cmake/common/LazyFetch.cmake
+@@ -87,11 +87,20 @@ function(LazyFetch_ConfigAndBuild)
+ 							"component specific. Pleas refer to the upstream documentation for more information.")
+ 	endif()
+ 
++	if(NOT DEFINED ${UC_DEP_NAME}_GENERATOR)
++		if(DEFINED ENV{${UC_DEP_NAME}_GENERATOR})
++			set(${UC_DEP_NAME}_GENERATOR ENV{${UC_DEP_NAME}_GENERATOR} CACHE STRING "CMake generator used for ${UC_DEP_NAME}.")
++		else()
++			set(${UC_DEP_NAME}_GENERATOR ${CMAKE_GENERATOR} CACHE STRING "CMake generator used for ${UC_DEP_NAME}.")
++		endif()
++	endif()
++
+ 	execute_process(COMMAND
+ 		${CMAKE_COMMAND} -E env "CROSS_COMPILE=${CROSS_COMPILE}"
+ 		${CMAKE_COMMAND}
+ 			"-C${CONFIGURED_CACHE_FILE}"
+ 			-DCMAKE_BUILD_TYPE=${${UC_DEP_NAME}_BUILD_TYPE}
++			-G${${UC_DEP_NAME}_GENERATOR}
+ 			-S ${BUILD_SRC_DIR}
+ 			-B ${BUILD_BIN_DIR}
+ 		RESULT_VARIABLE
+-- 
+2.34.1
+
diff --git a/meta-arm/recipes-security/trusted-services/trusted-services-src.inc b/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
index 86eb5083..50360b1d 100644
--- a/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
+++ b/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
@@ -9,6 +9,7 @@  FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
 
 SRC_URI:append = "\
 	file://0001-Limit-nanopb-build-to-single-process.patch \
+	file://0001-LazyFetch-allow-setting-the-cmake-generator.patch \
 "
 
 #Latest on 2023 April 28