Skip to content

Commit 92d729a

Browse files
authored
Fixes to patch application. (#579)
Every `CMakeLists.txt` that includes `fetch_llvm.cmake` must also call `find_package(Python3)`, because `fetch_llvm.cmake` tries to run `patch_llvm.py` by prefixing it with the Python interpreter name. The CMakeLists in `arm-multilib` wasn't looking for Python at all, and the one in `arm-runtimes` was looking for it _after_ including `fetch_llvm.cmake`. Also, `fetch_picolibc.cmake` was not reliably looking in the correct directory for its patches: it was using a path relative to `CMAKE_CURRENT_SOURCE_DIR`, which varies depending which CMakeLists it's invoked by. It should be relative to `CMAKE_CURRENT_LIST_DIR`, as the corresponding llvm and newlib paths already are.
1 parent 8d4f804 commit 92d729a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

arm-multilib/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ foreach(arg
6868
endif()
6969
endforeach()
7070

71+
find_package(Python3 REQUIRED COMPONENTS Interpreter) # needed by fetch_*.cmake
72+
7173
include(ExternalProject)
7274
include(${TOOLCHAIN_SOURCE_DIR}/cmake/fetch_llvm.cmake)
7375
list(APPEND passthrough_dirs "-DFETCHCONTENT_SOURCE_DIR_LLVMPROJECT=${FETCHCONTENT_SOURCE_DIR_LLVMPROJECT}")

arm-runtimes/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ set(LIBC_HDRGEN "" CACHE PATH "Path to prebuilt lbc-hdrgen if not included in LL
101101
# Temporary location to collect the libraries as they are built.
102102
set(TEMP_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp_install")
103103

104+
find_package(Python3 REQUIRED COMPONENTS Interpreter)
105+
104106
include(ExternalProject)
105107
include(${TOOLCHAIN_SOURCE_DIR}/cmake/fetch_llvm.cmake)
106108

107-
find_package(Python3 REQUIRED COMPONENTS Interpreter)
108-
109109
# If a compiler launcher such as ccache has been set, it should be
110110
# passed down to each subproject build.
111111
set(compiler_launcher_cmake_args "")

cmake/fetch_picolibc.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ read_repo_version(picolibc picolibc)
1313

1414
set(
1515
picolibc_patches
16-
${CMAKE_CURRENT_SOURCE_DIR}/patches/picolibc/0001-Enable-libcxx-builds.patch
17-
${CMAKE_CURRENT_SOURCE_DIR}/patches/picolibc/0002-Add-bootcode-for-AArch64-FVPs.patch
16+
${CMAKE_CURRENT_LIST_DIR}/../patches/picolibc/0001-Enable-libcxx-builds.patch
17+
${CMAKE_CURRENT_LIST_DIR}/../patches/picolibc/0002-Add-bootcode-for-AArch64-FVPs.patch
1818
)
1919

2020
FetchContent_Declare(picolibc

0 commit comments

Comments
 (0)