Skip to content

Commit

Permalink
Merge pull request #80 from hisazumi/fix-pyenvmake
Browse files Browse the repository at this point in the history
Updated CMakeLists.txt to conditionally check for the presence of pyenv.
  • Loading branch information
tmori authored Oct 31, 2024
2 parents a675975 + 80a288f commit c36baaf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ if( ${CMAKE_VERSION} LESS 3.12 )
include_directories(${Python_INCLUDE_DIRS})
set(HAKO_PYTHON_LIBS ${PYTHON_LIBRARIES})
else()
# check pyenv
execute_process(
COMMAND pyenv which python
RESULT_VARIABLE PYENV_FOUND
OUTPUT_VARIABLE PYENV_PYTHON_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

message(STATUS "PYENV_FOUND:${PYENV_FOUND}")

if(PYENV_FOUND EQUAL 0)
# if pyenv found, use pyenv python
set(Python_EXECUTABLE ${PYENV_PYTHON_PATH})
set(Python_ROOT_DIR ${PYENV_PYTHON_PATH})
endif()

find_package(Python COMPONENTS Interpreter Development)
include_directories(${Python_INCLUDE_DIRS})
set(HAKO_PYTHON_LIBS ${Python_LIBRARIES})
Expand Down

0 comments on commit c36baaf

Please sign in to comment.