Merge pull request #5 from kestred/cmake-cfs-direct

Get most of 'direct' building under CMake.
This commit is contained in:
Sam Edwards 2014-02-18 08:05:51 -07:00
commit ea36b87288
16 changed files with 255 additions and 6 deletions

View File

@ -26,8 +26,9 @@ include(dtool/Package.cmake)
include(dtool/Config.cmake)
# Determine which trees to build.
option(BUILD_DTOOL "Build the dtool source tree." ON)
option(BUILD_PANDA "Build the panda source tree." ON)
option(BUILD_DTOOL "Build the dtool source tree." ON)
option(BUILD_PANDA "Build the panda source tree." ON)
option(BUILD_DIRECT "Build the direct source tree." ON)
# Include Panda3D packages
if(BUILD_DTOOL)
@ -37,3 +38,7 @@ endif()
if(BUILD_PANDA)
add_subdirectory(panda)
endif()
if(BUILD_DIRECT)
add_subdirectory(direct)
endif()

View File

@ -174,9 +174,13 @@ function(interrogate_sources target output database module)
# will preprocess each file in the same way.
set(define_flags)
get_target_property(target_defines "${target}" COMPILE_DEFINITIONS)
foreach(target_define ${target_defines})
list(APPEND define_flags "-D${target_define}")
endforeach(target_define)
if(target_defines)
foreach(target_define ${target_defines})
list(APPEND define_flags "-D${target_define}")
# And add the same definition when we compile the _igate.cxx file:
add_definitions("-D${target_define}")
endforeach(target_define)
endif()
# If this is a release build that has NDEBUG defined, we need that too:
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
if("${CMAKE_CXX_FLAGS_${build_type}}" MATCHES ".*NDEBUG.*")

20
direct/CMakeLists.txt Normal file
View File

@ -0,0 +1,20 @@
if(NOT BUILD_PANDA)
message(FATAL_ERROR "Cannot build direct without panda! Please enable the BUILD_PANDA option.")
endif()
# Include source directories which have C++ components:
add_subdirectory(src/directbase)
add_subdirectory(src/autorestart)
add_subdirectory(src/dcparser)
add_subdirectory(src/dcparse)
add_subdirectory(src/deadrec)
#add_subdirectory(src/directdServer)
#add_subdirectory(src/directd)
add_subdirectory(src/distributed)
#add_subdirectory(src/heapq)
#add_subdirectory(src/http)
add_subdirectory(src/interval)
#add_subdirectory(src/motiontrail)
add_subdirectory(src/showbase)
add_python_module(direct p3dcparser p3deadrec p3distributed p3interval p3showbase)

View File

@ -0,0 +1,5 @@
if(UNIX)
add_executable(autorestart autorestart.c)
set_target_properties(autorestart PROPERTIES COMPILE_DEFINITIONS WITHIN_PANDA)
target_link_libraries(autorestart p3dtool)
endif()

View File

@ -0,0 +1,3 @@
add_executable(dcparse dcparse.cxx)
set_target_properties(dcparse PROPERTIES COMPILE_DEFINITIONS WITHIN_PANDA)
target_link_libraries(dcparse p3dcparser)

View File

@ -0,0 +1,53 @@
add_bison_target(dcParser.cxx dcParser.yxx DEFINES dcParser.h PREFIX dcyy)
add_flex_target(dcLexer.cxx dcLexer.lxx CASE_INSENSITIVE PREFIX dcyy)
set(P3DCPARSER_HEADERS
dcAtomicField.h dcAtomicField.I dcClass.h dcClass.I
dcDeclaration.h
dcField.h dcField.I
dcFile.h dcFile.I
dcKeyword.h dcKeywordList.h
dcLexer.lxx
dcLexerDefs.h dcMolecularField.h dcParser.yxx dcParserDefs.h
dcSubatomicType.h
dcPackData.h dcPackData.I
dcPacker.h dcPacker.I
dcPackerCatalog.h dcPackerCatalog.I
dcPackerInterface.h dcPackerInterface.I
dcParameter.h dcClassParameter.h dcArrayParameter.h
dcSimpleParameter.h dcSwitchParameter.h
dcNumericRange.h dcNumericRange.I
dcSwitch.h
dcTypedef.h
dcPython.h
dcbase.h dcindent.h hashGenerator.h
primeNumberGenerator.h)
set(P3DCPARSER_SOURCES
dcAtomicField.cxx dcClass.cxx
dcDeclaration.cxx
dcField.cxx dcFile.cxx
dcKeyword.cxx dcKeywordList.cxx
dcMolecularField.cxx dcSubatomicType.cxx
dcPackData.cxx
dcPacker.cxx
dcPackerCatalog.cxx
dcPackerInterface.cxx
dcParameter.cxx dcClassParameter.cxx dcArrayParameter.cxx
dcSimpleParameter.cxx dcSwitchParameter.cxx
dcSwitch.cxx
dcTypedef.cxx
dcindent.cxx
hashGenerator.cxx primeNumberGenerator.cxx)
# These cannot be interrogated, and are excluded from the composites.
set(P3DCPARSER_PARSER_SOURCES
dcParser.cxx
dcLexer.cxx)
composite_sources(p3dcparser P3DCPARSER_SOURCES)
add_library(p3dcparser ${P3DCPARSER_SOURCES} ${P3DCPARSER_HEADERS}
${P3DCPARSER_PARSER_SOURCES})
set_target_properties(p3dcparser PROPERTIES COMPILE_DEFINITIONS WITHIN_PANDA)
target_link_libraries(p3dcparser p3directbase p3express p3pstatclient p3prc)
target_interrogate(p3dcparser ${P3DCPARSER_SOURCES} ${P3DCPARSER_HEADERS})

