Darwin support
This commit is contained in:
parent
b89f94ff70
commit
1a5f61cec4
10 changed files with 225 additions and 77 deletions
|
@ -15,7 +15,7 @@ CXXFLAGS_debug := -g$(DEBUG_INFO_FORMAT) -O0
|
||||||
CFLAGS_debug := -g$(DEBUG_INFO_FORMAT) -O0
|
CFLAGS_debug := -g$(DEBUG_INFO_FORMAT) -O0
|
||||||
CXXFLAGS_release := -O2
|
CXXFLAGS_release := -O2
|
||||||
CFLAGS_release := -O2
|
CFLAGS_release := -O2
|
||||||
|
|
||||||
OUTPUT_DIR_PREFIX = ../lib/$(TARGET)-$(ARCH)
|
OUTPUT_DIR_PREFIX = ../lib/$(TARGET)-$(ARCH)
|
||||||
BUILD_DIR_PREFIX = ../build/$(TARGET)-$(ARCH)
|
BUILD_DIR_PREFIX = ../build/$(TARGET)-$(ARCH)
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ debug: $(BUILD_DIR_PREFIX)-debug/$(LIBNAME).$(LIBTYPE)
|
||||||
|
|
||||||
# Clean removes all objects
|
# Clean removes all objects
|
||||||
clean:
|
clean:
|
||||||
$(RM) -r build-release/obj-$(TARGET)-$(ARCH)/
|
$(RM) -r build-release/obj-$(TARGET)-$(ARCH)
|
||||||
$(RM) -r build-debug/obj-$(TARGET)-$(ARCH)/
|
$(RM) -r build-debug/obj-$(TARGET)-$(ARCH)
|
||||||
$(RM) -r build-release/$(TARGET)-$(ARCH)
|
$(RM) -r build-release/$(TARGET)-$(ARCH)
|
||||||
$(RM) -r build-debug/$(TARGET)-$(ARCH)
|
$(RM) -r build-debug/$(TARGET)-$(ARCH)
|
||||||
$(RM) -r $(BUILD_DIR_PREFIX)-release
|
$(RM) -r $(BUILD_DIR_PREFIX)-release
|
||||||
|
@ -86,7 +86,7 @@ build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(STATICLIB_EXT): $$(addprefix build-%/,$(O
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(DYNAMICLIB_EXT): $$(addprefix build-%/,$(OBJECTS))
|
build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(DYNAMICLIB_EXT): $$(addprefix build-%/,$(OBJECTS))
|
||||||
@mkdir -p `dirname $@`
|
@mkdir -p `dirname $@`
|
||||||
$(CXX) -shared -o $@ $(addprefix build-$*/,$(OBJECTS)) $(LDFLAGS) -L$(BUILD_DIR_PREFIX)-$* $(LDLIBS)
|
$(CXX) $(DYNAMICLIB_FLAGS) -o $@ $(addprefix build-$*/,$(OBJECTS)) $(LDFLAGS) -L$(BUILD_DIR_PREFIX)-$* $(LDLIBS)
|
||||||
|
|
||||||
# This is for copying binary files to build directory
|
# This is for copying binary files to build directory
|
||||||
$(BUILD_DIR_PREFIX)-%/$(LIBNAME).$(LIBTYPE): build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(LIBTYPE)
|
$(BUILD_DIR_PREFIX)-%/$(LIBNAME).$(LIBTYPE): build-%/$(TARGET)-$(ARCH)/$(LIBNAME).$(LIBTYPE)
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
# Make default definitions
|
# Autodetermine target if not set
|
||||||
ifndef $(ARCH)
|
ifeq ($(TARGET),)
|
||||||
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
ifeq ($(shell uname),Darwin)
|
||||||
# Cygwin returns 'unknown'
|
TARGET := darwin
|
||||||
ARCH := i386
|
else ifeq ($(shell uname),Linux)
|
||||||
else
|
TARGET := linux
|
||||||
ARCH := $(shell uname -i)
|
else ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
||||||
|
TARGET := windows
|
||||||
|
else ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
||||||
|
TARGET := windows
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
############# NACL ### TARGET
|
# Google NaCl target
|
||||||
ifeq ($(TARGET),nacl)
|
ifeq ($(TARGET),nacl)
|
||||||
ifndef NACL_SDK_ROOT
|
ifndef NACL_SDK_ROOT
|
||||||
$(error Set NACL_SDK_ROOT environment variable)
|
$(error Set NACL_SDK_ROOT environment variable)
|
||||||
|
@ -18,8 +22,8 @@ ifeq ($(TARGET),nacl)
|
||||||
NACL_SDK_ROOT := $(shell cygpath -u "$(NACL_SDK_ROOT)")
|
NACL_SDK_ROOT := $(shell cygpath -u "$(NACL_SDK_ROOT)")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
|
OSNAME := $(shell python $(NACL_SDK_ROOT)/tools/getos.py)
|
||||||
NACL_TOOLCHAIN:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
|
NACL_TOOLCHAIN := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
|
||||||
CXX := $(NACL_TOOLCHAIN)/bin/i686-nacl-g++
|
CXX := $(NACL_TOOLCHAIN)/bin/i686-nacl-g++
|
||||||
CC := $(NACL_TOOLCHAIN)/bin/i686-nacl-gcc
|
CC := $(NACL_TOOLCHAIN)/bin/i686-nacl-gcc
|
||||||
AR := $(NACL_TOOLCHAIN)/bin/i686-nacl-ar
|
AR := $(NACL_TOOLCHAIN)/bin/i686-nacl-ar
|
||||||
|
@ -29,59 +33,111 @@ ifeq ($(TARGET),nacl)
|
||||||
LDLIBS += -lppapi_cpp -lppapi
|
LDLIBS += -lppapi_cpp -lppapi
|
||||||
GLOBAL_INCLUDES := -I../zlib/zlib_library -I$(NACL_TOOLCHAIN)/i686-nacl/usr/include
|
GLOBAL_INCLUDES := -I../zlib/zlib_library -I$(NACL_TOOLCHAIN)/i686-nacl/usr/include
|
||||||
ZLIB_BUILD := defined
|
ZLIB_BUILD := defined
|
||||||
CFLAGS := -D__int64="long long"
|
CFLAGS += -D__int64="long long" -std=gnu++0x
|
||||||
CXXFLAGS := -D__int64="long long"
|
CXXFLAGS += -D__int64="long long" -std=gnu++0x
|
||||||
|
DYNAMICLIB_FLAGS := -shared
|
||||||
else
|
|
||||||
############################################
|
############################################
|
||||||
### EVERYTHING ELSE REQUIRES JAVA_HOME #####
|
# MacOSX/Darwin target
|
||||||
ifndef JAVA_HOME
|
else ifeq ($(TARGET),darwin)
|
||||||
$(error Set JAVA_HOME environment variable)
|
MACOSX_TOOLCHAIN_ROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
|
||||||
endif
|
MACOSX_SDK := $(IOS_TOOLCHAIN_ROOT)/SDKs/MacOSX10.6.sdk/
|
||||||
|
ifeq ($(JAVA_HOME),)
|
||||||
ifeq ($(TARGET),)
|
JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
|
||||||
ifeq ($(shell uname),Darwin)
|
|
||||||
TARGET := darwin
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(shell uname),Linux)
|
|
||||||
TARGET := linux
|
# Skia on Darwin supports only i386
|
||||||
endif
|
ARCH := i386
|
||||||
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
CXXFLAGS += -arch $(ARCH)
|
||||||
TARGET := windows
|
CFLAGS += -arch $(ARCH)
|
||||||
endif
|
|
||||||
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
CXX := /usr/bin/g++
|
||||||
TARGET := windows
|
CC := /usr/bin/gcc
|
||||||
endif
|
AR := /usr/bin/ar
|
||||||
endif
|
|
||||||
|
|
||||||
############################################
|
|
||||||
####### Windows via MinGW/Linux and MinGW/Cygwin target
|
|
||||||
ifeq ($(TARGET),windows)
|
|
||||||
CXX := i686-w64-mingw32-g++
|
|
||||||
CC := i686-w64-mingw32-gcc
|
|
||||||
AR := i686-w64-mingw32-ar
|
|
||||||
GLOBAL_INCLUDES := -I../zlib/zlib_library
|
GLOBAL_INCLUDES := -I../zlib/zlib_library
|
||||||
ZLIB_BUILD := defined
|
ZLIB_BUILD := defined
|
||||||
STATICLIB_EXT := lib
|
|
||||||
DYNAMICLIB_EXT := dll
|
|
||||||
LIBRARY_PREFIX := # empty
|
|
||||||
LDFLAGS := -Wl,--kill-at -static-libstdc++ -static-libgcc
|
|
||||||
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
||||||
# Latest MinGW compiler under Cygwin needs this
|
|
||||||
CFLAGS := -D__int64="long long"
|
|
||||||
CXXFLAGS := -D__int64="long long"
|
|
||||||
endif
|
|
||||||
############################################
|
|
||||||
####### DEFAULT LINUX ########## TARGET
|
|
||||||
else
|
|
||||||
CXX := g++
|
|
||||||
CC := gcc
|
|
||||||
STRIP := strip
|
|
||||||
STATICLIB_EXT := a
|
STATICLIB_EXT := a
|
||||||
DYNAMICLIB_EXT := so
|
DYNAMICLIB_EXT := dylib
|
||||||
LIBRARY_PREFIX := lib
|
LIBRARY_PREFIX := lib
|
||||||
|
DYNAMICLIB_FLAGS := -dynamiclib
|
||||||
|
############################################
|
||||||
|
# iOS target
|
||||||
|
else ifeq ($(TARGET),ios)
|
||||||
|
IOS_TOOLCHAIN_ROOT := /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
|
||||||
|
IOS_SDK := $(IOS_TOOLCHAIN_ROOT)/SDKs/iPhoneOS5.1.sdk/
|
||||||
|
ifeq ($(ARCH),)
|
||||||
|
ARCH := armv6
|
||||||
|
endif
|
||||||
|
|
||||||
|
CXX := $(IOS_TOOLCHAIN_ROOT)/usr/bin/arm-apple-darwin10-llvm-g++-4.2
|
||||||
|
CC := $(IOS_TOOLCHAIN_ROOT)/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
|
||||||
|
AR := $(IOS_TOOLCHAIN_ROOT)/usr/bin/ar
|
||||||
|
GLOBAL_INCLUDES := -I../zlib/zlib_library
|
||||||
|
ZLIB_BUILD := defined
|
||||||
|
STATICLIB_EXT := a
|
||||||
|
DYNAMICLIB_EXT := dylib
|
||||||
|
LIBRARY_PREFIX := lib
|
||||||
|
CXXFLAGS += -isysroot $(IOS_SDK)
|
||||||
|
CFLAGS += -isysroot $(IOS_SDK)
|
||||||
|
DYNAMICLIB_FLAGS := -dynamiclib
|
||||||
|
LDFLAGS := # empty
|
||||||
|
# -arch armv6
|
||||||
|
############################################
|
||||||
|
### EVERYTHING ELSE REQUIRES JAVA_HOME #####
|
||||||
|
else
|
||||||
|
|
||||||
|
# Just don't ask
|
||||||
|
ifndef JAVA_HOME
|
||||||
|
$(error Set JAVA_HOME environment variable)
|
||||||
|
endif
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Windows via MinGW/Linux and MinGW/Cygwin target
|
||||||
|
ifeq ($(TARGET),windows)
|
||||||
|
CXX := i686-w64-mingw32-g++
|
||||||
|
CC := i686-w64-mingw32-gcc
|
||||||
|
AR := i686-w64-mingw32-ar
|
||||||
|
GLOBAL_INCLUDES := -I../zlib/zlib_library
|
||||||
|
ZLIB_BUILD := defined
|
||||||
|
STATICLIB_EXT := lib
|
||||||
|
DYNAMICLIB_EXT := dll
|
||||||
|
LIBRARY_PREFIX := # empty
|
||||||
|
LDFLAGS += -Wl,--kill-at -static-libstdc++ -static-libgcc
|
||||||
|
CFLAGS += -std=gnu++0x
|
||||||
|
CXXFLAGS += -std=gnu++0x
|
||||||
|
DYNAMICLIB_FLAGS := -shared
|
||||||
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
||||||
|
# Latest MinGW compiler under Cygwin needs this
|
||||||
|
CFLAGS += -D__int64="long long"
|
||||||
|
CXXFLAGS += -D__int64="long long"
|
||||||
|
endif
|
||||||
|
###########################################
|
||||||
|
# Default target
|
||||||
|
else
|
||||||
|
STATICLIB_EXT := a
|
||||||
|
DYNAMICLIB_EXT := so
|
||||||
|
LIBRARY_PREFIX := lib
|
||||||
|
DYNAMICLIB_FLAGS := -shared
|
||||||
|
CFLAGS += -std=gnu++0x
|
||||||
|
CXXFLAGS += -std=gnu++0x
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# CPU architectures support
|
||||||
|
|
||||||
|
# Make default definitions
|
||||||
|
ifeq ($(ARCH),)
|
||||||
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
||||||
|
# Cygwin returns 'unknown'
|
||||||
|
ARCH := i386
|
||||||
|
else
|
||||||
|
ARCH := $(shell uname -i)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Modify compiler flags
|
||||||
ifeq ($(ARCH),i386)
|
ifeq ($(ARCH),i386)
|
||||||
CFLAGS += -m32
|
CFLAGS += -m32
|
||||||
CXXFLAGS += -m32
|
CXXFLAGS += -m32
|
||||||
|
@ -90,8 +146,7 @@ else ifeq ($(ARCH),x86_64)
|
||||||
CFLAGS += -m64
|
CFLAGS += -m64
|
||||||
CXXFLAGS += -m64
|
CXXFLAGS += -m64
|
||||||
LDFLAGS += -m64
|
LDFLAGS += -m64
|
||||||
|
else ifeq ($(ARCH),armv6)
|
||||||
else
|
else
|
||||||
$(error Undefined ARCH $(ARCH))
|
$(error Undefined ARCH $(ARCH))
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -2,7 +2,3 @@ chmod +x zlib/configure.sh
|
||||||
cd zlib
|
cd zlib
|
||||||
./configure.sh
|
./configure.sh
|
||||||
cd ..
|
cd ..
|
||||||
chmod +x pthread/configure.sh
|
|
||||||
cd pthread
|
|
||||||
./configure.sh
|
|
||||||
cd ..
|
|
||||||
|
|
|
@ -6,12 +6,10 @@ LOCAL_PATH = .
|
||||||
include Common.mk
|
include Common.mk
|
||||||
|
|
||||||
OSMAND_FLAGS = \
|
OSMAND_FLAGS = \
|
||||||
-std=c++0x \
|
|
||||||
-DGOOGLE_PROTOBUF_NO_RTTI \
|
-DGOOGLE_PROTOBUF_NO_RTTI \
|
||||||
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \
|
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \
|
||||||
-DSK_RELEASE \
|
-DSK_RELEASE \
|
||||||
-DGR_RELEASE=1
|
-DGR_RELEASE=1
|
||||||
|
|
||||||
OSMAND_FLAGS_WINDOWS = \
|
OSMAND_FLAGS_WINDOWS = \
|
||||||
-DSK_BUILD_FOR_WIN32 \
|
-DSK_BUILD_FOR_WIN32 \
|
||||||
-DMINGW_HAS_SECURE_API \
|
-DMINGW_HAS_SECURE_API \
|
||||||
|
@ -21,14 +19,30 @@ OSMAND_FLAGS_WINDOWS = \
|
||||||
-DSK_SCALAR_IS_FLOAT \
|
-DSK_SCALAR_IS_FLOAT \
|
||||||
-DSK_CAN_USE_FLOAT \
|
-DSK_CAN_USE_FLOAT \
|
||||||
-DSK_CPU_LENDIAN
|
-DSK_CPU_LENDIAN
|
||||||
|
OSMAND_FLAGS_MAC = \
|
||||||
|
-DSK_BUILD_FOR_MAC \
|
||||||
|
-DSK_USE_CORETEXT \
|
||||||
|
-DSkUserConfig_DEFINED \
|
||||||
|
-DPICTURE_VERSION_ICS=1 \
|
||||||
|
-DPICTURE_VERSION_JB=2 \
|
||||||
|
-DSK_SCALAR_IS_FLOAT \
|
||||||
|
-DSK_CAN_USE_FLOAT \
|
||||||
|
-DSK_CPU_LENDIAN
|
||||||
|
|
||||||
LIBNAME = $(LIBRARY_PREFIX)osmand
|
LIBNAME = $(LIBRARY_PREFIX)osmand
|
||||||
LIBTYPE = $(DYNAMICLIB_EXT)
|
LIBTYPE = $(DYNAMICLIB_EXT)
|
||||||
LDLIBS += -Wl,-Bsymbolic -Wl,--whole-archive -lskia -lpng -Wl,--no-whole-archive -lproto -lft2 -lexpat -lz
|
ifeq ($(TARGET),darwin)
|
||||||
|
LDLIBS += --whole-archive -lskia --no-whole-archive -lproto -lft2 -lexpat -lpng -lz
|
||||||
|
else
|
||||||
|
LDLIBS += -Wl,-Bsymbolic -Wl,--whole-archive -lskia -lpng -Wl,--no-whole-archive -lproto -lft2 -lexpat -lpng -lz
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET),windows)
|
ifeq ($(TARGET),windows)
|
||||||
LDLIBS += -lwinmm -lgdi32 -lusp10
|
LDLIBS += -lwinmm -lgdi32 -lusp10
|
||||||
OSMAND_FLAGS += $(OSMAND_FLAGS_WINDOWS)
|
OSMAND_FLAGS += $(OSMAND_FLAGS_WINDOWS)
|
||||||
|
else ifeq ($(TARGET),darwin)
|
||||||
|
OSMAND_FLAGS += $(OSMAND_FLAGS_MAC)
|
||||||
|
LDLIBS += -framework CoreText -lpthread
|
||||||
else ifeq ($(TARGET),nacl)
|
else ifeq ($(TARGET),nacl)
|
||||||
LDLIBS += -lpthread
|
LDLIBS += -lpthread
|
||||||
else
|
else
|
||||||
|
@ -40,6 +54,11 @@ ifeq ($(TARGET),nacl)
|
||||||
-DRT_NOT_SUPPORTED
|
-DRT_NOT_SUPPORTED
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
src/osmand_nacl.cpp
|
src/osmand_nacl.cpp
|
||||||
|
else ifeq ($(TARGET),darwin)
|
||||||
|
LOCAL_SRC_FILES += \
|
||||||
|
src/java_wrap.cpp
|
||||||
|
|
||||||
|
OSMAND_FLAGS += -I"$(JAVA_HOME)"
|
||||||
else
|
else
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
src/java_wrap.cpp
|
src/java_wrap.cpp
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
#include <SkPath.h>
|
#include <SkPath.h>
|
||||||
#include <SkBitmap.h>
|
#include <SkBitmap.h>
|
||||||
#include <SkImageDecoder.h>
|
#include <SkImageDecoder.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "osmand_log.h"
|
#include "osmand_log.h"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <mmsystem.h>
|
# include <mmsystem.h>
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
# include <mach/mach_time.h>|
|
||||||
|
#else
|
||||||
|
# include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TextDrawInfo::TextDrawInfo(std::string itext)
|
TextDrawInfo::TextDrawInfo(std::string itext)
|
||||||
|
@ -49,6 +52,9 @@ ElapsedTimer::ElapsedTimer()
|
||||||
, enableFlag(true)
|
, enableFlag(true)
|
||||||
, run(false)
|
, run(false)
|
||||||
{
|
{
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
mach_timebase_info(&machTimeInfo);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElapsedTimer::enable()
|
void ElapsedTimer::enable()
|
||||||
|
@ -70,6 +76,8 @@ void ElapsedTimer::start()
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
startInit = timeGetTime();
|
startInit = timeGetTime();
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
startInit = mach_absolute_time();
|
||||||
#else
|
#else
|
||||||
clock_gettime(CLOCK_MONOTONIC, &startInit);
|
clock_gettime(CLOCK_MONOTONIC, &startInit);
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,6 +92,12 @@ void ElapsedTimer::pause()
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
endInit = timeGetTime();
|
endInit = timeGetTime();
|
||||||
elapsedTime += (endInit - startInit) * 1e6;
|
elapsedTime += (endInit - startInit) * 1e6;
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
endInit = mach_absolute_time();
|
||||||
|
uint64_t duration = endInit - startInit;
|
||||||
|
duration *= machTimeInfo.numer;
|
||||||
|
duration /= machTimeInfo.denom;
|
||||||
|
elapsedTime += duration;
|
||||||
#else
|
#else
|
||||||
clock_gettime(CLOCK_MONOTONIC, &endInit);
|
clock_gettime(CLOCK_MONOTONIC, &endInit);
|
||||||
int sec = endInit.tv_sec - startInit.tv_sec;
|
int sec = endInit.tv_sec - startInit.tv_sec;
|
||||||
|
|
|
@ -3,10 +3,21 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#if defined(ANDROID)
|
||||||
#include <unordered_set>
|
# include <unordered_map>
|
||||||
|
# include <unordered_set>
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
# include <tr1/unordered_map>
|
||||||
|
# include <tr1/unordered_set>
|
||||||
|
#else
|
||||||
|
# include <unordered_map>
|
||||||
|
# include <unordered_set>
|
||||||
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cstdint>
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
# include <mach/mach_time.h>|
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <SkPath.h>
|
#include <SkPath.h>
|
||||||
#include <SkBitmap.h>
|
#include <SkBitmap.h>
|
||||||
|
@ -17,10 +28,10 @@
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#if !defined(M_PI)
|
#if !defined(M_PI)
|
||||||
const double M_PI = 3.14159265358979323846;
|
const double M_PI = 3.14159265358979323846;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(M_PI_2)
|
#if !defined(M_PI_2)
|
||||||
const double M_PI_2 = M_PI / 2.0;
|
const double M_PI_2 = M_PI / 2.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Wrapper for unordered classes
|
// Wrapper for unordered classes
|
||||||
|
@ -28,6 +39,10 @@ const double M_PI_2 = M_PI / 2.0;
|
||||||
# define UNORDERED_NAMESPACE std::tr1
|
# define UNORDERED_NAMESPACE std::tr1
|
||||||
# define UNORDERED_map unordered_map
|
# define UNORDERED_map unordered_map
|
||||||
# define UNORDERED_set unordered_set
|
# define UNORDERED_set unordered_set
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
# define UNORDERED_NAMESPACE std::tr1
|
||||||
|
# define UNORDERED_map unordered_map
|
||||||
|
# define UNORDERED_set unordered_set
|
||||||
#else
|
#else
|
||||||
# define UNORDERED_NAMESPACE std
|
# define UNORDERED_NAMESPACE std
|
||||||
# define UNORDERED_map unordered_map
|
# define UNORDERED_map unordered_map
|
||||||
|
@ -60,6 +75,10 @@ private:
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
DWORD startInit;
|
DWORD startInit;
|
||||||
DWORD endInit;
|
DWORD endInit;
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
mach_timebase_info_data_t machTimeInfo;
|
||||||
|
uint64_t startInit;
|
||||||
|
uint64_t endInit;
|
||||||
#else
|
#else
|
||||||
timespec startInit;
|
timespec startInit;
|
||||||
timespec endInit;
|
timespec endInit;
|
||||||
|
|
|
@ -8,7 +8,7 @@ include Common.mk
|
||||||
# Set library name
|
# Set library name
|
||||||
LIBNAME = $(LIBRARY_PREFIX)proto
|
LIBNAME = $(LIBRARY_PREFIX)proto
|
||||||
LIBTYPE = $(STATICLIB_EXT)
|
LIBTYPE = $(STATICLIB_EXT)
|
||||||
CXXFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI -std=gnu++0x
|
CXXFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
|
||||||
LDFLAGS += -lpthread
|
LDFLAGS += -lpthread
|
||||||
LOCAL_C_INCLUDES += .
|
LOCAL_C_INCLUDES += .
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,27 @@
|
||||||
/* define if the compiler has hash_map */
|
/* define if the compiler has hash_map */
|
||||||
#define HAVE_HASH_MAP 1
|
#define HAVE_HASH_MAP 1
|
||||||
|
|
||||||
|
/* define if the compiler has hash_set */
|
||||||
|
#define HAVE_HASH_SET 1
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
/* the namespace of hash_map/hash_set */
|
||||||
|
#define HASH_NAMESPACE std::tr1
|
||||||
|
|
||||||
|
/* the name of <hash_set> */
|
||||||
|
#define HASH_MAP_CLASS unordered_map
|
||||||
|
|
||||||
|
/* the location of <hash_map> */
|
||||||
|
#define HASH_MAP_H <tr1/unordered_map>
|
||||||
|
|
||||||
|
/* the name of <hash_set> */
|
||||||
|
#define HASH_SET_CLASS unordered_set
|
||||||
|
|
||||||
|
/* the location of <hash_set> */
|
||||||
|
#define HASH_SET_H <tr1/unordered_set>
|
||||||
|
|
||||||
|
/* define if the compiler has hash_map */
|
||||||
|
#define HAVE_HASH_MAP 1
|
||||||
|
|
||||||
/* define if the compiler has hash_set */
|
/* define if the compiler has hash_set */
|
||||||
#define HAVE_HASH_SET 1
|
#define HAVE_HASH_SET 1
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -47,7 +47,8 @@ LOCAL_SRC_FILES += \
|
||||||
$(OSMAND_SKIA_LOC)/src/ports/SkTime_Unix.cpp \
|
$(OSMAND_SKIA_LOC)/src/ports/SkTime_Unix.cpp \
|
||||||
FontHostConfiguration_android.cpp
|
FontHostConfiguration_android.cpp
|
||||||
LOCAL_C_INCLUDES += \
|
LOCAL_C_INCLUDES += \
|
||||||
$(OSMAND_SKIA_ABS)/src/ports
|
$(OSMAND_SKIA_ABS)/src/ports \
|
||||||
|
$(OSMAND_SKIA_ABS)/include/utils/android
|
||||||
|
|
||||||
ifeq ($(TARGET_ARCH),arm)
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,34 @@ SKIA_FLAGS_WINDOWS = \
|
||||||
-DSK_SCALAR_IS_FLOAT \
|
-DSK_SCALAR_IS_FLOAT \
|
||||||
-DSK_CAN_USE_FLOAT \
|
-DSK_CAN_USE_FLOAT \
|
||||||
-DSK_CPU_LENDIAN
|
-DSK_CPU_LENDIAN
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES_MAC = \
|
||||||
|
$(OSMAND_SKIA_LOC)/src/ports/SkThread_pthread.cpp \
|
||||||
|
$(OSMAND_SKIA_LOC)/src/ports/SkFontHost_mac.cpp \
|
||||||
|
$(OSMAND_SKIA_LOC)/src/ports/SkFontHost_mac_coretext.cpp \
|
||||||
|
$(OSMAND_SKIA_LOC)/src/ports/SkFontHost_freetype_mac.cpp \
|
||||||
|
$(OSMAND_SKIA_LOC)/src/ports/SkTime_Unix.cpp
|
||||||
|
|
||||||
|
SKIA_FLAGS_MAC = \
|
||||||
|
-DSK_BUILD_FOR_MAC \
|
||||||
|
-DSK_USE_CORETEXT \
|
||||||
|
-DSkUserConfig_DEFINED \
|
||||||
|
-DPICTURE_VERSION_ICS=1 \
|
||||||
|
-DPICTURE_VERSION_JB=2 \
|
||||||
|
-DSK_SCALAR_IS_FLOAT \
|
||||||
|
-DSK_CAN_USE_FLOAT \
|
||||||
|
-DSK_CPU_LENDIAN
|
||||||
|
|
||||||
ifeq ($(TARGET),windows)
|
ifeq ($(TARGET),windows)
|
||||||
LOCAL_SRC_FILES += $(LOCAL_SRC_FILES_WINDOWS)
|
LOCAL_SRC_FILES += $(LOCAL_SRC_FILES_WINDOWS)
|
||||||
|
LOCAL_C_INCLUDES += $(OSMAND_SKIA_ABS)/include/utils/win
|
||||||
SKIAFLAGS += $(SKIA_FLAGS_WINDOWS)
|
SKIAFLAGS += $(SKIA_FLAGS_WINDOWS)
|
||||||
|
else ifeq ($(TARGET),darwin)
|
||||||
|
LOCAL_SRC_FILES += $(LOCAL_SRC_FILES_MAC)
|
||||||
|
LOCAL_C_INCLUDES += $(OSMAND_SKIA_ABS)/include/utils/mac
|
||||||
|
SKIAFLAGS += $(SKIA_FLAGS_MAC)
|
||||||
else
|
else
|
||||||
|
LOCAL_C_INCLUDES += $(OSMAND_SKIA_ABS)/include/utils/unix
|
||||||
LOCAL_SRC_FILES += \
|
LOCAL_SRC_FILES += \
|
||||||
$(OSMAND_SKIA_LOC)/src/ports/SkFontHost_sandbox_none.cpp \
|
$(OSMAND_SKIA_LOC)/src/ports/SkFontHost_sandbox_none.cpp \
|
||||||
$(OSMAND_SKIA_LOC)/src/ports/SkThread_pthread.cpp \
|
$(OSMAND_SKIA_LOC)/src/ports/SkThread_pthread.cpp \
|
||||||
|
|
Loading…
Reference in a new issue