Browse Source

CMake: Start basic cmake files; working on dtool first as example.

kestred 12 years ago
parent
commit
b73d724fed
3 changed files with 133 additions and 0 deletions
  1. 18 0
      CMakeLists.txt
  2. 41 0
      dtool/Package.cmake
  3. 74 0
      dtool/src/dtoolbase/Sources.cmake

+ 18 - 0
CMakeLists.txt

@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 2.8)
+project(Panda3D)
+
+## Panda Version Information ##
+set(PANDA_VERSION 1 9 0)
+set(PANDA_OFFICIAL_VERSION FALSE CACHE BOOL "If true, signifies this is a tagged release rather than a repository snapshot. Scripts that generate source tarballs and/or binary releases for distribution should explicitly set this to true.")
+set(PANDA_DISTRIBUTOR "homebuilt" CACHE STRING "This should be set by whoever provides a particular distribution of Panda. If you build your own Panda, leave this unchanged.")
+
+set(P3D_PLUGIN_VERSION 1 0 4)
+set(P3D_COREAPI_VERSION ${P3D_PLUGIN_VERSION} 1)
+
+
+## Set CMake Find<Foo> Module path ##
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
+
+
+## Include Panda3D Packages ##
+include(${CMAKE_SOURCE_DIR}/dtool/Package.cmake)

+ 41 - 0
dtool/Package.cmake

@@ -0,0 +1,41 @@
+## Parse Panda3D Subversions ##
+list(GET PANDA_VERSION 0 PANDA_MAJOR_VERSION)
+list(GET PANDA_VERSION 1 PANDA_MINOR_VERSION)
+list(GET PANDA_VERSION 2 PANDA_SEQUENCE_VERSION)
+
+string(REPLACE ";" "." PANDA_VERSION_STR "${PANDA_VERSION}")
+if(NOT PANDA_OFFICIAL_VERSION)
+	set(PANDA_VERSION_STR "${PANDA_VERSION_STR}c")
+endif()
+
+set(PANDA_VERSION_SYMBOL panda_version_${PANDA_MAJOR_VERSION}_${PANDA_MINOR_VERSION})
+
+math(EXPR PANDA_NUMERIC_VERSION "${PANDA_MAJOR_VERSION}*1000000 + ${PANDA_MINOR_VERSION}*1000 + ${PANDA_SEQUENCE_VERSION}")
+
+
+## Parse Plugin-framework Subversions ##
+list(GET P3D_PLUGIN_VERSION 0 P3D_PLUGIN_MAJOR_VERSION)
+list(GET P3D_PLUGIN_VERSION 1 P3D_PLUGIN_MINOR_VERSION)
+list(GET P3D_PLUGIN_VERSION 2 P3D_PLUGIN_SEQUENCE_VERSION)
+
+string(REPLACE ";" "." P3D_PLUGIN_VERSION_STR "${P3D_PLUGIN_VERSION}")
+if(PANDA_OFFICIAL_VERSION)
+	set(P3D_PLUGIN_DLL_DOT_VERSION "${P3D_PLUGIN_VERSION_STR}.1000")
+else()
+	set(P3D_PLUGIN_DLL_DOT_VERSION "${P3D_PLUGIN_VERSION_STR}.0")
+	set(P3D_PLUGIN_VERSION_STR "${P3D_PLUGIN_VERSION_STR}c")
+endif()
+string(REPLACE "." "," P3D_PLUGIN_DLL_COMMA_VERSION "${P3D_PLUGIN_DLL_DOT_VERSION}")
+
+
+## Installation Config ##
+set(INSTALL_DIR "/usr/local/panda" CACHE STRING "The directory in which to install Panda3D.")
+
+set(DTOOL_INSTALL "${INSTALL_DIR}" CACHE STRING "The directory in which to install the dtool package.")
+
+set(DEFAULT_PRC_DIR "${INSTALL_DIR}/etc" CACHE STRING "Panda uses prc files for runtime configuration. Panda will search the default .prc directory if the PRC_PATH and PRC_DIR environment variables are not defined.")
+
+
+## Include dtool subpackages ##
+include(${CMAKE_CURRENT_LIST_DIR}/Configure.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/src/dtoolbase/Sources.cmake)

+ 74 - 0
dtool/src/dtoolbase/Sources.cmake

@@ -0,0 +1,74 @@
+set(P3DTOOLBASE_HEADER_FILES
+    addHash.I addHash.h
+    atomicAdjust.h
+    atomicAdjustDummyImpl.h atomicAdjustDummyImpl.I
+    atomicAdjustI386Impl.h atomicAdjustI386Impl.I
+    atomicAdjustPosixImpl.h atomicAdjustPosixImpl.I
+    atomicAdjustWin32Impl.h atomicAdjustWin32Impl.I
+    cmath.I cmath.h
+    deletedBufferChain.h deletedBufferChain.I
+    deletedChain.h deletedChain.T
+    dtoolbase.h dtoolbase_cc.h dtoolsymbols.h
+    dtool_platform.h
+    fakestringstream.h
+    indent.I indent.h
+    memoryBase.h
+    memoryHook.h memoryHook.I
+    mutexImpl.h
+    mutexDummyImpl.h mutexDummyImpl.I
+    mutexPosixImpl.h mutexPosixImpl.I
+    mutexWin32Impl.h mutexWin32Impl.I
+    mutexSpinlockImpl.h mutexSpinlockImpl.I
+    nearly_zero.h
+    neverFreeMemory.h neverFreeMemory.I
+    numeric_types.h
+    pstrtod.h
+    register_type.I register_type.h
+    selectThreadImpl.h
+    stl_compares.I stl_compares.h
+    typeHandle.I typeHandle.h
+    typeRegistry.I typeRegistry.h
+    typeRegistryNode.I typeRegistryNode.h
+    typedObject.I typedObject.h
+    pallocator.T pallocator.h
+    pdeque.h plist.h pmap.h pset.h pvector.h
+    lookup3.h
+)
+
+set(P3DTOOLBASE_SOURCE_FILES
+    addHash.cxx
+    atomicAdjustDummyImpl.cxx
+    atomicAdjustI386Impl.cxx
+    atomicAdjustPosixImpl.cxx
+    atomicAdjustWin32Impl.cxx
+    deletedBufferChain.cxx
+    dtoolbase.cxx
+    indent.cxx
+    lookup3.c
+    memoryBase.cxx
+    memoryHook.cxx
+    mutexDummyImpl.cxx
+    mutexPosixImpl.cxx
+    mutexWin32Impl.cxx
+    mutexSpinlockImpl.cxx
+    neverFreeMemory.cxx
+    pstrtod.cxx
+    register_type.cxx
+    typeHandle.cxx
+    typeRegistry.cxx typeRegistryNode.cxx
+    typedObject.cxx
+)
+
+foreach(FILENAME IN LISTS P3DTOOLBASE_HEADER_FILES)
+	set(P3DTOOLBASE_INSTALL_HEADERS ${P3DTOOLBASE_INSTALL_HEADERS} ${CMAKE_CURRENT_LIST_DIR}/${FILENAME})
+endforeach()
+foreach(FILENAME IN LISTS P3DTOOLBASE_SOURCE_FILES)
+	set(P3DTOOLBASE_SOURCES ${P3DTOOLBASE_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/${FILENAME})
+endforeach()
+
+message("${P3DTOOLBASE_SOURCES}")
+
+add_library(p3dtoolbase
+	${P3DTOOLBASE_INSTALL_HEADERS}
+	${P3DTOOLBASE_SOURCES}
+)