From a8cde9f6f155df5238b11b5fde990fd97a025bc7 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 13 Dec 2013 16:35:16 +0100 Subject: [PATCH] Use a custom target for bison as the built-in one is ill-equipped for our purposes. Also, add pandabase. --- CMakeLists.txt | 3 +++ dtool/Configure.cmake | 1 - dtool/src/cppparser/CMakeLists.txt | 22 +++++++++++++++++----- panda/CMakeLists.txt | 2 ++ panda/src/pandabase/CMakeLists.txt | 14 ++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 panda/CMakeLists.txt create mode 100644 panda/src/pandabase/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f5b0056b..14e3da0ba6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,9 @@ set(P3D_COREAPI_VERSION ${P3D_PLUGIN_VERSION} 1) ## Set CMake Find Module path ## set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") +## This is where dtool_config.h gets generated ## +include_directories("${CMAKE_BINARY_DIR}/include") ## Include Panda3D Packages ## add_subdirectory(dtool) +add_subdirectory(panda) diff --git a/dtool/Configure.cmake b/dtool/Configure.cmake index b1742ba6d6..72bb43a358 100644 --- a/dtool/Configure.cmake +++ b/dtool/Configure.cmake @@ -424,4 +424,3 @@ else() endif() configure_file(dtool_config.h.cmake ${CMAKE_BINARY_DIR}/include/dtool_config.h) -include_directories("${CMAKE_BINARY_DIR}/include") diff --git a/dtool/src/cppparser/CMakeLists.txt b/dtool/src/cppparser/CMakeLists.txt index 1d3d2e23c3..c7970491a1 100644 --- a/dtool/src/cppparser/CMakeLists.txt +++ b/dtool/src/cppparser/CMakeLists.txt @@ -47,11 +47,23 @@ if(NOT HAVE_BISON) endif() endif() -bison_target(cppParser - cppBison.yxx - ${CMAKE_CURRENT_BINARY_DIR}/cppBison.cxx - COMPILE_FLAGS --defines=${CMAKE_CURRENT_BINARY_DIR}/cppBison.h -) +# TODO: we should move this to a global macro somewhere. +if(BISON_FOUND) + add_custom_command( + OUTPUT cppBison.h cppBison.cxx + COMMAND ${BISON_EXECUTABLE} + --defines=cppBison.h -o cppBison.cxx -p cppyy + "${CMAKE_CURRENT_SOURCE_DIR}/cppBison.yxx" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cppBison.yxx" + ) +else() + add_custom_command( + OUTPUT cppBison.h cppBison.cxx + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cppBison.h.prebuilt" cppBison.h + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cppBison.cxx.prebuilt" cppBison.cxx + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cppBison.h.prebuilt" "${CMAKE_CURRENT_SOURCE_DIR}/cppBison.cxx.prebuilt" + ) +endif() include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_LIST_DIR}) diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt new file mode 100644 index 0000000000..f07f3367dc --- /dev/null +++ b/panda/CMakeLists.txt @@ -0,0 +1,2 @@ +## Include panda subpackages ## +add_subdirectory(src/pandabase) diff --git a/panda/src/pandabase/CMakeLists.txt b/panda/src/pandabase/CMakeLists.txt new file mode 100644 index 0000000000..25f065b222 --- /dev/null +++ b/panda/src/pandabase/CMakeLists.txt @@ -0,0 +1,14 @@ +include_directories(../../../dtool/src/dtoolbase) + +set(P3PANDABASE_HEADERS + pandabase.h pandasymbols.h +) + +set(P3PANDABASE_SOURCES + pandabase.cxx +) + +add_library(p3pandabase STATIC + ${P3PANDABASE_HEADERS} + ${P3PANDABASE_SOURCES} +)