Simplify OpenCL compile-time detection on OS X.
Turn wiiuse io_osx.m into Objective-C++. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6398 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a913295d70
commit
02edf66b49
|
@ -285,7 +285,6 @@ if(NOT APPLE)
|
||||||
include_directories(Externals/CLRun/include)
|
include_directories(Externals/CLRun/include)
|
||||||
add_subdirectory(Externals/CLRun)
|
add_subdirectory(Externals/CLRun)
|
||||||
add_definitions(-DUSE_CLRUN)
|
add_definitions(-DUSE_CLRUN)
|
||||||
add_definitions(-DHAVE_OPENCL=1)
|
|
||||||
endif(NOT APPLE)
|
endif(NOT APPLE)
|
||||||
|
|
||||||
set(DISABLE_WX FALSE CACHE BOOL "Disable wxWidgets (use CLI interface)")
|
set(DISABLE_WX FALSE CACHE BOOL "Disable wxWidgets (use CLI interface)")
|
||||||
|
|
23
SConstruct
23
SConstruct
|
@ -122,8 +122,11 @@ rev = utils.GenerateRevFile(env['flavor'], '.', None)
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
ccld = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5']
|
ccld = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5']
|
||||||
ccld += ['--sysroot=/Developer/SDKs/MacOSX10.5.sdk']
|
ccld += ['--sysroot=/Developer/SDKs/MacOSX10.5.sdk']
|
||||||
|
system = '/System/Library/Frameworks'
|
||||||
env['CCFLAGS'] += ccld
|
env['CCFLAGS'] += ccld
|
||||||
env['CCFLAGS'] += ['-msse3']
|
env['CCFLAGS'] += ['-msse3']
|
||||||
|
env['CCFLAGS'] += ['-iframework/Developer/SDKs/MacOSX10.5.sdk' + system]
|
||||||
|
env['CCFLAGS'] += ['-iframework/Developer/SDKs/MacOSX10.6.sdk' + system]
|
||||||
env['CC'] = "gcc-4.2 -ObjC"
|
env['CC'] = "gcc-4.2 -ObjC"
|
||||||
env['CXX'] = "g++-4.2 -ObjC++"
|
env['CXX'] = "g++-4.2 -ObjC++"
|
||||||
env['FRAMEWORKS'] += ['AppKit', 'CoreFoundation', 'CoreServices']
|
env['FRAMEWORKS'] += ['AppKit', 'CoreFoundation', 'CoreServices']
|
||||||
|
@ -132,19 +135,10 @@ if sys.platform == 'darwin':
|
||||||
env['LIBPATH'] += ['/usr/lib']
|
env['LIBPATH'] += ['/usr/lib']
|
||||||
env['LIBS'] = ['iconv', 'SDL']
|
env['LIBS'] = ['iconv', 'SDL']
|
||||||
env['LINKFLAGS'] += ccld
|
env['LINKFLAGS'] += ccld
|
||||||
env['LINKFLAGS'] += ['-Wl,-search_paths_first', '-Wl,-Z']
|
env['LINKFLAGS'] += ['-Wl,-search_paths_first', '-Wl,-Z', '-F' + system]
|
||||||
env['LINKFLAGS'] += ['-F/System/Library/Frameworks']
|
|
||||||
|
|
||||||
if platform.mac_ver()[0] < '10.6.0':
|
if platform.mac_ver()[0] >= '10.6.0':
|
||||||
env['HAVE_OPENCL'] = 0
|
|
||||||
else:
|
|
||||||
env['CCFLAGS'] += ['-Wextra-tokens', '-Wnewline-eof']
|
env['CCFLAGS'] += ['-Wextra-tokens', '-Wnewline-eof']
|
||||||
env['CCFLAGS'] += ['-iframework' +
|
|
||||||
'/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks']
|
|
||||||
env['CCFLAGS'] += ['-iframework' +
|
|
||||||
'/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks']
|
|
||||||
env['CPPDEFINES'] += [('HAVE_OPENCL', 1)]
|
|
||||||
env['HAVE_OPENCL'] = 1
|
|
||||||
env['FRAMEWORKSFLAGS'] = ['-weak_framework', 'OpenCL']
|
env['FRAMEWORKSFLAGS'] = ['-weak_framework', 'OpenCL']
|
||||||
|
|
||||||
if env['nowx']:
|
if env['nowx']:
|
||||||
|
@ -187,14 +181,15 @@ elif sys.platform == 'win32':
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
env['CCFLAGS'] += ['-fPIC', '-msse2']
|
env['CCFLAGS'] += ['-fPIC', '-msse2', '-pthread']
|
||||||
env['CPPDEFINES'] += ['HAVE_CONFIG_H']
|
env['CPPDEFINES'] += ['HAVE_CONFIG_H']
|
||||||
env['CPPPATH'].insert(0, '#') # Make sure we pick up our own config.h
|
env['CPPPATH'].insert(0, '#') # Make sure we pick up our own config.h
|
||||||
|
env['LINKFLAGS'] += ['-pthread']
|
||||||
|
env['RPATH'] = []
|
||||||
if sys.platform == 'linux2':
|
if sys.platform == 'linux2':
|
||||||
env['CPPDEFINES'] += [('_FILE_OFFSET_BITS', 64), '_LARGEFILE_SOURCE']
|
env['CPPDEFINES'] += [('_FILE_OFFSET_BITS', 64), '_LARGEFILE_SOURCE']
|
||||||
env['CXXFLAGS'] += ['-Wno-deprecated'] # XXX <hash_map>
|
env['CXXFLAGS'] += ['-Wno-deprecated'] # XXX <hash_map>
|
||||||
env['LINKFLAGS'] += ['-pthread', '-ldl']
|
env['LIBS'] += ['dl']
|
||||||
env['RPATH'] = []
|
|
||||||
|
|
||||||
conf = env.Configure(config_h = "#config.h", custom_tests = {
|
conf = env.Configure(config_h = "#config.h", custom_tests = {
|
||||||
'CheckPKG' : utils.CheckPKG,
|
'CheckPKG' : utils.CheckPKG,
|
||||||
|
|
|
@ -26,10 +26,17 @@
|
||||||
#define HAVE_OPENCL 1
|
#define HAVE_OPENCL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// We detect the presence of the 10.6 SDK, which has the OpenCL headers,
|
||||||
|
// by looking for the new blocks feature in the 10.6 version of gcc.
|
||||||
|
// This allows us to have the 10.5 SDK first in the search path.
|
||||||
|
#if defined __APPLE__ && defined __BLOCKS__
|
||||||
|
#define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER WEAK_IMPORT_ATTRIBUTE
|
||||||
|
#define HAVE_OPENCL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_OPENCL) && HAVE_OPENCL
|
#if defined(HAVE_OPENCL) && HAVE_OPENCL
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
|
|
||||||
#include <OpenCL/cl.h>
|
#include <OpenCL/cl.h>
|
||||||
#else
|
#else
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "Frame.h"
|
#include "Frame.h"
|
||||||
#include "HotkeyDlg.h"
|
#include "HotkeyDlg.h"
|
||||||
|
|
||||||
#include "../../Common/Src/OpenCL.h"
|
#include "OpenCL.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
|
@ -211,7 +211,7 @@ void Init(std::vector<ControllerInterface::Device*>& devices)
|
||||||
|
|
||||||
// Wait while current devices are initialized
|
// Wait while current devices are initialized
|
||||||
while (CFRunLoopRunInMode(OurRunLoop, 0, TRUE) ==
|
while (CFRunLoopRunInMode(OurRunLoop, 0, TRUE) ==
|
||||||
kCFRunLoopRunHandledSource);
|
kCFRunLoopRunHandledSource) {};
|
||||||
|
|
||||||
// Things should be configured now
|
// Things should be configured now
|
||||||
// Disable hotplugging and other scheduling
|
// Disable hotplugging and other scheduling
|
||||||
|
|
|
@ -31,11 +31,8 @@ set(SRCS Src/BPMemory.cpp
|
||||||
Src/VideoState.cpp
|
Src/VideoState.cpp
|
||||||
Src/XFBConvert.cpp
|
Src/XFBConvert.cpp
|
||||||
Src/XFMemory.cpp
|
Src/XFMemory.cpp
|
||||||
Src/XFStructs.cpp)
|
Src/XFStructs.cpp
|
||||||
|
Src/OpenCL/OCLTextureDecoder.cpp)
|
||||||
if(NOT APPLE)
|
|
||||||
set(SRCS ${SRCS} Src/OpenCL/OCLTextureDecoder.cpp)
|
|
||||||
endif(NOT APPLE)
|
|
||||||
|
|
||||||
add_library(videocommon STATIC ${SRCS})
|
add_library(videocommon STATIC ${SRCS})
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
|
|
|
@ -38,11 +38,7 @@ files = [
|
||||||
'OnScreenDisplay.cpp',
|
'OnScreenDisplay.cpp',
|
||||||
'HiresTextures.cpp',
|
'HiresTextures.cpp',
|
||||||
'DLCache.cpp',
|
'DLCache.cpp',
|
||||||
|
'OpenCL/OCLTextureDecoder.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
if env['HAVE_OPENCL']:
|
|
||||||
files += [
|
|
||||||
'OpenCL/OCLTextureDecoder.cpp',
|
|
||||||
]
|
|
||||||
|
|
||||||
env.StaticLibrary(env['local_libs'] + "videocommon", files)
|
env.StaticLibrary(env['local_libs'] + "videocommon", files)
|
||||||
|
|
|
@ -9,7 +9,7 @@ files = [
|
||||||
]
|
]
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
files += [ "io_osx.m" ]
|
files += [ "io_osx.mm" ]
|
||||||
elif sys.platform == 'linux2' and env['HAVE_BLUEZ']:
|
elif sys.platform == 'linux2' and env['HAVE_BLUEZ']:
|
||||||
files += [ "io_nix.cpp" ]
|
files += [ "io_nix.cpp" ]
|
||||||
elif sys.platform == 'win32':
|
elif sys.platform == 'win32':
|
||||||
|
@ -18,4 +18,3 @@ else:
|
||||||
files += [ "io_dummy.cpp" ]
|
files += [ "io_dummy.cpp" ]
|
||||||
|
|
||||||
env.StaticLibrary(env['local_libs'] + "wiiuse", files)
|
env.StaticLibrary(env['local_libs'] + "wiiuse", files)
|
||||||
env['CPPPATH'] += ['#Source/Core/wiiuse/Src']
|
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* wiiuse
|
|
||||||
*
|
|
||||||
* Written By:
|
|
||||||
* Michael Laforest < para >
|
|
||||||
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
|
|
||||||
*
|
|
||||||
* Copyright 2006-2007
|
|
||||||
*
|
|
||||||
* This file is part of wiiuse.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* $Header$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* @brief General definitions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DEFINITIONS_H_INCLUDED
|
|
||||||
#define DEFINITIONS_H_INCLUDED
|
|
||||||
|
|
||||||
#include <Common.h>
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <arpa/inet.h> /* htons() */
|
|
||||||
#else
|
|
||||||
/* disable warnings I don't care about */
|
|
||||||
#pragma warning(disable:4244) /* possible loss of data conversion */
|
|
||||||
#pragma warning(disable:4273) /* inconsistent dll linkage */
|
|
||||||
#pragma warning(disable:4217)
|
|
||||||
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
/* Convert to big endian */
|
|
||||||
#define BIG_ENDIAN_LONG(i) (htonl(i))
|
|
||||||
#define BIG_ENDIAN_SHORT(i) (htons(i))
|
|
||||||
|
|
||||||
#endif // DEFINITIONS_H_INCLUDED
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "definitions.h"
|
#include "Common.h"
|
||||||
#include "wiiuse_internal.h"
|
#include "wiiuse_internal.h"
|
||||||
|
|
||||||
int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
|
int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <bluetooth/hci_lib.h>
|
#include <bluetooth/hci_lib.h>
|
||||||
#include <bluetooth/l2cap.h>
|
#include <bluetooth/l2cap.h>
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "Common.h"
|
||||||
#include "wiiuse_internal.h"
|
#include "wiiuse_internal.h"
|
||||||
|
|
||||||
static int wiiuse_connect_single(struct wiimote_t* wm, char* address);
|
static int wiiuse_connect_single(struct wiimote_t* wm, char* address);
|
||||||
|
|
|
@ -32,14 +32,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <CoreServices/CoreServices.h>
|
#import <CoreServices/CoreServices.h>
|
||||||
extern OSErr UpdateSystemActivity(UInt8 activity);
|
extern "C" OSErr UpdateSystemActivity(UInt8 activity);
|
||||||
#define BLUETOOTH_VERSION_USE_CURRENT
|
#define BLUETOOTH_VERSION_USE_CURRENT
|
||||||
#import <IOBluetooth/objc/IOBluetoothDevice.h>
|
#import <IOBluetooth/objc/IOBluetoothDevice.h>
|
||||||
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
|
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
|
||||||
#import <IOBluetooth/objc/IOBluetoothHostController.h>
|
#import <IOBluetooth/objc/IOBluetoothHostController.h>
|
||||||
#import <IOBluetooth/objc/IOBluetoothL2CAPChannel.h>
|
#import <IOBluetooth/objc/IOBluetoothL2CAPChannel.h>
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "Common.h"
|
||||||
#include "wiiuse_internal.h"
|
#include "wiiuse_internal.h"
|
||||||
|
|
||||||
static int wiiuse_connect_single(struct wiimote_t *wm, char *address);
|
static int wiiuse_connect_single(struct wiimote_t *wm, char *address);
|
||||||
|
@ -49,7 +49,7 @@ IOBluetoothL2CAPChannel *ichan;
|
||||||
IOBluetoothL2CAPChannel *cchan;
|
IOBluetoothL2CAPChannel *cchan;
|
||||||
|
|
||||||
#define QUEUE_SIZE 64
|
#define QUEUE_SIZE 64
|
||||||
volatile struct buffer {
|
struct buffer {
|
||||||
char data[MAX_PAYLOAD];
|
char data[MAX_PAYLOAD];
|
||||||
int len;
|
int len;
|
||||||
} queue[QUEUE_SIZE];
|
} queue[QUEUE_SIZE];
|
|
@ -40,11 +40,9 @@
|
||||||
#include <dbt.h>
|
#include <dbt.h>
|
||||||
#include <setupapi.h>
|
#include <setupapi.h>
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "Common.h"
|
||||||
#include "wiiuse_internal.h"
|
#include "wiiuse_internal.h"
|
||||||
|
|
||||||
#include <Common.h>
|
|
||||||
|
|
||||||
typedef struct _HIDD_ATTRIBUTES {
|
typedef struct _HIDD_ATTRIBUTES {
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
USHORT VendorID;
|
USHORT VendorID;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "Common.h"
|
||||||
#include "wiiuse_internal.h"
|
#include "wiiuse_internal.h"
|
||||||
|
|
||||||
static int get_ir_sens(struct wiimote_t* wm, const char** block1, const char** block2);
|
static int get_ir_sens(struct wiimote_t* wm, const char** block1, const char** block2);
|
||||||
|
|
|
@ -45,10 +45,9 @@
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "Common.h"
|
||||||
#include "wiiuse_internal.h"
|
#include "wiiuse_internal.h"
|
||||||
|
|
||||||
|
|
||||||
static int g_banner = 1;
|
static int g_banner = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,7 +300,7 @@ int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* the offset is in big endian */
|
/* the offset is in big endian */
|
||||||
*(int*)(buf) = BIG_ENDIAN_LONG(addr);
|
*(int*)(buf) = Common::swap32(addr); /* XXX only if little-endian */
|
||||||
|
|
||||||
/* length */
|
/* length */
|
||||||
*(byte*)(buf + 4) = len;
|
*(byte*)(buf + 4) = len;
|
||||||
|
|
Loading…
Reference in New Issue