Skip to content

Commit

Permalink
Use FindPython (#749)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #749

Now that our minimum CMake version is greater than 3.12, we can use
FindPython.

Reviewed By: cortinico

Differential Revision: D36303232

fbshipit-source-id: 15c897ac23ed31713c4ba2130efbf3e9d4f9c345
  • Loading branch information
neildhar authored and facebook-github-bot committed May 11, 2022
1 parent a2cde0d commit 5244f81
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ if(NOT DEFINED HERMES_RELEASE_VERSION)
set(HERMES_RELEASE_VERSION ${PROJECT_VERSION})
endif()

This comment has been minimized.

Copy link
@Kusuma-0307

Kusuma-0307 Aug 17, 2022

python interpreter not found


include(FindPythonInterp)
if (NOT PYTHONINTERP_FOUND)
find_package(Python COMPONENTS Interpreter)
if (NOT Python_Interpreter_FOUND)
message(FATAL_ERROR "Unable to find Python interpreter, required for builds and testing.
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Lit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function(add_lit_target target comment)
list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR})
endif ()

set(LIT_COMMAND "${PYTHON_EXECUTABLE};${HERMES_LIT_PATH}")
set(LIT_COMMAND "${Python_EXECUTABLE};${HERMES_LIT_PATH}")
list(APPEND LIT_COMMAND ${LIT_ARGS})
foreach(param ${ARG_PARAMS})
list(APPEND LIT_COMMAND --param ${param})
Expand Down
2 changes: 1 addition & 1 deletion external/llvh/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ function(find_python_module module)
string(TOUPPER ${module_name} module_upper)
set(FOUND_VAR PY_${module_upper}_FOUND)

execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}"
execute_process(COMMAND "${Python_EXECUTABLE}" "-c" "import ${module}"
RESULT_VARIABLE status
ERROR_QUIET)

Expand Down
2 changes: 1 addition & 1 deletion lib/InternalBytecode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ add_custom_command(
# in the InternalBytecode.cpp as C/C++ hex literal to initialize a byte array.
add_custom_command(
OUTPUT InternalBytecode.inc
COMMAND ${PYTHON_EXECUTABLE} xxd.py ${CMAKE_CURRENT_BINARY_DIR}/InternalBytecode.hbc > ${CMAKE_CURRENT_BINARY_DIR}/InternalBytecode.inc
COMMAND ${Python_EXECUTABLE} xxd.py ${CMAKE_CURRENT_BINARY_DIR}/InternalBytecode.hbc > ${CMAKE_CURRENT_BINARY_DIR}/InternalBytecode.inc
DEPENDS xxd.py InternalBytecode.hbc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
Expand Down
4 changes: 2 additions & 2 deletions tools/node-hermes/nodelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ endforeach()
# Adds js function wrappers around each of the js files in this directory
add_custom_command(
OUTPUT WrappedNode.js
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/AddWrappers.py ${CMAKE_CURRENT_BINARY_DIR}/WrappedNode.js ${node_bytecode_sources_native_path}
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/AddWrappers.py ${CMAKE_CURRENT_BINARY_DIR}/WrappedNode.js ${node_bytecode_sources_native_path}
DEPENDS ${node_bytecode_sources} ${CMAKE_CURRENT_SOURCE_DIR}/AddWrappers.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
Expand All @@ -72,7 +72,7 @@ add_custom_command(
# in the NodeBytecode.cpp as C/C++ hex literal to initialize a byte array.
add_custom_command(
OUTPUT NodeBytecode.inc
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/InternalBytecode/xxd.py ${CMAKE_CURRENT_BINARY_DIR}/NodeBytecode.hbc > ${CMAKE_CURRENT_BINARY_DIR}/NodeBytecode.inc
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/InternalBytecode/xxd.py ${CMAKE_CURRENT_BINARY_DIR}/NodeBytecode.hbc > ${CMAKE_CURRENT_BINARY_DIR}/NodeBytecode.inc
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/InternalBytecode/xxd.py NodeBytecode.hbc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
Expand Down

0 comments on commit 5244f81

Please sign in to comment.