Add interrogate macros, add p3express/p3downloader/p3dtoolconfig, fixes for pre-2.8.11
This commit is contained in:
parent
7ea0d099e9
commit
d71923b36e
|
|
@ -14,7 +14,7 @@ include(dtool/PandaMacros.cmake)
|
|||
include(dtool/PandaVersion.cmake)
|
||||
include(dtool/Packages.cmake)
|
||||
include(dtool/Config.cmake)
|
||||
#include(dtool/Interrogate.cmake)
|
||||
include(dtool/Interrogate.cmake)
|
||||
|
||||
# Determine which trees to build.
|
||||
option(BUILD_DTOOL "Build the dtool source tree." ON)
|
||||
|
|
|
|||
|
|
@ -13,3 +13,4 @@ add_subdirectory(src/interrogate)
|
|||
|
||||
# Include dtool metalibs
|
||||
add_subdirectory(metalibs/dtool)
|
||||
add_subdirectory(metalibs/dtoolconfig)
|
||||
|
|
|
|||
|
|
@ -213,6 +213,19 @@ FFI step. This loads and runs much more quickly than the original
|
|||
mechanism. Define this false (that is, empty) to use the original
|
||||
interfaces." ON)
|
||||
|
||||
set(INTERROGATE_C_INTERFACE
|
||||
"Do you want to generate a C-callable interrogate interface? This
|
||||
generates an interface similar to the Python interface above, with
|
||||
a C calling convention. It should be useful for most other kinds
|
||||
of scripting language; the VR Studio used to use this to make calls
|
||||
into Panda from Squeak." OFF)
|
||||
|
||||
option(HAVE_INTERROGATE
|
||||
"Do you even want to build interrogate at all? This is the program
|
||||
that reads our C++ source files and generates one of the above
|
||||
interfaces. If you won't be building the interfaces, you don't
|
||||
need the program." ON)
|
||||
|
||||
set(INTERROGATE_OPTIONS "-fnames;-string;-refcount;-assert" CACHE STRING
|
||||
"What additional options should be passed to interrogate when
|
||||
generating either of the above two interfaces? Generally, you
|
||||
|
|
@ -264,7 +277,7 @@ endif()
|
|||
|
||||
option(USE_PYTHON
|
||||
"Enables support for Python. If INTERROGATE_PYTHON_INTERFACE
|
||||
is also enabled, Python bindings will be generated.")
|
||||
is also enabled, Python bindings will be generated." ON)
|
||||
|
||||
if(USE_PYTHON)
|
||||
find_package(PythonLibs)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,130 @@
|
|||
#
|
||||
# dtool/Interrogate.cmake
|
||||
#
|
||||
# This file contains macros and functions that are used to invoke
|
||||
# interrogate, in order to generate wrappers for Python and/or other
|
||||
# languages.
|
||||
#
|
||||
|
||||
set(IGATE_FLAGS ${INTERROGATE_OPTIONS} -DCPPPARSER -D__cplusplus -Dvolatile -Dmutable)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND IGATE_FLAGS -longlong __int64 -D_X86_ -D__STDC__=1 -DWIN32_VC -D "_declspec(param)=" -D "__declspec(param)=" -D_near -D_far -D__near -D__far -D_WIN32 -D__stdcall -DWIN32)
|
||||
endif()
|
||||
if(INTERROGATE_VERBOSE)
|
||||
list(APPEND IGATE_FLAGS "-v")
|
||||
endif()
|
||||
|
||||
set(IMOD_FLAGS ${INTERROGATE_MODULE_OPTIONS})
|
||||
|
||||
#
|
||||
# Function: target_interrogate(target [ALL] [source1 [source2 ...]])
|
||||
# NB. This doesn't actually invoke interrogate, but merely adds the
|
||||
# sources to the list of scan sources associated with the target.
|
||||
# Interrogate will be invoked when add_python_module is called.
|
||||
# If ALL is specified, all of the sources from the associated
|
||||
# target are added.
|
||||
#
|
||||
function(target_interrogate target)
|
||||
if(HAVE_PYTHON AND HAVE_INTERROGATE)
|
||||
set(sources)
|
||||
set(want_all OFF)
|
||||
|
||||
# Find any .N files that would normally be picked up by interrogate.
|
||||
# We let CMake add these as dependencies too, to allow rebuilding
|
||||
# the wrappers when the .N files have been modified.
|
||||
set(deps)
|
||||
foreach(arg ${ARGV})
|
||||
if(arg STREQUAL "ALL")
|
||||
set(want_all ON)
|
||||
else()
|
||||
list(APPEND sources "${source}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# If ALL was specified, pull in all sources from the target.
|
||||
if(want_all)
|
||||
get_target_property(target_sources "${target}" SOURCES)
|
||||
list(APPEND sources ${target_sources})
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES sources)
|
||||
|
||||
# Go through the sources to determine the full name,
|
||||
# and also find out if there are any .N files to pick up.
|
||||
foreach(source ${sources})
|
||||
get_source_file_property(exclude "${source}" WRAP_EXCLUDE)
|
||||
|
||||
if(NOT exclude)
|
||||
get_filename_component(basename "${source}" NAME_WE)
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${basename}.N")
|
||||
list(APPEND deps "${CMAKE_CURRENT_SOURCE_DIR}/${basename}.N")
|
||||
endif()
|
||||
|
||||
# Add the full path to the source file itself.
|
||||
get_source_file_property(location "${source}" LOCATION)
|
||||
list(APPEND deps "${location}")
|
||||
endif()
|
||||
endforeach(source)
|
||||
|
||||
set_target_properties("${target}" PROPERTIES IGATE_SOURCES "${sources}")
|
||||
set_target_properties("${target}" PROPERTIES IGATE_SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_target_properties("${target}" PROPERTIES IGATE_DEPS "${deps}")
|
||||
endif()
|
||||
endfunction(target_interrogate)
|
||||
|
||||
#
|
||||
# Function: add_python_module(module [lib1 [lib2 ...]])
|
||||
# Uses interrogate to create a Python module.
|
||||
#
|
||||
function(add_python_module module)
|
||||
if(HAVE_PYTHON AND HAVE_INTERROGATE)
|
||||
set(targets ${ARGN})
|
||||
set(infiles)
|
||||
set(sources)
|
||||
|
||||
foreach(target ${targets})
|
||||
get_target_property(scansrc "${target}" IGATE_SOURCES)
|
||||
get_target_property(srcdir "${target}" IGATE_SRCDIR)
|
||||
get_target_property(deps "${target}" IGATE_DEPS)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${target}_igate.cxx" "${target}.in"
|
||||
COMMAND interrogate
|
||||
-od "${target}.in"
|
||||
-oc "${target}_igate.cxx"
|
||||
-module ${module} -library ${target} ${IGATE_FLAGS}
|
||||
-srcdir "${srcdir}"
|
||||
-I "${PROJECT_BINARY_DIR}/include"
|
||||
-S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc"
|
||||
-S "${PROJECT_BINARY_DIR}/include/parser-inc"
|
||||
${scansrc}
|
||||
DEPENDS interrogate ${deps}
|
||||
)
|
||||
|
||||
list(APPEND infiles "${target}.in")
|
||||
list(APPEND sources "${target}_igate.cxx")
|
||||
endforeach(target)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
|
||||
COMMAND interrogate_module
|
||||
-oc "${CMAKE_CURRENT_BINARY_DIR}/${module}_module.cxx"
|
||||
-module ${module} -library ${module}
|
||||
${IMOD_FLAGS} ${infiles}
|
||||
DEPENDS interrogate_module ${infiles}
|
||||
)
|
||||
|
||||
add_library(${module} MODULE "${module}_module.cxx" ${sources})
|
||||
target_link_libraries(${module} ${PYTHON_LIBRARIES})
|
||||
target_link_libraries(${module} p3interrogatedb)
|
||||
|
||||
set_target_properties(${module} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/panda3d"
|
||||
PREFIX ""
|
||||
)
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set_target_properties(${module} PROPERTIES SUFFIX ".pyd")
|
||||
endif()
|
||||
endif()
|
||||
endfunction(add_python_module)
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
# Settings for composite builds. Should be moved to Config.cmake?
|
||||
set(COMPOSITE_SOURCE_LIMIT "10" CACHE STRING
|
||||
"Setting this to a value higher than 1 will enable unity builds.
|
||||
A high value will speed up the build dramatically but use more RAM.")
|
||||
set(COMPOSITE_SOURCE_LIMIT "30" CACHE STRING
|
||||
"Setting this to a value higher than 1 will enable unity builds, also
|
||||
known as SCU (single compilation unit). A high value will speed up the
|
||||
build dramatically but will be more memory intensive than a low value.")
|
||||
|
||||
set(COMPOSITE_SOURCE_EXTENSIONS "cxx;c;mm" CACHE STRING
|
||||
"Only files of these extensions will be added to composite files.")
|
||||
|
|
@ -172,25 +173,28 @@ if(CMAKE_VERSION VERSION_LESS 2.8.11)
|
|||
endfunction()
|
||||
|
||||
function(target_link_libraries target)
|
||||
set(interface_dirs "")
|
||||
set(interface_dirs)
|
||||
get_target_property(target_interface_dirs "${target}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
foreach(lib ${ARGN})
|
||||
get_target_property(lib_interface_dirs "${lib}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
set(interface_dirs ${interface_dirs} ${lib_interface_dirs})
|
||||
if(lib_interface_dirs)
|
||||
list(APPEND interface_dirs ${lib_interface_dirs})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES interface_dirs)
|
||||
|
||||
#NB. target_include_directories is new in 2.8.8.
|
||||
#target_include_directories("${target}" ${interace_dirs})
|
||||
#target_include_directories("${target}" ${interface_dirs})
|
||||
include_directories(${interface_dirs})
|
||||
message(STATUS "adding extra ${interface_dirs}")
|
||||
|
||||
# Update this target's interface inc dirs.
|
||||
set_target_properties("${target}" PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${target_interface_dirs};${interface_dirs}")
|
||||
|
||||
# Call to the built-in function we are overriding.
|
||||
_target_link_libraries(${name} ${ARGN})
|
||||
_target_link_libraries(${target} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
else()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
if(HAVE_PYTHON)
|
||||
add_library(p3dtoolconfig dtoolconfig.cxx pydtool.cxx)
|
||||
target_link_libraries(p3dtoolconfig ${PYTHON_LIBRARIES})
|
||||
else()
|
||||
add_library(p3dtoolconfig dtoolconfig.cxx)
|
||||
endif()
|
||||
|
||||
target_link_libraries(p3dtoolconfig p3prc p3dconfig p3interrogatedb)
|
||||
|
|
@ -4,3 +4,5 @@ endif()
|
|||
|
||||
# Include panda source directories
|
||||
add_subdirectory(src/pandabase)
|
||||
add_subdirectory(src/express)
|
||||
add_subdirectory(src/downloader)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
set(P3DOWNLOADER_HEADERS
|
||||
bioPtr.I bioPtr.h
|
||||
bioStreamPtr.I bioStreamPtr.h
|
||||
bioStream.I bioStream.h bioStreamBuf.h
|
||||
chunkedStream.I chunkedStream.h
|
||||
chunkedStreamBuf.h chunkedStreamBuf.I
|
||||
config_downloader.h
|
||||
decompressor.h decompressor.I
|
||||
documentSpec.h documentSpec.I
|
||||
download_utils.h downloadDb.h downloadDb.I
|
||||
extractor.h
|
||||
httpAuthorization.I httpAuthorization.h
|
||||
httpBasicAuthorization.I httpBasicAuthorization.h
|
||||
httpChannel.I httpChannel.h
|
||||
httpClient.I httpClient.h
|
||||
httpCookie.I httpCookie.h
|
||||
httpDate.I httpDate.h
|
||||
httpDigestAuthorization.I httpDigestAuthorization.h
|
||||
httpEntityTag.I httpEntityTag.h
|
||||
httpEnum.h
|
||||
identityStream.I identityStream.h
|
||||
identityStreamBuf.h identityStreamBuf.I
|
||||
multiplexStream.I multiplexStream.h
|
||||
multiplexStreamBuf.I multiplexStreamBuf.h
|
||||
patcher.h patcher.I
|
||||
socketStream.h socketStream.I
|
||||
stringStreamBuf.I stringStreamBuf.h
|
||||
stringStream.I stringStream.h
|
||||
urlSpec.h urlSpec.I
|
||||
virtualFileHTTP.I virtualFileHTTP.h
|
||||
virtualFileMountHTTP.I virtualFileMountHTTP.h)
|
||||
|
||||
set(P3DOWNLOADER_SOURCES
|
||||
config_downloader.cxx
|
||||
bioPtr.cxx
|
||||
bioStreamPtr.cxx
|
||||
bioStream.cxx bioStreamBuf.cxx
|
||||
chunkedStream.cxx chunkedStreamBuf.cxx
|
||||
decompressor.cxx
|
||||
documentSpec.cxx
|
||||
downloadDb.cxx
|
||||
download_utils.cxx
|
||||
extractor.cxx
|
||||
httpAuthorization.cxx
|
||||
httpBasicAuthorization.cxx
|
||||
httpChannel.cxx
|
||||
httpClient.cxx
|
||||
httpCookie.cxx
|
||||
httpDate.cxx
|
||||
httpDigestAuthorization.cxx
|
||||
httpEntityTag.cxx
|
||||
httpEnum.cxx
|
||||
identityStream.cxx identityStreamBuf.cxx
|
||||
multiplexStream.cxx multiplexStreamBuf.cxx
|
||||
patcher.cxx
|
||||
socketStream.cxx
|
||||
stringStreamBuf.cxx
|
||||
stringStream.cxx
|
||||
urlSpec.cxx
|
||||
virtualFileHTTP.cxx
|
||||
virtualFileMountHTTP.cxx)
|
||||
|
||||
composite_sources(p3downloader P3DOWNLOADER_SOURCES)
|
||||
|
||||
add_library(p3downloader ${P3DOWNLOADER_SOURCES} ${P3DOWNLOADER_HEADERS})
|
||||
target_link_libraries(p3downloader p3express p3pandabase)
|
||||
target_interrogate(p3downloader ALL)
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
set(P3EXPRESS_HEADERS
|
||||
buffer.I buffer.h
|
||||
ca_bundle_data_src.c
|
||||
checksumHashGenerator.I checksumHashGenerator.h circBuffer.I
|
||||
circBuffer.h
|
||||
compress_string.h
|
||||
config_express.h
|
||||
copy_stream.h
|
||||
datagram.I datagram.h datagramGenerator.I
|
||||
datagramGenerator.h
|
||||
datagramIterator.I datagramIterator.h datagramSink.I datagramSink.h
|
||||
dcast.T dcast.h
|
||||
encrypt_string.h
|
||||
error_utils.h
|
||||
fileReference.h fileReference.I
|
||||
hashGeneratorBase.I hashGeneratorBase.h
|
||||
hashVal.I hashVal.h
|
||||
indirectLess.I indirectLess.h
|
||||
memoryInfo.I memoryInfo.h
|
||||
memoryUsage.I memoryUsage.h
|
||||
memoryUsagePointerCounts.I memoryUsagePointerCounts.h
|
||||
memoryUsagePointers.I memoryUsagePointers.h
|
||||
multifile.I multifile.h
|
||||
namable.I
|
||||
namable.h
|
||||
nodePointerTo.h nodePointerTo.I
|
||||
nodePointerToBase.h nodePointerToBase.I
|
||||
nodeReferenceCount.h nodeReferenceCount.I
|
||||
openSSLWrapper.h openSSLWrapper.I
|
||||
ordered_vector.h ordered_vector.I ordered_vector.T
|
||||
pStatCollectorForwardBase.h
|
||||
password_hash.h
|
||||
patchfile.I patchfile.h
|
||||
pointerTo.I pointerTo.h
|
||||
pointerToArray.I pointerToArray.h
|
||||
pointerToArrayBase.I pointerToArrayBase.h
|
||||
pointerToBase.I pointerToBase.h
|
||||
pointerToVoid.I pointerToVoid.h
|
||||
profileTimer.I profileTimer.h
|
||||
pta_int.h
|
||||
pta_uchar.h pta_double.h pta_float.h
|
||||
pta_stdfloat.h
|
||||
ramfile.I ramfile.h
|
||||
referenceCount.I referenceCount.h
|
||||
subStream.I subStream.h subStreamBuf.h
|
||||
subfileInfo.h subfileInfo.I
|
||||
temporaryFile.h temporaryFile.I
|
||||
threadSafePointerTo.I threadSafePointerTo.h
|
||||
threadSafePointerToBase.I threadSafePointerToBase.h
|
||||
trueClock.I trueClock.h
|
||||
typedReferenceCount.I typedReferenceCount.h typedef.h
|
||||
vector_uchar.h vector_double.h vector_float.h
|
||||
vector_stdfloat.h
|
||||
virtualFile.I virtualFileList.I virtualFileList.h virtualFileMount.h
|
||||
virtualFileComposite.h virtualFileComposite.I virtualFile.h
|
||||
virtualFileMount.I virtualFileMountMultifile.h
|
||||
virtualFileMountMultifile.I
|
||||
virtualFileMountRamdisk.h virtualFileMountRamdisk.I
|
||||
virtualFileMountSystem.h virtualFileMountSystem.I
|
||||
virtualFileSimple.h virtualFileSimple.I
|
||||
virtualFileSystem.h virtualFileSystem.I
|
||||
weakPointerCallback.I weakPointerCallback.h
|
||||
weakPointerTo.I weakPointerTo.h
|
||||
weakPointerToBase.I weakPointerToBase.h
|
||||
weakPointerToVoid.I weakPointerToVoid.h
|
||||
weakReferenceList.I weakReferenceList.h
|
||||
windowsRegistry.h
|
||||
zStream.I zStream.h zStreamBuf.h)
|
||||
|
||||
set(P3EXPRESS_SOURCES
|
||||
buffer.cxx checksumHashGenerator.cxx
|
||||
compress_string.cxx
|
||||
config_express.cxx
|
||||
copy_stream.cxx
|
||||
datagram.cxx datagramGenerator.cxx
|
||||
datagramIterator.cxx
|
||||
datagramSink.cxx dcast.cxx
|
||||
encrypt_string.cxx
|
||||
error_utils.cxx
|
||||
fileReference.cxx
|
||||
hashGeneratorBase.cxx hashVal.cxx
|
||||
memoryInfo.cxx memoryUsage.cxx memoryUsagePointerCounts.cxx
|
||||
memoryUsagePointers.cxx multifile.cxx
|
||||
namable.cxx
|
||||
nodePointerTo.cxx
|
||||
nodePointerToBase.cxx
|
||||
nodeReferenceCount.cxx
|
||||
openSSLWrapper.cxx
|
||||
ordered_vector.cxx
|
||||
pStatCollectorForwardBase.cxx
|
||||
password_hash.cxx
|
||||
patchfile.cxx
|
||||
pointerTo.cxx
|
||||
pointerToArray.cxx
|
||||
pointerToBase.cxx
|
||||
pointerToVoid.cxx
|
||||
profileTimer.cxx
|
||||
pta_int.cxx
|
||||
pta_uchar.cxx pta_double.cxx pta_float.cxx
|
||||
ramfile.cxx
|
||||
referenceCount.cxx
|
||||
subStream.cxx subStreamBuf.cxx
|
||||
subfileInfo.cxx
|
||||
temporaryFile.cxx
|
||||
threadSafePointerTo.cxx
|
||||
threadSafePointerToBase.cxx
|
||||
trueClock.cxx
|
||||
typedReferenceCount.cxx
|
||||
vector_uchar.cxx vector_double.cxx vector_float.cxx
|
||||
virtualFileComposite.cxx virtualFile.cxx virtualFileList.cxx
|
||||
virtualFileMount.cxx
|
||||
virtualFileMountMultifile.cxx
|
||||
virtualFileMountRamdisk.cxx
|
||||
virtualFileMountSystem.cxx
|
||||
virtualFileSimple.cxx virtualFileSystem.cxx
|
||||
weakPointerCallback.cxx
|
||||
weakPointerTo.cxx
|
||||
weakPointerToBase.cxx
|
||||
weakPointerToVoid.cxx
|
||||
weakReferenceList.cxx
|
||||
windowsRegistry.cxx
|
||||
zStream.cxx zStreamBuf.cxx)
|
||||
|
||||
composite_sources(p3express P3EXPRESS_SOURCES)
|
||||
|
||||
add_library(p3express ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS})
|
||||
target_link_libraries(p3express p3pandabase p3dtool p3dtoolconfig)
|
||||
target_interrogate(p3express ALL)
|
||||
Loading…
Reference in New Issue