Windows builds

This commit is contained in:
Alexey Pelykh 2012-05-28 21:56:12 +03:00
parent e084044a58
commit 001c7e8ffa
9 changed files with 57 additions and 28 deletions

View file

@ -1,2 +1,2 @@
osmand_main osmand_main*
osm_out osm_out

View file

@ -10,7 +10,7 @@ ifeq ($(os),)
os := darwin os := darwin
endif endif
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
os := win os := cygwin
endif endif
ifeq ($(findstring MINGW,$(shell uname)),MINGW) ifeq ($(findstring MINGW,$(shell uname)),MINGW)
os := win os := win
@ -31,24 +31,35 @@ endif
# os=Default is meant to be generic unix/linux # os=Default is meant to be generic unix/linux
linux_CXX := g++ linux_CXX := g++
linux_CC := gcc
linux_STRIP := strip linux_STRIP := strip
#Default_LINKFLAGS := -shared #Default_LINKFLAGS := -shared
# #
Support10_4 := -isysroot /Developer/SDKs/MacOSX10.4u.sdk Support10_4 := -isysroot /Developer/SDKs/MacOSX10.4u.sdk
darwin_CXX := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4) darwin_CXX := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4)
darwin_CC := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4)
darwin_STRIP := strip -x darwin_STRIP := strip -x
#darwin_CPP_FLAGS := strip -x #darwin_CPP_FLAGS := strip -x
#darwin_LINKFLAGS := -dynamiclib $(Support10_4) #darwin_LINKFLAGS := -dynamiclib $(Support10_4)
# mingw32 via Cygwin OBSOLETE : i686-pc-mingw32-
# mingw64 via Cygwin : i686-w64-mingw32-
# gcc via Cygwin : i686-pc-cygwin-
# x86_64-w64-mingw32
cygwin_CXX := i686-pc-cygwin-g++
cygwin_CC := i686-pc-cygwin-gcc
cygwin_STRIP := i686-pc-cygwin-strip
win_CXX := i586-mingw32msvc-gcc win_CXX := i586-mingw32msvc-gcc
win_CC := i586-mingw32msvc-gcc
win_STRIP := i586-mingw32msvc-strip win_STRIP := i586-mingw32msvc-strip
win_CPP_FLAGS := -D_Windows win_CPP_FLAGS := -D_Windows
#win_CFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -I$(JAVA_HOME)/include -O #win_CFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -I$(JAVA_HOME)/include -O
#win_LINKFLAGS := -Wl,--kill-at -shared #win_LINKFLAGS := -Wl,--kill-at -shared
CXX := $($(os)_CXX) CXX := $($(os)_CXX)
CC := $($(os)_CC)
STRIP := $($(os)_STRIP) STRIP := $($(os)_STRIP)
CPP_OS_FLAGS = $($(os)_CPP_FLAGS) CPP_OS_FLAGS = $($(os)_CPP_FLAGS)
#LINKFLAGS := $($(os)_LINKFLAGS) #LINKFLAGS := $($(os)_LINKFLAGS)

View file

@ -4,14 +4,15 @@ include Common.mk
CPP_FILE_EXTENSION = c CPP_FILE_EXTENSION = c
LIBNAME := libexpat.a LIBNAME := libexpat.a
PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)
OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o)
CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS) CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS) -Iexpat_library
target : $(PREBUILT_DIR)/$(LIBNAME) target : $(PREBUILT_DIR)/$(LIBNAME)
$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME)
cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) mkdir -p $(PREBUILT_DIR)
cp build/$(LIBNAME) $(PREBUILT_DIR)
build/$(LIBNAME): $(OBJECTS) build/$(LIBNAME): $(OBJECTS)
ar -rf build/$(LIBNAME) $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS)

View file

@ -4,7 +4,7 @@ include Common.mk
CPP_FILE_EXTENSION = c CPP_FILE_EXTENSION = c
LIBNAME := libft2.a LIBNAME := libft2.a
PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)
OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o)
C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES)) C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES))
CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES)
@ -12,7 +12,8 @@ CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES)
target : $(PREBUILT_DIR)/$(LIBNAME) target : $(PREBUILT_DIR)/$(LIBNAME)
$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME)
cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) mkdir -p $(PREBUILT_DIR)
cp build/$(LIBNAME) $(PREBUILT_DIR)
build/$(LIBNAME): $(OBJECTS) build/$(LIBNAME): $(OBJECTS)
ar -rf build/$(LIBNAME) $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS)

