mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
CMake: Support targeting Python 3
This commit is contained in:
parent
ef9e117e5a
commit
b68b6caeb0
@ -206,7 +206,7 @@ function(interrogate_sources target output database module)
|
|||||||
${define_flags}
|
${define_flags}
|
||||||
-S "${PROJECT_BINARY_DIR}/include"
|
-S "${PROJECT_BINARY_DIR}/include"
|
||||||
-S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc"
|
-S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc"
|
||||||
-S "${PROJECT_BINARY_DIR}/include/parser-inc"
|
-S "${PYTHON_INCLUDE_DIRS}"
|
||||||
${include_flags}
|
${include_flags}
|
||||||
${scan_sources}
|
${scan_sources}
|
||||||
${extensions}
|
${extensions}
|
||||||
|
@ -444,9 +444,16 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
# Is Python installed, and should Python interfaces be generated?
|
# Is Python installed, and should Python interfaces be generated?
|
||||||
find_package(PythonLibs 2.5)
|
set(WANT_PYTHON_VERSION "2.7"
|
||||||
find_package(PythonInterp 2.5)
|
CACHE STRING "Which Python version to seek out for building Panda3D against.")
|
||||||
set(PYTHON_FOUND ${PYTHONLIBS_FOUND})
|
|
||||||
|
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
|
package_option(PYTHON DEFAULT ON
|
||||||
"Enables support for Python. If INTERROGATE_PYTHON_INTERFACE
|
"Enables support for Python. If INTERROGATE_PYTHON_INTERFACE
|
||||||
@ -456,12 +463,12 @@ is also enabled, Python bindings will be generated.")
|
|||||||
if(HAVE_PYTHON)
|
if(HAVE_PYTHON)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
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_VARIABLE _LIB_DIR
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
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_VARIABLE _ARCH_DIR
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ endif()
|
|||||||
|
|
||||||
message("")
|
message("")
|
||||||
if(HAVE_INTERROGATE AND HAVE_PYTHON)
|
if(HAVE_INTERROGATE AND HAVE_PYTHON)
|
||||||
message("Compilation will generate Python interfaces.")
|
message("Compilation will generate Python interfaces for Python ${PYTHON_VERSION_STRING}.")
|
||||||
else()
|
else()
|
||||||
message("Configuring Panda WITHOUT Python interfaces.")
|
message("Configuring Panda WITHOUT Python interfaces.")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user