Browse Source

CMake: Remove references to "panda3d" from Interrogate

Sam Edwards 6 năm trước cách đây
mục cha
commit
b3f5c38ef3

+ 7 - 12
cmake/macros/Interrogate.cmake

@@ -292,6 +292,8 @@ function(add_python_module module)
     set(link_targets ${targets})
     set(link_targets ${targets})
   endif()
   endif()
 
 
+  string(REGEX REPLACE "^.*\\." "" modname "${module}")
+
   foreach(target ${targets})
   foreach(target ${targets})
     get_target_property(workdir_abs "${target}" TARGET_BINDIR)
     get_target_property(workdir_abs "${target}" TARGET_BINDIR)
     if(NOT workdir_abs)
     if(NOT workdir_abs)
@@ -303,7 +305,7 @@ function(add_python_module module)
 
 
     interrogate_sources(${target}
     interrogate_sources(${target}
       "${workdir_abs}/${target}_igate.cxx" "${workdir_abs}/${target}.in"
       "${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)
     get_target_property(target_extensions "${target}" IGATE_EXTENSIONS)
     list(APPEND infiles_rel "${workdir_rel}/${target}.in")
     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"
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
     COMMAND host_interrogate_module
     COMMAND host_interrogate_module
       -oc "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
       -oc "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
-      -module ${module} -library ${module}
+      -module ${modname} -library ${modname}
       ${import_flags}
       ${import_flags}
       ${INTERROGATE_MODULE_OPTIONS}
       ${INTERROGATE_MODULE_OPTIONS}
       ${IMOD_FLAGS} ${infiles_rel}
       ${IMOD_FLAGS} ${infiles_rel}
     DEPENDS host_interrogate_module ${infiles_abs}
     DEPENDS host_interrogate_module ${infiles_abs}
     COMMENT "Generating module ${module}")
     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})
     "${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")
   if(CMAKE_VERSION VERSION_LESS "3.11")
     # CMake <3.11 doesn't allow generator expressions on source files, so we
     # 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})
     foreach(source ${sources_abs})
       get_source_file_property(compile_definitions "${source}" COMPILE_DEFINITIONS)
       get_source_file_property(compile_definitions "${source}" COMPILE_DEFINITIONS)
       if(compile_definitions)
       if(compile_definitions)
-        set_property(TARGET panda3d.${module} APPEND PROPERTY
+        set_property(TARGET ${module} APPEND PROPERTY
           COMPILE_DEFINITIONS ${compile_definitions})
           COMPILE_DEFINITIONS ${compile_definitions})
 
 
         set_source_files_properties("${source}" PROPERTIES 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}")
   list(APPEND ALL_INTERROGATE_MODULES "${module}")
   set(ALL_INTERROGATE_MODULES "${ALL_INTERROGATE_MODULES}" CACHE INTERNAL "Internal variable")
   set(ALL_INTERROGATE_MODULES "${ALL_INTERROGATE_MODULES}" CACHE INTERNAL "Internal variable")
 endfunction(add_python_module)
 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()

+ 2 - 2
contrib/CMakeLists.txt

@@ -8,10 +8,10 @@ add_subdirectory(src/contribbase)
 add_subdirectory(src/rplight)
 add_subdirectory(src/rplight)
 
 
 if(HAVE_PYTHON)
 if(HAVE_PYTHON)
-  add_python_module(ai p3ai
+  add_python_module(panda3d.ai p3ai
     IMPORT panda3d.core COMPONENT ContribPython)
     IMPORT panda3d.core COMPONENT ContribPython)
 
 
-  add_python_module(_rplight p3rplight
+  add_python_module(panda3d._rplight p3rplight
     IMPORT panda3d.core COMPONENT ContribPython)
     IMPORT panda3d.core COMPONENT ContribPython)
 endif()
 endif()
 
 

+ 1 - 1
direct/CMakeLists.txt

@@ -37,7 +37,7 @@ install(TARGETS p3direct
 if(HAVE_PYTHON)
 if(HAVE_PYTHON)
   # Now for the Python side of everything
   # Now for the Python side of everything
 
 
-  add_python_module(direct
+  add_python_module(panda3d.direct
     p3dcparser p3deadrec p3distributed p3interval
     p3dcparser p3deadrec p3distributed p3interval
     p3motiontrail p3showbase LINK p3direct IMPORT panda3d.core COMPONENT Direct)
     p3motiontrail p3showbase LINK p3direct IMPORT panda3d.core COMPONENT Direct)
 
 

+ 12 - 8
panda/CMakeLists.txt

@@ -103,37 +103,41 @@ if(HAVE_FREETYPE)
   list(APPEND CORE_MODULE_COMPONENTS p3pnmtext)
   list(APPEND CORE_MODULE_COMPONENTS p3pnmtext)
 endif()
 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)
   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)
     export_targets(BulletPython NAMESPACE "Panda3D::Python::" COMPONENT BulletDevel)
   endif()
   endif()
 
 
   if(HAVE_EGG)
   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)
     export_targets(EggPython NAMESPACE "Panda3D::Python::" COMPONENT EggDevel)
   endif()
   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)
   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)
     export_targets(ODEPython NAMESPACE "Panda3D::Python::" COMPONENT ODEDevel)
   endif()
   endif()
 
 
   if(HAVE_OPENCV OR HAVE_ARTOOLKIT)
   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)
     export_targets(VisionPython NAMESPACE "Panda3D::Python::" COMPONENT VisionDevel)
   endif()
   endif()
 
 
   if(HAVE_VRPN)
   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)
     export_targets(VRPNPython NAMESPACE "Panda3D::Python::" COMPONENT VRPNDevel)
   endif()
   endif()