View file

@ -1,6 +1,2 @@
x86/ *
armeabi/ !.gitignore
armeabi-v7a/
linux-x86/
win-x86/
darwin-x86/

View file

@ -1,7 +1,7 @@
LOCAL_PATH := . LOCAL_PATH := .
include ../Makefile.vars include ../Makefile.vars
include ./Common.mk include ./Common.mk
PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)
LIBNAME := osmand.lib LIBNAME := osmand.lib
LIBOSNAME := osmand-$(os)-$(arch).lib LIBOSNAME := osmand-$(os)-$(arch).lib
@ -11,7 +11,7 @@ LOCAL_SRC_FILES += src/osmand_main.cpp
#LDFLAGS = -Wl,--hash-style=both -fPIC #LDFLAGS = -Wl,--hash-style=both -fPIC
LDFLAGS = -Wall -fPIC -Wl,-Bsymbolic LDFLAGS = -Wall -fPIC -Wl,-Bsymbolic
LDRUNFLAGS = -Wl,--hash-style=both #LDRUNFLAGS = -Wl,--hash-style=both
# --trace -Bsymbolic -Bsymbolic-functions # --trace -Bsymbolic -Bsymbolic-functions
LDLIBS = -L$(PREBUILT_DIR) -lskia -lproto -lpthread -lrt -lft2 -lexpat -lpng -lz LDLIBS = -L$(PREBUILT_DIR) -lskia -lproto -lpthread -lrt -lft2 -lexpat -lpng -lz
@ -20,12 +20,30 @@ OBJECTS = $(LOCAL_SRC_FILES:src/%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/
C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES)) C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES))
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
FIXED_JAVA_HOME := $(shell cygpath -u "$(JAVA_HOME)")
else
FIXED_JAVA_HOME := $(JAVA_HOME)
endif
ifeq ($(java_os),)
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
java_os := linux
endif
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
java_os := win32
endif
endif
ifeq ($(os),)
java_os := linux
endif
CPPFLAGS := \ CPPFLAGS := \
-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 \
-c -fPIC -I$(JAVA_HOME)/include \ -c -fPIC -I"$(FIXED_JAVA_HOME)/include" -I"$(FIXED_JAVA_HOME)/include/$(java_os)" \
-DHASH_MAP_GNU \ -DHASH_MAP_GNU \
$(C_INCLUDES) $(C_INCLUDES)
@ -33,14 +51,13 @@ CPPFLAGS := \
#target : $(PREBUILT_DIR)/$(LIBNAME) #target : $(PREBUILT_DIR)/$(LIBNAME)
target : $(PREBUILT_DIR)/$(LIBNAME) ../$(RUNFILE) target : $(PREBUILT_DIR)/$(LIBNAME) ../$(RUNFILE)
../$(RUNFILE) : $(OBJECTS) $(PREBUILT_DIR)/libskia.a $(PREBUILT_DIR)/libproto.a Makefile ../$(RUNFILE) : $(OBJECTS) $(PREBUILT_DIR)/libskia.a $(PREBUILT_DIR)/libproto.a Makefile
$(CXX) $(LDRUNFLAGS) -o ../$(RUNFILE) $(OBJECTS) $(LDLIBS) $(CXX) $(LDRUNFLAGS) -o ../$(RUNFILE) $(OBJECTS) $(LDLIBS)
@chmod +x ../$(RUNFILE) @chmod +x ../$(RUNFILE)
$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBOSNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBOSNAME)
cp build/$(LIBOSNAME) $(PREBUILT_DIR)/$(LIBNAME) mkdir -p $(PREBUILT_DIR)
cp build/$(LIBOSNAME) $(PREBUILT_DIR)
build/$(LIBOSNAME): $(OBJECTS) $(PREBUILT_DIR)/libskia.a $(PREBUILT_DIR)/libproto.a Makefile build/$(LIBOSNAME): $(OBJECTS) $(PREBUILT_DIR)/libskia.a $(PREBUILT_DIR)/libproto.a Makefile
$(CXX) -shared -o build/$(LIBOSNAME) $(OBJECTS) $(LDFLAGS) $(LDLIBS) $(CXX) -shared -o build/$(LIBOSNAME) $(OBJECTS) $(LDFLAGS) $(LDLIBS)