View File

@ -0,0 +1,11 @@
set(P3DEADREC_HEADERS
config_deadrec.h
smoothMover.h smoothMover.I)
set(P3DEADREC_SOURCES
config_deadrec.cxx
smoothMover.cxx)
add_library(p3deadrec ${P3DEADREC_HEADERS} ${P3DEADREC_SOURCES})
target_link_libraries(p3deadrec p3directbase p3linmath p3pgraph p3prc)
target_interrogate(p3deadrec ALL)

View File

@ -0,0 +1,11 @@
set(P3DIRECTBASE_SOURCES
directbase.cxx
)
set(P3DIRECTBASE_HEADERS
directbase.h directsymbols.h
)
# Not worth compositing sources, there's really only one.
add_library(p3directbase ${P3DIRECTBASE_SOURCES} ${P3DIRECTBASE_HEADERS})
target_link_libraries(p3directbase p3pandabase)

View File

@ -0,0 +1,24 @@
if(HAVE_PYTHON)
set(P3DISTRIBUTED_HEADERS
config_distributed.h
cConnectionRepository.I
cConnectionRepository.h
cDistributedSmoothNodeBase.I
cDistributedSmoothNodeBase.h)
set(P3DISTRIBUTED_SOURCES
config_distributed.cxx
cConnectionRepository.cxx
cDistributedSmoothNodeBase.cxx)
add_library(p3distributed ${P3DISTRIBUTED_HEADERS} ${P3DISTRIBUTED_SOURCES})
set_target_properties(p3distributed PROPERTIES COMPILE_DEFINITIONS WITHIN_PANDA)
target_link_libraries(p3distributed p3directbase p3dcparser p3pgraph)
if(WANT_NATIVE_NET)
target_link_libraries(p3distributed p3nativenet)
endif()
if(HAVE_NET)
target_link_libraries(p3distributed p3net)
endif()
target_interrogate(p3distributed ALL)
endif()

View File

@ -0,0 +1,41 @@
set(P3INTERVAL_HEADERS
config_interval.h
cInterval.I cInterval.h
cIntervalManager.I cIntervalManager.h
cConstraintInterval.I cConstraintInterval.h
cConstrainTransformInterval.I cConstrainTransformInterval.h
cConstrainPosInterval.I cConstrainPosInterval.h
cConstrainHprInterval.I cConstrainHprInterval.h
cConstrainPosHprInterval.I cConstrainPosHprInterval.h
cLerpInterval.I cLerpInterval.h
cLerpNodePathInterval.I cLerpNodePathInterval.h
cLerpAnimEffectInterval.I cLerpAnimEffectInterval.h
cMetaInterval.I cMetaInterval.h
hideInterval.I hideInterval.h
lerpblend.h
showInterval.I showInterval.h
waitInterval.I waitInterval.h
lerp_helpers.h)
set(P3INTERVAL_SOURCES
config_interval.cxx
cInterval.cxx
cIntervalManager.cxx
cConstraintInterval.cxx
cConstrainTransformInterval.cxx
cConstrainPosInterval.cxx
cConstrainHprInterval.cxx
cConstrainPosHprInterval.cxx
cLerpInterval.cxx
cLerpNodePathInterval.cxx
cLerpAnimEffectInterval.cxx
cMetaInterval.cxx
hideInterval.cxx
lerpblend.cxx
showInterval.cxx
waitInterval.cxx)
composite_sources(p3interval P3INTERVAL_SOURCES)
add_library(p3interval ${P3INTERVAL_HEADERS} ${P3INTERVAL_SOURCES})
target_link_libraries(p3interval p3directbase p3pstatclient p3pgraph p3chan p3dconfig p3prc)
target_interrogate(p3interval ALL)

