CMake: Generate and install 'pandac' for backwards-compatibility.

This commit is contained in:
Sam Edwards 2014-02-07 14:30:46 -07:00
parent 6c5dcb0a75
commit 9fc2e6829b
4 changed files with 29 additions and 1 deletions

View File

@ -36,6 +36,8 @@ endif()
set(IMOD_FLAGS -python-native)
# This stores the names of every module added to the Interrogate system:
set(ALL_INTERROGATE_MODULES CACHE INTERNAL "Internal variable")
#
# Function: target_interrogate(target [ALL] [source1 [source2 ...]])
@ -270,6 +272,9 @@ function(add_python_module module)
if(WIN32 AND NOT CYGWIN)
set_target_properties(${module} PROPERTIES SUFFIX ".pyd")
endif()
list(APPEND ALL_INTERROGATE_MODULES "${module}")
set(ALL_INTERROGATE_MODULES "${ALL_INTERROGATE_MODULES}" CACHE INTERNAL "Internal variable")
endif()
endfunction(add_python_module)
@ -281,5 +286,5 @@ if(HAVE_PYTHON)
# The Interrogate path needs to be installed to the architecture-dependent
# Python directory.
install(DIRECTORY "${PROJECT_BINARY_DIR}/panda3d" DESTINATION "${PYTHON_LIB_INSTALL_DIR}")
install(DIRECTORY "${PROJECT_BINARY_DIR}/panda3d" DESTINATION "${PYTHON_ARCH_INSTALL_DIR}")
endif()

View File

@ -36,3 +36,6 @@ if(HAVE_PYTHON)
FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py"
DESTINATION "${PYTHON_LIB_INSTALL_DIR}/direct")
endif()
# pandac has its own installation steps necessary:
add_subdirectory(src/pandac)

View File

@ -0,0 +1,15 @@
if(HAVE_PYTHON)
# Generate PandaModules:
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/PandaModules.py"
"# Generated by CMake; edits not preserved\n")
foreach(module ${ALL_INTERROGATE_MODULES})
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/PandaModules.py"
"from panda3d.${module} import *\n")
endforeach()
# Now install ourselves:
file(GLOB python_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
install(
FILES ${python_sources} "${CMAKE_CURRENT_BINARY_DIR}/PandaModules.py"
DESTINATION "${PYTHON_LIB_INSTALL_DIR}/pandac")
endif()

View File

@ -0,0 +1,5 @@
# N.B. PandaModules is generated at build time by CMake
from PandaModules import *
# Now import all extensions: