wxWidgets/include/wx/osx/chkconf.h
Vadim Zeitlin 382c4adea6 Fix preprocessor definitions for wxBase build under OS X.
Define __WXOSX__ for non-GUI build under Darwin. Ensure that the rest of the
code compiles correctly when just __WXOSX__ is defined but neither of
__WXOSX_{CARBON,COCOA,IPHONE}__ is. This ensures that wxBase can actually be
built under Mac.

Move OS X symbols definitions in wx/platform.h after wx/setup.h inclusion as
they rely on __DARWIN__ and wxUSE_GUI values which are both define in that
file now. Still keep them before wx/chkconf.h inclusion which relies on
__WXOSX_XXX__ being defined. Yes, it's a mess and should be cleaned up more
permanently some day.

Also remove some redundancy from wx/osx/{carbon,cocoa}/private.h by factoring
out common parts into wx/osx/core/private.h. Also include this header itself
from wx/osx/private.h directly instead of including it thrice from different
sub-ports headers.

Closes #12660.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-09 23:53:42 +00:00

109 lines
2.4 KiB
C

/*
* Name: wx/osx/chkconf.h
* Purpose: Mac-specific config settings checks
* Author: Vadim Zeitlin
* Modified by:
* Created: 2005-04-05 (extracted from wx/chkconf.h)
* RCS-ID: $Id$
* Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org>
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_OSX_CHKCONF_H_
#define _WX_OSX_CHKCONF_H_
#if wxUSE_STACKWALKER
/* not supported under Mac */
# undef wxUSE_STACKWALKER
# define wxUSE_STACKWALKER 0
#endif /* wxUSE_STACKWALKER */
/*
* disable the settings which don't work for some compilers
*/
#if defined(__MWERKS__)
#undef wxUSE_DEBUG_NEW_ALWAYS
#define wxUSE_DEBUG_NEW_ALWAYS 0
/* DS: Fixes compilation when wxUSE_ON_FATAL_EXCEPTION is 1 */
#ifndef wxTYPE_SA_HANDLER
#define wxTYPE_SA_HANDLER int
#endif
#endif
/*
* check graphics context option, must be on for every os x platform
* we only use core graphics now on all builds, try to catch attempts
* to configure the build otherwise and give error messages
*/
#if wxUSE_GUI && (!wxUSE_GRAPHICS_CONTEXT || \
( defined( wxMAC_USE_CORE_GRAPHICS ) && !wxMAC_USE_CORE_GRAPHICS ))
# error "OS X builds use CoreGraphics in this wx version, you cannot turn back to QuickDraw completely"
#endif
/*
* using mixins of cocoa functionality
*/
#ifdef __WXOSX_COCOA__
#define wxOSX_USE_COCOA 1
#else
#define wxOSX_USE_COCOA 0
#endif
#ifdef __WXOSX_CARBON__
#define wxOSX_USE_CARBON 1
#else
#define wxOSX_USE_CARBON 0
#endif
/*
* setting flags according to the platform
*/
#ifdef __LP64__
#if wxOSX_USE_COCOA == 0
#undef wxOSX_USE_COCOA
#define wxOSX_USE_COCOA 1
#endif
#define wxOSX_USE_CARBON 0
#define wxOSX_USE_IPHONE 0
#else
#ifdef __WXOSX_IPHONE__
#define wxOSX_USE_IPHONE 1
#else
#define wxOSX_USE_IPHONE 0
#endif
#endif
/*
* combination flags
*/
#if wxOSX_USE_COCOA || wxOSX_USE_CARBON
#define wxOSX_USE_COCOA_OR_CARBON 1
#else
#define wxOSX_USE_COCOA_OR_CARBON 0
#endif
#if wxOSX_USE_COCOA || wxOSX_USE_IPHONE
#define wxOSX_USE_COCOA_OR_IPHONE 1
#else
#define wxOSX_USE_COCOA_OR_IPHONE 0
#endif
#if wxOSX_USE_IPHONE
#include "wx/osx/iphone/chkconf.h"
#elif wxOSX_USE_CARBON
#include "wx/osx/carbon/chkconf.h"
#elif wxOSX_USE_COCOA
#include "wx/osx/cocoa/chkconf.h"
#endif
#endif // _WX_OSX_CHKCONF_H_