View File

@ -0,0 +1,3 @@
add_library(p3showbase showBase.cxx showBase.h)
target_link_libraries(p3showbase p3directbase p3express p3event p3chan p3display p3dconfig p3prc)
target_interrogate(p3showbase ALL)

View File

@ -62,4 +62,6 @@ set(P3DTOOLBASE_SOURCES
composite_sources(p3dtoolbase P3DTOOLBASE_SOURCES)
add_library(p3dtoolbase ${P3DTOOLBASE_HEADERS} ${P3DTOOLBASE_SOURCES})
if(HAVE_PYTHON)
target_link_libraries(p3dtoolbase ${PYTHON_LIBRARIES})
endif()

View File

@ -52,3 +52,6 @@ composite_sources(p3dtoolutil P3DTOOLUTIL_SOURCES)
add_library(p3dtoolutil ${P3DTOOLUTIL_HEADERS} ${P3DTOOLUTIL_SOURCES})
target_link_libraries(p3dtoolutil p3dtoolbase ${CMAKE_DL_LIBS})
if(HAVE_PYTHON)
target_link_libraries(p3dtoolutil ${PYTHON_LIBRARIES})
endif()

View File

@ -56,6 +56,8 @@ add_subdirectory(src/tform)
add_subdirectory(src/pgui)
add_subdirectory(src/recorder)
add_subdirectory(src/collide)
add_subdirectory(src/nativenet)
add_subdirectory(src/net)
add_subdirectory(src/egg)
add_subdirectory(src/egg2pg)
add_subdirectory(src/framework)

View File

@ -0,0 +1,30 @@
if(WANT_NATIVE_NET)
set(P3NATIVENET_HEADERS
buffered_datagramconnection.h
buffered_datagramreader.h buffered_datagramreader.i
ringbuffer.h ringbuffer.i socket_ip.h
socket_tcp_listen.h time_accumulator.h time_out.h
socket_address.h
socket_portable.h time_base.h time_span.h buffered_datagramwriter.h
socket_base.h socket_selector.h
socket_udp.h
socket_udp_incoming.h time_clock.h
membuffer.h membuffer.i socket_fdset.h socket_tcp.h
socket_udp_outgoing.h time_general.h)
set(P3NATIVENET_SOURCES
config_nativenet.cxx
buffered_datagramconnection.cxx
socket_ip.cxx
socket_tcp.cxx
socket_tcp_listen.cxx
socket_tcp_ssl.cxx
socket_udp.cxx
socket_udp_incoming.cxx
socket_udp_outgoing.cxx)
composite_sources(p3nativenet P3NATIVENET_SOURCES)
add_library(p3nativenet ${P3NATIVENET_HEADERS} ${P3NATIVENET_SOURCES})
target_link_libraries(p3nativenet p3express p3pandabase)
target_interrogate(p3nativenet ALL)
endif()

View File

@ -0,0 +1,32 @@
if(HAVE_NET AND WANT_NATIVE_NET)
set(P3NET_HEADERS
config_net.h connection.h connectionListener.h
connectionManager.N connectionManager.h
connectionReader.I connectionReader.h
connectionWriter.h datagramQueue.h
datagramTCPHeader.I datagramTCPHeader.h
datagramUDPHeader.I datagramUDPHeader.h
netAddress.h netDatagram.I netDatagram.h
datagramGeneratorNet.I datagramGeneratorNet.h
datagramSinkNet.I datagramSinkNet.h
queuedConnectionListener.I
queuedConnectionListener.h queuedConnectionManager.h
queuedConnectionReader.h recentConnectionReader.h
queuedReturn.h queuedReturn.I)
set(P3NET_SOURCES
config_net.cxx connection.cxx connectionListener.cxx
connectionManager.cxx connectionReader.cxx
connectionWriter.cxx datagramQueue.cxx datagramTCPHeader.cxx
datagramUDPHeader.cxx netAddress.cxx netDatagram.cxx
datagramGeneratorNet.cxx
datagramSinkNet.cxx
queuedConnectionListener.cxx
queuedConnectionManager.cxx queuedConnectionReader.cxx
recentConnectionReader.cxx)
composite_sources(p3net P3NET_SOURCES)
add_library(p3net ${P3NET_HEADERS} ${P3NET_SOURCES})
target_link_libraries(p3net p3express p3downloader p3pandabase p3nativenet p3pipeline)
target_interrogate(p3net ALL)
endif()