Browse Source

CMake: Update for upstream Interrogate changes

- "igateruntime" is no longer a thing
- interrogate_module embeds a preamble; we have to provide it
- WindowProperties now has an extension
Sam Edwards 7 years ago
parent
commit
7f8d7366dc

+ 1 - 1
cmake/macros/Interrogate.cmake

@@ -310,7 +310,7 @@ function(add_python_module module)
   )
 
   add_python_target(panda3d.${module} "${module}_module.cxx" ${sources} ${extensions})
-  target_link_libraries(panda3d.${module} ${link_targets} p3igateruntime)
+  target_link_libraries(panda3d.${module} ${link_targets})
 
   if(CMAKE_VERSION VERSION_LESS "3.11")
     # CMake <3.11 doesn't allow generator expressions on source files, so we

+ 29 - 3
dtool/src/interrogate/CMakeLists.txt

@@ -22,7 +22,8 @@ set(INTERROGATE_HEADERS
   parameterRemapToString.h
   parameterRemapHandleToInt.h
   parameterRemapUnchanged.h
-  typeManager.h)
+  typeManager.h
+)
 
 set(INTERROGATE_SOURCES
   functionRemap.cxx
@@ -47,7 +48,15 @@ set(INTERROGATE_SOURCES
   parameterRemapToString.cxx
   parameterRemapHandleToInt.cxx
   parameterRemapUnchanged.cxx
-  typeManager.cxx)
+  typeManager.cxx
+)
+
+set(INTERROGATE_PREAMBLE_PYTHON_NATIVE
+  ../interrogatedb/py_panda.cxx
+  ../interrogatedb/py_compat.cxx
+  ../interrogatedb/py_wrappers.cxx
+  ../interrogatedb/dtool_super_base.cxx
+)
 
 composite_sources(interrogate INTERROGATE_SOURCES)
 
@@ -55,7 +64,24 @@ add_executable(interrogate ${INTERROGATE_HEADERS} ${INTERROGATE_SOURCES})
 target_link_libraries(interrogate p3cppParser p3dtoolconfig p3pystub
   PKG::OPENSSL)
 
-add_executable(interrogate_module interrogate_module.cxx)
+# Python preamble for interrogate_module
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/interrogate_preamble_python_native.cxx
+  "extern const char interrogate_preamble_python_native[];\n")
+file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/interrogate_preamble_python_native.cxx
+  "const char interrogate_preamble_python_native[] = (\n")
+foreach(preamble_file ${INTERROGATE_PREAMBLE_PYTHON_NATIVE})
+  file(READ ${preamble_file} preamble_content)
+  string(REPLACE "\\" "\\\\" preamble_content "${preamble_content}")
+  string(REPLACE "\"" "\\\"" preamble_content "${preamble_content}")
+  string(REPLACE "\n" "\\n" preamble_content "${preamble_content}")
+  file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/interrogate_preamble_python_native.cxx
+    "  \"${preamble_content}\"\n")
+endforeach(preamble_file)
+file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/interrogate_preamble_python_native.cxx
+  ");\n")
+
+add_executable(interrogate_module interrogate_module.cxx
+  ${CMAKE_CURRENT_BINARY_DIR}/interrogate_preamble_python_native.cxx)
 target_link_libraries(interrogate_module p3cppParser p3dtoolconfig p3pystub
   PKG::OPENSSL)
 

+ 11 - 32
dtool/src/interrogatedb/CMakeLists.txt

@@ -9,10 +9,8 @@ set(P3INTERROGATEDB_HEADERS
   interrogateManifest.I interrogateManifest.h
   interrogateType.I interrogateType.h
   interrogate_datafile.I interrogate_datafile.h
-  interrogate_interface.h interrogate_request.h)
-
-set(P3IGATERUNTIME_HEADERS
-  extension.h py_compat.h py_panda.h py_wrappers.h)
+  interrogate_interface.h interrogate_request.h
+)
 
 set(P3INTERROGATEDB_SOURCES
   config_interrogatedb.cxx
@@ -23,17 +21,17 @@ set(P3INTERROGATEDB_SOURCES
   interrogateMakeSeq.cxx
   interrogateManifest.cxx
   interrogateType.cxx interrogate_datafile.cxx
-  interrogate_interface.cxx interrogate_request.cxx)
-
-set(P3IGATERUNTIME_SOURCES
-  dtool_super_base.cxx
-  py_compat.cxx
-  ${CMAKE_CURRENT_BINARY_DIR}/py_panda.cxx
-  py_wrappers.cxx)
+  interrogate_interface.cxx interrogate_request.cxx
+)
 
 set(P3INTERROGATEDB_IGATE
   interrogate_interface.h
-  interrogate_request.h)
+  interrogate_request.h
+)
+
+set(P3IGATERUNTIME_HEADERS
+  extension.h py_compat.h py_panda.h py_wrappers.h
+)
 
 composite_sources(p3interrogatedb P3INTERROGATEDB_SOURCES)
 
