diff --git a/CMakeLists.txt b/CMakeLists.txt index 80561e21826..fccef3ea18e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,9 @@ include(Interrogate) # Defines target_interrogate AND add_python_module include_directories("${CMAKE_BINARY_DIR}/include") # 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) @@ -40,4 +41,6 @@ if(BUILD_PANDA) add_subdirectory(panda) endif() -add_subdirectory(direct) +if(BUILD_DIRECT) + add_subdirectory(direct) +endif() diff --git a/direct/CMakeLists.txt b/direct/CMakeLists.txt index 9bf1cbdb194..6fc755a522c 100644 --- a/direct/CMakeLists.txt +++ b/direct/CMakeLists.txt @@ -1,3 +1,7 @@ +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) diff --git a/direct/src/autorestart/CMakeLists.txt b/direct/src/autorestart/CMakeLists.txt index eef609e69cf..665e9be1c7e 100644 --- a/direct/src/autorestart/CMakeLists.txt +++ b/direct/src/autorestart/CMakeLists.txt @@ -1,4 +1,7 @@ -add_executable(autorestart autorestart.c) -set_target_properties(autorestart PROPERTIES COMPILE_DEFINITIONS WITHIN_PANDA) -target_link_libraries(autorestart p3dtool) -install(TARGETS autorestart DESTINATION bin) +if(UNIX) + add_executable(autorestart autorestart.c) + set_target_properties(autorestart PROPERTIES COMPILE_DEFINITIONS WITHIN_PANDA) + target_link_libraries(autorestart p3dtool) + + install(TARGETS autorestart DESTINATION bin) +endif() diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index 1a0c7ded181..6cbbfb7f4cd 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -40,6 +40,8 @@ add_subdirectory(src/glstuff) add_subdirectory(src/glgsg) add_subdirectory(src/x11display) add_subdirectory(src/glxdisplay) +add_subdirectory(src/windisplay) +add_subdirectory(src/wgldisplay) add_subdirectory(src/movies) add_subdirectory(src/audio) add_subdirectory(src/chan) @@ -66,7 +68,6 @@ add_subdirectory(metalibs/panda) add_subdirectory(metalibs/pandagl) add_subdirectory(metalibs/pandaegg) - # Now add the Python modules: set(CORE_MODULE_COMPONENTS p3chan p3char p3collide p3cull p3device p3dgraph p3display p3downloader diff --git a/panda/metalibs/pandagl/CMakeLists.txt b/panda/metalibs/pandagl/CMakeLists.txt index 2134f350ebb..a0e156358f6 100644 --- a/panda/metalibs/pandagl/CMakeLists.txt +++ b/panda/metalibs/pandagl/CMakeLists.txt @@ -11,7 +11,10 @@ if(HAVE_GL) set(PANDAGL_LINK_TARGETS p3glgsg) if(HAVE_GLX) - set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3glxdisplay) + list(APPEND PANDAGL_LINK_TARGETS p3glxdisplay) + endif() + if(HAVE_WGL) + list(APPEND PANDAGL_LINK_TARGETS p3wgldisplay) endif() diff --git a/panda/src/express/CMakeLists.txt b/panda/src/express/CMakeLists.txt index 631078215f6..ff7b47fe659 100644 --- a/panda/src/express/CMakeLists.txt +++ b/panda/src/express/CMakeLists.txt @@ -130,6 +130,10 @@ target_link_libraries(p3express p3pandabase p3dtool p3dtoolconfig ${_TAR_LIBRARY}) target_interrogate(p3express ALL) +if(WIN32) + target_link_libraries(p3express advapi32.lib ws2_32.lib) +endif() + install(TARGETS p3express DESTINATION lib) #add_executable(p3expressTestTypes test_types.cxx) diff --git a/panda/src/wgldisplay/CMakeLists.txt b/panda/src/wgldisplay/CMakeLists.txt new file mode 100644 index 00000000000..f6e83b06af6 --- /dev/null +++ b/panda/src/wgldisplay/CMakeLists.txt @@ -0,0 +1,21 @@ +if(HAVE_WGL) + set(P3WGLDISPLAY_HEADERS + config_wgldisplay.h + wglGraphicsBuffer.I wglGraphicsBuffer.h + wglGraphicsPipe.I wglGraphicsPipe.h + wglGraphicsStateGuardian.I wglGraphicsStateGuardian.h + wglGraphicsWindow.I wglGraphicsWindow.h + wglext.h) + + set(P3WGLDISPLAY_SOURCES + config_wgldisplay.cxx + wglGraphicsBuffer.cxx + wglGraphicsPipe.cxx + wglGraphicsStateGuardian.cxx + wglGraphicsWindow.cxx) + + + composite_sources(p3wgldisplay P3WGLDISPLAY_SOURCES) + add_library(p3wgldisplay ${P3WGLDISPLAY_HEADERS} ${P3WGLDISPLAY_SOURCES}) + target_link_libraries(p3wgldisplay p3display p3putil p3windisplay p3glgsg) +endif() diff --git a/panda/src/windisplay/CMakeLists.txt b/panda/src/windisplay/CMakeLists.txt new file mode 100644 index 00000000000..3d07b6f9a93 --- /dev/null +++ b/panda/src/windisplay/CMakeLists.txt @@ -0,0 +1,17 @@ +if(WIN32) + set(P3WINDISPLAY_HEADERS + config_windisplay.h + winGraphicsPipe.I winGraphicsPipe.h + winGraphicsWindow.I winGraphicsWindow.h + winDetectDx.h) + + set(P3WINDISPLAY_SOURCES + config_windisplay.cxx winGraphicsPipe.cxx + winGraphicsWindow.cxx + winDetectDx9.cxx winDetectDx8.cxx) + + composite_sources(p3windisplay P3WINDISPLAY_SOURCES) + add_library(p3windisplay ${P3WINDISPLAY_HEADERS} ${P3WINDISPLAY_SOURCES}) + target_link_libraries(p3windisplay p3display p3putil + Coreimm.lib) +endif()