diff --git a/cmake/macros/Interrogate.cmake b/cmake/macros/Interrogate.cmake index aac4eec8c4..525897886c 100644 --- a/cmake/macros/Interrogate.cmake +++ b/cmake/macros/Interrogate.cmake @@ -206,7 +206,7 @@ function(interrogate_sources target output database module) ${define_flags} -S "${PROJECT_BINARY_DIR}/include" -S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc" - -S "${PROJECT_BINARY_DIR}/include/parser-inc" + -S "${PYTHON_INCLUDE_DIRS}" ${include_flags} ${scan_sources} ${extensions} diff --git a/dtool/Config.cmake b/dtool/Config.cmake index 82c8831031..7eadc11c7c 100644 --- a/dtool/Config.cmake +++ b/dtool/Config.cmake @@ -444,9 +444,16 @@ endif() # Is Python installed, and should Python interfaces be generated? -find_package(PythonLibs 2.5) -find_package(PythonInterp 2.5) -set(PYTHON_FOUND ${PYTHONLIBS_FOUND}) +set(WANT_PYTHON_VERSION "2.7" + CACHE STRING "Which Python version to seek out for building Panda3D against.") + +find_package(PythonInterp ${WANT_PYTHON_VERSION} QUIET) +find_package(PythonLibs ${PYTHON_VERSION_STRING} QUIET) +if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND) + set(PYTHON_FOUND ON) +else() + set(PYTHON_FOUND OFF) +endif() package_option(PYTHON DEFAULT ON "Enables support for Python. If INTERROGATE_PYTHON_INTERFACE @@ -456,12 +463,12 @@ is also enabled, Python bindings will be generated.") if(HAVE_PYTHON) execute_process( COMMAND ${PYTHON_EXECUTABLE} - -c "from distutils.sysconfig import get_python_lib; print get_python_lib(False)" + -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(False))" OUTPUT_VARIABLE _LIB_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( COMMAND ${PYTHON_EXECUTABLE} - -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True)" + -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))" OUTPUT_VARIABLE _ARCH_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/dtool/LocalSetup.cmake b/dtool/LocalSetup.cmake index e9a0853089..37c7cb2094 100644 --- a/dtool/LocalSetup.cmake +++ b/dtool/LocalSetup.cmake @@ -448,7 +448,7 @@ endif() message("") if(HAVE_INTERROGATE AND HAVE_PYTHON) - message("Compilation will generate Python interfaces.") + message("Compilation will generate Python interfaces for Python ${PYTHON_VERSION_STRING}.") else() message("Configuring Panda WITHOUT Python interfaces.") endif()