1From 495491e9d53bfb184c15753b5187e4bb55b19511 Mon Sep 17 00:00:00 2001
2From: Matt Weber <matthew.weber@rockwellcollins.com>
3Date: Tue, 9 Mar 2021 15:55:17 -0600
4Subject: [PATCH] support out of tree build
5
6(1) The package has a prepare_builtins tool which is built
7but not placed in the path for later use in the build. This
8fix allows the later build steps to use the binary in-place.
9
10(2) With cmake, find_file() when used for non-host builds is
11limited by CMAKE_FIND_ROOT_PATH* scope.
12
13In $(HOST_DIR)/share/buildroot/toolchainfile.cmake we set the
14following target settings for CMAKE_FIND_ROOT_PATH* which
15limit the scope.
16set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/aarch64-buildroot-linux-gnu/sysroot")
17set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
18set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
19set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
20set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
21
22
23Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
24---
25 CMakeLists.txt                          | 2 +-
26 cmake/CMakeDetermineCLCCompiler.cmake   | 4 ++++
27 cmake/CMakeDetermineLLAsmCompiler.cmake | 4 ++++
28 3 files changed, 9 insertions(+), 1 deletion(-)
29
30diff --git a/CMakeLists.txt b/CMakeLists.txt
31index 9472f19..a784519 100644
32--- a/CMakeLists.txt
33+++ b/CMakeLists.txt
34@@ -279,7 +279,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
35
36			# Add prepare target
37			add_custom_command( OUTPUT "${obj_suffix}"
38-				            COMMAND prepare_builtins -o
39+				            COMMAND ./prepare_builtins -o
40					    "${obj_suffix}"
41					    "builtins.opt.${obj_suffix}"
42					    DEPENDS "opt.${obj_suffix}"
43diff --git a/cmake/CMakeDetermineCLCCompiler.cmake b/cmake/CMakeDetermineCLCCompiler.cmake
44index 94d85d9..5de6a48 100644
45--- a/cmake/CMakeDetermineCLCCompiler.cmake
46+++ b/cmake/CMakeDetermineCLCCompiler.cmake
47@@ -12,7 +12,7 @@ mark_as_advanced(CMAKE_CLC_ARCHIVE)
48
49 set(CMAKE_CLC_COMPILER_ENV_VAR "CLC_COMPILER")
50 set(CMAKE_CLC_ARCHIVE_ENV_VAR "CLC_LINKER")
51-find_file(clc_comp_in CMakeCLCCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
52+set(clc_comp_in "${CMAKE_MODULE_PATH}/CMakeCLCCompiler.cmake.in" )
53 # configure all variables set in this file
54 configure_file(${clc_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeCLCCompiler.cmake @ONLY)
55 mark_as_advanced(clc_comp_in)
56diff --git a/cmake/CMakeDetermineLLAsmCompiler.cmake b/cmake/CMakeDetermineLLAsmCompiler.cmake
57index 1c424c7..dd3bfb6 100644
58--- a/cmake/CMakeDetermineLLAsmCompiler.cmake
59+++ b/cmake/CMakeDetermineLLAsmCompiler.cmake
60@@ -18,7 +18,7 @@ mark_as_advanced(CMAKE_LLAsm_ARCHIVE)
61 set(CMAKE_LLAsm_PREPROCESSOR_ENV_VAR "LL_PREPROCESSOR")
62 set(CMAKE_LLAsm_COMPILER_ENV_VAR "LL_ASSEMBLER")
63 set(CMAKE_LLAsm_ARCHIVE_ENV_VAR "LL_LINKER")
64-find_file(ll_comp_in CMakeLLAsmCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
65+set(ll_comp_in "${CMAKE_MODULE_PATH}/CMakeLLAsmCompiler.cmake.in" )
66 # configure all variables set in this file
67 configure_file(${ll_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeLLAsmCompiler.cmake @ONLY)
68 mark_as_advanced(ll_comp_in)
69--
702.17.1
71
72