Browse Source

add pandaVersion.h, checkPandaVersion.h, and PandaSystem

David Rose 21 years ago
parent
commit
d347a6be8e

+ 6 - 0
direct/src/extensions/PandaSystem-extensions.py

@@ -0,0 +1,6 @@
+
+    def getSystems(self):
+        l = []
+        for i in range(self.getNumSystems()):
+            l.append(self.getSystem(l))
+        return l

+ 9 - 2
dtool/Package.pp

@@ -17,10 +17,17 @@
   #error You need at least ppremake version 1.11 to process this tree.
   #error You need at least ppremake version 1.11 to process this tree.
 #endif
 #endif
 
 
-// What is the name and version of this source tree?
+// Get the current version info for Panda.
+#include $[THISDIRPREFIX]PandaVersion.pp
+#defer PANDA_MAJOR_VERSION $[word 1,$[PANDA_VERSION]]
+#defer PANDA_MINOR_VERSION $[word 2,$[PANDA_VERSION]]
+#defer PANDA_SEQUENCE_VERSION $[word 3,$[PANDA_VERSION]]
+#defer PANDA_VERSION_STR $[PANDA_MAJOR_VERSION].$[PANDA_MINOR_VERSION].$[PANDA_SEQUENCE_VERSION]$[if $[not $[OFFICIAL_VERSION]],c]
+#defer PANDA_VERSION_SYMBOL panda_version_$[PANDA_MAJOR_VERSION]_$[PANDA_MINOR_VERSION]_$[PANDA_SEQUENCE_VERSION]$[if $[not $[OFFICIAL_VERSION]],c]
+
+// What is the name of this source tree?
 #if $[eq $[PACKAGE],]
 #if $[eq $[PACKAGE],]
   #define PACKAGE dtool
   #define PACKAGE dtool
-  #define VERSION 0.80
 #endif
 #endif
 
 
 // Where should we install DTOOL, specifically?
 // Where should we install DTOOL, specifically?

+ 20 - 0
dtool/PandaVersion.pp

@@ -0,0 +1,20 @@
+// This file defines the current version number for Panda.  It is read
+// by Package.pp, which puts it in the global namespace for all
+// ppremake scripts for Panda.
+
+// Use spaces to separate the major, minor, and sequence numbers here.
+#define PANDA_VERSION 1 0 0
+
+// This variable will be defined to false in the CVS repository, but
+// scripts that generate source tarballs and/or binary releases for
+// distribution, by checking out Panda from an official CVS tag,
+// should explictly set this to true.  When false, it indicates that
+// the current version of Panda was checked out from CVS, so it may
+// not be a complete representation of the indicated version.
+#define PANDA_OFFICIAL_VERSION
+
+// This string is reported verbatim by PandaSystem::get_distributor().
+// It should be set by whoever provides a particular distribution of
+// Panda.  If you build your own Panda, leave this unchanged.
+#define PANDA_DISTRIBUTOR homebuilt
+

+ 1 - 0
dtool/Sources.pp

@@ -4,3 +4,4 @@
 #define DIR_TYPE toplevel
 #define DIR_TYPE toplevel
 
 
 #define CONFIG_HEADER dtool_config.h
 #define CONFIG_HEADER dtool_config.h
+#define EXTRA_PPREMAKE_SOURCE PandaVersion.pp

+ 5 - 1
dtool/pptempl/Template.gmsvc.pp

@@ -911,7 +911,7 @@ $[TAB] $[COMMAND]
 
 
 
 
 // Finally, the rules to freshen the Makefile itself.
 // Finally, the rules to freshen the Makefile itself.
-Makefile : $[SOURCE_FILENAME]
+Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]
 $[TAB] ppremake
 $[TAB] ppremake
 
 
 #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
 #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
@@ -1052,6 +1052,10 @@ $[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER]
 $[TAB] cp -f $[local] $[dest]/
 $[TAB] cp -f $[local] $[dest]/
 #endif
 #endif
 
 
