Browse Source

CMake: Hack up the Interrogate macro to work when the codebase depends on the Dtool_* stubs.

Sam Edwards 12 years ago
parent
commit
3f045f85f5
1 changed files with 19 additions and 1 deletions
  1. 19 1
      cmake/macros/Interrogate.cmake

+ 19 - 1
cmake/macros/Interrogate.cmake

@@ -65,6 +65,9 @@ function(target_interrogate target)
 
 
     set_target_properties("${target}" PROPERTIES IGATE_SOURCES
     set_target_properties("${target}" PROPERTIES IGATE_SOURCES
       "${absolute_sources}")
       "${absolute_sources}")
+
+    # HACK HACK HACK -- this is part of the below hack.
+    target_link_libraries(${target} ${target}_igate)
   endif()
   endif()
 endfunction(target_interrogate)
 endfunction(target_interrogate)
 
 
@@ -154,11 +157,25 @@ function(add_python_module module)
     set(targets ${ARGN})
     set(targets ${ARGN})
     set(infiles)
     set(infiles)
     set(sources)
     set(sources)
+    set(HACKlinklibs)
 
 
     foreach(target ${targets})
     foreach(target ${targets})
       interrogate_sources(${target} "${target}_igate.cxx" "${target}.in" "${module}")
       interrogate_sources(${target} "${target}_igate.cxx" "${target}.in" "${module}")
       list(APPEND infiles "${target}.in")
       list(APPEND infiles "${target}.in")
-      list(APPEND sources "${target}_igate.cxx")
+      #list(APPEND sources "${target}_igate.cxx")
+
+      # HACK HACK HACK:
+      # Currently, the codebase has dependencies on the Interrogate-generated
+      # code when HAVE_PYTHON is enabled. rdb is working to remove this, but
+      # until then, the generated code must somehow be made available to the
+      # modules themselves. The workaround here is to put the _igate.cxx into
+      # its own micro-library, which is linked both here on the module and
+      # against the component library in question.
+      add_library(${target}_igate ${target}_igate.cxx)
+      list(APPEND HACKlinklibs "${target}_igate")
+
+      get_target_property(target_links "${target}" INTERFACE_LINK_LIBRARIES)
+      target_link_libraries(${target}_igate ${target_links})
     endforeach(target)
     endforeach(target)
 
 
     add_custom_command(
     add_custom_command(
@@ -174,6 +191,7 @@ function(add_python_module module)
     add_library(${module} MODULE "${module}_module.cxx" ${sources})
     add_library(${module} MODULE "${module}_module.cxx" ${sources})
     target_link_libraries(${module}
     target_link_libraries(${module}
       ${targets} ${PYTHON_LIBRARIES} p3interrogatedb)
       ${targets} ${PYTHON_LIBRARIES} p3interrogatedb)
+    target_link_libraries(${module} ${HACKlinklibs})
 
 
     set_target_properties(${module} PROPERTIES
     set_target_properties(${module} PROPERTIES
       LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/panda3d"
       LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/panda3d"