Skip to content

Commit 6ba480a

Browse files
authored
Add the FIREBASE_PYTHON_EXECUTABLE cache variable to cmake (#478)
1 parent 17867c7 commit 6ba480a

File tree

19 files changed

+62
-20
lines changed

19 files changed

+62
-20
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ if (NOT FIREBASE_ANDROID_STL STREQUAL "")
8181
set(ANDROID_STL ${FIREBASE_ANDROID_STL})
8282
endif()
8383

84+
set(FIREBASE_PYTHON_EXECUTABLE "python" CACHE FILEPATH
85+
"The Python interpreter to use, such as one from a venv")
86+
8487
set(FIREBASE_XCODE_TARGET_FORMAT "frameworks" CACHE STRING
8588
"Format to output, 'frameworks' or 'libraries'")
8689

admob/integration_test/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
cmake_minimum_required(VERSION 2.8)
1818

19+
set(FIREBASE_PYTHON_EXECUTABLE "python" CACHE FILEPATH
20+
"The Python interpreter to use, such as one from a venv")
21+
1922
# User settings for Firebase integration tests.
2023
# Path to Firebase SDK.
2124
# Try to read the path to the Firebase C++ SDK from an environment variable.
@@ -39,7 +42,7 @@ endif()
3942
if(NOT ANDROID)
4043
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py)
4144
# If this is running from inside the SDK directory, run the setup script.
42-
execute_process(COMMAND "python" "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
45+
execute_process(COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
4346
endif()
4447
endif()
4548

analytics/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ file(MAKE_DIRECTORY ${analytics_generated_headers_dir})
2929
function(generate_analytics_header OBJC_FILE CPP_FILE)
3030
add_custom_command(
3131
OUTPUT ${CPP_FILE}
32-
COMMAND python "${CMAKE_CURRENT_LIST_DIR}/generate_constants.py"
32+
COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/generate_constants.py"
3333
"--objc_header=${OBJC_FILE}"
3434
"--cpp_header=${CPP_FILE}"
3535
DEPENDS ${OBJC_FILE}

analytics/integration_test/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
cmake_minimum_required(VERSION 2.8)
1818

19+
set(FIREBASE_PYTHON_EXECUTABLE "python" CACHE FILEPATH
20+
"The Python interpreter to use, such as one from a venv")
21+
1922
# User settings for Firebase integration tests.
2023
# Path to Firebase SDK.
2124
# Try to read the path to the Firebase C++ SDK from an environment variable.
@@ -39,7 +42,7 @@ endif()
3942
if(NOT ANDROID)
4043
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py)
4144
# If this is running from inside the SDK directory, run the setup script.
42-
execute_process(COMMAND "python" "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
45+
execute_process(COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
4346
endif()
4447
endif()
4548

app/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ set(version_header ${version_header_dir}/version.h)
4646
file(MAKE_DIRECTORY ${version_header_dir})
4747
add_custom_command(
4848
OUTPUT ${version_header}
49-
COMMAND python "${FIREBASE_SCRIPT_DIR}/version_header.py"
49+
COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${FIREBASE_SCRIPT_DIR}/version_header.py"
5050
"--input_file=${FIREBASE_SCRIPT_DIR}/cpp_sdk_version.json"
5151
"--output_file=${version_header}"
5252
"--build_type=released"
@@ -417,7 +417,7 @@ if (IOS)
417417
function(generate_analytics_header OBJC_FILE CPP_FILE)
418418
add_custom_command(
419419
OUTPUT ${CPP_FILE}
420-
COMMAND python "${FIREBASE_SOURCE_DIR}/analytics/generate_constants.py"
420+
COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${FIREBASE_SOURCE_DIR}/analytics/generate_constants.py"
421421
"--objc_header=${OBJC_FILE}"
422422
"--cpp_header=${CPP_FILE}"
423423
DEPENDS ${OBJC_FILE}

app/integration_test/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
cmake_minimum_required(VERSION 2.8)
1818

19+
set(FIREBASE_PYTHON_EXECUTABLE "python" CACHE FILEPATH
20+
"The Python interpreter to use, such as one from a venv")
21+
1922
# User settings for Firebase integration tests.
2023
# Path to Firebase SDK.
2124
# Try to read the path to the Firebase C++ SDK from an environment variable.
@@ -39,7 +42,7 @@ endif()
3942
if(NOT ANDROID)
4043
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py)
4144
# If this is running from inside the SDK directory, run the setup script.
42-
execute_process(COMMAND "python" "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
45+
execute_process(COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
4346
endif()
4447
endif()
4548

auth/integration_test/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
cmake_minimum_required(VERSION 2.8)
1818

19+
set(FIREBASE_PYTHON_EXECUTABLE "python" CACHE FILEPATH
20+
"The Python interpreter to use, such as one from a venv")
21+
1922
# User settings for Firebase integration tests.
2023
# Path to Firebase SDK.
2124
# Try to read the path to the Firebase C++ SDK from an environment variable.
@@ -39,7 +42,7 @@ endif()
3942
if(NOT ANDROID)
4043
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py)
4144
# If this is running from inside the SDK directory, run the setup script.
42-
execute_process(COMMAND "python" "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
45+
execute_process(COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
4346
endif()
4447
endif()
4548

cmake/binary_to_array.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function(binary_to_array NAME INPUT CPP_NAMESPACE OUTPUT_DIRECTORY)
3939
OUTPUT ${output_source}
4040
${output_header}
4141
DEPENDS ${INPUT}
42-
COMMAND python "${FIREBASE_SCRIPT_DIR}/binary_to_array.py"
42+
COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${FIREBASE_SCRIPT_DIR}/binary_to_array.py"
4343
"--input=${INPUT}"
4444
"--output_header=${output_header}"
4545
"--output_source=${output_source}"
@@ -49,4 +49,4 @@ function(binary_to_array NAME INPUT CPP_NAMESPACE OUTPUT_DIRECTORY)
4949
"--filename_identifier=${NAME}_filename"
5050
COMMENT "Generating ${NAME}"
5151
)
52-
endfunction()
52+
endfunction()

cmake/external_rules.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function(download_external_sources)
123123
endif()
124124

125125
execute_process(
126-
COMMAND "python" "${PROJECT_SOURCE_DIR}/scripts/patch_websockets.py"
126+
COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/patch_websockets.py"
127127
"-file" "${PROJECT_BINARY_DIR}/external/src/uWebSockets/src/Socket.h"
128128
"-cmakefile" "${PROJECT_SOURCE_DIR}/cmake/external/uWebSockets.cmake"
129129
RESULT_VARIABLE STATUS)

database/integration_test/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
cmake_minimum_required(VERSION 2.8)
1818

19+
set(FIREBASE_PYTHON_EXECUTABLE "python" CACHE FILEPATH
20+
"The Python interpreter to use, such as one from a venv")
21+
1922
# User settings for Firebase integration tests.
2023
# Path to Firebase SDK.
2124
# Try to read the path to the Firebase C++ SDK from an environment variable.
@@ -39,7 +42,7 @@ endif()
3942
if(NOT ANDROID)
4043
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py)
4144
# If this is running from inside the SDK directory, run the setup script.
42-
execute_process(COMMAND "python" "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
45+
execute_process(COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
4346
endif()
4447
endif()
4548

0 commit comments

Comments
 (0)