diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-02-03 16:18:37 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-02-04 11:54:01 +0100 |
commit | 73f7db9af2f76593856d64349a376412d292cd15 (patch) | |
tree | db311e489246d41e6386f4c8bcc14da17e634c66 | |
parent | f007c420ed4e2eadaedbbdd1c29912c6c8142fa1 (diff) | |
download | qtlocation-mapboxgl-73f7db9af2f76593856d64349a376412d292cd15.tar.gz |
cleanup makefiles
m--------- | .mason | 0 | ||||
-rw-r--r-- | Makefile | 363 | ||||
-rw-r--r-- | android/mapboxgl-app.gyp | 20 | ||||
-rw-r--r-- | bin/render.gyp | 4 | ||||
-rwxr-xr-x | configure | 15 | ||||
-rw-r--r-- | gyp/asset-fs.gypi | 2 | ||||
-rw-r--r-- | gyp/asset-zip.gypi | 2 | ||||
-rw-r--r-- | gyp/core.gypi | 2 | ||||
-rw-r--r-- | gyp/http-curl.gypi | 2 | ||||
-rw-r--r-- | gyp/install.gypi | 8 | ||||
-rw-r--r-- | gyp/platform-android.gypi | 2 | ||||
-rw-r--r-- | gyp/platform-ios.gypi | 2 | ||||
-rw-r--r-- | gyp/platform-linux.gypi | 2 | ||||
-rw-r--r-- | gyp/platform-osx.gypi | 2 | ||||
-rwxr-xr-x | scripts/android_env.sh | 16 | ||||
-rwxr-xr-x | scripts/run_tests.sh | 5 | ||||
-rw-r--r-- | test/fixtures/main.cpp | 27 | ||||
-rw-r--r-- | test/fixtures/util.hpp | 1 | ||||
-rw-r--r-- | test/headless/headless.cpp | 5 | ||||
-rw-r--r-- | test/storage/storage.cpp | 4 | ||||
-rw-r--r-- | test/test.gyp | 2 |
21 files changed, 259 insertions, 227 deletions
diff --git a/.mason b/.mason -Subproject 3d9c0c829f19b3f133ea2fdbe0be8b2ba9ef465 +Subproject 03869fd11e4bc619d3ba7e4f8a1f00d4612c90e @@ -1,204 +1,261 @@ BUILDTYPE ?= Release PYTHON ?= python PREFIX ?= /usr/local +ANDROID_ABI ?= arm-v7 JOBS ?= 1 ifeq ($(shell uname -s), Darwin) -DEFAULT_HOST ?= osx +HOST ?= osx endif -DEFAULT_HOST ?= linux - -ANDROID_ABI ?= arm-v7 +HOST ?= linux -.PHONY: all all: mbgl #### Configuration defaults #################################################### -__osx__/%: ENV = MASON_PLATFORM=osx -__osx__/%: HOST ?= osx -__osx__/%: HEADLESS ?= cgl -__osx__/%: PLATFORM ?= osx -__osx__/%: ASSET ?= fs -__osx__/%: HTTP ?= nsurl -__osx__/%: CACHE ?= sqlite - -__ios__/%: ENV = MASON_PLATFORM=ios -__ios__/%: HOST = ios -__ios__/%: HEADLESS ?= none -__ios__/%: PLATFORM ?= ios -__ios__/%: ASSET ?= fs -__ios__/%: HTTP ?= nsurl -__ios__/%: CACHE ?= sqlite - -__linux__/%: ENV = MASON_PLATFORM=linux -__linux__/%: HOST = linux -__linux__/%: HEADLESS ?= glx -__linux__/%: PLATFORM ?= linux -__linux__/%: ASSET ?= fs -__linux__/%: HTTP ?= curl -__linux__/%: CACHE ?= sqlite - -__android-%__/gyp: ENV = $(shell MASON_ANDROID_ABI=$* ./scripts/android_env.sh) -__android-%__/build: ENV = $(shell MASON_ANDROID_ABI=$* ./scripts/android_env.sh) - -__android-%__/gyp: HOST = android -__android-%__/gyp: HEADLESS ?= none -__android-%__/gyp: PLATFORM ?= android -__android-%__/gyp: ASSET ?= zip -__android-%__/gyp: HTTP ?= curl -__android-%__/gyp: CACHE ?= sqlite - -CONFIG_STRING += -Dhost=$(HOST) -CONFIG_STRING += -Dheadless_lib=$(HEADLESS) -CONFIG_STRING += -Dplatform_lib=$(PLATFORM) -CONFIG_STRING += -Dasset_lib=$(ASSET) -CONFIG_STRING += -Dhttp_lib=$(HTTP) -CONFIG_STRING += -Dcache_lib=$(CACHE) -CONFIG_STRING += -Dinstall_prefix=$(PREFIX) -CONFIG_STRING += --depth=. -CONFIG_STRING += -Goutput_dir=.. +ENV_osx = MASON_PLATFORM=osx +CONFIG_osx = -Dhost=osx -Iconfig-osx.gypi -Dinstall_prefix=$(PREFIX) +LIBS_osx = -Dheadless_lib=$(word 1,$(HEADLESS) cgl) +LIBS_osx += -Dplatform_lib=$(word 1,$(PLATFORM) osx) +LIBS_osx += -Dasset_lib=$(word 1,$(ASSET) fs) +LIBS_osx += -Dhttp_lib=$(word 1,$(HTTP) nsurl) +LIBS_osx += -Dcache_lib=$(word 1,$(CACHE) sqlite) +LIBS_osx += --depth=. -Goutput_dir=. + + +ENV_ios = MASON_PLATFORM=ios +CONFIG_ios = -Dhost=ios -Iconfig-ios.gypi -Dinstall_prefix=$(PREFIX) +LIBS_ios = -Dheadless_lib=none +LIBS_ios += -Dplatform_lib=$(word 1,$(PLATFORM) ios) +LIBS_ios += -Dasset_lib=$(word 1,$(ASSET) fs) +LIBS_ios += -Dhttp_lib=$(word 1,$(HTTP) nsurl) +LIBS_ios += -Dcache_lib=$(word 1,$(CACHE) sqlite) +LIBS_ios += --depth=. -Goutput_dir=. + + +ENV_linux = MASON_PLATFORM=linux +CONFIG_linux = -Dhost=linux -Iconfig-linux.gypi -Dinstall_prefix=$(PREFIX) +LIBS_linux = -Dheadless_lib=$(word 1,$(HEADLESS) glx) +LIBS_linux += -Dplatform_lib=$(word 1,$(PLATFORM) linux) +LIBS_linux += -Dasset_lib=$(word 1,$(ASSET) fs) +LIBS_linux += -Dhttp_lib=$(word 1,$(HTTP) curl) +LIBS_linux += -Dcache_lib=$(word 1,$(CACHE) sqlite) +LIBS_linux += --depth=. -Goutput_dir=. + +ANDROID_ABIS += android-lib-arm-v8 +ENV_android-arm-v8 = $(shell MASON_ANDROID_ABI=arm-v8 ./scripts/android_env.sh) +CONFIG_android-arm-v8 = -Dhost=android -Iconfig-android-arm-v8.gypi + +ANDROID_ABIS += android-lib-arm-v7 +ENV_android-arm-v7 = $(shell MASON_ANDROID_ABI=arm-v7 ./scripts/android_env.sh) +CONFIG_android-arm-v7 = -Dhost=android -Iconfig-android-arm-v7.gypi + +ANDROID_ABIS += android-lib-arm-v5 +ENV_android-arm-v5 = $(shell MASON_ANDROID_ABI=arm-v5 ./scripts/android_env.sh) +CONFIG_android-arm-v5 = -Dhost=android -Iconfig-android-arm-v5.gypi + +ANDROID_ABIS += android-lib-x86 +ENV_android-x86 = $(shell MASON_ANDROID_ABI=x86 ./scripts/android_env.sh) +CONFIG_android-x86 = -Dhost=android -Iconfig-android-x86.gypi + +# OpenSSL build is incomplete. +# ANDROID_ABIS += android-lib-x86-64 +# ENV_android-x86-64 = $(shell MASON_ANDROID_ABI=x86-64 ./scripts/android_env.sh) +# CONFIG_android-x86-64 = -Dhost=android -Iconfig-android-x86-64.gypi + +ANDROID_ABIS += android-lib-mips +ENV_android-mips = $(shell MASON_ANDROID_ABI=mips ./scripts/android_env.sh) +CONFIG_android-mips = -Dhost=android -Iconfig-android-mips.gypi + +ANDROID_ABIS += android-lib-mips-64 +ENV_android-mips-64 = $(shell MASON_ANDROID_ABI=mips-64 ./scripts/android_env.sh) +CONFIG_android-mips-64 = -Dhost=android -Iconfig-android-mips-64.gypi + +LIBS_android = -Dheadless_lib=none +LIBS_android += -Dplatform_lib=$(word 1,$(PLATFORM) android) +LIBS_android += -Dasset_lib=$(word 1,$(ASSET) zip) +LIBS_android += -Dhttp_lib=$(word 1,$(HTTP) curl) +LIBS_android += -Dcache_lib=$(word 1,$(CACHE) sqlite) +LIBS_android += --depth=. -Goutput_dir=. #### Dependencies ############################################################## -.PHONY: FORCE -FORCE: - +# Wildcard targets get removed after build by default, but we want to preserve the config. .PRECIOUS: config-%.gypi -config-%.gypi: configure __%__/configure +config-%.gypi: CMD = ./configure config-$*.gypi +config-%.gypi: configure + @echo $(CMD) + @$(ENV_$*) $(CMD) cat config-$*.gypi -__%__/configure: - $(ENV) ./configure config-$*.gypi - #### Library builds ############################################################ -.PHONY: mbgl -mbgl: build/mbgl/Makefile - $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) everything +.PRECOIUS: Makefile/mbgl +Makefile/mbgl: config-$(HOST).gypi + deps/run_gyp mbgl.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make -.PHONY: install -install: build/mbgl/Makefile - LINK=`pwd`/gyp/link.py $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) install +mbgl: Makefile/mbgl + $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) everything -.PHONY: standalone -standalone: build/mbgl/Makefile - LINK=`pwd`/gyp/link.py $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) standalone +standalone: Makefile/mbgl + LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) standalone +install: Makefile/mbgl + LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) install -#### Application buidls ######################################################## -.PHONY: build/mbgl/Makefile -build/mbgl/Makefile: mbgl.gyp __$(DEFAULT_HOST)__/mbgl -__%__/mbgl: config-%.gypi - deps/run_gyp mbgl.gyp -Iconfig-$*.gypi $(CONFIG_STRING) --generator-output=./build/mbgl -f make +##### Test builds ############################################################## -.PHONY: build/test/Makefile -build/test/Makefile: test/test.gyp __$(DEFAULT_HOST)__/test -__%__/test: config-%.gypi - deps/run_gyp test/test.gyp -Iconfig-$*.gypi $(CONFIG_STRING) --generator-output=./build/test -f make +.PRECIOUS: Makefile/test +Makefile/test: test/test.gyp config-$(HOST).gypi + deps/run_gyp test/test.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make -.PHONY: build/linux/Makefile -build/linux/Makefile: linux/mapboxgl-app.gyp __linux__/linux -__linux__/linux: config-linux.gypi - deps/run_gyp linux/mapboxgl-app.gyp -Iconfig-linux.gypi $(CONFIG_STRING) --generator-output=./build/linux -f make +test: Makefile/test + $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) test -.PHONY: build/macosx/Makefile -build/macosx/Makefile: macosx/mapboxgl-app.gyp __osx__/osx -__osx__/osx: config-osx.gypi - deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig-osx.gypi $(CONFIG_STRING) --generator-output=./build/macosx -f make +test-%: test + ./scripts/run_tests.sh "build/$(HOST)/$(BUILDTYPE)/test" --gtest_filter=$* -.PHONY: build/render/Makefile -build/render/Makefile: bin/render.gyp __$(DEFAULT_HOST)__/render -__%__/render: config-%.gypi - deps/run_gyp bin/render.gyp -Iconfig-$*.gypi $(CONFIG_STRING) --generator-output=./build/render -f make -.PHONY: build/test/test.xcodeproj -build/test/test.xcodeproj: test/test.gyp __osx__/test-xcode -__osx__/test-xcode: config-osx.gypi - deps/run_gyp test/test.gyp -Iconfig-osx.gypi $(CONFIG_STRING) --generator-output=./build -f xcode +.PRECIOUS: Xcode/test +Xcode/test: test/test.gyp config-osx.gypi + deps/run_gyp test/test.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f xcode -.PHONY: build/macosx/mapboxgl-app.xcodeproj -build/macosx/mapboxgl-app.xcodeproj: macosx/mapboxgl-app.gyp __osx__/app-xcode -__osx__/app-xcode: config-osx.gypi - deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig-osx.gypi $(CONFIG_STRING) --generator-output=./build -f xcode +.PHONY: lproj lbuild run-xlinux +xtest-proj: Xcode/test + open ./build/osx/test/test.xcodeproj -.PHONY: build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj -build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj: ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp __ios__/app-xcode -__ios__/app-xcode: config-ios.gypi - deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp -Iconfig-ios.gypi $(CONFIG_STRING) -Goutput_dir=. --generator-output=./build -f xcode +xtest: Xcode/test + xcodebuild -project ./build/osx/test/test.xcodeproj -configuration $(BUILDTYPE) -scheme test -derivedDataPath build/osx -jobs `sysctl -n hw.ncpu` -.PHONY: build/linux/mapboxgl-app.xcodeproj -build/linux/mapboxgl-app.xcodeproj: linux/mapboxgl-app.gyp __linux__/app-xcode -__linux__/app-xcode: config-osx.gypi - deps/run_gyp linux/mapboxgl-app.gyp -Iconfig-osx.gypi $(CONFIG_STRING) --generator-output=./build -f xcode +xtest-%: xtest + ./scripts/run_tests.sh "build/osx/Build/Products/$(BUILDTYPE)/test" --gtest_filter=$* -.PHONY: build/bin/render.xcodeproj -build/bin/render.xcodeproj: bin/render.gyp __osx__/render-xcode -__osx__/render-xcode:config-osx.gypi - deps/run_gyp bin/render.gyp -Iconfig-osx.gypi $(CONFIG_STRING) --generator-output=./build -f xcode -build/android-%/Makefile: android/mapboxgl-app.gyp __android-%__/gyp - @# leave this line here +#### Mac OS X application builds ############################################### -__android-%__/gyp: GYP_CMD = deps/run_gyp android/mapboxgl-app.gyp -Iconfig-android-$*.gypi $(CONFIG_STRING) -Goutput_dir=. --generator-output=./build/android-$* -f make-android -__android-%__/gyp: config-android-%.gypi - @echo $(GYP_CMD) ; $(ENV) $(GYP_CMD) +.PRECIOUS: Makefile/osx +Makefile/osx: macosx/mapboxgl-app.gyp config-osx.gypi + deps/run_gyp macosx/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f make -__android-%__/build: MAKE_CMD = $(MAKE) -C build/android-$* BUILDTYPE=$(BUILDTYPE) androidapp -__android-%__/build: build/android-%/Makefile - @echo $(MAKE_CMD) ; $(ENV) $(MAKE_CMD) +.PHONY: osx run-osx +osx: Makefile/osx + $(MAKE) -C build/osx BUILDTYPE=$(BUILDTYPE) osxapp +run-osx: osx + "build/osx/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" -##### Test cases ############################################################### -test: build/test/Makefile - $(MAKE) -C build/test BUILDTYPE=$(BUILDTYPE) test +.PRECIOUS: Xcode/osx +Xcode/osx: macosx/mapboxgl-app.gyp config-osx.gypi + deps/run_gyp macosx/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f xcode -test-%: test - ./scripts/run_tests.sh --gtest_filter=$* +.PHONY: xosx-proj xosx run-xosx +xosx-proj: Xcode/osx + open ./build/osx/macosx/mapboxgl-app.xcodeproj + +xosx: Xcode/osx + xcodebuild -project ./build/osx/macosx/mapboxgl-app.xcodeproj -configuration $(BUILDTYPE) -scheme osxapp -derivedDataPath build/osx -jobs `sysctl -n hw.ncpu` + +run-xosx: xosx + "build/osx/Build/Products/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" -# build Mac OS X project for Xcode -xtest: build/test/test.xcodeproj - open ./build/test/test.xcodeproj +# Legacy name +xproj: xosx-proj -##### Makefile builds ########################################################## -# Builds the linux app with make. -linux: build/linux/Makefile - $(MAKE) -C build/linux BUILDTYPE=$(BUILDTYPE) linuxapp +#### iOS application builds #################################################### + +.PRECIOUS: Xcode/ios +Xcode/ios: ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp config-ios.gypi + deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp $(CONFIG_ios) $(LIBS_ios) --generator-output=./build/ios -f xcode + +.PHONY: ios-proj ios run-ios +ios-proj: Xcode/ios + open ./build/ios/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj + +ios: Xcode/ios + xcodebuild -sdk iphonesimulator ONLY_ACTIVE_ARCH=YES -project ./build/ios/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj -configuration $(BUILDTYPE) -scheme iosapp -derivedDataPath build/ios -jobs `sysctl -n hw.ncpu` + +# Legacy name +iproj: ios-proj + + +#### Linux application builds ################################################## + +.PRECIOUS: Makefile/linux +Makefile/linux: linux/mapboxgl-app.gyp config-$(HOST).gypi + deps/run_gyp linux/mapboxgl-app.gyp $(CONFIG_$(HOST)) $(LIBS_linux) --generator-output=./build/$(HOST) -f make + +.PHONY: linux run-linux +linux: Makefile/linux + $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) linuxapp -# Executes the Linux binary run-linux: linux - (cd build/$(BUILDTYPE) && ./mapbox-gl) + (cd build/$(HOST)/$(BUILDTYPE) && ./mapbox-gl) -# Builds the OS X app with make. -osx: build/macosx/Makefile - $(MAKE) -C build/macosx BUILDTYPE=$(BUILDTYPE) osxapp -# Executes the OS X binary -run-osx: osx - build/$(BUILDTYPE)/Mapbox\ GL.app/Contents/MacOS/MAPBOX\ GL +.PRECIOUS: Xcode/linux +Xcode/linux: linux/mapboxgl-app.gyp config-osx.gypi + deps/run_gyp linux/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_linux) --generator-output=./build/osx -f xcode + +.PHONY: lproj lbuild run-xlinux +xlinux-proj: Xcode/linux + open ./build/osx/linux/mapboxgl-app.xcodeproj -# Builds the iOS app with Xcode. -ios: build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj - xcodebuild -project ./build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO -jobs $JOBS +xlinux: Xcode/linux + xcodebuild -project ./build/osx/linux/mapboxgl-app.xcodeproj -configuration $(BUILDTYPE) -scheme linuxapp -derivedDataPath build/osx + +run-xlinux: xlinux + "build/osx/Build/Products/$(BUILDTYPE)/mapbox-gl" + +# Legacy name +lproj: xlinux-proj + + +##### Render application ####################################################### +# .PHONY: build/render/Makefile +# build/render/Makefile: bin/render.gyp __$(HOST)__/render +# __%__/render: config-%.gypi +# deps/run_gyp bin/render.gyp -Iconfig-$*.gypi $(CONFIG_STRING) --generator-output=./build/render -f make + +# .PHONY: build/bin/render.xcodeproj +# build/bin/render.xcodeproj: bin/render.gyp __osx__/render-xcode +# __osx__/render-xcode:config-osx.gypi +# deps/run_gyp bin/render.gyp -Iconfig-osx.gypi $(CONFIG_STRING) --generator-output=./build -f xcode + +# # Builds the CLI render app +# render: build/render/Makefile +# $(MAKE) -C build/render BUILDTYPE=$(BUILDTYPE) mbgl-render + +#### Android libaries ######################################################### + +.PRECIOUS: Makefile/android-% +Makefile/android-%: CMD = deps/run_gyp android/mapboxgl-app.gyp $(CONFIG_android-$*) $(LIBS_android) --generator-output=./build/android-$* -f make-android +Makefile/android-%: config-android-%.gypi + @echo $(CMD) + @$(ENV_android-$*) $(CMD) + +# Builds all android architectures. +android-all: $(ANDROID_ABIS) +android-all: android + +# Builds a particular android architecture. +android-lib-%: CMD = $(MAKE) -C build/android-$* BUILDTYPE=$(BUILDTYPE) androidapp +android-lib-%: Makefile/android-% + @echo $(CMD) + @$(ENV_android-$*) $(CMD) # Builds the selected/default Android library -android: __android-$(ANDROID_ABI)__/build +android: android-lib-$(ANDROID_ABI) cd android/java && ./gradlew --parallel-threads=$(JOBS) build -# Builds all android architectures. As new architectures appear, add them to this list. -android-all: __android-arm-v7__/build -android-all: __android-arm-v8__/build -android-all: android +# rproj: build/bin/render.xcodeproj +# open ./build/bin/render.xcodeproj -# Builds the CLI render app -render: build/render/Makefile - $(MAKE) -C build/render BUILDTYPE=$(BUILDTYPE) mbgl-render -##### Xcode projects ########################################################### +##### Maintenace operations #################################################### .PHONY: clear_xcode_cache clear_xcode_cache: @@ -214,22 +271,6 @@ ifeq ($(PLATFORM), osx) fi endif -xproj: build/macosx/mapboxgl-app.xcodeproj - open ./build/macosx/mapboxgl-app.xcodeproj - -iproj: build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj - open ./build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj - -rproj: build/bin/render.xcodeproj - open ./build/bin/render.xcodeproj - -# build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code) -lproj: build/linux/mapboxgl-app.xcodeproj - open ./build/linux/mapboxgl-app.xcodeproj - - -##### Maintenace operations #################################################### - .PHONY: clear_sqlite_cache clear_sqlite_cache: ifeq ($(PLATFORM), osx) diff --git a/android/mapboxgl-app.gyp b/android/mapboxgl-app.gyp index e12205ea76..5933db4c19 100644 --- a/android/mapboxgl-app.gyp +++ b/android/mapboxgl-app.gyp @@ -22,7 +22,7 @@ ], 'cflags_cc': [ - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'libraries': [ '<@(openssl_static_libs)', @@ -73,16 +73,20 @@ 'copies': [ { - 'files': [ '<(PRODUCT_DIR)/lib.target/libmapbox-gl.so' ], - 'destination': '<(pwd)/java/lib/src/main/jniLibs/$(JNIDIR)' - }, - { - 'files': [ '../common/ca-bundle.crt' ], + 'files': [ + '../common/ca-bundle.crt', + '../styles/styles' + ], 'destination': '<(pwd)/java/lib/src/main/assets' }, + ], + + 'actions': [ { - 'files': [ '../styles/styles' ], - 'destination': '<(pwd)/java/lib/src/main/assets' + 'action_name': 'Strip dynamic library', + 'inputs': [ '<(PRODUCT_DIR)/lib.target/libmapbox-gl.so' ], + 'outputs': [ '<(pwd)/java/lib/src/main/jniLibs/$(JNIDIR)/libmapbox-gl.so' ], + 'action': [ '$(STRIP)', '<@(_inputs)', '-o', '<@(_outputs)' ] }, ], }, diff --git a/bin/render.gyp b/bin/render.gyp index 4529cd12ab..316a7f3ed0 100644 --- a/bin/render.gyp +++ b/bin/render.gyp @@ -28,11 +28,11 @@ 'variables' : { 'cflags_cc': [ '<@(glfw3_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'ldflags': [ '<@(glfw3_ldflags)', - '-L<(boost_root)/lib', + '<@(boost_ldflags)', '-lboost_program_options' ], 'libraries': [ @@ -85,14 +85,15 @@ CONFIG="# Do not edit. Generated by the configure script. if [ ! -z ${BOOST_VERSION} ]; then mason install boost ${BOOST_VERSION} - CONFIG+=" 'boost_root': '$(mason prefix boost ${BOOST_VERSION})',"$LN + CONFIG+=" 'boost_cflags%': $(quote_flags $(mason cflags boost ${BOOST_VERSION})),"$LN + CONFIG+=" 'boost_ldflags%': $(quote_flags $(mason ldflags boost ${BOOST_VERSION})),"$LN fi if [ ! -z ${OPENSSL_VERSION} ]; then mason install openssl ${OPENSSL_VERSION} - CONFIG+=" 'openssl_static_libs': $(quote_flags $(mason static_libs openssl ${OPENSSL_VERSION})),"$LN - CONFIG+=" 'openssl_cflags': $(quote_flags $(mason cflags openssl ${OPENSSL_VERSION})),"$LN - CONFIG+=" 'openssl_ldflags': $(quote_flags $(mason ldflags openssl ${OPENSSL_VERSION})),"$LN + CONFIG+=" 'openssl_static_libs%': $(quote_flags $(mason static_libs openssl ${OPENSSL_VERSION})),"$LN + CONFIG+=" 'openssl_cflags%': $(quote_flags $(mason cflags openssl ${OPENSSL_VERSION})),"$LN + CONFIG+=" 'openssl_ldflags%': $(quote_flags $(mason ldflags openssl ${OPENSSL_VERSION})),"$LN fi if [ ! -z ${LIBCURL_VERSION} ]; then @@ -153,9 +154,9 @@ fi if [ ! -z ${LIBZIP_VERSION} ]; then mason install libzip ${LIBZIP_VERSION} - CONFIG+=" 'zip_static_libs': $(quote_flags $(mason static_libs libzip ${LIBZIP_VERSION})),"$LN - CONFIG+=" 'zip_cflags': $(quote_flags $(mason cflags libzip ${LIBZIP_VERSION})),"$LN - CONFIG+=" 'zip_ldflags': $(quote_flags $(mason ldflags libzip ${LIBZIP_VERSION})),"$LN + CONFIG+=" 'zip_static_libs%': $(quote_flags $(mason static_libs libzip ${LIBZIP_VERSION})),"$LN + CONFIG+=" 'zip_cflags%': $(quote_flags $(mason cflags libzip ${LIBZIP_VERSION})),"$LN + CONFIG+=" 'zip_ldflags%': $(quote_flags $(mason ldflags libzip ${LIBZIP_VERSION})),"$LN fi CONFIG+=" } diff --git a/gyp/asset-fs.gypi b/gyp/asset-fs.gypi index 9cd8593fbc..0606eaf7f8 100644 --- a/gyp/asset-fs.gypi +++ b/gyp/asset-fs.gypi @@ -17,7 +17,7 @@ 'variables': { 'cflags_cc': [ '<@(uv_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'ldflags': [ '<@(uv_ldflags)', diff --git a/gyp/asset-zip.gypi b/gyp/asset-zip.gypi index 87f7584772..25df2a3d8b 100644 --- a/gyp/asset-zip.gypi +++ b/gyp/asset-zip.gypi @@ -23,7 +23,7 @@ 'cflags_cc': [ '<@(uv_cflags)', '<@(zip_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'ldflags': [ '<@(uv_ldflags)', diff --git a/gyp/core.gypi b/gyp/core.gypi index 0adcaa766f..9a3b07d0bb 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -29,7 +29,7 @@ 'variables': { 'cflags_cc': [ '<@(uv_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'cflags': [ '<@(uv_cflags)', diff --git a/gyp/http-curl.gypi b/gyp/http-curl.gypi index 5dcd71a59b..87edff2492 100644 --- a/gyp/http-curl.gypi +++ b/gyp/http-curl.gypi @@ -18,7 +18,7 @@ 'cflags_cc': [ '<@(uv_cflags)', '<@(curl_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'ldflags': [ '<@(uv_ldflags)', diff --git a/gyp/install.gypi b/gyp/install.gypi index 90d64e9403..4ed32eea14 100644 --- a/gyp/install.gypi +++ b/gyp/install.gypi @@ -17,11 +17,17 @@ 'copies': [ { 'files': [ '<(PRODUCT_DIR)/libmbgl.a' ], 'destination': '<(install_prefix)/lib' }, - { 'files': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' }, { 'files': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp' ], 'destination': '<(install_prefix)/include/mbgl/util' }, ], 'actions': [ + { + 'action_name': 'Copy header files', + 'inputs': [ '../include/mbgl/mbgl.hpp' ], + 'outputs': [ '../include/mbgl/mbgl.hpp' ], + 'action': [ 'cp', '-r', 'include', '<(install_prefix)/' ] + }, + { 'action_name': 'mbgl-config', 'inputs': [ '../utils/mbgl-config/mbgl-config.template.sh', diff --git a/gyp/platform-android.gypi b/gyp/platform-android.gypi index ac86f50e65..cbd855e9c2 100644 --- a/gyp/platform-android.gypi +++ b/gyp/platform-android.gypi @@ -24,7 +24,7 @@ '<@(jpeg_cflags)', '<@(uv_cflags)', '<@(nu_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'ldflags': [ '<@(png_ldflags)', diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi index 2bbe1272d2..bb1b450728 100644 --- a/gyp/platform-ios.gypi +++ b/gyp/platform-ios.gypi @@ -20,7 +20,7 @@ 'variables': { 'cflags_cc': [ '<@(uv_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'libraries': [ '<@(uv_static_libs)', diff --git a/gyp/platform-linux.gypi b/gyp/platform-linux.gypi index 2915606ac5..30715f8289 100644 --- a/gyp/platform-linux.gypi +++ b/gyp/platform-linux.gypi @@ -26,7 +26,7 @@ '<@(jpeg_cflags)', '<@(uv_cflags)', '<@(nu_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'ldflags': [ '<@(png_ldflags)', diff --git a/gyp/platform-osx.gypi b/gyp/platform-osx.gypi index 1fdf9de2c7..e3fe7b0d53 100644 --- a/gyp/platform-osx.gypi +++ b/gyp/platform-osx.gypi @@ -20,7 +20,7 @@ 'variables': { 'cflags_cc': [ '<@(uv_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'libraries': [ '<@(uv_static_libs)', diff --git a/scripts/android_env.sh b/scripts/android_env.sh index f91d7628e5..93b1452a5a 100755 --- a/scripts/android_env.sh +++ b/scripts/android_env.sh @@ -7,17 +7,19 @@ set -o pipefail export MASON_PLATFORM=android +export PATH=`.mason/mason env PATH` + echo MASON_PLATFORM=\"android\" echo MASON_ANDROID_ABI=\"${MASON_ANDROID_ABI}\" -echo CXX=\"`.mason/mason env CXX`\" -echo CC=\"`.mason/mason env CC`\" -echo LD=\"`.mason/mason env LD`\" -echo LINK=\"`.mason/mason env CXX`\" -echo AR=\"`.mason/mason env AR`\" -echo RANLIB=\"`.mason/mason env RANLIB`\" +echo CXX=\"`which $(.mason/mason env CXX)`\" +echo CC=\"`which $(.mason/mason env CC)`\" +echo LD=\"`which $(.mason/mason env LD)`\" +echo LINK=\"`which $(.mason/mason env CXX)`\" +echo AR=\"`which $(.mason/mason env AR)`\" +echo RANLIB=\"`which $(.mason/mason env RANLIB)`\" +echo STRIP=\"`which $(.mason/mason env STRIP)`\" echo LDFLAGS=\"`.mason/mason env LDFLAGS` ${LDFLAGS}\" echo CFLAGS=\"`.mason/mason env CFLAGS` ${CFLAGS}\" echo CPPFLAGS=\"`.mason/mason env CPPFLAGS` ${CPPFLAGS}\" -echo PATH=\"`.mason/mason env PATH`\" echo JNIDIR=\"`.mason/mason env JNIDIR`\" diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 6a715f3783..e4c9e77eac 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -3,7 +3,10 @@ set -e set -o pipefail -CMD="build/${BUILDTYPE:-Release}/test" +if [ `uname -s` = 'Darwin' ]; then HOST=${HOST:-osx} ; else HOST=${HOST:-linux} ; fi + +CMD=$1 +shift # allow writing core files ulimit -c unlimited -S diff --git a/test/fixtures/main.cpp b/test/fixtures/main.cpp index 303a0b9ab5..f7b2a6e92f 100644 --- a/test/fixtures/main.cpp +++ b/test/fixtures/main.cpp @@ -1,33 +1,6 @@ #include "util.hpp" -#include <libgen.h> - -std::string baseDirectory; - -namespace mbgl { -namespace test { - -const std::string &getBaseDirectory() { - return baseDirectory; -} - -} -} - GTEST_API_ int main(int argc, char *argv[]) { - // Note: glibc's dirname() **modifies** the argument and can't handle static strings. - std::string file { __FILE__ }; - file = dirname(const_cast<char *>(file.c_str())); - if (file[0] == '/') { - // If __FILE__ is an absolute path, we don't have to guess from the argv 0. - baseDirectory = file + "/.."; - } else { - std::string argv0 { argv[0] }; argv0 = dirname(const_cast<char *>(argv0.c_str())); - baseDirectory = argv0 + "/" + file + "/.."; - } - - fprintf(stderr, "basedir: %s\n", mbgl::test::getBaseDirectory().c_str()); - testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/test/fixtures/util.hpp b/test/fixtures/util.hpp index f1201d34e7..dd8539c846 100644 --- a/test/fixtures/util.hpp +++ b/test/fixtures/util.hpp @@ -14,7 +14,6 @@ namespace mbgl { namespace test { -const std::string &getBaseDirectory(); pid_t startServer(const char *executable); void stopServer(pid_t pid); diff --git a/test/headless/headless.cpp b/test/headless/headless.cpp index 20f5b5b3ae..e7e1153923 100644 --- a/test/headless/headless.cpp +++ b/test/headless/headless.cpp @@ -10,6 +10,7 @@ #include <rapidjson/writer.h> #include <rapidjson/stringbuffer.h> +#include <mbgl/platform/platform.hpp> #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/storage/default_file_source.hpp> @@ -29,7 +30,7 @@ void rewriteLocalScheme(rapidjson::Value &value, rapidjson::Document::AllocatorT class HeadlessTest : public ::testing::TestWithParam<std::string> { public: static void SetUpTestCase() { - const auto server = mbgl::test::getBaseDirectory() + "/headless/server.js"; + const auto server = mbgl::platform::applicationRoot() + "/TEST_DATA/headless/server.js"; pid = mbgl::test::startServer(server.c_str()); display = std::make_shared<mbgl::HeadlessDisplay>(); } @@ -165,7 +166,7 @@ TEST_P(HeadlessTest, render) { INSTANTIATE_TEST_CASE_P(Headless, HeadlessTest, ::testing::ValuesIn([] { std::vector<std::string> names; - const auto tests = mbgl::test::getBaseDirectory() + "/suite/tests"; + const auto tests = mbgl::platform::applicationRoot() + "/TEST_DATA/suite/tests"; DIR *dir = opendir(tests.c_str()); if (dir != nullptr) { for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) { diff --git a/test/storage/storage.cpp b/test/storage/storage.cpp index 99386a02ce..ddc6fef5fb 100644 --- a/test/storage/storage.cpp +++ b/test/storage/storage.cpp @@ -1,9 +1,11 @@ #include "storage.hpp" +#include <mbgl/platform/platform.hpp> + pid_t Storage::pid = 0; void Storage::SetUpTestCase() { - const auto server = mbgl::test::getBaseDirectory() + "/storage/server.js"; + const auto server = mbgl::platform::applicationRoot() + "/TEST_DATA/storage/server.js"; pid = mbgl::test::startServer(server.c_str()); } diff --git a/test/test.gyp b/test/test.gyp index 547a2d099b..1d80a4f830 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -73,7 +73,7 @@ 'variables': { 'cflags_cc': [ '<@(uv_cflags)', - '-I<(boost_root)/include', + '<@(boost_cflags)', ], 'ldflags': [ '<@(uv_ldflags)', |