diff --git a/dtool/src/dtoolutil/executionEnvironment.cxx b/dtool/src/dtoolutil/executionEnvironment.cxx index 3f06a3427f..3e1543ba4d 100644 --- a/dtool/src/dtoolutil/executionEnvironment.cxx +++ b/dtool/src/dtoolutil/executionEnvironment.cxx @@ -60,7 +60,7 @@ extern char **environ; #include #endif -#if defined(IS_LINUX) || defined(IS_OSX) || defined(IS_FREEBSD) +#if defined(IS_LINUX) || defined(IS_FREEBSD) // For link_map and dlinfo. #include #include diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 306bd72bcc..7c80093784 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -139,8 +139,8 @@ def usage(problem): print(" --outputdir X (use the specified directory instead of 'built')") print(" --host URL (set the host url (runtime build only))") print(" --threads N (use the multithreaded build system. see manual)") - print(" --osxtarget N (the OSX version number to build for (OSX only))") - print(" --universal (build universal binaries (OSX only))") + print(" --osxtarget N (the OS X version number to build for (OS X only))") + print(" --universal (build universal binaries (OS X only))") print(" --override \"O=V\" (override dtool_config/prc option value)") print(" --static (builds libraries for static linking)") print(" --target X (experimental cross-compilation (android only))") @@ -261,6 +261,13 @@ def parseopts(args): OSXTARGET = "10.%d" % (int(OSXTARGET[-1])) except: usage("Invalid setting for OSXTARGET") + + if UNIVERSAL: + if not OSXTARGET: + exit("--universal requires --osxtarget") + if target_arch: + exit("--universal is incompatible with --arch") + try: SetOptimize(int(optimize)) assert GetOptimize() in [1, 2, 3, 4] @@ -670,7 +677,7 @@ if (COMPILER=="GCC"): elif (RTDIST or RUNTIME): # We don't support Cocoa in the runtime yet. PkgDisable("COCOA") - elif (not UNIVERSAL and GetTargetArch() == 'x86_64'): + elif (UNIVERSAL or GetTargetArch() == 'x86_64'): # 64-bits OS X doesn't have Carbon. PkgDisable("CARBON") @@ -1084,10 +1091,15 @@ def CompileCxx(obj,src,opts): if (OSXTARGET != None): cmd += " -isysroot " + SDK["MACOSX"] cmd += " -mmacosx-version-min=" + OSXTARGET + if UNIVERSAL: cmd += " -arch i386" - if ("NOPPC" not in opts): - cmd += " -arch ppc" + if OSXTARGET: + osxver = int(OSXTARGET[-1]) + if "NOPPC" not in opts and int(OSXTARGET[-1]) < 6: + cmd += " -arch ppc" + if int(OSXTARGET[-1]) >= 5: + cmd += " -arch x86_64" elif HasTargetArch(): cmd += " -arch %s" % (GetTargetArch()) @@ -1539,10 +1551,15 @@ def CompileLink(dll, obj, opts): if OSXTARGET != None: cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"] cmd += " -mmacosx-version-min=" + OSXTARGET + if UNIVERSAL: cmd += " -arch i386" - if ("NOPPC" not in opts): - cmd += " -arch ppc" + if OSXTARGET: + osxver = int(OSXTARGET[-1]) + if "NOPPC" not in opts and int(OSXTARGET[-1]) < 6: + cmd += " -arch ppc" + if int(OSXTARGET[-1]) >= 5: + cmd += " -arch x86_64" elif HasTargetArch(): cmd += " -arch %s" % (GetTargetArch()) @@ -6621,10 +6638,15 @@ def MakeInstallerOSX(): if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) + if OSXTARGET: + target = '--target %s' % (OSXTARGET) + else: + target = '' + if os.path.exists("/Developer/usr/bin/packagemaker"): - cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target 10.4 --domain system --root dstroot/' + pkg + '/ --no-relocate' + cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"): - cmd = '/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target 10.4 --domain system --root dstroot/' + pkg + '/ --no-relocate' + cmd = '/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Developer/Tools/packagemaker"): cmd = '/Developer/Tools/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' else: diff --git a/panda/src/cocoadisplay/cocoaGraphicsPipe.mm b/panda/src/cocoadisplay/cocoaGraphicsPipe.mm index 3241973ec7..1969ac4116 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsPipe.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsPipe.mm @@ -343,7 +343,7 @@ make_output(const string &name, if (!cocoagsg->_supports_framebuffer_object || cocoagsg->_glDrawBuffers == NULL) { return NULL; - } else { + } else if (fb_prop.is_basic()) { // Early success - if we are sure that this buffer WILL // meet specs, we can precertify it. precertify = true; diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index eff69cd16d..84a5d9149a 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -1592,7 +1592,8 @@ handle_key_event(NSEvent *event) { if ([str canBeConvertedToEncoding: NSASCIIStringEncoding]) { // Nhm, ascii character perhaps? str = [str lowercaseString]; - button = KeyboardButton::ascii_key([str cStringUsingEncoding: NSASCIIStringEncoding]); + const char *c_str = [str cStringUsingEncoding: NSASCIIStringEncoding]; + button = KeyboardButton::ascii_key(c_str[0]); } } diff --git a/panda/src/cocoadisplay/config_cocoadisplay.h b/panda/src/cocoadisplay/config_cocoadisplay.h index 04754bf635..0ec8791588 100644 --- a/panda/src/cocoadisplay/config_cocoadisplay.h +++ b/panda/src/cocoadisplay/config_cocoadisplay.h @@ -17,8 +17,11 @@ #include "pandabase.h" #include "notifyCategoryProxy.h" +#include "configVariableBool.h" NotifyCategoryDecl(cocoadisplay, EXPCL_PANDAGL, EXPTP_PANDAGL); + +extern ConfigVariableBool gl_support_fbo; extern EXPCL_PANDAGL void init_libcocoadisplay(); diff --git a/panda/src/cocoadisplay/config_cocoadisplay.mm b/panda/src/cocoadisplay/config_cocoadisplay.mm index f3a59a242b..2333ab8803 100644 --- a/panda/src/cocoadisplay/config_cocoadisplay.mm +++ b/panda/src/cocoadisplay/config_cocoadisplay.mm @@ -27,6 +27,12 @@ ConfigureFn(config_cocoadisplay) { init_libcocoadisplay(); } +ConfigVariableBool gl_support_fbo + ("gl-support-fbo", true, + PRC_DESC("Configure this false if your GL's implementation of " + "EXT_framebuffer_object is broken. The system might still be " + "able to create buffers using pbuffers or the like.")); + //////////////////////////////////////////////////////////////////// // Function: init_libcocoadisplay // Description: Initializes the library. This must be called at diff --git a/panda/src/osxdisplay/osxGraphicsPipe.cxx b/panda/src/osxdisplay/osxGraphicsPipe.cxx index 951c1bf3e1..326bb69cb7 100644 --- a/panda/src/osxdisplay/osxGraphicsPipe.cxx +++ b/panda/src/osxdisplay/osxGraphicsPipe.cxx @@ -433,7 +433,7 @@ make_output(const string &name, if (!posixgsg->_supports_framebuffer_object || posixgsg->_glDrawBuffers == NULL) { return NULL; - } else { + } else if (fb_prop.is_basic()) { // Early success - if we are sure that this buffer WILL // meet specs, we can precertify it. precertify = true; diff --git a/panda/src/pnmimage/convert_srgb.cxx b/panda/src/pnmimage/convert_srgb.cxx index ef27735d06..ac46aa50f4 100644 --- a/panda/src/pnmimage/convert_srgb.cxx +++ b/panda/src/pnmimage/convert_srgb.cxx @@ -14,17 +14,6 @@ #include "convert_srgb.h" -#ifdef __GNUC__ -#include -#endif - -#ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include -#endif - // Lookup tables for converting from unsigned char formats. ALIGN_64BYTE const unsigned char to_srgb8_table[256] = { 0x00, 0x0d, 0x16, 0x1c, 0x22, 0x26, 0x2a, @@ -119,9 +108,20 @@ has_sse2_sRGB_encode() { return true; } -#else +#elif defined(__i386__) || defined(_M_IX86) // SSE2 support not guaranteed. Use a runtime detection mechanism. +#ifdef __GNUC__ +#include +#endif + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif + bool has_sse2_sRGB_encode() { #if defined(__GNUC__) @@ -162,4 +162,12 @@ has_sse2_sRGB_encode() { return has_support; } +#else +// Other architectures don't support SSE2 at all. + +bool +has_sse2_sRGB_encode() { + return false; +} + #endif // __SSE2__ diff --git a/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm b/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm index 37822be9d3..baf237dab9 100644 --- a/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm +++ b/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm @@ -1192,7 +1192,7 @@ OSStatus TinyOsxGraphicsWindow::handleKeyInput (EventHandlerCallRef myHandler, E if (keyDown) { if ((newModifiers & cmdKey) != 0) { - if (button == KeyboardButton::ascii_key("q") || button == KeyboardButton::ascii_key("w")) { + if (button == KeyboardButton::ascii_key('q') || button == KeyboardButton::ascii_key('w')) { // Command-Q or Command-W: quit the application or close the // window, respectively. For now, we treat them both the // same: close the window.