From d347a6be8ecacc397c681b26183230bcdce03b53 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 26 Jan 2005 19:47:14 +0000 Subject: [PATCH] add pandaVersion.h, checkPandaVersion.h, and PandaSystem --- .../src/extensions/PandaSystem-extensions.py | 6 + dtool/Package.pp | 11 +- dtool/PandaVersion.pp | 20 ++ dtool/Sources.pp | 1 + dtool/pptempl/Template.gmsvc.pp | 6 +- dtool/pptempl/Template.nmake.pp | 6 +- dtool/pptempl/Template.unix.pp | 6 +- dtool/src/dtoolutil/Sources.pp | 23 +- dtool/src/dtoolutil/dtoolutil_composite1.cxx | 3 + dtool/src/dtoolutil/pandaSystem.cxx | 277 ++++++++++++++++++ dtool/src/dtoolutil/pandaSystem.h | 75 +++++ dtool/src/dtoolutil/pandaVersion.h.pp | 146 +++++++++ panda/metalibs/panda/panda.cxx | 6 + panda/metalibs/pandacr/pandacr.cxx | 27 -- panda/metalibs/pandacr/pandacr.h | 14 - panda/metalibs/pandadx8/pandadx8.cxx | 6 + panda/metalibs/pandadx9/pandadx9.cxx | 6 + panda/metalibs/pandaegg/pandaegg.cxx | 6 + panda/metalibs/pandaexpress/pandaexpress.cxx | 9 +- panda/metalibs/pandafx/pandafx.cxx | 8 +- panda/metalibs/pandagl/pandagl.cxx | 6 + panda/metalibs/pandaphysics/pandaphysics.cxx | 10 +- panda/metalibs/pandarib/Sources.pp | 21 -- panda/metalibs/pandarib/pandarib.cxx | 9 - panda/src/express/config_express.N | 1 + panda/src/express/config_express.h | 1 + panda/src/framework/config_framework.cxx | 6 + panda/src/testbed/pview.cxx | 6 + 28 files changed, 632 insertions(+), 90 deletions(-) create mode 100644 direct/src/extensions/PandaSystem-extensions.py create mode 100644 dtool/PandaVersion.pp create mode 100644 dtool/src/dtoolutil/pandaSystem.cxx create mode 100644 dtool/src/dtoolutil/pandaSystem.h create mode 100644 dtool/src/dtoolutil/pandaVersion.h.pp delete mode 100644 panda/metalibs/pandacr/pandacr.cxx delete mode 100644 panda/metalibs/pandacr/pandacr.h delete mode 100644 panda/metalibs/pandarib/Sources.pp delete mode 100644 panda/metalibs/pandarib/pandarib.cxx diff --git a/direct/src/extensions/PandaSystem-extensions.py b/direct/src/extensions/PandaSystem-extensions.py new file mode 100644 index 0000000000..ea55f63946 --- /dev/null +++ b/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 diff --git a/dtool/Package.pp b/dtool/Package.pp index 96c1fbd543..c07fd315f3 100644 --- a/dtool/Package.pp +++ b/dtool/Package.pp @@ -17,10 +17,17 @@ #error You need at least ppremake version 1.11 to process this tree. #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],] #define PACKAGE dtool - #define VERSION 0.80 #endif // Where should we install DTOOL, specifically? diff --git a/dtool/PandaVersion.pp b/dtool/PandaVersion.pp new file mode 100644 index 0000000000..1fa4a77701 --- /dev/null +++ b/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 + diff --git a/dtool/Sources.pp b/dtool/Sources.pp index 18c5b14cd9..ece3e4687f 100644 --- a/dtool/Sources.pp +++ b/dtool/Sources.pp @@ -4,3 +4,4 @@ #define DIR_TYPE toplevel #define CONFIG_HEADER dtool_config.h +#define EXTRA_PPREMAKE_SOURCE PandaVersion.pp diff --git a/dtool/pptempl/Template.gmsvc.pp b/dtool/pptempl/Template.gmsvc.pp index 6fb3f1f123..e1c525969c 100644 --- a/dtool/pptempl/Template.gmsvc.pp +++ b/dtool/pptempl/Template.gmsvc.pp @@ -911,7 +911,7 @@ $[TAB] $[COMMAND] // Finally, the rules to freshen the Makefile itself. -Makefile : $[SOURCE_FILENAME] +Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] $[TAB] ppremake #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]] @@ -1052,6 +1052,10 @@ $[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER] $[TAB] cp -f $[local] $[dest]/ #endif +// Finally, the rules to freshen the Makefile itself. +Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] +$[TAB] ppremake + #end Makefile // If there is a file called LocalSetup.pp in the package's top diff --git a/dtool/pptempl/Template.nmake.pp b/dtool/pptempl/Template.nmake.pp index 4603a2f5a8..bdc26ccf85 100644 --- a/dtool/pptempl/Template.nmake.pp +++ b/dtool/pptempl/Template.nmake.pp @@ -933,7 +933,7 @@ $[TAB] $[COMMAND] // Finally, the rules to freshen the Makefile itself. -Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME]] +Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]] $[TAB] ppremake #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]] #endif +// Finally, the rules to freshen the Makefile itself. +Makefile : $[patsubst %,$[osfilename %],$[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE]] +$[TAB] ppremake + #end Makefile // If there is a file called LocalSetup.pp in the package's top diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index f840d1edd3..467086151e 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -751,7 +751,7 @@ $[TAB] $[COMMAND] // Finally, the rules to freshen the Makefile itself. -Makefile : $[SOURCE_FILENAME] +Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] $[TAB] ppremake #if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]] @@ -892,6 +892,10 @@ $[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER] $[TAB] $[INSTALL] #endif +// Finally, the rules to freshen the Makefile itself. +Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] +$[TAB] ppremake + #end Makefile // If there is a file called LocalSetup.pp in the package's top diff --git a/dtool/src/dtoolutil/Sources.pp b/dtool/src/dtoolutil/Sources.pp index a7e48a6cb0..65da1b96dc 100644 --- a/dtool/src/dtoolutil/Sources.pp +++ b/dtool/src/dtoolutil/Sources.pp @@ -6,19 +6,27 @@ #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx #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 \ - 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 \ + checkPandaVersion.h \ executionEnvironment.I executionEnvironment.h filename.I \ filename.h load_dso.h dSearchPath.I dSearchPath.h \ + pandaSystem.h pandaVersion.h \ pfstream.h pfstream.I vector_string.h gnu_getopt.h \ pfstreamBuf.h vector_src.cxx vector_src.h #end lib_target @@ -37,3 +45,4 @@ #define SOURCES test_touch.cxx #end test_bin_target +#include $[THISDIRPREFIX]pandaVersion.h.pp diff --git a/dtool/src/dtoolutil/dtoolutil_composite1.cxx b/dtool/src/dtoolutil/dtoolutil_composite1.cxx index 31e9b5294e..c51a5c47ea 100644 --- a/dtool/src/dtoolutil/dtoolutil_composite1.cxx +++ b/dtool/src/dtoolutil/dtoolutil_composite1.cxx @@ -2,4 +2,7 @@ #include "filename.cxx" #include "load_dso.cxx" #include "dSearchPath.cxx" +#include "pandaSystem.cxx" +#include "checkPandaVersion.cxx" + diff --git a/dtool/src/dtoolutil/pandaSystem.cxx b/dtool/src/dtoolutil/pandaSystem.cxx new file mode 100644 index 0000000000..ba1f30b4ab --- /dev/null +++ b/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 +// panda3d-general@lists.sourceforge.net . +// +//////////////////////////////////////////////////////////////////// + +#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 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; +} diff --git a/dtool/src/dtoolutil/pandaSystem.h b/dtool/src/dtoolutil/pandaSystem.h new file mode 100644 index 0000000000..58bd64a1bb --- /dev/null +++ b/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 +// panda3d-general@lists.sourceforge.net . +// +//////////////////////////////////////////////////////////////////// + +#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 SystemTags; + typedef pmap Systems; + typedef pvector SystemNames; + + Systems _systems; + SystemNames _system_names; + bool _system_names_dirty; + + static PandaSystem *_global_ptr; +}; + +#endif + + diff --git a/dtool/src/dtoolutil/pandaVersion.h.pp b/dtool/src/dtoolutil/pandaVersion.h.pp new file mode 100644 index 0000000000..234c640fd7 --- /dev/null +++ b/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 + * panda3d-general@lists.sourceforge.net . + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/******************************************************************* + * 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 + * panda3d-general@lists.sourceforge.net . + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/******************************************************************* + * 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 + * panda3d-general@lists.sourceforge.net . + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/******************************************************************* + * 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 diff --git a/panda/metalibs/panda/panda.cxx b/panda/metalibs/panda/panda.cxx index bc9b7cbecd..d55b76a973 100644 --- a/panda/metalibs/panda/panda.cxx +++ b/panda/metalibs/panda/panda.cxx @@ -25,6 +25,12 @@ #include "config_particlesystem.h" #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 // Description: Initializes the library. This must be called at diff --git a/panda/metalibs/pandacr/pandacr.cxx b/panda/metalibs/pandacr/pandacr.cxx deleted file mode 100644 index 920ad62887..0000000000 --- a/panda/metalibs/pandacr/pandacr.cxx +++ /dev/null @@ -1,27 +0,0 @@ -// Filename: pandacr.cxx -// Created by: skyler, baseed on pandagl -// -//////////////////////////////////////////////////////////////////// - -#include "pandacr.h" - -#include -#ifdef HAVE_WCR -#include -#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 -} diff --git a/panda/metalibs/pandacr/pandacr.h b/panda/metalibs/pandacr/pandacr.h deleted file mode 100644 index 3e3bf7d4fb..0000000000 --- a/panda/metalibs/pandacr/pandacr.h +++ /dev/null @@ -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 - diff --git a/panda/metalibs/pandadx8/pandadx8.cxx b/panda/metalibs/pandadx8/pandadx8.cxx index 2f728b569f..672cd089a9 100644 --- a/panda/metalibs/pandadx8/pandadx8.cxx +++ b/panda/metalibs/pandadx8/pandadx8.cxx @@ -7,6 +7,12 @@ #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 // Description: Initializes the library. This must be called at diff --git a/panda/metalibs/pandadx9/pandadx9.cxx b/panda/metalibs/pandadx9/pandadx9.cxx index a86be20fd2..ec5dae0c16 100755 --- a/panda/metalibs/pandadx9/pandadx9.cxx +++ b/panda/metalibs/pandadx9/pandadx9.cxx @@ -7,6 +7,12 @@ #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 // Description: Initializes the library. This must be called at diff --git a/panda/metalibs/pandaegg/pandaegg.cxx b/panda/metalibs/pandaegg/pandaegg.cxx index 7fe397b6ad..d9369babdd 100644 --- a/panda/metalibs/pandaegg/pandaegg.cxx +++ b/panda/metalibs/pandaegg/pandaegg.cxx @@ -9,6 +9,12 @@ #include "config_builder.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 // Description: Initializes the library. This must be called at diff --git a/panda/metalibs/pandaexpress/pandaexpress.cxx b/panda/metalibs/pandaexpress/pandaexpress.cxx index f6268be616..1ec56ad688 100644 --- a/panda/metalibs/pandaexpress/pandaexpress.cxx +++ b/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" diff --git a/panda/metalibs/pandafx/pandafx.cxx b/panda/metalibs/pandafx/pandafx.cxx index b4a9601dd3..b13b9f7036 100644 --- a/panda/metalibs/pandafx/pandafx.cxx +++ b/panda/metalibs/pandafx/pandafx.cxx @@ -5,7 +5,13 @@ #include "pandafx.h" -#include +#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 diff --git a/panda/metalibs/pandagl/pandagl.cxx b/panda/metalibs/pandagl/pandagl.cxx index 8f6653192d..6eb99b4e57 100644 --- a/panda/metalibs/pandagl/pandagl.cxx +++ b/panda/metalibs/pandagl/pandagl.cxx @@ -15,6 +15,12 @@ */ #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 // Description: Initializes the library. This must be called at diff --git a/panda/metalibs/pandaphysics/pandaphysics.cxx b/panda/metalibs/pandaphysics/pandaphysics.cxx index 4a37a1869b..cca2e1aa8d 100644 --- a/panda/metalibs/pandaphysics/pandaphysics.cxx +++ b/panda/metalibs/pandaphysics/pandaphysics.cxx @@ -6,10 +6,16 @@ #include "pandaphysics.h" #ifndef LINK_IN_PHYSICS -#include -#include +#include "config_physics.h" +#include "config_particlesystem.h" #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 // Description: Initializes the library. This must be called at diff --git a/panda/metalibs/pandarib/Sources.pp b/panda/metalibs/pandarib/Sources.pp deleted file mode 100644 index 1112cceb31..0000000000 --- a/panda/metalibs/pandarib/Sources.pp +++ /dev/null @@ -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 diff --git a/panda/metalibs/pandarib/pandarib.cxx b/panda/metalibs/pandarib/pandarib.cxx deleted file mode 100644 index 0318c5126d..0000000000 --- a/panda/metalibs/pandarib/pandarib.cxx +++ /dev/null @@ -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. diff --git a/panda/src/express/config_express.N b/panda/src/express/config_express.N index 36bbbeded7..c40d9cae39 100644 --- a/panda/src/express/config_express.N +++ b/panda/src/express/config_express.N @@ -1,3 +1,4 @@ +forcetype PandaSystem forcetype DSearchPath forcetype Filename forcetype GlobPattern diff --git a/panda/src/express/config_express.h b/panda/src/express/config_express.h index 9827b8e775..4a7b96dff7 100644 --- a/panda/src/express/config_express.h +++ b/panda/src/express/config_express.h @@ -26,6 +26,7 @@ // We include these files to force them to be instrumented by // interrogate. +#include "pandaSystem.h" #include "globPattern.h" #include "configFlags.h" #include "configPage.h" diff --git a/panda/src/framework/config_framework.cxx b/panda/src/framework/config_framework.cxx index 12be4892a9..a1e2b3fe81 100644 --- a/panda/src/framework/config_framework.cxx +++ b/panda/src/framework/config_framework.cxx @@ -21,6 +21,12 @@ #include "dconfig.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); NotifyCategoryDef(framework, ""); diff --git a/panda/src/testbed/pview.cxx b/panda/src/testbed/pview.cxx index 313f3eae66..adea064609 100644 --- a/panda/src/testbed/pview.cxx +++ b/panda/src/testbed/pview.cxx @@ -22,6 +22,12 @@ #include "configVariableBool.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 #include "gnu_getopt.h" #else