@@ -45,25 +43,6 @@ if(NOT BUILD_METALIBS)
   install(TARGETS p3interrogatedb DESTINATION lib RUNTIME DESTINATION bin)
 endif()
 install(FILES ${P3INTERROGATEDB_HEADERS} DESTINATION include/panda3d)
-
-# Now we need to build the Interrogate runtime code; this should eventually be
-# split out into its own subdirectory.
-
-# HACK: igateruntime doesn't have its own BUILDING_IGATERUNTIME symbol yet;
-# it's still using BUILDING_INTERROGATEDB.
-
-# py_panda.cxx can't rely on anything from interrogatedb, so:
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/py_panda.cxx _py_panda)
-string(REGEX REPLACE "interrogatedb" "prc" _py_panda "${_py_panda}")
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/py_panda.cxx "${_py_panda}")
-
-add_library(p3igateruntime
-  ${P3IGATERUNTIME_HEADERS} ${P3IGATERUNTIME_SOURCES})
-set_target_properties(p3igateruntime PROPERTIES
-  DEFINE_SYMBOL BUILDING_INTERROGATEDB) # HACK
-target_link_libraries(p3igateruntime p3dtoolconfig PKG::PYTHON)
-
-install(TARGETS p3igateruntime DESTINATION lib RUNTIME DESTINATION bin)
 install(FILES ${P3IGATERUNTIME_HEADERS} DESTINATION include/panda3d)
 
 # ALSO: This has an Interrogate binding! Take care of that if we want it.
@@ -91,4 +70,4 @@ add_custom_command(
 
 add_python_target(panda3d.interrogatedb
   "${CMAKE_CURRENT_BINARY_DIR}/interrogatedb_module.cxx")
-target_link_libraries(panda3d.interrogatedb p3igateruntime)
+target_link_libraries(panda3d.interrogatedb p3dtoolconfig)

+ 2 - 0
panda/src/display/CMakeLists.txt

@@ -71,6 +71,8 @@ set(P3DISPLAY_IGATEEXT
   graphicsWindow_ext.h
   pythonGraphicsWindowProc.cxx
   pythonGraphicsWindowProc.h
+  windowProperties_ext.cxx
+  windowProperties_ext.h
 )
 
 if(APPLE)

+ 9 - 4
panda/src/ode/CMakeLists.txt

@@ -39,7 +39,8 @@ set(P3ODE_HEADERS
   odeTriMeshData.I odeTriMeshData.h
   odeTriMeshGeom.I odeTriMeshGeom.h
   odeCollisionEntry.I odeCollisionEntry.h
-  odeHelperStructs.h)
+  odeHelperStructs.h
+)
 
 set(P3ODE_SOURCES
   config_ode.cxx
@@ -62,9 +63,11 @@ set(P3ODE_SOURCES
   odePlaneGeom.cxx odeCappedCylinderGeom.cxx
   odeCylinderGeom.cxx odeRayGeom.cxx
   odeTriMeshData.cxx  odeTriMeshGeom.cxx
-  odeCollisionEntry.cxx)
+  odeCollisionEntry.cxx
+)
 
 set(P3ODE_IGATEEXT
+  odeBody_ext.cxx
   odeBody_ext.h
   odeBody_ext.I
   odeGeom_ext.cxx
@@ -76,7 +79,8 @@ set(P3ODE_IGATEEXT
   odeSpace_ext.h
   odeSpace_ext.I
   odeUtil_ext.cxx
-  odeUtil_ext.h)
+  odeUtil_ext.h
+)
 
 set(P3ODE_IGATE_SOURCES "${P3ODE_HEADERS};${P3ODE_SOURCES}")
 list(REMOVE_ITEM P3ODE_IGATE_SOURCES "odeHelperStructs.h")
@@ -84,7 +88,8 @@ list(REMOVE_ITEM P3ODE_IGATE_SOURCES "odeHelperStructs.h")
 composite_sources(p3ode P3ODE_SOURCES)
 add_library(p3ode ${P3ODE_SOURCES} ${P3ODE_HEADERS})
 set_target_properties(p3ode PROPERTIES DEFINE_SYMBOL BUILDING_PANDAODE)
-target_link_libraries(p3ode p3igateruntime panda PKG::ODE)
+target_link_libraries(p3ode panda
+  PKG::ODE)
 target_interrogate(p3ode ${P3ODE_IGATE_SOURCES} EXTENSIONS ${P3ODE_IGATEEXT})
 
 install(TARGETS p3ode DESTINATION lib RUNTIME DESTINATION bin)