+// Finally, the rules to freshen the Makefile itself.
+Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]
+$[TAB] ppremake
+
 #end Makefile
 #end Makefile
 
 
 // If there is a file called LocalSetup.pp in the package's top
 // If there is a file called LocalSetup.pp in the package's top

+ 5 - 1
dtool/pptempl/Template.nmake.pp

@@ -933,7 +933,7 @@ $[TAB] $[COMMAND]
 
 
 
 
 // Finally, the rules to freshen the Makefile itself.
 // Finally, the rules to freshen the Makefile itself.
-Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME]]
+Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]]
 $[TAB] ppremake
 $[TAB] ppremake
 
 
 #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
 #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
@@ -1075,6 +1075,10 @@ $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] : $[patsubst %,$[osfilenam
 $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
 $[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]]
 #endif
 #endif
 
 
+// Finally, the rules to freshen the Makefile itself.
+Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]]
+$[TAB] ppremake
+
 #end Makefile
 #end Makefile
 
 
 // If there is a file called LocalSetup.pp in the package's top
 // If there is a file called LocalSetup.pp in the package's top

+ 5 - 1
dtool/pptempl/Template.unix.pp

@@ -751,7 +751,7 @@ $[TAB] $[COMMAND]
 
 
 
 
 // Finally, the rules to freshen the Makefile itself.
 // Finally, the rules to freshen the Makefile itself.
-Makefile : $[SOURCE_FILENAME]
+Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]
 $[TAB] ppremake
 $[TAB] ppremake
 
 
 #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
 #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]]
@@ -892,6 +892,10 @@ $[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER]
 $[TAB] $[INSTALL]
 $[TAB] $[INSTALL]
 #endif
 #endif
 
 
+// Finally, the rules to freshen the Makefile itself.
+Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]
+$[TAB] ppremake
+
 #end Makefile
 #end Makefile
 
 
 // If there is a file called LocalSetup.pp in the package's top
 // If there is a file called LocalSetup.pp in the package's top

+ 16 - 7
dtool/src/dtoolutil/Sources.pp

@@ -6,19 +6,27 @@
   #define COMBINED_SOURCES $[TARGET]_composite1.cxx  $[TARGET]_composite2.cxx
   #define COMBINED_SOURCES $[TARGET]_composite1.cxx  $[TARGET]_composite2.cxx
   
   
   #define SOURCES \
   #define SOURCES \
-     executionEnvironment.I executionEnvironment.h filename.I  \
-     filename.h load_dso.h dSearchPath.I dSearchPath.h pfstream.h  \
-     vector_string.h gnu_getopt.c gnu_getopt.h gnu_getopt1.c  \
-     pfstreamBuf.h vector_src.h 
+    checkPandaVersion.h \
+    executionEnvironment.I executionEnvironment.h filename.I  \
+    filename.h load_dso.h dSearchPath.I dSearchPath.h \
+    pandaSystem.h pandaVersion.h \
+    pfstream.h  \
+    vector_string.h gnu_getopt.c gnu_getopt.h gnu_getopt1.c  \
+    pfstreamBuf.h vector_src.h 
 
 
   #define INCLUDED_SOURCES \
   #define INCLUDED_SOURCES \
-     executionEnvironment.cxx filename.cxx load_dso.cxx  \
-     dSearchPath.cxx vector_string.cxx \
-     pfstreamBuf.cxx pfstream.cxx 
+    checkPandaVersion.cxx \
+    executionEnvironment.cxx filename.cxx load_dso.cxx  \
+    dSearchPath.cxx \
+    pandaSystem.cxx \
+    pfstreamBuf.cxx pfstream.cxx \
+    vector_string.cxx
 
 
   #define INSTALL_HEADERS \
   #define INSTALL_HEADERS \
+    checkPandaVersion.h \
     executionEnvironment.I executionEnvironment.h filename.I    \
     executionEnvironment.I executionEnvironment.h filename.I    \
     filename.h load_dso.h dSearchPath.I dSearchPath.h   \
     filename.h load_dso.h dSearchPath.I dSearchPath.h   \
