Skip to content

Commit 30d6892

Browse files
authored
Use find_program to get python in cmake (#546)
* Use find_program to get python in cmake * Update build_linux.yml * Revert "Update build_linux.yml" This reverts commit 82bd9f4.
1 parent 30081b1 commit 30d6892

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ else()
146146
set(DESKTOP OFF)
147147
endif()
148148

149+
# Define the Python executable before including the subprojects
150+
find_program(FIREBASE_PYTHON_EXECUTABLE
151+
NAMES python3 python
152+
REQUIRED
153+
)
154+
149155
include(FindPkgConfig)
150156
include(android_dependencies)
151157
include(build_universal)

cmake/build_aar.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function(build_aar LIBRARY_NAME LIBRARY_TARGET PROGUARD_TARGET
4545

4646
add_custom_command(
4747
OUTPUT "${OUTPUT_AAR}"
48-
COMMAND python "${FIREBASE_SOURCE_DIR}/aar_builder/build_aar.py"
48+
COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${FIREBASE_SOURCE_DIR}/aar_builder/build_aar.py"
4949
"--output_file=${OUTPUT_AAR}"
5050
"--library_file=$<TARGET_FILE:${LIBRARY_TARGET}>"
5151
"--architecture=${ANDROID_ABI}"

cmake/firebase_swig.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ macro(firebase_swig_add_library name)
202202
OUTPUT ${UNITY_SWIG_CS_FIX_FILE}
203203
DEPENDS ${UNITY_SWIG_CS_GEN_FILE}
204204
COMMAND
205-
python
205+
${FIREBASE_PYTHON_EXECUTABLE}
206206
${CMAKE_CURRENT_LIST_DIR}/../swig_commenter.py
207207
--input=\"${all_cpp_header_files}\"
208208
--output=\"${UNITY_SWIG_CS_GEN_FILE}\"
209209
--namespace_prefix=\"Firebase\"
210210
COMMAND
211-
python
211+
${FIREBASE_PYTHON_EXECUTABLE}
212212
${FIREBASE_SWIG_FIX_PY}
213213
--language=csharp
214214
--in_file=\"${UNITY_SWIG_CS_GEN_FILE}\"
@@ -233,7 +233,7 @@ macro(firebase_swig_add_library name)
233233
OUTPUT ${UNITY_SWIG_CPP_FIX_FILE}
234234
DEPENDS ${UNITY_SWIG_CPP_GEN_FILE}
235235
COMMAND
236-
python
236+
${FIREBASE_PYTHON_EXECUTABLE}
237237
${FIREBASE_SWIG_FIX_PY}
238238
--language=cpp
239239
--in_file=\"${UNITY_SWIG_CPP_GEN_FILE}\"

0 commit comments

Comments
 (0)