Rename all .cc files which include Objective-C headers to .mm.

This allows the Mac Make build to pass. We were hacking it in XCode with "-x objective-c++", but gyp/Make doesn't seem to accept that flag.

Also switch Objective-C #includes to #imports.

There is one file missing from this: vie_autotest_main.cc, because it's required on multiple platforms. I'm not immediately sure what the best approach is there, but the Objective-C headers should be somehow hidden.
Review URL: http://webrtc-codereview.appspot.com/153005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@726 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2011-10-11 15:43:35 +00:00
parent a0258defd4
commit 199f4defd3
11 changed files with 38 additions and 45 deletions

View File

@ -9,8 +9,8 @@
*/
#include "video_capture_qtkit.h"
#include "video_capture_qtkit_objc.h"
#include "video_capture_qtkit_info_objc.h"
#import "video_capture_qtkit_objc.h"
#import "video_capture_qtkit_info_objc.h"
#include "trace.h"
#include "critical_section_wrapper.h"
#include "../../video_capture_config.h"

View File

@ -10,7 +10,7 @@
#include "trace.h"
#include "../../video_capture_config.h"
#include "video_capture_qtkit_info_objc.h"
#import "video_capture_qtkit_info_objc.h"
#include "video_capture.h"

View File

@ -65,19 +65,16 @@
'Mac/QTKit/video_capture_qtkit_info_objc.h',
'Mac/QTKit/video_capture_qtkit_objc.h',
'Mac/QTKit/video_capture_qtkit_utility.h',
'Mac/video_capture_mac.cc',
'Mac/QTKit/video_capture_qtkit.cc',
'Mac/video_capture_mac.mm',
'Mac/QTKit/video_capture_qtkit.mm',
'Mac/QTKit/video_capture_qtkit_objc.mm',
'Mac/QTKit/video_capture_recursive_lock.mm',
'Mac/QTKit/video_capture_qtkit_info.cc',
'Mac/QTKit/video_capture_qtkit_info.mm',
'Mac/QTKit/video_capture_qtkit_info_objc.mm',
],
'include_dirs': [
'Mac',
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': '-x objective-c++',
},
'link_settings': {
'xcode_settings': {
'OTHER_LDFLAGS': [
@ -185,7 +182,7 @@
},
],
# Exclude the test targets when building with chromium.
'conditions': [
'conditions': [
['build_with_chromium==0', {
'targets': [
{
@ -244,6 +241,8 @@
}],
['OS=="mac"', {
'xcode_settings': {
# TODO(andrew): remove this. Shouldn't be needed when required
# files have proper .mm extensions.
'OTHER_CPLUSPLUSFLAGS': '-x objective-c++',
'OTHER_LDFLAGS': [
'-framework Foundation -framework AppKit -framework Cocoa -framework OpenGL -framework CoreVideo -framework CoreAudio -framework AudioToolbox',

View File

@ -14,18 +14,18 @@
#ifndef WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_NSOPENGL_H_
#define WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_NSOPENGL_H_
#include <Cocoa/Cocoa.h>
#import <Cocoa/Cocoa.h>
#import <OpenGL/OpenGL.h>
#import <OpenGL/glu.h>
#import <OpenGL/glext.h>
#include <QuickTime/QuickTime.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/glu.h>
#include <OpenGL/glext.h>
#include <list>
#include <map>
#include "video_render_defines.h"
#include "video_render_defines.h"
#import "cocoa_render_view.h"
#import "cocoa_full_screen_window.h"
#import "cocoa_render_view.h"
#import "cocoa_full_screen_window.h"
class Trace;

View File

@ -66,8 +66,8 @@
'linux/video_x11_channel.cc',
'linux/video_x11_render.cc',
# Mac
'mac/video_render_nsopengl.cc',
'mac/video_render_mac_cocoa_impl.cc',
'mac/video_render_nsopengl.mm',
'mac/video_render_mac_cocoa_impl.mm',
'mac/video_render_agl.cc',
'mac/video_render_mac_carbon_impl.cc',
'mac/cocoa_render_view.mm',
@ -79,8 +79,9 @@
# External
'external/video_render_external_impl.cc',
],
# TODO(andrew): with the proper suffix, these files will be excluded
# automatically.
'conditions': [
# DEFINE PLATFORM SPECIFIC SOURCE FILES
['OS!="linux" or build_with_chromium==1', {
'sources!': [
'linux/video_render_linux_impl.h',
@ -99,8 +100,8 @@
'mac/video_render_mac_carbon_impl.h',
'mac/video_render_mac_cocoa_impl.h',
'mac/video_render_nsopengl.h',
'mac/video_render_nsopengl.cc',
'mac/video_render_mac_cocoa_impl.cc',
'mac/video_render_nsopengl.mm',
'mac/video_render_mac_cocoa_impl.mm',
'mac/video_render_agl.cc',
'mac/video_render_mac_carbon_impl.cc',
'mac/cocoa_render_view.mm',
@ -118,36 +119,27 @@
'windows/video_render_windows_impl.cc',
],
}],
# DEFINE PLATFORM SPECIFIC INCLUDE AND CFLAGS
['OS=="mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': '-x objective-c++'
},
}],
] # conditions
}, # video_render_module
], # targets
# Exclude the test target when building with chromium.
'conditions': [
# Exclude the test target when building with chromium.
'conditions': [
['build_with_chromium==0', {
'targets': [
{
'target_name': 'video_render_module_test',
'type': 'executable',
'dependencies': [
'video_render_module',
'webrtc_utility',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/common_video/common_video.gyp:webrtc_vplib',
'video_render_module',
'webrtc_utility',
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/common_video/common_video.gyp:webrtc_vplib',
],
'include_dirs': [
],
'sources': [
# sources
'sources': [
'../test/testAPI/testAPI.cpp',
], # source
],
'conditions': [
# DEFINE PLATFORM SPECIFIC INCLUDE AND CFLAGS
['OS=="mac" or OS=="linux"', {
'cflags': [
'-Wno-write-strings',
@ -160,11 +152,13 @@
'libraries': [
'-lrt',
'-lXext',
'-lX11',
'-lX11',
],
}],
['OS=="mac"', {
'xcode_settings': {
# TODO(andrew): remove this. It shouldn't be needed when the
# required files have proper .mm extensions.
'OTHER_CPLUSPLUSFLAGS': '-x objective-c++',
'OTHER_LDFLAGS': [
'-framework Foundation -framework AppKit -framework Cocoa -framework OpenGL',

View File

@ -27,13 +27,11 @@
#elif defined (WEBRTC_ANDROID)
#include <android/log.h>
#include <string>
#elif defined(WEBRTC_LINUX)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#elif defined(WEBRTC_MAC_INTEL)
#import <Foundation/Foundation.h>
#endif
// Choose how to log

View File

@ -73,7 +73,7 @@
# Linux
'source/vie_autotest_linux.cc',
# Mac
'source/vie_autotest_mac_cocoa.cc',
'source/vie_autotest_mac_cocoa.mm',
'source/vie_autotest_mac_carbon.cc',
# Windows
'source/vie_autotest_windows.cc',
@ -121,6 +121,8 @@
}],
['OS=="mac"', {
'xcode_settings': {
# TODO(andrew): remove this when the issue with Objective-C in
# vie_autotest_main.cc is worked out.
'OTHER_CPLUSPLUSFLAGS': '-x objective-c++',
'OTHER_LDFLAGS': [
'-framework Foundation -framework AppKit -framework Cocoa -framework OpenGL -framework CoreVideo -framework CoreAudio -framework AudioToolbox',