pytorch/scripts/get_python_cmake_flags.py

25 lines
730 B
Python
Raw Permalink Normal View History

2023-11-08 09:01:59 -07:00
## @package get_python_cmake_flags
# Module scripts.get_python_cmake_flags
##############################################################################
# Use this script to find your preferred python installation.
##############################################################################
#
# You can use the following to build with your preferred version of python
# if your installation is not being properly detected by CMake.
#
# mkdir -p build && cd build
# cmake $(python ../scripts/get_python_cmake_flags.py) ..
# make
#
import sys
2023-11-08 09:13:36 -07:00
import sysconfig
2023-11-08 09:01:59 -07:00
flags = [
2023-11-08 09:13:36 -07:00
f"-DPYTHON_EXECUTABLE:FILEPATH={sys.executable}",
f"-DPYTHON_INCLUDE_DIR={sysconfig.get_path('include')}",
2023-11-08 09:01:59 -07:00
]
2023-11-08 09:13:36 -07:00
print(" ".join(flags), end="")