From b3f5c38ef36a397c8d7ffdfe0bfd5a7a9fb65398 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 14 Apr 2019 22:41:48 -0600 Subject: [PATCH] CMake: Remove references to "panda3d" from Interrogate --- cmake/macros/Interrogate.cmake | 19 +++++++------------ contrib/CMakeLists.txt | 4 ++-- direct/CMakeLists.txt | 2 +- panda/CMakeLists.txt | 20 ++++++++++++-------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/cmake/macros/Interrogate.cmake b/cmake/macros/Interrogate.cmake index fd94b68e69..414e2b6b8c 100644 --- a/cmake/macros/Interrogate.cmake +++ b/cmake/macros/Interrogate.cmake @@ -292,6 +292,8 @@ function(add_python_module module) set(link_targets ${targets}) endif() + string(REGEX REPLACE "^.*\\." "" modname "${module}") + foreach(target ${targets}) get_target_property(workdir_abs "${target}" TARGET_BINDIR) if(NOT workdir_abs) @@ -303,7 +305,7 @@ function(add_python_module module) interrogate_sources(${target} "${workdir_abs}/${target}_igate.cxx" "${workdir_abs}/${target}.in" - "-python-native;-module;panda3d.${module}") + "-python-native;-module;${module}") get_target_property(target_extensions "${target}" IGATE_EXTENSIONS) list(APPEND infiles_rel "${workdir_rel}/${target}.in") @@ -316,16 +318,16 @@ function(add_python_module module) OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx" COMMAND host_interrogate_module -oc "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx" - -module ${module} -library ${module} + -module ${modname} -library ${modname} ${import_flags} ${INTERROGATE_MODULE_OPTIONS} ${IMOD_FLAGS} ${infiles_rel} DEPENDS host_interrogate_module ${infiles_abs} COMMENT "Generating module ${module}") - add_python_target(panda3d.${module} COMPONENT "${component}" EXPORT "${component}" + add_python_target(${module} COMPONENT "${component}" EXPORT "${component}" "${module}_module.cxx" ${sources_abs} ${extensions}) - target_link_libraries(panda3d.${module} ${link_targets}) + target_link_libraries(${module} ${link_targets}) if(CMAKE_VERSION VERSION_LESS "3.11") # CMake <3.11 doesn't allow generator expressions on source files, so we @@ -334,7 +336,7 @@ function(add_python_module module) foreach(source ${sources_abs}) get_source_file_property(compile_definitions "${source}" COMPILE_DEFINITIONS) if(compile_definitions) - set_property(TARGET panda3d.${module} APPEND PROPERTY + set_property(TARGET ${module} APPEND PROPERTY COMPILE_DEFINITIONS ${compile_definitions}) set_source_files_properties("${source}" PROPERTIES COMPILE_DEFINITIONS "") @@ -345,10 +347,3 @@ function(add_python_module module) list(APPEND ALL_INTERROGATE_MODULES "${module}") set(ALL_INTERROGATE_MODULES "${ALL_INTERROGATE_MODULES}" CACHE INTERNAL "Internal variable") endfunction(add_python_module) - - -if(INTERROGATE_PYTHON_INTERFACE AND BUILD_SHARED_LIBS) - # The Interrogate path needs to be installed to the architecture-dependent - # Python directory. - install_python_package("${PROJECT_BINARY_DIR}/panda3d" ARCH) -endif() diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 19f8604966..ff5145261e 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -8,10 +8,10 @@ add_subdirectory(src/contribbase) add_subdirectory(src/rplight) if(HAVE_PYTHON) - add_python_module(ai p3ai + add_python_module(panda3d.ai p3ai IMPORT panda3d.core COMPONENT ContribPython) - add_python_module(_rplight p3rplight + add_python_module(panda3d._rplight p3rplight IMPORT panda3d.core COMPONENT ContribPython) endif() diff --git a/direct/CMakeLists.txt b/direct/CMakeLists.txt index 8d1c92329e..d14abb4d3b 100644 --- a/direct/CMakeLists.txt +++ b/direct/CMakeLists.txt @@ -37,7 +37,7 @@ install(TARGETS p3direct if(HAVE_PYTHON) # Now for the Python side of everything - add_python_module(direct + add_python_module(panda3d.direct p3dcparser p3deadrec p3distributed p3interval p3motiontrail p3showbase LINK p3direct IMPORT panda3d.core COMPONENT Direct) diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index f440327827..55de86dac9 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -103,37 +103,41 @@ if(HAVE_FREETYPE) list(APPEND CORE_MODULE_COMPONENTS p3pnmtext) endif() -if(HAVE_PYTHON) - add_python_module(core ${CORE_MODULE_COMPONENTS} LINK panda) +if(INTERROGATE_PYTHON_INTERFACE) + add_python_module(panda3d.core ${CORE_MODULE_COMPONENTS} LINK panda) + + if(BUILD_SHARED_LIBS) + install_python_package("${PROJECT_BINARY_DIR}/panda3d" ARCH) + endif() if(HAVE_BULLET) - add_python_module(bullet p3bullet IMPORT panda3d.core COMPONENT BulletPython) + add_python_module(panda3d.bullet p3bullet IMPORT panda3d.core COMPONENT BulletPython) export_targets(BulletPython NAMESPACE "Panda3D::Python::" COMPONENT BulletDevel) endif() if(HAVE_EGG) - add_python_module(egg p3egg p3egg2pg LINK pandaegg IMPORT panda3d.core COMPONENT EggPython) + add_python_module(panda3d.egg p3egg p3egg2pg LINK pandaegg IMPORT panda3d.core COMPONENT EggPython) export_targets(EggPython NAMESPACE "Panda3D::Python::" COMPONENT EggDevel) endif() - add_python_module(physics p3physics p3particlesystem LINK pandaphysics IMPORT panda3d.core) + add_python_module(panda3d.physics p3physics p3particlesystem LINK pandaphysics IMPORT panda3d.core) if(HAVE_ODE) - add_python_module(ode p3ode IMPORT panda3d.core COMPONENT ODEPython) + add_python_module(panda3d.ode p3ode IMPORT panda3d.core COMPONENT ODEPython) export_targets(ODEPython NAMESPACE "Panda3D::Python::" COMPONENT ODEDevel) endif() if(HAVE_OPENCV OR HAVE_ARTOOLKIT) - add_python_module(vision p3vision IMPORT panda3d.core COMPONENT VisionPython) + add_python_module(panda3d.vision p3vision IMPORT panda3d.core COMPONENT VisionPython) export_targets(VisionPython NAMESPACE "Panda3D::Python::" COMPONENT VisionDevel) endif() if(HAVE_VRPN) - add_python_module(vrpn p3vrpn IMPORT panda3d.core COMPONENT VRPNPython) + add_python_module(panda3d.vrpn p3vrpn IMPORT panda3d.core COMPONENT VRPNPython) export_targets(VRPNPython NAMESPACE "Panda3D::Python::" COMPONENT VRPNDevel) endif()