Skip to content

Commit 202ee5b

Browse files
committed
build: help pave the road for a mixed Python build
LLDB requires python3, however, gyb is a python2 tool. Use the fact that we have a newer CMake at our disposal and use the `Python2` package in CMake to locate a viable python interpreter. This allows us to have references to both versions of python simultaneously.
1 parent dedbf55 commit 202ee5b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmake/modules/SwiftHandleGybSources.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
include(SwiftAddCustomCommandTarget)
22
include(SwiftSetIfArchBitness)
33

4+
find_package(Python2 COMPONENTS Interpreter REQUIRED)
5+
46
# Create a target to process single gyb source with the 'gyb' tool.
57
#
68
# handle_gyb_source_single(
@@ -58,7 +60,7 @@ function(handle_gyb_source_single dependency_out_var_name)
5860
COMMAND
5961
"${CMAKE_COMMAND}" -E make_directory "${dir}"
6062
COMMAND
61-
"${PYTHON_EXECUTABLE}" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
63+
"$<TARGET_FILE:Python2::Interpreter>" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
6264
COMMAND
6365
"${CMAKE_COMMAND}" -E copy_if_different "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_OUTPUT}"
6466
COMMAND

0 commit comments

Comments
 (0)