Browse Source

CMake: Link Interrogate bindings against metalibs.

Sam Edwards 11 years ago
parent
commit
3969d0e1ac
3 changed files with 35 additions and 6 deletions
  1. 22 4
      cmake/macros/Interrogate.cmake
  2. 1 1
      panda/CMakeLists.txt
  3. 12 1
      panda/metalibs/panda/CMakeLists.txt

+ 22 - 4
cmake/macros/Interrogate.cmake

@@ -219,16 +219,34 @@ function(interrogate_sources target output database module)
 endfunction(interrogate_sources)
 
 #
-# Function: add_python_module(module [lib1 [lib2 ...]])
-# Uses interrogate to create a Python module.
+# Function: add_python_module(module [lib1 [lib2 ...]] [LINK lib1 ...])
+# Uses interrogate to create a Python module. If the LINK keyword is specified,
+# the Python module is linked against the specified libraries instead of those
+# listed before.
 #
 function(add_python_module module)
   if(HAVE_PYTHON AND HAVE_INTERROGATE)
-    set(targets ${ARGN})
+    set(targets)
+    set(link_targets)
     set(infiles)
     set(sources)
     set(HACKlinklibs)
 
+    set(link_keyword OFF)
+    foreach(arg ${ARGN})
+      if(arg STREQUAL "LINK")
+        set(link_keyword ON)
+      elseif(link_keyword)
+        list(APPEND link_targets "${arg}")
+      else()
+        list(APPEND targets "${arg}")
+      endif()
+    endforeach(arg)
+
+    if(NOT link_keyword)
+      set(link_targets ${targets})
+    endif()
+
     foreach(target ${targets})
       interrogate_sources(${target} "${target}_igate.cxx" "${target}.in" "${module}")
       list(APPEND infiles "${target}.in")
@@ -262,7 +280,7 @@ function(add_python_module module)
 
     add_library(${module} MODULE "${module}_module.cxx" ${sources})
     target_link_libraries(${module}
-      ${targets} ${PYTHON_LIBRARIES} p3interrogatedb)
+      ${link_targets} ${PYTHON_LIBRARIES} p3interrogatedb)
     target_link_libraries(${module} ${HACKlinklibs})
 
     set_target_properties(${module} PROPERTIES

+ 1 - 1
panda/CMakeLists.txt

@@ -90,7 +90,7 @@ if(HAVE_FREETYPE)
   list(APPEND CORE_MODULE_COMPONENTS p3pnmtext)
 endif()
 
-add_python_module(core ${CORE_MODULE_COMPONENTS})
+add_python_module(core ${CORE_MODULE_COMPONENTS} LINK panda)
 
 if(HAVE_EGG)
   add_python_module(egg p3egg p3egg2pg)

+ 12 - 1
panda/metalibs/panda/CMakeLists.txt

@@ -1,5 +1,16 @@
 add_definitions(-DBUILDING_PANDA)
-set(PANDA_LINK_TARGETS p3pnmimagetypes p3device)
+set(PANDA_LINK_TARGETS
+    p3chan p3char p3collide p3cull p3device p3dgraph p3display p3downloader
+    p3event p3express p3gobj p3grutil p3gsgbase p3linmath p3mathutil p3nativenet
+    p3net p3movies p3parametrics p3pgraph p3pgraphnodes p3pgui p3pipeline
+    p3pnmimage p3pnmimagetypes p3pstatclient p3putil p3recorder p3text p3tform)
+
+if(HAVE_AUDIO)
+  list(APPEND PANDA_LINK_TARGETS p3audio)
+endif()
+if(HAVE_FREETYPE)
+  list(APPEND PANDA_LINK_TARGETS p3pnmtext)
+endif()
 
 if(LINK_IN_PHYSX)
   add_definitions(-DBUILDING_PANDAPHYSX)