From b352700ff7ec57ea6532d4088d91d808245d5738 Mon Sep 17 00:00:00 2001 From: "leozwang@google.com" Date: Tue, 26 Jul 2011 17:29:38 +0000 Subject: [PATCH] Clean up ANDROID macro definitions [system_wrapper] Review URL: http://webrtc-codereview.appspot.com/94001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@257 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/system_wrappers/source/Android.mk | 44 ++++++++------------ src/system_wrappers/source/aligned_malloc.cc | 2 +- src/system_wrappers/source/cpu.cc | 6 +-- src/system_wrappers/source/rw_lock.cc | 4 +- src/system_wrappers/source/thread_linux.cc | 8 ++-- src/system_wrappers/source/trace_linux.cc | 2 +- 6 files changed, 28 insertions(+), 38 deletions(-) diff --git a/src/system_wrappers/source/Android.mk b/src/system_wrappers/source/Android.mk index f8e406f99..784421a22 100644 --- a/src/system_wrappers/source/Android.mk +++ b/src/system_wrappers/source/Android.mk @@ -1,4 +1,10 @@ -# This file is generated by gyp; do not edit. This means you! +# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. LOCAL_PATH := $(call my-dir) @@ -8,7 +14,6 @@ LOCAL_ARM_MODE := arm LOCAL_MODULE := libwebrtc_system_wrappers LOCAL_MODULE_TAGS := optional LOCAL_CPP_EXTENSION := .cc -LOCAL_GENERATED_SOURCES := LOCAL_SRC_FILES := \ map.cc \ rw_lock_generic.cc \ @@ -33,35 +38,20 @@ LOCAL_SRC_FILES := \ trace_linux.cc \ rw_lock_linux.cc -# Flags passed to both C and C++ files. -MY_CFLAGS := -MY_CFLAGS_C := -MY_DEFS := '-DNO_TCMALLOC' \ - '-DNO_HEAPCHECKER' \ - '-DWEBRTC_TARGET_PC' \ - '-DWEBRTC_LINUX' \ - '-DWEBRTC_CLOCK_TYPE_REALTIME' \ - '-DWEBRTC_THREAD_RR' \ - '-DWEBRTC_ANDROID' \ - '-DANDROID' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) +LOCAL_CFLAGS := \ + $(MY_WEBRTC_COMMON_DEFS) -# Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../.. \ - $(LOCAL_PATH)/spreadsortlib \ - $(LOCAL_PATH)/../interface +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../.. \ + $(LOCAL_PATH)/../interface \ + $(LOCAL_PATH)/spreadsortlib -# Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := - -LOCAL_LDFLAGS := - -LOCAL_STATIC_LIBRARIES := - -LOCAL_SHARED_LIBRARIES := libcutils \ +LOCAL_SHARED_LIBRARIES := \ + libcutils \ libdl \ libstlport -LOCAL_ADDITIONAL_DEPENDENCIES := +ifndef NDK_ROOT include external/stlport/libstlport.mk +endif include $(BUILD_STATIC_LIBRARY) diff --git a/src/system_wrappers/source/aligned_malloc.cc b/src/system_wrappers/source/aligned_malloc.cc index 62257533e..bb10c6bb4 100644 --- a/src/system_wrappers/source/aligned_malloc.cc +++ b/src/system_wrappers/source/aligned_malloc.cc @@ -13,7 +13,7 @@ #include #include -#ifdef ANDROID +#ifdef WEBRTC_ANDROID #include #endif diff --git a/src/system_wrappers/source/cpu.cc b/src/system_wrappers/source/cpu.cc index 228587272..56dbfbde2 100644 --- a/src/system_wrappers/source/cpu.cc +++ b/src/system_wrappers/source/cpu.cc @@ -20,7 +20,7 @@ #include "cpu_mac.h" #elif defined(WEBRTC_MAC_INTEL) #include "cpu_mac.h" -#elif defined(ANDROID) +#elif defined(WEBRTC_ANDROID) // Not implemented yet, might be possible to use Linux implementation #else // defined(WEBRTC_LINUX) #include @@ -43,7 +43,7 @@ WebRtc_UWord32 CpuWrapper::DetectNumberOfCores() WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1, "Available number of cores:%d", _numberOfCores); -#elif defined(WEBRTC_LINUX) && !defined(ANDROID) +#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) _numberOfCores = get_nprocs(); WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1, "Available number of cores:%d", _numberOfCores); @@ -78,7 +78,7 @@ CpuWrapper* CpuWrapper::CreateCpu() return new CpuWindows(); #elif (defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)) return new CpuWrapperMac(); -#elif defined(ANDROID) +#elif defined(WEBRTC_ANDROID) return 0; #else return new CpuLinux(); diff --git a/src/system_wrappers/source/rw_lock.cc b/src/system_wrappers/source/rw_lock.cc index 47901d346..922f73b7b 100644 --- a/src/system_wrappers/source/rw_lock.cc +++ b/src/system_wrappers/source/rw_lock.cc @@ -14,7 +14,7 @@ #if defined(_WIN32) #include "rw_lock_windows.h" -#elif defined(ANDROID) +#elif defined(WEBRTC_ANDROID) #include #include "rw_lock_generic.h" #else @@ -26,7 +26,7 @@ RWLockWrapper* RWLockWrapper::CreateRWLock() { #ifdef _WIN32 RWLockWrapper* lock = new RWLockWindows(); -#elif defined(ANDROID) +#elif defined(WEBRTC_ANDROID) RWLockWrapper* lock = new RWLockWrapperGeneric(); #else RWLockWrapper* lock = new RWLockLinux(); diff --git a/src/system_wrappers/source/thread_linux.cc b/src/system_wrappers/source/thread_linux.cc index 1281c1b0d..f871a1f35 100644 --- a/src/system_wrappers/source/thread_linux.cc +++ b/src/system_wrappers/source/thread_linux.cc @@ -35,7 +35,7 @@ extern "C" } } -#if (defined(WEBRTC_LINUX) && !defined(ANDROID)) +#if (defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)) static pid_t gettid() { #if defined(__NR_gettid) @@ -86,7 +86,7 @@ ThreadLinux::ThreadLinux(ThreadRunFunction func, ThreadObj obj, int ThreadLinux::Construct() { int result = 0; -#if !defined(ANDROID) +#if !defined(WEBRTC_ANDROID) // Enable immediate cancellation if requested, see Shutdown() result = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); if (result != 0) @@ -191,7 +191,7 @@ bool ThreadLinux::Start(unsigned int& /*threadID*/) return true; } -#if (defined(WEBRTC_LINUX) && !defined(ANDROID)) +#if (defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)) bool ThreadLinux::SetAffinity(const int* processorNumbers, const unsigned int amountOfProcessors) { @@ -235,7 +235,7 @@ void ThreadLinux::SetNotAlive() bool ThreadLinux::Shutdown() { -#if !defined(ANDROID) +#if !defined(WEBRTC_ANDROID) if (_thread && (0 != pthread_cancel(_thread))) { return false; diff --git a/src/system_wrappers/source/trace_linux.cc b/src/system_wrappers/source/trace_linux.cc index 8dba3beba..cdc2138bd 100644 --- a/src/system_wrappers/source/trace_linux.cc +++ b/src/system_wrappers/source/trace_linux.cc @@ -16,7 +16,7 @@ #include #include -#ifdef ANDROID +#ifdef WEBRTC_ANDROID #include #else #include