View file

@ -4,7 +4,7 @@ include Common.mk
CPP_FILE_EXTENSION = c CPP_FILE_EXTENSION = c
LIBNAME := libpng.a LIBNAME := libpng.a
PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)
OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o)
C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES)) C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES))
CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS) CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS)
@ -12,14 +12,15 @@ CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS)
target : $(PREBUILT_DIR)/$(LIBNAME) target : $(PREBUILT_DIR)/$(LIBNAME)
$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME)
cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) mkdir -p $(PREBUILT_DIR)
cp build/$(LIBNAME) $(PREBUILT_DIR)
build/$(LIBNAME): $(OBJECTS) build/$(LIBNAME): $(OBJECTS)
ar -rf build/$(LIBNAME) $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS)
build/obj-$(os)-$(arch)/%.o : %.$(CPP_FILE_EXTENSION) $(LOCAL_C_INCLUDES) build/obj-$(os)-$(arch)/%.o : %.$(CPP_FILE_EXTENSION) $(LOCAL_C_INCLUDES)
@mkdir -p `dirname $@` @mkdir -p `dirname $@`
$(CXX) -o $@ -c $*.$(CPP_FILE_EXTENSION) $(CPPFLAGS) $(CC) -o $@ -c $*.$(CPP_FILE_EXTENSION) $(CPPFLAGS)
clean: clean:
$(RM) $(OBJECTS) build/$(LIBNAME) $(RM) $(OBJECTS) build/$(LIBNAME)

View file

@ -3,7 +3,7 @@ include Common.mk
CPP_FILE_EXTENSION = cc CPP_FILE_EXTENSION = cc
LIBNAME := libproto.a LIBNAME := libproto.a
PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)
OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o)
CPPFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI -I. -fPIC CPPFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI -I. -fPIC
LDLIBS = -lpthread LDLIBS = -lpthread
@ -11,7 +11,8 @@ LDLIBS = -lpthread
target : $(PREBUILT_DIR)/$(LIBNAME) target : $(PREBUILT_DIR)/$(LIBNAME)
$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME)
cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) mkdir -p $(PREBUILT_DIR)
cp build/$(LIBNAME) $(PREBUILT_DIR)
build/$(LIBNAME): $(OBJECTS) build/$(LIBNAME): $(OBJECTS)
ar -rf build/$(LIBNAME) $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS)

View file

@ -2,7 +2,7 @@ LOCAL_PATH = .
include ../Makefile.vars include ../Makefile.vars
include Common.mk include Common.mk
PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)
LIBNAME := libskia.a LIBNAME := libskia.a
CPP_FILE_EXTENSION = cpp CPP_FILE_EXTENSION = cpp
@ -31,18 +31,19 @@ CPPFLAGS := -DSK_RELEASE \
-fno-rtti \ -fno-rtti \
-fno-exceptions \ -fno-exceptions \
-fPIC \ -fPIC \
-DSK_BUILD_FOR_UNIX \
$(C_INCLUDES) $(C_INCLUDES)
LDLIBS = -lpthread LDLIBS = -lpthread
target : $(PREBUILT_DIR)/$(LIBNAME) target : $(PREBUILT_DIR)/$(LIBNAME)
$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME)
cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) mkdir -p $(PREBUILT_DIR)
cp build/$(LIBNAME) $(PREBUILT_DIR)
build/$(LIBNAME): $(OBJECTS) build/$(LIBNAME): $(OBJECTS)
ar -rf build/$(LIBNAME) $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS)
cp build/$(LIBNAME) ../jni-prebuilt/linux-x86/$(LIBNAME)
build/obj-$(os)-$(arch)/%.o : %.$(CPP_FILE_EXTENSION) $(LOCAL_C_INCLUDES) build/obj-$(os)-$(arch)/%.o : %.$(CPP_FILE_EXTENSION) $(LOCAL_C_INCLUDES)
@mkdir -p `dirname $@` @mkdir -p `dirname $@`