Merge branch 'osx-libcxx'

This commit is contained in:
Pierre Bourdon 2013-04-01 18:17:49 +02:00
commit 49d809ac0e
10 changed files with 64 additions and 38 deletions

View File

@ -168,8 +168,8 @@ if(APPLE)
set(ENV{PATH} /usr/bin:/bin:/usr/sbin:/sbin) set(ENV{PATH} /usr/bin:/bin:/usr/sbin:/sbin)
# Some of our code contains Objective C constructs. # Some of our code contains Objective C constructs.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++ -stdlib=libc++")
# Avoid mistaking an object file for a source file on the link command line. # Avoid mistaking an object file for a source file on the link command line.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none")
@ -180,10 +180,10 @@ if(APPLE)
# This is inserted into the Info.plist as well. # This is inserted into the Info.plist as well.
# Note that the SDK determines the maximum version of which optional # Note that the SDK determines the maximum version of which optional
# features can be used, not the minimum required version to run. # features can be used, not the minimum required version to run.
set(OSX_MIN_VERSION "10.5.4") set(OSX_MIN_VERSION "10.7")
set(TARGET_FLAGS "${TARGET_FLAGS} -mmacosx-version-min=${OSX_MIN_VERSION}") set(TARGET_FLAGS "${TARGET_FLAGS} -mmacosx-version-min=${OSX_MIN_VERSION}")
set(SYSROOT_LEGACY_PATH "/Developer/SDKs/MacOSX10.6.sdk") set(SYSROOT_LEGACY_PATH "/Developer/SDKs/MacOSX10.7.sdk")
set(SYSROOT_PATH "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk") set(SYSROOT_PATH "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk")
if(EXISTS "${SYSROOT_PATH}/") if(EXISTS "${SYSROOT_PATH}/")
set(TARGET_SYSROOT ${SYSROOT_PATH}) set(TARGET_SYSROOT ${SYSROOT_PATH})
elseif(EXISTS "${SYSROOT_LEGACY_PATH}/") elseif(EXISTS "${SYSROOT_LEGACY_PATH}/")
@ -197,8 +197,8 @@ if(APPLE)
# This avoids a warning when linking with QuickTime. # This avoids a warning when linking with QuickTime.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_arch_warnings") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_arch_warnings")
# Specify target CPUs. # Specify target CPUs.
set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_x86_64 -mssse3") set(TARGET_FLAGS "${TARGET_FLAGS} -mssse3")
set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_x86_64 -march=core2") set(TARGET_FLAGS "${TARGET_FLAGS} -march=core2")
# Target flags apply to both C and C++ compilation. # Target flags apply to both C and C++ compilation.
# CMake passes these to the compiler on the link command line as well. # CMake passes these to the compiler on the link command line as well.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
@ -247,7 +247,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(wxWidgets_USE_DEBUG ON CACHE BOOL "Use wxWidgets Debugging") set(wxWidgets_USE_DEBUG ON CACHE BOOL "Use wxWidgets Debugging")
endif(CMAKE_BUILD_TYPE STREQUAL Debug) endif(CMAKE_BUILD_TYPE STREQUAL Debug)
if(CMAKE_BUILD_TYPE STREQUAL Release) if(CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE)
add_definitions(-fomit-frame-pointer) add_definitions(-fomit-frame-pointer)
endif(CMAKE_BUILD_TYPE STREQUAL Release) endif(CMAKE_BUILD_TYPE STREQUAL Release)

View File

@ -5,7 +5,9 @@ cd wxWidgets
case $OSTYPE in case $OSTYPE in
darwin*) darwin*)
export CC=clang CXX=clang++ CFLAGS="-stdlib=libc++" CXXFLAGS="-stdlib=libc++" CPPFLAGS="-stdlib=libc++"
BACKEND="osx_cocoa" BACKEND="osx_cocoa"
ADD_OPTS=--with-macosx-version-min=10.7 --enable-stl
;; ;;
linux*) linux*)
BACKEND="gtk" BACKEND="gtk"
@ -15,5 +17,5 @@ esac
mkdir build-local mkdir build-local
cd build-local cd build-local
../configure --with-$BACKEND --disable-shared --enable-unicode --disable-compat28 --disable-exceptions --disable-fswatcher --without-regex --without-expat --disable-xml --disable-ribbon --disable-propgrid --disable-stc --disable-html --disable-richtext --without-libjpeg --without-libtiff --disable-webview --disable-markup ../configure --with-$BACKEND --disable-shared --enable-unicode --disable-compat28 --disable-exceptions --disable-fswatcher --without-regex --without-expat --disable-xml --disable-ribbon --disable-propgrid --disable-stc --disable-html --disable-richtext --without-libjpeg --without-libtiff --disable-webview --disable-markup $ADD_OPTS
make make

View File

