Fix building WITH_PYTHON=OFF after discover_nodes.py inclusion

Recently [0] added PYTHON_EXECUTABLE as a build time dependency.
Define PYTHON_EXECUTABLE even with WITH_PYTHON=OFF.

[0]: 19912457c6
This commit is contained in:
Campbell Barton
2023-08-10 11:57:30 +10:00
parent 8cea7519ca
commit b057c0cce1
3 changed files with 25 additions and 9 deletions

View File

@@ -65,8 +65,14 @@ endif()
set(CMAKE_FIND_FRAMEWORK NEVER)
# Optionally use system Python if PYTHON_ROOT_DIR is specified.
if(WITH_PYTHON AND (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
find_package(PythonLibsUnix REQUIRED)
if(WITH_PYTHON)
if(WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR)
find_package(PythonLibsUnix REQUIRED)
endif()
else()
# Python executable is needed as part of the build-process,
# note that building without Python is quite unusual.
find_program(PYTHON_EXECUTABLE "python3")
endif()
# Prefer lib directory paths
@@ -127,8 +133,10 @@ if(WITH_CODEC_SNDFILE)
unset(_sndfile_VORBISENC_LIBRARY)
endif()
if(WITH_PYTHON AND NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
find_package(PythonLibsUnix REQUIRED)
if(WITH_PYTHON)
if(NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
find_package(PythonLibsUnix REQUIRED)
endif()
endif()
if(WITH_FFTW3)

View File

@@ -181,6 +181,10 @@ Proceeding with PYTHON_SITE_PACKAGES install target, you have been warned!"
unset(_is_prefix)
endif()
endif()
else()
# Python executable is needed as part of the build-process,
# note that building without Python is quite unusual.
find_program(PYTHON_EXECUTABLE "python3")
endif()
if(WITH_IMAGE_OPENEXR)

View File

@@ -517,25 +517,29 @@ if(WITH_JACK)
set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
endif()
set(_PYTHON_VERSION "3.10")
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
# Python executable is needed as part of the build-process,
# note that building without Python is quite unusual.
set(PYTHON_EXECUTABLE ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python$<$<CONFIG:Debug>:_d>.exe)
if(WITH_PYTHON)
# Cache version for make_bpy_wheel.py to detect.
unset(PYTHON_VERSION CACHE)
set(PYTHON_VERSION "3.10" CACHE STRING "Python version")
set(PYTHON_VERSION "${_PYTHON_VERSION}" CACHE STRING "Python version")
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
set(PYTHON_LIBRARY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}.lib)
set(PYTHON_LIBRARY_DEBUG ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}_d.lib)
set(PYTHON_EXECUTABLE ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python$<$<CONFIG:Debug>:_d>.exe)
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/include)
set(PYTHON_NUMPY_INCLUDE_DIRS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib/site-packages/numpy/core/include)
set(NUMPY_FOUND ON)
unset(_PYTHON_VERSION_NO_DOTS)
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES debug "${PYTHON_LIBRARY_DEBUG}" optimized "${PYTHON_LIBRARY}" )
endif()
unset(_PYTHON_VERSION)
unset(_PYTHON_VERSION_NO_DOTS)
if(NOT WITH_WINDOWS_FIND_MODULES)
# even if boost is off, we still need to install the dlls when we use our lib folder since