CMake: Don't compile Interrogate runtime code into interrogatedb

This should obviate the need for pystub as well.

Note that it's currently a little bit hacky; the source will
have to be moved to make the CMake dependencies work better.
This commit is contained in:
Sam Edwards 2018-09-06 00:26:13 -06:00
parent 27ac068908
commit e501d20927
6 changed files with 34 additions and 20 deletions

View File

@ -219,6 +219,7 @@ function(interrogate_sources target output database language_flags)
${language_flags}
${define_flags}
-S "${PROJECT_BINARY_DIR}/include"
-S "${PROJECT_SOURCE_DIR}/dtool/src/interrogatedb"
-S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc"
-S "${PYTHON_INCLUDE_DIRS}"
${include_flags}
@ -291,8 +292,7 @@ function(add_python_module module)
)
add_python_target(panda3d.${module} "${module}_module.cxx" ${sources})
target_link_libraries(panda3d.${module}
${link_targets} p3dtool)
target_link_libraries(panda3d.${module} ${link_targets} p3igateruntime)
list(APPEND ALL_INTERROGATE_MODULES "${module}")
set(ALL_INTERROGATE_MODULES "${ALL_INTERROGATE_MODULES}" CACHE INTERNAL "Internal variable")

View File

@ -85,9 +85,6 @@ composite_sources(p3dtoolbase P3DTOOLBASE_SOURCES)
add_component_library(p3dtoolbase NOINIT SYMBOL BUILDING_DTOOL_DTOOLBASE
${P3DTOOLBASE_HEADERS} ${P3DTOOLBASE_SOURCES})
# The extensions need py_panda.h and extension.h from interrogatedb
target_include_directories(p3dtoolbase PUBLIC
$<TARGET_PROPERTY:p3interrogatedb,INTERFACE_INCLUDE_DIRECTORIES>)
# Help other libraries find the autogenerated version headers
target_include_directories(p3dtoolbase PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_use_packages(p3dtoolbase THREADS EIGEN)

View File

@ -66,9 +66,6 @@ composite_sources(p3dtoolutil P3DTOOLUTIL_SOURCES)
add_component_library(p3dtoolutil SYMBOL BUILDING_DTOOL_DTOOLUTIL
${P3DTOOLUTIL_HEADERS} ${P3DTOOLUTIL_SOURCES})
# The extensions need py_panda.h and extension.h from interrogatedb
target_include_directories(p3dtoolutil PUBLIC
$<TARGET_PROPERTY:p3interrogatedb,INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries(p3dtoolutil p3dtoolbase ${CMAKE_DL_LIBS})
target_interrogate(p3dtoolutil ALL EXTENSIONS ${P3DTOOLUTIL_IGATEEXT})

View File

@ -9,12 +9,13 @@ set(P3INTERROGATEDB_HEADERS
interrogateManifest.I interrogateManifest.h
interrogateType.I interrogateType.h
interrogate_datafile.I interrogate_datafile.h
interrogate_interface.h interrogate_request.h
interrogate_interface.h interrogate_request.h)
set(P3IGATERUNTIME_HEADERS
extension.h py_compat.h py_panda.h py_wrappers.h)
set(P3INTERROGATEDB_SOURCES
config_interrogatedb.cxx
dtool_super_base.cxx
indexRemapper.cxx
interrogateComponent.cxx interrogateDatabase.cxx
interrogateElement.cxx interrogateFunction.cxx
@ -22,28 +23,50 @@ set(P3INTERROGATEDB_SOURCES
interrogateMakeSeq.cxx
interrogateManifest.cxx
interrogateType.cxx interrogate_datafile.cxx
interrogate_interface.cxx interrogate_request.cxx
interrogate_interface.cxx interrogate_request.cxx)
set(P3IGATERUNTIME_SOURCES
dtool_super_base.cxx
py_compat.cxx
py_panda.cxx
${CMAKE_CURRENT_BINARY_DIR}/py_panda.cxx
py_wrappers.cxx)
set(P3INTERROGATEDB_IGATE
interrogate_interface.h
interrogate_request.h
)
interrogate_request.h)
composite_sources(p3interrogatedb P3INTERROGATEDB_SOURCES)
add_component_library(p3interrogatedb NOINIT SYMBOL BUILDING_INTERROGATEDB
${P3INTERROGATEDB_HEADERS} ${P3INTERROGATEDB_SOURCES})
target_link_libraries(p3interrogatedb p3dconfig)
target_use_packages(p3interrogatedb PYTHON)
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)
target_use_packages(p3igateruntime 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.
# Note we don't use the regular Interrogate macros; this has some custom flags
# that would make it not worthwhile.
@ -69,4 +92,4 @@ add_custom_command(
add_python_target(panda3d.interrogatedb
"${CMAKE_CURRENT_BINARY_DIR}/interrogatedb_module.cxx")
target_link_libraries(panda3d.interrogatedb p3dtoolconfig)
target_link_libraries(panda3d.interrogatedb p3igateruntime)

View File

@ -73,9 +73,6 @@ composite_sources(p3prc P3PRC_SOURCES)
add_component_library(p3prc NOINIT SYMBOL BUILDING_DTOOL_PRC
${P3PRC_HEADERS} ${P3PRC_SOURCES})
target_include_directories(p3prc PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
# The extensions need py_panda.h and extension.h from interrogatedb
target_include_directories(p3prc PUBLIC
$<TARGET_PROPERTY:p3interrogatedb,INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries(p3prc p3dtool)
target_use_packages(p3prc OPENSSL)
target_interrogate(p3prc ALL EXTENSIONS ${P3PRC_IGATEEXT})

View File

@ -87,7 +87,7 @@ composite_sources(p3ode P3ODE_SOURCES)
add_library(p3ode ${P3ODE_SOURCES} ${P3ODE_HEADERS})
set_target_properties(p3ode PROPERTIES DEFINE_SYMBOL BUILDING_PANDAODE)
target_compile_definitions(p3ode PUBLIC dSINGLE)
target_link_libraries(p3ode panda)
target_link_libraries(p3ode p3igateruntime panda)
target_use_packages(p3ode ODE)
target_interrogate(p3ode ${P3ODE_IGATE_SOURCES} EXTENSIONS ${P3ODE_IGATEEXT})