@ -16,7 +16,7 @@
#endif /* __cplusplus */ #endif /* __cplusplus */
/* fill in with the string wxGetOsDescription() will return */ /* fill in with the string wxGetOsDescription() will return */
#define WXWIN_OS_DESCRIPTION "Darwin 11.3.0 i386" #define WXWIN_OS_DESCRIPTION "Darwin 11.4.2 x86_64"
/* the installation location prefix from configure */ /* the installation location prefix from configure */
#define wxINSTALL_PREFIX "/usr/local" #define wxINSTALL_PREFIX "/usr/local"
@ -205,7 +205,7 @@
#define wxUSE_STL 0 #define wxUSE_STL 1
#if defined(__DMC__) || defined(__WATCOMC__) \ #if defined(__DMC__) || defined(__WATCOMC__) \
|| (defined(_MSC_VER) && _MSC_VER < 1200) || (defined(_MSC_VER) && _MSC_VER < 1200)
@ -214,7 +214,7 @@
#define wxUSE_STD_DEFAULT 0 #define wxUSE_STD_DEFAULT 0
#endif #endif
#define wxUSE_STD_CONTAINERS 0 #define wxUSE_STD_CONTAINERS 1
#define wxUSE_STD_IOSTREAM 1 #define wxUSE_STD_IOSTREAM 1
@ -715,7 +715,7 @@
/* /*
* Define if your compiler has compliant std::string::compare * Define if your compiler has compliant std::string::compare
*/ */
/* #undef HAVE_STD_STRING_COMPARE */ #define HAVE_STD_STRING_COMPARE 1
/* /*
* Define if your compiler has <hash_map> * Define if your compiler has <hash_map>
*/ */
@ -736,12 +736,12 @@
/* /*
* Define if your compiler has std::unordered_map * Define if your compiler has std::unordered_map
*/ */
/* #undef HAVE_STD_UNORDERED_MAP */ #define HAVE_STD_UNORDERED_MAP 1
/* /*
* Define if your compiler has std::unordered_set * Define if your compiler has std::unordered_set
*/ */
/* #undef HAVE_STD_UNORDERED_SET */ #define HAVE_STD_UNORDERED_SET 1
/* /*
* Define if your compiler has std::tr1::unordered_map * Define if your compiler has std::tr1::unordered_map
@ -756,12 +756,12 @@
/* /*
* Define if your compiler has <tr1/type_traits> * Define if your compiler has <tr1/type_traits>
*/ */
#define HAVE_TR1_TYPE_TRAITS 1 /* #undef HAVE_TR1_TYPE_TRAITS */
/* /*
* Define if your compiler has <type_traits> * Define if your compiler has <type_traits>
*/ */
/* #undef HAVE_TYPE_TRAITS */ #define HAVE_TYPE_TRAITS 1
/* /*
* Define if the compiler supports simple visibility declarations. * Define if the compiler supports simple visibility declarations.
@ -830,7 +830,7 @@
/* /*
* Define if compiler has __thread keyword. * Define if compiler has __thread keyword.
*/ */
/* #undef HAVE___THREAD_KEYWORD */ #define HAVE___THREAD_KEYWORD 1
/* /*
* Define if large (64 bit file offsets) files are supported. * Define if large (64 bit file offsets) files are supported.
*/ */
@ -996,25 +996,25 @@
#define HAVE_USLEEP 1 #define HAVE_USLEEP 1
/* Define if you have wcscasecmp() function */ /* Define if you have wcscasecmp() function */
/* #undef HAVE_WCSCASECMP 1 */ #define HAVE_WCSCASECMP 1
/* Define if you have wcsncasecmp() function */ /* Define if you have wcsncasecmp() function */
/* #undef HAVE_WCSNCASECMP 1 */ #define HAVE_WCSNCASECMP 1
/* Define if you have wcslen function */ /* Define if you have wcslen function */
#define HAVE_WCSLEN 1 #define HAVE_WCSLEN 1
/* Define if you have wcsdup function */ /* Define if you have wcsdup function */
/* #undef HAVE_WCSDUP 1 */ #define HAVE_WCSDUP 1
/* Define if you have wcsftime() function */ /* Define if you have wcsftime() function */
#define HAVE_WCSFTIME 1 #define HAVE_WCSFTIME 1
/* Define if you have strnlen() function */ /* Define if you have strnlen() function */
/* #undef HAVE_STRNLEN 1 */ #define HAVE_STRNLEN 1
/* Define if you have wcsnlen() function */ /* Define if you have wcsnlen() function */
/* #undef HAVE_WCSNLEN 1 */ #define HAVE_WCSNLEN 1
/* Define if you have wcstoull() and wcstoll() */ /* Define if you have wcstoull() and wcstoll() */
/* #undef HAVE_WCSTOULL */ /* #undef HAVE_WCSTOULL */

View File

@ -46,7 +46,7 @@ public:
void Log(LogTypes::LOG_LEVELS, const char *msg); void Log(LogTypes::LOG_LEVELS, const char *msg);
bool IsValid() { return (m_logfile != NULL); } bool IsValid() { return (bool)m_logfile; }
bool IsEnabled() const { return m_enable; } bool IsEnabled() const { return m_enable; }
void SetEnable(bool enable) { m_enable = enable; } void SetEnable(bool enable) { m_enable = enable; }

