add dtool_platform

This commit is contained in:
David Rose 2009-08-03 18:51:54 +00:00
parent 1a52b3f65f
commit 9908148679
6 changed files with 82 additions and 1 deletions

View File

@ -956,6 +956,12 @@
#define ARTOOLKIT_LIBS $[if $[WINDOWS_PLATFORM],libAR.lib,AR] #define ARTOOLKIT_LIBS $[if $[WINDOWS_PLATFORM],libAR.lib,AR]
#defer HAVE_ARTOOLKIT $[libtest $[ARTOOLKIT_LPATH],$[ARTOOLKIT_LIBS]] #defer HAVE_ARTOOLKIT $[libtest $[ARTOOLKIT_LPATH],$[ARTOOLKIT_LIBS]]
// Define this to explicitly indicate the given platform string within
// the resulting Panda runtime. Normally it is best to leave this
// undefined, in which case Panda will determine the best value
// automatically.
#define DTOOL_PLATFORM
// Define this to generate static libraries and executables, rather than // Define this to generate static libraries and executables, rather than
// dynamic libraries. // dynamic libraries.
//#define LINK_ALL_STATIC yes //#define LINK_ALL_STATIC yes

View File

@ -686,5 +686,6 @@ $[cdefine IS_OSX]
$[cdefine IS_LINUX] $[cdefine IS_LINUX]
$[cdefine IS_FREEBSD] $[cdefine IS_FREEBSD]
$[cdefine BUILD_IPHONE] $[cdefine BUILD_IPHONE]
$[cdefine DTOOL_PLATFORM]
#end dtool_config.h #end dtool_config.h

View File

@ -17,6 +17,7 @@
deletedBufferChain.h deletedBufferChain.I \ deletedBufferChain.h deletedBufferChain.I \
deletedChain.h deletedChain.T \ deletedChain.h deletedChain.T \
dtoolbase.h dtoolbase_cc.h dtoolsymbols.h \ dtoolbase.h dtoolbase_cc.h dtoolsymbols.h \
dtool_platform.h \
fakestringstream.h \ fakestringstream.h \
indent.I indent.h indent.cxx \ indent.I indent.h indent.cxx \
memoryBase.h \ memoryBase.h \
@ -73,7 +74,9 @@
cmath.I cmath.h \ cmath.I cmath.h \
deletedBufferChain.h deletedBufferChain.I \ deletedBufferChain.h deletedBufferChain.I \
deletedChain.h deletedChain.T \ deletedChain.h deletedChain.T \
dtoolbase.h dtoolbase_cc.h dtoolsymbols.h fakestringstream.h \ dtoolbase.h dtoolbase_cc.h dtoolsymbols.h \
dtool_platform.h \
fakestringstream.h \
indent.I indent.h \ indent.I indent.h \
memoryBase.h \ memoryBase.h \
memoryHook.h memoryHook.I \ memoryHook.h memoryHook.I \

View File

@ -0,0 +1,55 @@
/* Filename: dtool_platform.h
* Created by: drose (03Aug09)
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef DTOOL_PLATFORM_H
#define DTOOL_PLATFORM_H
/* This file defines the macro DTOOL_PLATFORM, which is used in
PandaSystem and a few other places to report the current platform
string. In practice, this string is primarily useful for the
packaged runtime system. */
#include "dtool_config.h"
#if defined(DTOOL_PLATFORM)
// This has already been defined explicitly by the Config.pp file.
#elif defined(_WIN32)
#define DTOOL_PLATFORM "win32"
#elif defined(_WIN64)
#define DTOOL_PLATFORM "win64"
#elif defined(__APPLE__)
#if defined(BUILD_IPHONE)
#define DTOOL_PLATFORM "iphone"
#elif defined(__ppc__)
#define DTOOL_PLATFORM "osx.ppc"
#else
#define DTOOL_PLATFORM "osx.i386"
#endif
#elif defined(__x86_64)
#define DTOOL_PLATFORM "linux.amd64"
#elif defined(__i386)
#define DTOOL_PLATFORM "linux.i386"
#else
#error Can't determine platform; please define DTOOL_PLATFORM in Config.pp file.
#endif
#endif

View File

@ -14,6 +14,7 @@
#include "pandaSystem.h" #include "pandaSystem.h"
#include "pandaVersion.h" #include "pandaVersion.h"
#include "dtool_platform.h"
PandaSystem *PandaSystem::_global_ptr = NULL; PandaSystem *PandaSystem::_global_ptr = NULL;
TypeHandle PandaSystem::_type_handle; TypeHandle PandaSystem::_type_handle;
@ -182,6 +183,19 @@ string PandaSystem::
get_build_date() { get_build_date() {
return __DATE__ " " __TIME__; return __DATE__ " " __TIME__;
} }
////////////////////////////////////////////////////////////////////
// Function: PandaSystem::get_platform
// Access: Published, Static
// Description: Returns a string representing the runtime platform
// that we are currently running on. This will be
// something like "win32" or "osx.i386" or
// "linux.amd64".
////////////////////////////////////////////////////////////////////
string PandaSystem::
get_platform() {
return DTOOL_PLATFORM;
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: PandaSystem::has_system // Function: PandaSystem::has_system

View File

@ -43,6 +43,8 @@ PUBLISHED:
static string get_compiler(); static string get_compiler();
static string get_build_date(); static string get_build_date();
static string get_platform();
bool has_system(const string &system) const; bool has_system(const string &system) const;
int get_num_systems() const; int get_num_systems() const;
string get_system(int n) const; string get_system(int n) const;