File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -24,17 +24,38 @@ cmake_minimum_required(VERSION 3.19)
2424# Find prebuilt _portable_lib.<EXT_SUFFIX>.so. This file should be installed under
2525# <site-packages>/executorch/share/cmake
2626
27+ # Find python
28+ if (DEFINED ENV{CONDA_DEFAULT_ENV} AND NOT $ENV{CONDA_DEFAULT_ENV} STREQUAL "base" )
29+ set (PYTHON_EXECUTABLE
30+ python
31+ )
32+ else ()
33+ set (PYTHON_EXECUTABLE
34+ python3
35+ )
36+ endif ()
37+
2738# Get the Python version and platform information
2839execute_process (
29- COMMAND python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
40+ COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
3041 OUTPUT_VARIABLE EXT_SUFFIX
42+ RESULT_VARIABLE SYSCONFIG_RESULT
43+ ERROR_VARIABLE SYSCONFIG_ERROR
3144 OUTPUT_STRIP_TRAILING_WHITESPACE
3245)
46+
47+ if (RESULT_VARIABLE EQUAL 0)
48+ message (STATUS "Sysconfig extension suffix: ${EXT_SUFFIX} " )
49+ else ()
50+ message (FATAL_ERROR "Failed to retrieve sysconfig config var EXT_SUFFIX: ${SYSCONFIG_ERROR} " )
51+ endif ()
52+
3353find_library (
3454 _portable_lib_LIBRARY
3555 NAMES _portable_lib${EXT_SUFFIX}
3656 PATHS "${CMAKE_CURRENT_LIST_DIR} /../../extension/pybindings/"
3757)
58+
3859set (EXECUTORCH_LIBRARIES)
3960set (EXECUTORCH_FOUND OFF )
4061if (_portable_lib_LIBRARY)
You can’t perform that action at this time.
0 commit comments