View File

@ -5,9 +5,26 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
#define __has_include(s) 0
#endif
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID #if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <condition_variable> // GCC 4.4 provides <condition_variable>
#include <condition_variable> #include <condition_variable>
#elif __has_include(<condition_variable>)
// clang and libc++ provide <condition_variable> on OSX. However, the version
// of libc++ bundled with OSX 10.7 and 10.8 is buggy: it uses _ as a variable.
//
// We work around this issue by undefining and redefining _.
#undef _
#include <condition_variable>
#define _(s) wxGetTranslation((s))
#else #else
// partial std::condition_variable implementation for win32/pthread // partial std::condition_variable implementation for win32/pthread

View File

@ -5,9 +5,16 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
#define __has_include(s) 0
#endif
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID #if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <mutex> // GCC 4.4 provides <mutex>
#include <mutex> #include <mutex>
#elif __has_include(<mutex>)
// Clang + libc++
#include <mutex>
#else #else
// partial <mutex> implementation for win32/pthread // partial <mutex> implementation for win32/pthread

View File

@ -5,12 +5,19 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#ifndef __has_include
#define __has_include(s) 0
#endif
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID #if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID
// GCC 4.4 provides <thread> // GCC 4.4 provides <thread>
#ifndef _GLIBCXX_USE_SCHED_YIELD #ifndef _GLIBCXX_USE_SCHED_YIELD
#define _GLIBCXX_USE_SCHED_YIELD #define _GLIBCXX_USE_SCHED_YIELD
#endif #endif
#include <thread> #include <thread>
#elif __has_include(<thread>)
// Clang + libc++
#include <thread>
#else #else
// partial std::thread implementation for win32/pthread // partial std::thread implementation for win32/pthread

View File

@ -18,9 +18,9 @@
#ifndef _THREAD_H_ #ifndef _THREAD_H_
#define _THREAD_H_ #define _THREAD_H_
#include "StdThread.h"
#include "StdMutex.h"
#include "StdConditionVariable.h" #include "StdConditionVariable.h"
#include "StdMutex.h"
#include "StdThread.h"
// Don't include common.h here as it will break LogManager // Don't include common.h here as it will break LogManager
#include "CommonTypes.h" #include "CommonTypes.h"

View File

@ -75,7 +75,7 @@ public:
virtual void DoState(PointerWrap& p); virtual void DoState(PointerWrap& p);
// Needed because StdThread.h std::thread implem does not support member // Needed because StdThread.h std::thread implem does not support member
// pointers. // pointers. TODO(delroth): obsolete.
static void SpawnAXThread(CUCode_AX* self); static void SpawnAXThread(CUCode_AX* self);
protected: protected:
@ -107,13 +107,13 @@ protected:
volatile u16 m_cmdlist[512]; volatile u16 m_cmdlist[512];
volatile u32 m_cmdlist_size; volatile u32 m_cmdlist_size;
std::thread m_axthread;
// Sync objects // Sync objects
std::mutex m_processing; std::mutex m_processing;
std::condition_variable m_cmdlist_cv; std::condition_variable m_cmdlist_cv;
std::mutex m_cmdlist_mutex; std::mutex m_cmdlist_mutex;
std::thread m_axthread;
// Copy a command list from memory to our temp buffer // Copy a command list from memory to our temp buffer
void CopyCmdList(u32 addr, u16 size); void CopyCmdList(u32 addr, u16 size);

View File

@ -18,6 +18,7 @@
#include <string> // System #include <string> // System
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <functional>
#include <wx/spinbutt.h> #include <wx/spinbutt.h>
#include "Common.h" #include "Common.h"
@ -43,14 +44,6 @@
#include "Main.h" #include "Main.h"
#include "VideoBackendBase.h" #include "VideoBackendBase.h"
#if defined(__APPLE__)
#include <tr1/functional>
using std::tr1::function;
#else
#include <functional>
using std::function;
#endif
#define TEXT_BOX(page, text) new wxStaticText(page, wxID_ANY, text, wxDefaultPosition, wxDefaultSize) #define TEXT_BOX(page, text) new wxStaticText(page, wxID_ANY, text, wxDefaultPosition, wxDefaultSize)
struct CPUCore struct CPUCore
@ -631,7 +624,7 @@ void CConfigMain::CreateGUIControls()
theme_selection->SetStringSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name); theme_selection->SetStringSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name);
// std::function = avoid error on msvc // std::function = avoid error on msvc
theme_selection->Bind(wxEVT_COMMAND_CHOICE_SELECTED, function<void(wxEvent&)>([theme_selection](wxEvent&) theme_selection->Bind(wxEVT_COMMAND_CHOICE_SELECTED, std::function<void(wxEvent&)>([theme_selection](wxEvent&)
{ {
SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name = theme_selection->GetStringSelection(); SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name = theme_selection->GetStringSelection();
main_frame->InitBitmaps(); main_frame->InitBitmaps();