+    pandaSystem.h pandaVersion.h \
     pfstream.h pfstream.I vector_string.h gnu_getopt.h \
     pfstream.h pfstream.I vector_string.h gnu_getopt.h \
     pfstreamBuf.h vector_src.cxx vector_src.h
     pfstreamBuf.h vector_src.cxx vector_src.h
 #end lib_target
 #end lib_target
@@ -37,3 +45,4 @@
   #define SOURCES test_touch.cxx
   #define SOURCES test_touch.cxx
 #end test_bin_target
 #end test_bin_target
 
 
+#include $[THISDIRPREFIX]pandaVersion.h.pp

+ 3 - 0
dtool/src/dtoolutil/dtoolutil_composite1.cxx

@@ -2,4 +2,7 @@
 #include "filename.cxx"
 #include "filename.cxx"
 #include "load_dso.cxx"
 #include "load_dso.cxx"
 #include "dSearchPath.cxx"
 #include "dSearchPath.cxx"
+#include "pandaSystem.cxx"
+#include "checkPandaVersion.cxx"
+
 
 

+ 277 - 0
dtool/src/dtoolutil/pandaSystem.cxx

@@ -0,0 +1,277 @@
+// Filename: pandaSystem.cxx
+// Created by:  drose (26Jan05)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "pandaSystem.h"
+#include "pandaVersion.h"
+
+PandaSystem *PandaSystem::_global_ptr = NULL;
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::Constructor
+//       Access: Protected
+//  Description: Don't try to construct a PandaSystem object; there is
+//               only one of these, and it constructs itself.  Use
+//               get_global_ptr() to get a pointer to the one
+//               PandaSystem.
+////////////////////////////////////////////////////////////////////
+PandaSystem::
+PandaSystem() {
+  _system_names_dirty = false;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::Destructor
+//       Access: Protected
+//  Description: Don't try to destruct the global PandaSystem object.
+////////////////////////////////////////////////////////////////////
+PandaSystem::
+~PandaSystem() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_version_string
+//       Access: Published, Static
+//  Description: Returns the current version of Panda, expressed as a
+//               string, e.g. "1.0.0".  The string will end in the
+//               letter "c" if this build does not represent an
+//               official version.
+////////////////////////////////////////////////////////////////////
+string PandaSystem::
+get_version_string() {
+  return PANDA_VERSION_STR;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_major_version
+//       Access: Published, Static
+//  Description: Returns the major version number of the current
+//               version of Panda.  This is the first number of the
+//               dotted triple returned by get_version_string().  It
+//               changes very rarely.
+////////////////////////////////////////////////////////////////////
+int PandaSystem::
+get_major_version() {
+  return PANDA_MAJOR_VERSION;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_minor_version
+//       Access: Published, Static
+//  Description: Returns the minor version number of the current
+//               version of Panda.  This is the second number of the
+//               dotted triple returned by get_version_string().  It
+//               changes with each release that introduces new
+//               features.
+////////////////////////////////////////////////////////////////////
+int PandaSystem::
+get_minor_version() {
+  return PANDA_MINOR_VERSION;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_sequence_version
+//       Access: Published, Static
+//  Description: Returns the sequence version number of the current
+//               version of Panda.  This is the third number of the
+//               dotted triple returned by get_version_string().  It
+//               changes with bugfix updates and very minor feature
+//               updates.
+////////////////////////////////////////////////////////////////////
+int PandaSystem::
+get_sequence_version() {
+  return PANDA_SEQUENCE_VERSION;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::is_official_version
+//       Access: Published, Static
+//  Description: Returns true if current version of Panda claims to be
+//               an "official" version, that is, one that was compiled
+//               by an official distributor of Panda using a specific
+//               version of the panda source tree.  If this is true,
+//               there will not be a "c" at the end of the version
+//               string returned by get_version_string().
+//
+//               Note that we must take the distributor's word for it
+//               here.
+////////////////////////////////////////////////////////////////////
+bool PandaSystem::
+is_official_version() {
+#ifdef PANDA_OFFICIAL_VERSION
+  return true;
+#else
+  return false;
+#endif
+}
+  
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_distributor
+//       Access: Published, Static
+//  Description: Returns the string defined by the distributor of this
+//               version of Panda, or "homebuilt" if this version was
+//               built directly from the sources by the end-user.
+//               This is a completely arbitrary string.
+////////////////////////////////////////////////////////////////////
+string PandaSystem::
+get_distributor() {
+  return PANDA_DISTRIBUTOR;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::has_system
+//       Access: Published
+//  Description: Returns true if the current version of Panda claims
+//               to have the indicated subsystem installed, false
+//               otherwise.  The set of available subsystems is
+//               implementation defined.
+////////////////////////////////////////////////////////////////////
+bool PandaSystem::
+has_system(const string &system) const {
+  Systems::const_iterator si;
+  si = _systems.find(system);
+  return (si != _systems.end());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_num_systems
+//       Access: Published
+//  Description: Returns the number of Panda subsystems that have
+//               registered themselves.  This can be used with
+//               get_system() to iterate through the entire list of
+//               available Panda subsystems.
+////////////////////////////////////////////////////////////////////
+int PandaSystem::
+get_num_systems() const {
+  return _systems.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_system
+//       Access: Published
+//  Description: Returns the nth Panda subsystem that has registered
+//               itself.  This list will be sorted in alphabetical
+//               order.
+////////////////////////////////////////////////////////////////////
+string PandaSystem::
+get_system(int n) const {
+  if (n < 0 || n >= (int)_system_names.size()) {
+    return string();
+  }
+
+  if (_system_names_dirty) {
+    ((PandaSystem *)this)->reset_system_names();
+  }
+
+  return _system_names[n];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_system_tag
+//       Access: Published
+//  Description: Returns the value associated with the indicated tag
+//               for the given system.  This provides a standard way
+//               to query each subsystem's advertised capabilities.
+//               The set of tags and values are per-system and
+//               implementation-defined.
+//
+//               The return value is the empty string if the indicated
+//               system is undefined or if does not define the
+//               indicated tag.
+////////////////////////////////////////////////////////////////////
+string PandaSystem::
+get_system_tag(const string &system, const string &tag) const {
+  Systems::const_iterator si;
+  si = _systems.find(system);
+  if (si != _systems.end()) {
+    const SystemTags &tags = (*si).second;
+    SystemTags::const_iterator ti;
+    ti = tags.find(tag);
+    if (ti != tags.end()) {
+      return (*ti).second;
+    }
+  }
+
+  return string();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::add_system
+//       Access: Published
+//  Description: Intended for use by each subsystem to register itself
+//               at startup.
+////////////////////////////////////////////////////////////////////
+void PandaSystem::
+add_system(const string &system) {
+  bool inserted = _systems.insert(Systems::value_type(system, SystemTags())).second;
+  if (inserted) {
+    _system_names_dirty = true;
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::set_system_tag
+//       Access: Published
+//  Description: Intended for use by each subsystem to register its
+//               set of capabilities at startup.
+////////////////////////////////////////////////////////////////////
+void PandaSystem::
+set_system_tag(const string &system, const string &tag,
+               const string &value) {
+  pair<Systems::iterator, bool> result;
+  result = _systems.insert(Systems::value_type(system, SystemTags()));
+  if (result.second) {
+    _system_names_dirty = true;
+  }
+
+  SystemTags &tags = (*result.first).second;
+  tags[tag] = value;
+}
+  
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::get_global_ptr
+//       Access: Published, Static
+//  Description: Returns the global PandaSystem object.
+////////////////////////////////////////////////////////////////////
+PandaSystem *PandaSystem::
+get_global_ptr() {
+  if (_global_ptr == (PandaSystem *)NULL) {
+    _global_ptr = new PandaSystem;
+  }
+
+  return _global_ptr;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PandaSystem::reset_system_names
+//       Access: Private
+//  Description: Refills the _system_names vector, which is used for
+//               get_system_name(), from the current set of available
+//               system names.
+////////////////////////////////////////////////////////////////////
+void PandaSystem::
+reset_system_names() {
+  _system_names.clear();
+  _system_names.reserve(_systems.size());
+  
+  Systems::const_iterator si;
+  for (si = _systems.begin(); si != _systems.end(); ++si) {
+    _system_names.push_back((*si).first);
+  }
+  
+  _system_names_dirty = false;
+}

+ 75 - 0
dtool/src/dtoolutil/pandaSystem.h

@@ -0,0 +1,75 @@
+// Filename: pandaSystem.h
+// Created by:  drose (26Jan05)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://etc.cmu.edu/panda3d/docs/license/ .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef PANDASYSTEM_H
+#define PANDASYSTEM_H
+
+#include "dtoolbase.h"
+#include "pmap.h"
+
+////////////////////////////////////////////////////////////////////
+//       Class : PandaSystem
+// Description : This class is used as a namespace to group several
+//               global properties of Panda.  Application developers
+//               can use this class to query the runtime version or
+//               capabilities of the current Panda environment.
+////////////////////////////////////////////////////////////////////
+class EXPCL_DTOOL PandaSystem {
+protected:
+  PandaSystem();
+  ~PandaSystem();
+
+PUBLISHED:
+  static string get_version_string();
+
+  static int get_major_version();
+  static int get_minor_version();
+  static int get_sequence_version();
+  static bool is_official_version();
+  
+  static string get_distributor();
+
+  bool has_system(const string &system) const;
+  int get_num_systems() const;
+  string get_system(int n) const;
+
+  string get_system_tag(const string &system, const string &tag) const;
+
+  void add_system(const string &system);
+  void set_system_tag(const string &system, const string &tag,
+                      const string &value);
+
+  static PandaSystem *get_global_ptr();
+
+private:
+  void reset_system_names();
+
+  typedef pmap<string, string> SystemTags;
+  typedef pmap<string, SystemTags> Systems;
+  typedef pvector<string> SystemNames;
+
+  Systems _systems;
+  SystemNames _system_names;
+  bool _system_names_dirty;
+
+  static PandaSystem *_global_ptr;
+};
+
+#endif
+
+  

+ 146 - 0
dtool/src/dtoolutil/pandaVersion.h.pp

@@ -0,0 +1,146 @@
+//
+// pandaVersion.h.pp
+//
+// This file defines the script to auto-generate pandaVersion.h at
+// ppremake time.
+//
+
+#output pandaVersion.h notouch
+/* Filename: pandaVersion.h
+ * Created by:  drose (26Jan05)
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * PANDA 3D SOFTWARE
+ * Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+ *
+ * All use of this software is subject to the terms of the Panda 3d
+ * Software license.  You should have received a copy of this license
+ * along with this source code; you will also find a current copy of
+ * the license at http://etc.cmu.edu/panda3d/docs/license/ .
+ *
+ * To contact the maintainers of this program write to
+ * [email protected] .
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*******************************************************************
+ *  Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]].
+ ***************************** DO NOT EDIT *************************
+
+   Do NOT attempt to edit the version number in this file.  This is a
+   generated file, and your changes to this file will not persist.  To
+   increment the version number, modify dtool/PandaVersion.pp and
+   re-run ppremake.
+
+ ***************************** DO NOT EDIT *************************/
+
+/* Include this file anywhere you need to determine the Panda version
+   number at compile time.  If you need the runtime Panda version, use
+   pandaSystem.h instead. */
+
+/* Try to avoid including this file from another .h file; include it
+   only from .cxx instead.  This helps prevent unnecessarily long
+   rebuilds just because the version number changes; if this file is
+   included in a .h file, then any other files which also include that
+   .h file will need to be rebuilt when the version number changes. */
+
+$[cdefine PANDA_MAJOR_VERSION]
+$[cdefine PANDA_MINOR_VERSION]
+$[cdefine PANDA_SEQUENCE_VERSION]
+
+/* Define if this is an "official" version, undefine otherwise. */
+$[cdefine PANDA_OFFICIAL_VERSION]
+
+/* This is the panda numeric version as a single number, with three
+   digits reserved for each component. */
+# define PANDA_VERSION $[+ $[* $[PANDA_MAJOR_VERSION],1000000],$[* $[PANDA_MINOR_VERSION],1000],$[PANDA_SEQUENCE_VERSION]]
+
+/* This is the panda version expressed as a string.  It ends in the
+   letter "c" if this is not an "official" version (e.g. it was checked
+   out from CVS by the builder). */
+# define PANDA_VERSION_STR "$[PANDA_VERSION_STR]"
+
+/* This is a string indicating who has provided this distribution. */
+# define PANDA_DISTRIBUTOR "$[PANDA_DISTRIBUTOR]"
+
+#end pandaVersion.h
+
+
+// Let's also define checkPandaVersion.h and checkPandaVersion.cxx here.
+
+#output checkPandaVersion.h notouch
+/* Filename: checkPandaVersion.h
+ * Created by:  drose (26Jan05)
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * PANDA 3D SOFTWARE
+ * Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+ *
+ * All use of this software is subject to the terms of the Panda 3d
+ * Software license.  You should have received a copy of this license
+ * along with this source code; you will also find a current copy of
+ * the license at http://etc.cmu.edu/panda3d/docs/license/ .
+ *
+ * To contact the maintainers of this program write to
+ * [email protected] .
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*******************************************************************
+ *  Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]].
+ ***************************** DO NOT EDIT *************************/
+
+/* Include this file in code that compiles with Panda to guarantee
+   that it is linking with the same version of the Panda DLL's that it
+   was compiled with.  You should include it in one .cxx file only. */
+
+/* We guarantee this by defining an external symbol which is based on
+   the version number.  If that symbol is defined, then our DLL's
+   (probably) match.  Otherwise, we must be running with the wrong
+   DLL; but the system linker will prevent the DLL from loading with
+   an undefined symbol. */
+
+# include "dtoolbase.h"
+
+extern EXPCL_DTOOL int $[PANDA_VERSION_SYMBOL];
+
+# ifndef WIN32
+/* For Windows, exporting the symbol from the DLL is sufficient; the
+   DLL will not load unless all expected public symbols are defined.
+   Other systems may not mind if the symbol is absent unless we
+   explictly write code that references it. */
+static int check_panda_version = $[PANDA_VERSION_SYMBOL];
+# endif
+
+#end checkPandaVersion.h
+
+#output checkPandaVersion.cxx notouch
+/* Filename: checkPandaVersion.cxx
+ * Created by:  drose (26Jan05)
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * PANDA 3D SOFTWARE
+ * Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
+ *
+ * All use of this software is subject to the terms of the Panda 3d
+ * Software license.  You should have received a copy of this license
+ * along with this source code; you will also find a current copy of
+ * the license at http://etc.cmu.edu/panda3d/docs/license/ .
+ *
+ * To contact the maintainers of this program write to
+ * [email protected] .
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*******************************************************************
+ *  Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]].
+ ***************************** DO NOT EDIT *************************/
+
+# include "dtoolbase.h"
+
+EXPCL_DTOOL int $[PANDA_VERSION_SYMBOL] = 0;
+
+#end checkPandaVersion.cxx

+ 6 - 0
panda/metalibs/panda/panda.cxx

@@ -25,6 +25,12 @@
 #include "config_particlesystem.h"
 #include "config_particlesystem.h"
 #endif
 #endif
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpanda.so/.dll will fail if they inadvertently
+// link with the wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpanda
 //     Function: init_libpanda
 //  Description: Initializes the library.  This must be called at
 //  Description: Initializes the library.  This must be called at

+ 0 - 27
panda/metalibs/pandacr/pandacr.cxx

@@ -1,27 +0,0 @@
-// Filename: pandacr.cxx
-// Created by:  skyler, baseed on pandagl
-// 
-////////////////////////////////////////////////////////////////////
-
-#include "pandacr.h"
-
-#include <config_crgsg.h>
-#ifdef HAVE_WCR
-#include <config_wcrdisplay.h>
-#endif
-
-////////////////////////////////////////////////////////////////////
-//     Function: init_libpandacr
-//  Description: Initializes the library.  This must be called at
-//               least once before any of the functions or classes in
-//               this library can be used.  Normally it will be
-//               called by the static initializers and need not be
-//               called explicitly, but special cases exist.
-////////////////////////////////////////////////////////////////////
-void
-init_libpandacr() {
-  init_libcrgsg();
-#ifdef HAVE_WCR
-  init_libwcrdisplay();
-#endif
-}

+ 0 - 14
panda/metalibs/pandacr/pandacr.h

@@ -1,14 +0,0 @@
-// Filename: pandacr.h
-// Created by:  skyler, baseed on pandagl
-// 
-////////////////////////////////////////////////////////////////////
-
-#ifndef PANDACR_H
-#define PANDACR_H
-
-#include "pandabase.h"
-
-EXPCL_PANDACR void init_libpandacr();
-
-#endif
-

+ 6 - 0
panda/metalibs/pandadx8/pandadx8.cxx

@@ -7,6 +7,12 @@
 
 
 #include "config_dxgsg8.h"
 #include "config_dxgsg8.h"
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpandadx8.dll will fail if they
+// inadvertently link with the wrong version of libdtool.dll.
+
+#include "checkPandaVersion.h"
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpandadx
 //     Function: init_libpandadx
 //  Description: Initializes the library.  This must be called at
 //  Description: Initializes the library.  This must be called at

+ 6 - 0
panda/metalibs/pandadx9/pandadx9.cxx

@@ -7,6 +7,12 @@
 
 
 #include "config_dxgsg9.h"
 #include "config_dxgsg9.h"
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpandadx8.dll will fail if they
+// inadvertently link with the wrong version of libdtool.dll.
+
+#include "checkPandaVersion.h"
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpandadx
 //     Function: init_libpandadx
 //  Description: Initializes the library.  This must be called at
 //  Description: Initializes the library.  This must be called at

+ 6 - 0
panda/metalibs/pandaegg/pandaegg.cxx

@@ -9,6 +9,12 @@
 #include "config_builder.h"
 #include "config_builder.h"
 #include "config_egg2pg.h"
 #include "config_egg2pg.h"
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpandaegg.so/.dll will fail if they
+// inadvertently link with the wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpandaegg
 //     Function: init_libpandaegg
 //  Description: Initializes the library.  This must be called at
 //  Description: Initializes the library.  This must be called at

+ 5 - 4
panda/metalibs/pandaexpress/pandaexpress.cxx

@@ -3,7 +3,8 @@
 // 
 // 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-// This is a dummy file whose sole purpose is to give the compiler
-// something to compile when making libpanda.so in NO_DEFER mode,
-// which generates an empty library that itself links with all the
-// other shared libraries that make up libpanda.
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpandaexpress.so/.dll will fail if they
+// inadvertently link with the wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"

+ 7 - 1
panda/metalibs/pandafx/pandafx.cxx

@@ -5,7 +5,13 @@
 
 
 #include "pandafx.h"
 #include "pandafx.h"
 
 
-#include <config_distort.h>
+#include "config_distort.h"
+
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpandafx.so/.dll will fail if they inadvertently
+// link with the wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpandafx
 //     Function: init_libpandafx

+ 6 - 0
panda/metalibs/pandagl/pandagl.cxx

@@ -15,6 +15,12 @@
 */
 */
 #endif
 #endif
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpandagl.so/.dll will fail if they inadvertently
+// link with the wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpandagl
 //     Function: init_libpandagl
 //  Description: Initializes the library.  This must be called at
 //  Description: Initializes the library.  This must be called at

+ 8 - 2
panda/metalibs/pandaphysics/pandaphysics.cxx

@@ -6,10 +6,16 @@
 #include "pandaphysics.h"
 #include "pandaphysics.h"
 
 
 #ifndef LINK_IN_PHYSICS
 #ifndef LINK_IN_PHYSICS
-#include <config_physics.h>
-#include <config_particlesystem.h>
+#include "config_physics.h"
+#include "config_particlesystem.h"
 #endif
 #endif
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libpandaphysics.so/.dll will fail if they
+// inadvertently link with the wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpandaphysics
 //     Function: init_libpandaphysics
 //  Description: Initializes the library.  This must be called at
 //  Description: Initializes the library.  This must be called at

+ 0 - 21
panda/metalibs/pandarib/Sources.pp

@@ -1,21 +0,0 @@
-#define BUILD_DIRECTORY $[HAVE_RIB]
-
-// DIR_TYPE "metalib" indicates we are building a shared library that
-// consists mostly of references to other shared libraries.  Under
-// Windows, this directly produces a DLL (as opposed to the regular
-// src libraries, which don't produce anything but a pile of OBJ files
-// under Windows).
-
-#define DIR_TYPE metalib
-#define BUILDING_DLL BUILDING_PANDARIB
-
-#define COMPONENT_LIBS \
-    ribgsg ribdisplay
-#define LOCAL_LIBS gsgbase display express
-#define OTHER_LIBS dtoolconfig dtool
-
-#begin metalib_target
-  #define TARGET pandarib
-
-  #define SOURCES pandarib.cxx
-#end metalib_target

+ 0 - 9
panda/metalibs/pandarib/pandarib.cxx

@@ -1,9 +0,0 @@
-// Filename: pandarib.cxx
-// Created by:  drose (15May00)
-// 
-////////////////////////////////////////////////////////////////////
-
-// This is a dummy file whose sole purpose is to give the compiler
-// something to compile when making libpandarib.so in NO_DEFER mode,
-// which generates an empty library that itself links with all the
-// other shared libraries that make up libpandarib.

+ 1 - 0
panda/src/express/config_express.N

@@ -1,3 +1,4 @@
+forcetype PandaSystem
 forcetype DSearchPath
 forcetype DSearchPath
 forcetype Filename
 forcetype Filename
 forcetype GlobPattern
 forcetype GlobPattern

+ 1 - 0
panda/src/express/config_express.h

@@ -26,6 +26,7 @@
 
 
 // We include these files to force them to be instrumented by
 // We include these files to force them to be instrumented by
 // interrogate.
 // interrogate.
+#include "pandaSystem.h"
 #include "globPattern.h"
 #include "globPattern.h"
 #include "configFlags.h"
 #include "configFlags.h"
 #include "configPage.h"
 #include "configPage.h"

+ 6 - 0
panda/src/framework/config_framework.cxx

@@ -21,6 +21,12 @@
 #include "dconfig.h"
 #include "dconfig.h"
 #include "windowFramework.h"
 #include "windowFramework.h"
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to load libframework.so/.dll will fail if they
+// inadvertently link with the wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"
+
 Configure(config_framework);
 Configure(config_framework);
 NotifyCategoryDef(framework, "");
 NotifyCategoryDef(framework, "");
 
 

+ 6 - 0
panda/src/testbed/pview.cxx

@@ -22,6 +22,12 @@
 #include "configVariableBool.h"
 #include "configVariableBool.h"
 #include "texturePool.h"
 #include "texturePool.h"
 
 
+// By including checkPandaVersion.h, we guarantee that runtime
+// attempts to run pview will fail if it inadvertently links with the
+// wrong version of libdtool.so/.dll.
+
+#include "checkPandaVersion.h"
+
 #ifndef HAVE_GETOPT
 #ifndef HAVE_GETOPT
   #include "gnu_getopt.h"
   #include "gnu_getopt.h"
 #else
 #else