Updates from Bob Kuehne and Kristopher Bixler to remove the fink
dependency from the MacOSX build.
This commit is contained in:
@@ -232,14 +232,14 @@ endif
|
||||
#### MacOS X specific definitions
|
||||
ifeq ($(OS),Darwin)
|
||||
C++ = cc
|
||||
INC += -I/usr/include -I/sw/include
|
||||
INC += -I/usr/include
|
||||
DEF += -Wall -D__DARWIN_OSX__
|
||||
OPTF = -O2
|
||||
DBGF = -g
|
||||
DEPARG = -M $(DEF)
|
||||
SHARED = -shared
|
||||
ARCHARGS =
|
||||
LINKARGS = -L/usr/lib -L/sw/lib
|
||||
LINKARGS = -L/usr/lib
|
||||
DYNAMICLIBRARYLIB =
|
||||
OSG_LIBS = -losgGLUT -losgGA -losgDB -losgUtil -losg
|
||||
FREETYPE_LIB = -lfreetype
|
||||
@@ -248,18 +248,19 @@ ifeq ($(OS),Darwin)
|
||||
GL_LIBS = -framework OpenGL $(CARBON_LIB)
|
||||
X_LIBS =
|
||||
SOCKET_LIBS =
|
||||
OTHER_LIBS = -lm -ldl -lstdc++ -lobjc
|
||||
OTHER_LIBS = -lm -lstdc++ -lobjc
|
||||
LIB_EXT = dylib
|
||||
QUICKTIME = -framework QuickTime $(CARBON_LIB)
|
||||
TIFF_LIB = -ltiff
|
||||
SRC_DIRS = osg osgUtil osgDB osgPlugins \
|
||||
osgGA osgGLUT osgParticle \
|
||||
SRC_DIRS = osg osgUtil osgDB \
|
||||
osgGA osgGLUT \
|
||||
osgPlugins osgParticle \
|
||||
Demos
|
||||
# Plugins which require external libs: gif jpeg png
|
||||
# Plugins which require external libs: gif jpeg png tiff
|
||||
PLUGIN_DIRS = bmp dw flt \
|
||||
lib3ds logos lwo obj \
|
||||
osg osgtgz pic \
|
||||
quicktime rgb tga tgz tiff \
|
||||
quicktime rgb tga tgz \
|
||||
txp zip
|
||||
# Demos which require external libs: osghud osgtext
|
||||
DEMOS_DIRS = osgbillboard osgcallback osgclip \
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#elif !defined macintosh
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
#include <mach-o/dyld.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
@@ -62,12 +64,14 @@ void* osg::getGLExtensionFuncPtr(const char *funcName)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
return wglGetProcAddress(funcName);
|
||||
#else
|
||||
#if defined( __DARWIN_OSX__ )
|
||||
static void *lib = dlopen("libGL.dylib", RTLD_LAZY);
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
std::string temp( "_" );
|
||||
NSSymbol symbol;
|
||||
temp += funcName; // Mac OS X prepends an underscore on function names
|
||||
symbol = NSLookupAndBindSymbol( temp.c_str() );
|
||||
return NSAddressOfSymbol( symbol );
|
||||
#else // all other unixes
|
||||
static void *lib = dlopen("libGL.so", RTLD_LAZY);
|
||||
#endif
|
||||
if (lib)
|
||||
return dlsym(lib, funcName);
|
||||
else
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#include <Io.h>
|
||||
#include <Windows.h>
|
||||
#include <Winbase.h>
|
||||
#elif !defined(macintosh)
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
#include <mach-o/dyld.h>
|
||||
#else // all other unix
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
@@ -27,7 +29,9 @@ DynamicLibrary::~DynamicLibrary()
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
FreeLibrary((HMODULE)_handle);
|
||||
#elif !defined(macintosh)
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
NSUnLinkModule(_handle, FALSE);
|
||||
#else // other unix
|
||||
dlclose(_handle);
|
||||
#endif
|
||||
}
|
||||
@@ -43,7 +47,18 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
|
||||
HANDLE handle = LoadLibrary( fullLibraryName.c_str() );
|
||||
if (handle) return osgNew DynamicLibrary(libraryName,handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
#elif !defined(macintosh)
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
NSObjectFileImage image;
|
||||
// NSModule os_handle = NULL;
|
||||
if (NSCreateObjectFileImageFromFile(fullLibraryName.c_str(), &image) == NSObjectFileImageSuccess) {
|
||||
// os_handle = NSLinkModule(image, fullLibraryName.c_str(), TRUE);
|
||||
HANDLE handle = NSLinkModule(image, fullLibraryName.c_str(), TRUE);
|
||||
NSDestroyObjectFileImage(image);
|
||||
if (handle) return osgNew DynamicLibrary(libraryName,handle);
|
||||
}
|
||||
// if (os_handle) return osgNew DynamicLibrary(libraryName,os_handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
#else // other unix
|
||||
HANDLE handle = dlopen( fullLibraryName.c_str(), RTLD_LAZY );
|
||||
if (handle) return osgNew DynamicLibrary(libraryName,handle);
|
||||
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
|
||||
@@ -56,8 +71,15 @@ DynamicLibrary::PROC_ADDRESS DynamicLibrary::getProcAddress(const std::string& p
|
||||
{
|
||||
if (_handle==NULL) return NULL;
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
return (DynamicLibrary::PROC_ADDRESS)GetProcAddress( (HMODULE)_handle, procName.c_str() );
|
||||
#elif !defined(macintosh)
|
||||
return (DynamicLibrary::PROC_ADDRESS)GetProcAddress( (HMODULE)_handle,
|
||||
procName.c_str() );
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
std::string temp("_");
|
||||
NSSymbol symbol;
|
||||
temp += procName; // Mac OS X prepends an underscore on function names
|
||||
symbol = NSLookupAndBindSymbol(temp.c_str());
|
||||
return NSAddressOfSymbol(symbol);
|
||||
#else // other unix
|
||||
return dlsym( _handle, procName.c_str() );
|
||||
#endif
|
||||
return NULL;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#ifdef TARGET_API_MAC_CARBON
|
||||
#include <osgDB/FileUtils_Mac.cpp>
|
||||
#if 0 // defined(__DARWIN_OSX__)
|
||||
#include "FileUtils_Mac.cpp" // this is not functional yet -- fix!
|
||||
#else
|
||||
|
||||
// implementations for Windows and all Unix's except Mac when TARGET_API_MAC_CARBON defined.
|
||||
// currently this impl is for _all_ platforms, execpt as defined.
|
||||
// the mac version will change soon to reflect the path scheme under osx, but
|
||||
// for now, the above include is commented out, and the below code takes precedence.
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#include <Io.h>
|
||||
@@ -10,10 +12,8 @@
|
||||
#include <Winbase.h>
|
||||
// set up for windows so acts just like unix access().
|
||||
#define F_OK 4
|
||||
#else
|
||||
// unix.
|
||||
#else // unix
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <osg/Notify>
|
||||
|
||||
Reference in New Issue
Block a user