Changes to support building universal Mac rtdist for 1.9

This commit is contained in:
rdb 2015-03-28 00:31:10 +01:00
parent e7ed6cee41
commit b06100afdd
18 changed files with 90 additions and 67 deletions

View File

@ -52,7 +52,7 @@ enum {
#ifdef _WIN32
typedef P3DWinSplashWindow SplashWindowType;
#elif defined(__APPLE__)
#elif defined(__APPLE__) && !__LP64__
typedef P3DOsxSplashWindow SplashWindowType;
#elif defined(HAVE_X11)
typedef P3DX11SplashWindow SplashWindowType;
@ -3455,7 +3455,9 @@ paint_window() {
#ifdef __APPLE__
const P3D_window_handle &handle = _wparams.get_parent_window();
if (handle._window_handle_type == P3D_WHT_osx_port) {
#if !__LP64__
paint_window_osx_port();
#endif
} else if (handle._window_handle_type == P3D_WHT_osx_cgcontext) {
const P3D_window_handle &handle = _wparams.get_parent_window();
@ -3467,7 +3469,7 @@ paint_window() {
#endif // __APPLE__
}
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
////////////////////////////////////////////////////////////////////
// Function: P3DInstance::get_framebuffer_osx_port
// Access: Private
@ -3590,7 +3592,7 @@ get_framebuffer_osx_cgcontext() {
}
#endif // __APPLE__
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
////////////////////////////////////////////////////////////////////
// Function: P3DInstance::paint_window_osx_port
// Access: Private
@ -3680,7 +3682,7 @@ bool P3DInstance::
handle_event_osx_event_record(const P3D_event_data &event) {
bool retval = false;
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
assert(event._event_type == P3D_ET_osx_event_record);
EventRecord *er = event._event._osx_event_record._event;
@ -3895,7 +3897,7 @@ handle_event_osx_cocoa(const P3D_event_data &event) {
////////////////////////////////////////////////////////////////////
void P3DInstance::
add_carbon_modifier_flags(unsigned int &swb_flags, int modifiers) {
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
if (modifiers & cmdKey) {
swb_flags |= SubprocessWindowBuffer::EF_meta_held;
}

View File

@ -14,7 +14,7 @@
#include "p3dOsxSplashWindow.h"
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>

View File

@ -17,7 +17,7 @@
#include "p3d_plugin_common.h"
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
#include "p3dSplashWindow.h"

View File

@ -1882,8 +1882,10 @@ send_window() {
assert(!_use_xembed);
parent_window._window_handle_type = _window_handle_type;
if (_window_handle_type == P3D_WHT_osx_port) {
#if !__LP64__
NP_Port *port = (NP_Port *)_window.window;
parent_window._handle._osx_port._port = port->port;
#endif
} else if (_window_handle_type == P3D_WHT_osx_cgcontext) {
NP_CGContext *context = (NP_CGContext *)_window.window;
if (context != NULL) {
@ -1929,8 +1931,10 @@ send_window() {
#elif defined(__APPLE__)
parent_window._window_handle_type = _window_handle_type;
if (_window_handle_type == P3D_WHT_osx_port) {
#if !__LP64__
NP_Port *port = (NP_Port *)_window.window;
parent_window._handle._osx_port._port = port->port;
#endif
} else if (_window_handle_type == P3D_WHT_osx_cgcontext) {
NP_CGContext *context = (NP_CGContext *)_window.window;
if (context != NULL) {

View File

@ -147,7 +147,7 @@ run_main_loop() {
}
}
#elif defined(__APPLE__)
#elif defined(__APPLE__) && !__LP64__
// OSX really prefers to own the main loop, so we install a timer to
// call out to our instances and getters, rather than polling within
// the event loop as we do in the Windows case, above.
@ -699,7 +699,7 @@ report_download_complete(P3D_instance *instance) {
}
}
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
////////////////////////////////////////////////////////////////////
// Function: Panda3DBase::st_timer_callback
// Access: Protected, Static
@ -712,7 +712,7 @@ st_timer_callback(EventLoopTimerRef timer, void *user_data) {
}
#endif // __APPLE__
#ifdef __APPLE__
#if defined(__APPLE__) && !__LP64__
////////////////////////////////////////////////////////////////////
// Function: Panda3DBase::timer_callback
// Access: Protected

View File

@ -63,7 +63,7 @@ open_p3d_file(FSRef *ref) {
static pascal OSErr
open_documents_handler(const AppleEvent *theAppleEvent, AppleEvent *reply,
long handlerRefcon) {
SRefCon handlerRefcon) {
AEDescList docList;
FSRef theFSRef;
long index;

View File

@ -441,6 +441,8 @@ if (RTDIST and DISTRIBUTOR == "cmu"):
exit("The CMU 1.7 runtime distribution must be built against Python 2.6!")
elif (RTDIST_VERSION == "cmu_1.8" and SDK["PYTHONVERSION"] != "python2.7"):
exit("The CMU 1.8 runtime distribution must be built against Python 2.7!")
elif (RTDIST_VERSION == "cmu_1.9" and SDK["PYTHONVERSION"] != "python2.7"):
exit("The CMU 1.9 runtime distribution must be built against Python 2.7!")
elif RTDIST and not HOST_URL:
exit("You must specify a host URL when building the rtdist!")
@ -675,13 +677,13 @@ if (COMPILER == "MSVC"):
if (COMPILER=="GCC"):
PkgDisable("AWESOMIUM")
if (GetTarget() != "darwin"):
if GetTarget() != "darwin":
PkgDisable("CARBON")
PkgDisable("COCOA")
elif (RTDIST or RUNTIME):
elif RUNTIME:
# We don't support Cocoa in the runtime yet.
PkgDisable("COCOA")
elif (UNIVERSAL or GetTargetArch() == 'x86_64'):
if UNIVERSAL or GetTargetArch() == 'x86_64':
# 64-bits OS X doesn't have Carbon.
PkgDisable("CARBON")
@ -730,6 +732,9 @@ if (COMPILER=="GCC"):
SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h")
SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config")
if GetTarget() == "darwin" and not PkgSkip("FFMPEG"):
LibName("FFMPEG", "-Wl,-read_only_relocs,suppress")
cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV")
if cv_lib == "opencv_core":
OPENCV_VER_23 = True
@ -746,26 +751,27 @@ if (COMPILER=="GCC"):
rocket_libs += ("boost_python",)
SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h")
if not PkgSkip("PYTHON"):
if GetHost() == "darwin" and GetTarget() == "darwin" and not RTDIST:
# Use the system Python framework in the standard Mac SDK.
LibName("PYTHON", "-framework Python")
else:
SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config")
SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h"))
SmartPkgEnable("ZLIB", "zlib", ("z"), "zlib.h")
SmartPkgEnable("GTK2", "gtk+-2.0")
if (RTDIST and GetHost() == "darwin" and "PYTHONVERSION" in SDK):
# Don't use the framework for the OSX rtdist build. I'm afraid it gives problems somewhere.
SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config")
elif("PYTHONVERSION" in SDK and not RUNTIME):
SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config", framework = "Python")
if (RTDIST):
SmartPkgEnable("WX", tool = "wx-config")
SmartPkgEnable("FLTK", "", ("fltk"), ("FL/Fl.H"), tool = "fltk-config")
if GetTarget() != 'darwin':
# CgGL is covered by the Cg framework, and we don't need X11 components on OSX
if (PkgSkip("NVIDIACG")==0 and not RUNTIME):
SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h")
if (not RUNTIME):
SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h"))
if not PkgSkip("NVIDIACG") and not RUNTIME:
SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h")
if not RUNTIME:
SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h"))
SmartPkgEnable("XRANDR", "xrandr", "Xrandr", "X11/extensions/Xrandr.h")
SmartPkgEnable("XF86DGA", "xxf86dga", "Xxf86dga", "X11/extensions/xf86dga.h")
SmartPkgEnable("XCURSOR", "xcursor", "Xcursor", "X11/Xcursor/Xcursor.h")
@ -1110,6 +1116,8 @@ def CompileCxx(obj,src,opts):
else: cmd = GetCXX()+' -ftemplate-depth-70 -fPIC -c -o ' + obj
for (opt, dir) in INCDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir)
for (opt, dir) in FRAMEWORKDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts): cmd += ' -F' + BracketNameWithQuotes(dir)
for (opt,var,val) in DEFSYMBOLS:
if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
for x in ipath: cmd += ' -I' + x
@ -1612,6 +1620,9 @@ def CompileLink(dll, obj, opts):
for (opt, dir) in LIBDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts):
cmd += ' -L' + BracketNameWithQuotes(dir)
for (opt, dir) in FRAMEWORKDIRECTORIES:
if (opt=="ALWAYS") or (opt in opts):
cmd += ' -F' + BracketNameWithQuotes(dir)
for (opt, name) in LIBNAMES:
if (opt=="ALWAYS") or (opt in opts):
cmd += ' ' + BracketNameWithQuotes(name)
@ -1717,7 +1728,10 @@ def CompileRes(target, src, opts):
def CompileRsrc(target, src, opts):
"""Compiles a Mac OS .r file into an .rsrc file."""
ipath = GetListOption(opts, "DIR:")
cmd = "/Developer/Tools/Rez -useDF"
if os.path.isfile("/usr/bin/Rez"):
cmd = "Rez -useDF"
else:
cmd = "/Developer/Tools/Rez -useDF"
cmd += " -o " + BracketNameWithQuotes(target)
for x in ipath:
cmd += " -i " + x

View File

@ -1473,8 +1473,14 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
pkg_dir = os.path.join(GetThirdpartyDir(), pkg.lower())
if (os.path.isdir(pkg_dir)):
if framework and os.path.isdir(os.path.join(pkg_dir, framework + ".framework")):
FrameworkDirectory(target_pkg, pkg_dir)
LibName(target_pkg, "-framework " + framework)
return
if os.path.isdir(os.path.join(pkg_dir, "include")):
IncDirectory(target_pkg, os.path.join(pkg_dir, "include"))
if os.path.isdir(os.path.join(pkg_dir, "lib")):
LibDirectory(target_pkg, os.path.join(pkg_dir, "lib"))
@ -1800,15 +1806,14 @@ def SdkLocateMax():
if (os.path.isdir(top + "\\" + subdir)!=0):
SDK[version+"CS"] = top + subdir
def SdkLocatePython(force_use_sys_executable = False):
def SdkLocatePython(prefer_thirdparty_python=False):
if PkgSkip("PYTHON"):
# We're not compiling with Python support. We still need to set this
# in case we want to run any scripts that use Python, though.
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
return
if CrossCompiling():
force_use_sys_executable = False
if (GetTarget() == 'windows' and not force_use_sys_executable):
if GetTarget() == 'windows':
SDK["PYTHON"] = GetThirdpartyBase() + "/win-python"
if (GetOptimize() <= 2):
SDK["PYTHON"] += "-dbg"
@ -1840,7 +1845,7 @@ def SdkLocatePython(force_use_sys_executable = False):
os.environ["PYTHONHOME"] = SDK["PYTHON"]
elif CrossCompiling():
elif CrossCompiling() or (prefer_thirdparty_python and os.path.isdir(os.path.join(GetThirdpartyDir(), "python"))):
tp_python = os.path.join(GetThirdpartyDir(), "python")
SDK["PYTHON"] = tp_python + "/include"
@ -1859,11 +1864,12 @@ def SdkLocatePython(force_use_sys_executable = False):
py_lib = os.path.basename(py_libs[0])
SDK["PYTHONVERSION"] = "python" + py_lib[9] + "." + py_lib[11]
SDK["PYTHONEXEC"] = tp_python + "/bin/" + SDK["PYTHONVERSION"]
elif (GetTarget() == 'windows'):
SDK["PYTHON"] = os.path.dirname(sysconfig.get_python_inc())
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
SDK["PYTHONEXEC"] = sys.executable
#elif GetTarget() == 'windows':
# SDK["PYTHON"] = os.path.dirname(sysconfig.get_python_inc())
# SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
# SDK["PYTHONEXEC"] = sys.executable
else:
SDK["PYTHON"] = sysconfig.get_python_inc()
@ -1871,6 +1877,7 @@ def SdkLocatePython(force_use_sys_executable = False):
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
if CrossCompiling():
# We need a version of Python we can run.
SDK["PYTHONEXEC"] = sys.executable
host_version = "python" + sysconfig.get_python_version()
if SDK["PYTHONVERSION"] != host_version:
@ -2186,6 +2193,7 @@ def SetupVisualStudioEnviron():
INCDIRECTORIES = []
LIBDIRECTORIES = []
FRAMEWORKDIRECTORIES = []
LIBNAMES = []
DEFSYMBOLS = []
@ -2195,6 +2203,9 @@ def IncDirectory(opt, dir):
def LibDirectory(opt, dir):
LIBDIRECTORIES.append((opt, dir))
def FrameworkDirectory(opt, dir):
FRAMEWORKDIRECTORIES.append((opt, dir))
def LibName(opt, name):
# Check to see if the lib file actually exists for the thirdparty library given
# Are we a thirdparty library?
@ -2263,7 +2274,13 @@ def SetupBuildEnvironment(compiler):
continue
line = line[12:].strip()
SYS_LIB_DIRS += line.split(':')
for libdir in line.split(':'):
libdir = os.path.normpath(libdir)
if os.path.isdir(libdir):
if libdir not in SYS_LIB_DIRS:
SYS_LIB_DIRS.append(libdir)
elif GetVerbose():
print("Ignoring non-existent library directory %s" % (libdir))
returnval = handle.close()
if returnval != None and returnval != 0:
@ -2288,8 +2305,10 @@ def SetupBuildEnvironment(compiler):
continue
line = line.strip()
if os.path.isdir(line):
SYS_INC_DIRS.append(line)
if line.endswith(" (framework directory)"):
pass
elif os.path.isdir(line):
SYS_INC_DIRS.append(os.path.normpath(line))
elif GetVerbose():
print("Ignoring non-existent include directory %s" % (line))

View File

@ -21,8 +21,6 @@
NotifyCategoryDecl(cocoadisplay, EXPCL_PANDAGL, EXPTP_PANDAGL);
extern ConfigVariableBool gl_support_fbo;
extern EXPCL_PANDAGL void init_libcocoadisplay();
#endif

View File

@ -27,12 +27,6 @@ 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

View File

@ -14,6 +14,12 @@
#include "pandaSystem.h"
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."));
ConfigVariableBool gl_cheap_textures
("gl-cheap-textures", false,
PRC_DESC("Configure this true to glHint the textures into the cheapest "

View File

@ -40,6 +40,7 @@
//#define GSG_VERBOSE 1
extern EXPCL_PANDAGL ConfigVariableBool gl_support_fbo;
extern ConfigVariableBool gl_cheap_textures;
extern ConfigVariableBool gl_ignore_clamp;
extern ConfigVariableBool gl_support_clamp_to_border;

View File

@ -45,12 +45,6 @@ ConfigVariableBool glx_get_os_address
"addresses of extension functions. This will be done only "
"if glxGetProcAddress() cannot be used for some reason."));
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."));
ConfigVariableBool glx_support_fbconfig
("glx-support-fbconfig", true,
PRC_DESC("Set this true to enable the use of the advanced FBConfig "

View File

@ -28,7 +28,6 @@ extern EXPCL_PANDAGL void init_libglxdisplay();
extern ConfigVariableBool glx_get_proc_address;
extern ConfigVariableBool glx_get_os_address;
extern ConfigVariableBool gl_support_fbo;
extern ConfigVariableBool glx_support_fbconfig;
extern ConfigVariableBool glx_support_pbuffer;
extern ConfigVariableBool glx_support_pixmap;

View File

@ -163,14 +163,14 @@ open_buffer() {
if (_pbuffer == NULL) {
GLenum target = GL_TEXTURE_RECTANGLE_ARB;
if (_x_size == Texture::up_to_power_2(_x_size) &&
_y_size == Texture::up_to_power_2(_x_size)) {
if (_size[0] == Texture::up_to_power_2(_size[0]) &&
_size[1] == Texture::up_to_power_2(_size[1])) {
// It's a power-of-two size, so we can use GL_TEXTURE_2D as the
// target. Dunno, but maybe this will be more likely to work on
// some hardware.
target = GL_TEXTURE_2D;
}
if (!aglCreatePBuffer(_x_size, _y_size, target, GL_RGBA, 0, &_pbuffer)) {
if (!aglCreatePBuffer(_size.get_x(), _size.get_y(), target, GL_RGBA, 0, &_pbuffer)) {
report_agl_error("aglCreatePBuffer");
close_buffer();
return false;

View File

@ -429,9 +429,9 @@ make_output(const string &name,
return NULL;
}
}
if (posixgsg != NULL && posixgsg->is_valid() && !posixgsg->needs_reset()) {
if (!posixgsg->_supports_framebuffer_object ||
posixgsg->_glDrawBuffers == NULL) {
if (osxgsg != NULL && osxgsg->is_valid() && !osxgsg->needs_reset()) {
if (!osxgsg->_supports_framebuffer_object ||
osxgsg->_glDrawBuffers == NULL) {
return NULL;
} else if (fb_prop.is_basic()) {
// Early success - if we are sure that this buffer WILL

View File

@ -42,13 +42,6 @@ ConfigVariableBool gl_do_vidmemsize_check
"fullscreen windows, no matter what resolution of window was "
"requested. It only affects fullscreen windows."));
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_libwgldisplay
// Description: Initializes the library. This must be called at

View File

@ -25,7 +25,6 @@ NotifyCategoryDecl(wgldisplay, EXPCL_PANDAGL, EXPTP_PANDAGL);
extern ConfigVariableInt gl_force_pixfmt;
extern ConfigVariableBool gl_force_invalid;
extern ConfigVariableBool gl_do_vidmemsize_check;
extern ConfigVariableBool gl_support_fbo;
extern EXPCL_PANDAGL void init_libwgldisplay();