summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2013-04-01 18:17:49 +0200
committerPierre Bourdon <delroth@gmail.com>2013-04-01 18:17:49 +0200
commit49d809ac0edd21f77ea6203481bfa680a72b9aa2 (patch)
treebbf8bed504bfb6762a579741b824fd0eb0d0af8d
parent58159a1693ebb9b33b6e1b97a83a2f58f0046623 (diff)
parent4d27315cd1c0de85df93bfa859d19741483c06ea (diff)
Merge branch 'osx-libcxx'
-rw-r--r--CMakeLists.txt16
-rwxr-xr-xExternals/wxWidgets3/build_wx.sh4
-rw-r--r--Externals/wxWidgets3/wx/wxcocoa.h28
-rw-r--r--Source/Core/Common/Src/LogManager.h2
-rw-r--r--Source/Core/Common/Src/StdConditionVariable.h17
-rw-r--r--Source/Core/Common/Src/StdMutex.h7
-rw-r--r--Source/Core/Common/Src/StdThread.h7
-rw-r--r--Source/Core/Common/Src/Thread.h4
-rw-r--r--Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h6
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp11
10 files changed, 64 insertions, 38 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29e41047a1..13688ae5fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -168,8 +168,8 @@ if(APPLE)
set(ENV{PATH} /usr/bin:/bin:/usr/sbin:/sbin)
# Some of our code contains Objective C constructs.
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_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++ -stdlib=libc++")
# 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")
@@ -180,10 +180,10 @@ if(APPLE)
# This is inserted into the Info.plist as well.
# Note that the SDK determines the maximum version of which optional
# 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(SYSROOT_LEGACY_PATH "/Developer/SDKs/MacOSX10.6.sdk")
- set(SYSROOT_PATH "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/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.7.sdk")
if(EXISTS "${SYSROOT_PATH}/")
set(TARGET_SYSROOT ${SYSROOT_PATH})
elseif(EXISTS "${SYSROOT_LEGACY_PATH}/")
@@ -197,8 +197,8 @@ if(APPLE)
# This avoids a warning when linking with QuickTime.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_arch_warnings")
# Specify target CPUs.
- set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_x86_64 -mssse3")
- set(TARGET_FLAGS "${TARGET_FLAGS} -Xarch_x86_64 -march=core2")
+ set(TARGET_FLAGS "${TARGET_FLAGS} -mssse3")
+ set(TARGET_FLAGS "${TARGET_FLAGS} -march=core2")
# Target flags apply to both C and C++ compilation.
# CMake passes these to the compiler on the link command line as well.
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")
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)
endif(CMAKE_BUILD_TYPE STREQUAL Release)
diff --git a/Externals/wxWidgets3/build_wx.sh b/Externals/wxWidgets3/build_wx.sh
index 2173572bfa..82670d6e9f 100755
--- a/Externals/wxWidgets3/build_wx.sh
+++ b/Externals/wxWidgets3/build_wx.sh
@@ -5,7 +5,9 @@ cd wxWidgets
case $OSTYPE in
darwin*)
+export CC=clang CXX=clang++ CFLAGS="-stdlib=libc++" CXXFLAGS="-stdlib=libc++" CPPFLAGS="-stdlib=libc++"
BACKEND="osx_cocoa"
+ADD_OPTS=--with-macosx-version-min=10.7 --enable-stl
;;
linux*)
BACKEND="gtk"
@@ -15,5 +17,5 @@ esac
mkdir 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
diff --git a/Externals/wxWidgets3/wx/wxcocoa.h b/Externals/wxWidgets3/wx/wxcocoa.h
index 841d17e949..33a19cda5b 100644
--- a/Externals/wxWidgets3/wx/wxcocoa.h
+++ b/Externals/wxWidgets3/wx/wxcocoa.h
@@ -16,7 +16,7 @@
#endif /* __cplusplus */
/* 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 */
#define wxINSTALL_PREFIX "/usr/local"
@@ -205,7 +205,7 @@
-#define wxUSE_STL 0
+#define wxUSE_STL 1
#if defined(__DMC__) || defined(__WATCOMC__) \
|| (defined(_MSC_VER) && _MSC_VER < 1200)
@@ -214,7 +214,7 @@
#define wxUSE_STD_DEFAULT 0
#endif
-#define wxUSE_STD_CONTAINERS 0
+#define wxUSE_STD_CONTAINERS 1
#define wxUSE_STD_IOSTREAM 1
@@ -715,7 +715,7 @@
/*
* 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>
*/
@@ -736,12 +736,12 @@
/*
* 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
*/
-/* #undef HAVE_STD_UNORDERED_SET */
+#define HAVE_STD_UNORDERED_SET 1
/*
* Define if your compiler has std::tr1::unordered_map
@@ -756,12 +756,12 @@
/*
* 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>
*/
-/* #undef HAVE_TYPE_TRAITS */
+#define HAVE_TYPE_TRAITS 1
/*
* Define if the compiler supports simple visibility declarations.
@@ -830,7 +830,7 @@
/*
* 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.
*/
@@ -996,25 +996,25 @@
#define HAVE_USLEEP 1
/* Define if you have wcscasecmp() function */
-/* #undef HAVE_WCSCASECMP 1 */
+#define HAVE_WCSCASECMP 1
/* Define if you have wcsncasecmp() function */
-/* #undef HAVE_WCSNCASECMP 1 */
+#define HAVE_WCSNCASECMP 1
/* Define if you have wcslen function */
#define HAVE_WCSLEN 1
/* Define if you have wcsdup function */
-/* #undef HAVE_WCSDUP 1 */
+#define HAVE_WCSDUP 1
/* Define if you have wcsftime() function */
#define HAVE_WCSFTIME 1
/* Define if you have strnlen() function */
-/* #undef HAVE_STRNLEN 1 */
+#define HAVE_STRNLEN 1
/* Define if you have wcsnlen() function */
-/* #undef HAVE_WCSNLEN 1 */
+#define HAVE_WCSNLEN 1
/* Define if you have wcstoull() and wcstoll() */
/* #undef HAVE_WCSTOULL */
diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h
index f7ccb15034..9c3855982e 100644
--- a/Source/Core/Common/Src/LogManager.h
+++ b/Source/Core/Common/Src/LogManager.h
@@ -46,7 +46,7 @@ public:
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; }
void SetEnable(bool enable) { m_enable = enable; }
diff --git a/Source/Core/Common/Src/StdConditionVariable.h b/Source/Core/Common/Src/StdConditionVariable.h
index 6530712c8f..85875fef10 100644
--- a/Source/Core/Common/Src/StdConditionVariable.h
+++ b/Source/Core/Common/Src/StdConditionVariable.h
@@ -5,9 +5,26 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#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
+
// GCC 4.4 provides <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
// partial std::condition_variable implementation for win32/pthread
diff --git a/Source/Core/Common/Src/StdMutex.h b/Source/Core/Common/Src/StdMutex.h
index 8a5d22f928..a20c7f744a 100644
--- a/Source/Core/Common/Src/StdMutex.h
+++ b/Source/Core/Common/Src/StdMutex.h
@@ -5,9 +5,16 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#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
// GCC 4.4 provides <mutex>
#include <mutex>
+#elif __has_include(<mutex>)
+// Clang + libc++
+#include <mutex>
#else
// partial <mutex> implementation for win32/pthread
diff --git a/Source/Core/Common/Src/StdThread.h b/Source/Core/Common/Src/StdThread.h
index 8893c36204..19dfd60c37 100644
--- a/Source/Core/Common/Src/StdThread.h
+++ b/Source/Core/Common/Src/StdThread.h
@@ -5,12 +5,19 @@
#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
#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
// GCC 4.4 provides <thread>
#ifndef _GLIBCXX_USE_SCHED_YIELD
#define _GLIBCXX_USE_SCHED_YIELD
#endif
#include <thread>
+#elif __has_include(<thread>)
+// Clang + libc++
+#include <thread>
#else
// partial std::thread implementation for win32/pthread
diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h
index b5f899c43b..e35e73dbe9 100644
--- a/Source/Core/Common/Src/Thread.h
+++ b/Source/Core/Common/Src/Thread.h
@@ -18,9 +18,9 @@
#ifndef _THREAD_H_
#define _THREAD_H_
-#include "StdThread.h"
-#include "StdMutex.h"
#include "StdConditionVariable.h"
+#include "StdMutex.h"
+#include "StdThread.h"
// Don't include common.h here as it will break LogManager
#include "CommonTypes.h"
diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h
index 8fd2a2af5f..40466a81dd 100644
--- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h
+++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h
@@ -75,7 +75,7 @@ public:
virtual void DoState(PointerWrap& p);
// Needed because StdThread.h std::thread implem does not support member
- // pointers.
+ // pointers. TODO(delroth): obsolete.
static void SpawnAXThread(CUCode_AX* self);
protected:
@@ -107,13 +107,13 @@ protected:
volatile u16 m_cmdlist[512];
volatile u32 m_cmdlist_size;
- std::thread m_axthread;
-
// Sync objects
std::mutex m_processing;
std::condition_variable m_cmdlist_cv;
std::mutex m_cmdlist_mutex;
+ std::thread m_axthread;
+
// Copy a command list from memory to our temp buffer
void CopyCmdList(u32 addr, u16 size);
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index 85fe8d0225..4272d9ef90 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -18,6 +18,7 @@
#include <string> // System
#include <vector>
#include <algorithm>
+#include <functional>
#include <wx/spinbutt.h>
#include "Common.h"
@@ -43,14 +44,6 @@
#include "Main.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)
struct CPUCore
@@ -631,7 +624,7 @@ void CConfigMain::CreateGUIControls()
theme_selection->SetStringSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name);
// 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();
main_frame->InitBitmaps();