diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-03 15:16:49 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-07 18:01:02 -0700 |
commit | f964e40e7e9220d08751d8607af61ac5a7c0794c (patch) | |
tree | d34ca5407188fe3d71396faa8a8acceb52d9bd4b | |
parent | f5d66f362272db034a311d2077dbdb2937c9bbdf (diff) | |
download | qtlocation-mapboxgl-f964e40e7e9220d08751d8607af61ac5a7c0794c.tar.gz |
[build] Refactor and simplify build system
* Main gyp files are now standardized as platform/<platform>/platform.gyp.
* Each platform gyp file defines appropriate loop_lib and headless_lib variables.
* Each platform gyp file includes mbgl.gypi, which defines base targets which may be useful to all platforms.
* CI targets are consistent across platforms: `make $(PLATFORM) && make test-$(PLATFORM)`.
* Renamed the "linux" test app to "glfw". It's now built in OS X CI.
* Android build flakiness is fixed.
* iOS CI builds the bench and iosapp targets.
* Mesa version is now in one place.
* CI scripts use bash "strict mode" and correct error handling.
* All build output goes to the build directory.
* Removed vestigial iOS/OS X/Android Travis scripts.
94 files changed, 1684 insertions, 3094 deletions
diff --git a/.gitignore b/.gitignore index 68e242a31b..218297e317 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,14 @@ .DS_Store -*.xcodeproj -*.o -*.actual.png -*.diff.png *.pyc *.gcno *.gcda +*~ offline.db -/platform/android/debug -/platform/android/sdk -/platform/android/**/.classpath -/platform/android/**/.project -/platform/android/**/.settings/ +/platform/node/test/actual +/platform/node/test/diff /mason_packages -/config/*.gypi /build /lib -/ios/build -/ios/app/build -/test/build -/gyp/build -/gyp/java /test/node_modules /test/fixtures/*/*_actual.* /test/fixtures/api/1.png @@ -30,15 +18,4 @@ offline.db /test/fixtures/**/actual.png /test/fixtures/**/diff.png /test/output -/include/mbgl/shader/shaders.hpp -/src/shader/shaders_gl.cpp -/src/shader/shaders_gles2.cpp -/bin/style.bin.js /node_modules -*~ - -/ios/benchmark/assets/tiles/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6/ -/ios/benchmark/assets/glyphs/DIN Offc Pro*/ - -/platform/node/test/actual -/platform/node/test/diff diff --git a/.travis.yml b/.travis.yml index 79090a21a7..cf2d04abd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ -language: cpp - sudo: false +git: + submodules: false + # Save common build configurations as shortcuts, so we can reference them later. addons_shortcuts: addons_clang35: &clang35 @@ -15,39 +16,69 @@ addons_shortcuts: packages: [ 'gdb', 'g++-4.9', 'gcc-4.9', 'libllvm3.4', 'xutils-dev', 'libxxf86vm-dev', 'x11proto-xf86vidmode-dev', 'mesa-utils' ] +env: + global: + - TERM: dumb + - CCACHE: 1 + # AWS + - secure: "MZHblLZXG/jWf2w0ZFlxCLDwx2qtGgRDODQyg1BR7JIuMz6AtWv8XR/sUczWLbiABCL0a/NzJF1g4v2pI7X69IntcjOdIABBgTh7++6+1TJ0Kp8viEltb55nQG3lHy/R6fOaI7Pj9tuCX0PCRtGA5C/fGnodLGEjy3RVOJ09ln0=" + - secure: "KaSQbhgjtV7ZCkesHmvrNsbQVjk5SPfGKB1VkWenRGYhLF45HpSRNwSxMQddZ566Pg7qIFgF1iWl/B0QW3B6AWL5WmzQ5AOJgwS876pNIc/UT7ubMPtgAtjpvw1bQvQP3B8MrB+3OE5c6tD+a3LhR9krV//dOsfErR5Yy+3Mbkc=" + # Access Token + - secure: "RiBIBfVhhaMjU5ksuwJO3shdvG9FpinBjdSv4co9jg9171SR8edNriedHjVKSIeBhSGNmZmX+twS3dJS/By6tl/LKh9sTynA+ZAYYljkE7jn881B/gMrlYvdAA6og5KvkhV1/0iJWlhuZrMTkhpDR200iLgg3EWBhWjltzmDW/I=" + +install: + - source ./scripts/travis_helper.sh + - source ./scripts/travis_setup.sh +before_script: + - ccache --zero-stats +script: + - make linux + - make test-linux +after_script: + - ccache --show-stats + - ./platform/linux/scripts/after_script.sh ${TRAVIS_JOB_NUMBER} ${TRAVIS_TAG:-} + matrix: - exclude: - - os: linux include: - - # Linux/Node.js 4 - Clang 3.5 - Release - - os: linux + # Clang 3.5 - Release - Node + - language: node compiler: ": node4-clang35-release" - env: FLAVOR=node BUILDTYPE=Release NODE_VERSION=4 _CXX=clang++-3.5 _CC=clang-3.5 CCACHE=1 + env: BUILDTYPE=Release _CXX=clang++-3.5 _CC=clang-3.5 addons: *clang35 - - # Linux - GCC 4.9 - Debug - - os: linux + script: + - nvm install 4 + - nvm use 4 + - make node + - make test-node + after_script: + - ccache --show-stats + - ./platform/node/scripts/after_script.sh ${TRAVIS_JOB_NUMBER} ${TRAVIS_TAG:-} + + # GCC 4.9 - Debug - Coverage + - language: cpp compiler: ": linux-gcc49-debug" - env: FLAVOR=linux ACTION=coveralls _CXX=g++-4.9 _CC=gcc-4.9 CCACHE=1 + env: BUILDTYPE=Debug _CXX=g++-4.9 _CC=gcc-4.9 ENABLE_COVERAGE=1 addons: *gcc49 + after_script: + - ccache --show-stats + - ./platform/linux/scripts/coveralls.sh - # Linux - GCC 4.9 - Release - - os: linux + # GCC 4.9 - Release + - language: cpp compiler: ": linux-gcc49-release" - env: FLAVOR=linux BUILDTYPE=Release _CXX=g++-4.9 _CC=gcc-4.9 CCACHE=1 + env: BUILDTYPE=Release _CXX=g++-4.9 _CC=gcc-4.9 addons: *gcc49 - # Linux - Clang 3.5 - Debug - - os: linux + # Clang 3.5 - Debug + - language: cpp compiler: ": linux-clang35-debug" - env: FLAVOR=linux BUILDTYPE=Debug _CXX=clang++-3.5 _CC=clang-3.5 CCACHE=1 + env: BUILDTYPE=Debug _CXX=clang++-3.5 _CC=clang-3.5 addons: *clang35 - # Linux - Clang 3.5 - Release - - os: linux + # Clang 3.5 - Release + - language: cpp compiler: ": linux-clang35-release" - env: FLAVOR=linux BUILDTYPE=Release _CXX=clang++-3.5 _CC=clang-3.5 CCACHE=1 + env: BUILDTYPE=Release _CXX=clang++-3.5 _CC=clang-3.5 addons: *clang35 cache: @@ -57,44 +88,6 @@ cache: - $HOME/build/mapbox/mapbox-gl-native/.binaries - $HOME/build/mapbox/mapbox-gl-native/.scripts -env: - global: - - TERM: dumb - # AWS - - secure: "MZHblLZXG/jWf2w0ZFlxCLDwx2qtGgRDODQyg1BR7JIuMz6AtWv8XR/sUczWLbiABCL0a/NzJF1g4v2pI7X69IntcjOdIABBgTh7++6+1TJ0Kp8viEltb55nQG3lHy/R6fOaI7Pj9tuCX0PCRtGA5C/fGnodLGEjy3RVOJ09ln0=" - - secure: "KaSQbhgjtV7ZCkesHmvrNsbQVjk5SPfGKB1VkWenRGYhLF45HpSRNwSxMQddZ566Pg7qIFgF1iWl/B0QW3B6AWL5WmzQ5AOJgwS876pNIc/UT7ubMPtgAtjpvw1bQvQP3B8MrB+3OE5c6tD+a3LhR9krV//dOsfErR5Yy+3Mbkc=" - # Access Token - - secure: "RiBIBfVhhaMjU5ksuwJO3shdvG9FpinBjdSv4co9jg9171SR8edNriedHjVKSIeBhSGNmZmX+twS3dJS/By6tl/LKh9sTynA+ZAYYljkE7jn881B/gMrlYvdAA6og5KvkhV1/0iJWlhuZrMTkhpDR200iLgg3EWBhWjltzmDW/I=" - -before_install: -- source ./scripts/set_compiler.sh -- source ./scripts/travis_helper.sh -- if [[ ${ACTION:-0} == 'coveralls' ]]; then - rvm install 2.3.0; - rvm use 2.3.0; - rvm rubygems latest --force; - gem install coveralls-lcov; - fi - -install: -- ./platform/${FLAVOR}/scripts/install.sh - -before_script: -- if command -v ccache >/dev/null 2>&1; then ccache --zero-stats ; fi - -script: -- ./platform/${FLAVOR}/scripts/${ACTION:-run}.sh - -after_failure: -- "[ -f ./platform/${FLAVOR}/scripts/after_failure.sh ] && ./platform/${FLAVOR}/scripts/after_failure.sh" - -after_script: -- if command -v ccache >/dev/null 2>&1; then ccache --show-stats ; fi -- "[ -f ./platform/${FLAVOR}/scripts/after_script.sh ] && ./platform/${FLAVOR}/scripts/after_script.sh" - notifications: slack: secure: HHQYr7sF8M1SzoWSqgKVYtwAgGdLLCyTMsQjFhEEQNYO92ZwURE5s03qWTGH5k8+4Yqn26yrXt3NztLC4JIOpcGervN2mSZyq4dZgFTcWEd61igw0qwSenlwvFfbE1ASK/KYCzfyn9MIfHN+ovwLoRxXZkPwinKDvl3DXjBaFNg= - -git: - submodules: false @@ -1,147 +1,92 @@ export BUILDTYPE ?= Release -export BUILD_TEST ?= 1 -export BUILD_RENDER ?= 1 -export BUILD_OFFLINE ?= 1 export ENABLE_COVERAGE ?= 0 -# Determine build platform ifeq ($(shell uname -s), Darwin) -export BUILD = osx -export JOBS ?= $(shell sysctl -n hw.ncpu) + export JOBS ?= $(shell sysctl -n hw.ncpu) else ifeq ($(shell uname -s), Linux) -export BUILD = linux -export JOBS ?= $(shell grep --count processor /proc/cpuinfo) + export JOBS ?= $(shell grep --count processor /proc/cpuinfo) else -$(error Cannot determine build platform) + $(error Cannot determine host platform) endif -export BUILD_VERSION = $(shell uname -m) - -RUN = +$(MAKE) -f scripts/main.mk +RUN = +$(MAKE) -f scripts/main.mk default: @printf "You must specify a valid target\n" #### OS X targets ############################################################## -.PHONY: osx -osx: - $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/osxapp - -.PHONY: run-osx -run-osx: osx - "gyp/build/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" - -.PHONY: Xcode/osx -Xcode/osx: - $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/__project__ +OSX_PROJ_PATH = build/osx-x86_64/platform/osx/platform.xcodeproj -.PHONY: xproj -xproj: Xcode/osx - open ./build/osx-x86_64/gyp/osx.xcodeproj +osx: + $(RUN) PLATFORM=osx Xcode/All -.PHONY: xpackage -xpackage: Xcode/osx - ./platform/osx/scripts/package.sh +$(OSX_PROJ_PATH): + $(RUN) PLATFORM=osx Xcode/__project__ -.PHONY: xpackage-strip -xpackage-strip: Xcode/osx - ./platform/osx/scripts/package.sh strip +xproj: $(OSX_PROJ_PATH) + open $(OSX_PROJ_PATH) -.PHONY: xtest -xtest: - $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/test +$(OSX_PROJ_PATH)/xcshareddata/xcschemes/osxtest.xcscheme: platform/osx/scripts/osxtest.xcscheme $(OSX_PROJ_PATH) + mkdir -p $(basename $@) + cp $< $@ -.PHONY: xctest -xctest: Xcode/osx - ./platform/osx/scripts/test.sh +test-osx: $(OSX_PROJ_PATH)/xcshareddata/xcschemes/osxtest.xcscheme node_modules/express + xcodebuild -project $(OSX_PROJ_PATH) -configuration $(BUILDTYPE) -target test build + build/osx-x86_64/$(BUILDTYPE)/test + xcodebuild -project $(OSX_PROJ_PATH) -configuration $(BUILDTYPE) -scheme osxtest test #### iOS targets ############################################################## -.PHONY: Xcode/ios -Xcode/ios: - $(RUN) HOST=ios Xcode/__project__ - -.PHONY: iproj -iproj: Xcode/ios - open ./build/ios-all/gyp/ios.xcodeproj +IOS_PROJ_PATH = build/ios-all/platform/ios/platform.xcodeproj -.PHONY: ios ios: - $(RUN) HOST=ios XCODEBUILD_ARGS='-sdk iphoneos ARCHS="arm64 armv7 armv7s"' Xcode/iosapp + $(RUN) PLATFORM=ios Xcode/All -.PHONY: isim -isim: - $(RUN) HOST=ios XCODEBUILD_ARGS='-sdk iphonesimulator ARCHS="x86_64 i386"' Xcode/iosapp +$(IOS_PROJ_PATH): + $(RUN) PLATFORM=ios Xcode/__project__ -.PHONY: ibench -ibench: - $(RUN) HOST=ios XCODEBUILD_ARGS='-sdk iphoneos ARCHS="arm64"' Xcode/ios-bench +iproj: $(IOS_PROJ_PATH) + open $(IOS_PROJ_PATH) -.PHONY: ipackage -ipackage: Xcode/ios +test-ios: + # Currently nothing + +ipackage: $(IOS_PROJ_PATH) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \ BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \ ./platform/ios/scripts/package.sh -.PHONY: ipackage-strip -ipackage-strip: Xcode/ios +ipackage-strip: $(IOS_PROJ_PATH) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO \ BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \ ./platform/ios/scripts/package.sh -.PHONY: ipackage-sim -ipackage-sim: Xcode/ios +ipackage-sim: $(IOS_PROJ_PATH) BUILDTYPE=Debug BITCODE=$(BITCODE) FORMAT=dynamic BUILD_DEVICE=false SYMBOLS=$(SYMBOLS) \ BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \ ./platform/ios/scripts/package.sh -.PHONY: iframework -iframework: Xcode/ios +iframework: $(IOS_PROJ_PATH) BITCODE=$(BITCODE) FORMAT=dynamic BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \ ./platform/ios/scripts/package.sh -.PHONY: ifabric -ifabric: Xcode/ios +ifabric: $(IOS_PROJ_PATH) BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO BUNDLE_RESOURCES=YES \ ./platform/ios/scripts/package.sh -.PHONY: itest -itest: ipackage-sim - ./platform/ios/scripts/test.sh - -.PHONY: idocument idocument: OUTPUT=$(OUTPUT) ./platform/ios/scripts/document.sh -#### Linux targets ##################################################### - -.PHONY: linux -linux: - $(RUN) Makefile/linuxapp - -.PHONY: nlinux -nlinux: - $(RUN) Ninja/linuxapp - -.PHONY: run-linux -run-linux: linux - (cd build/$(BUILD)-$(BUILD_VERSION)/$(BUILDTYPE) && ./mapbox-gl) - -.PHONY: run-valgrind-linux -run-valgrind-linux: linux - (cd build/$(BUILD)-$(BUILD_VERSION)/$(BUILDTYPE) && valgrind --leak-check=full --suppressions=../../../scripts/valgrind.sup ./mapbox-gl) - #### Android targets ##################################################### # Builds a particular android architecture. android-lib-%: - $(RUN) HOST=android HOST_VERSION=$* Makefile/androidapp + $(RUN) PLATFORM=android SUBPLATFORM=$* Makefile/all # Builds the default Android library .PHONY: android-lib -android-lib: - $(RUN) HOST=android Makefile/androidapp +android-lib: android-lib-arm-v7 # Builds the selected/default Android library .PHONY: android @@ -153,42 +98,64 @@ android: android-lib apackage: android-lib-arm-v5 android-lib-arm-v7 android-lib-arm-v8 android-lib-x86 android-lib-x86-64 android-lib-mips cd platform/android && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) +test-android: + cd platform/android && ./gradlew testReleaseUnitTest --continue + #### Node targets ##################################################### -# Builds the Node.js library -.PHONY: node -node: - $(RUN) LOOP=uv HTTP=none ASSET=none Makefile/node +node_modules: package.json + npm update # Install dependencies but don't run our own install script. -.PHONY: Xcode/node -Xcode/node: - $(RUN) LOOP=uv HTTP=none ASSET=none Xcode/node +.PHONY: node +node: node_modules + $(RUN) PLATFORM=node Makefile/node .PHONY: xnode -xnode: Xcode/node +xnode: + $(RUN) Xcode/node + ./platform/node/scripts/create_node_scheme.sh "node test" "`npm bin tape`/tape platform/node/test/js/**/*.test.js" + ./platform/node/scripts/create_node_scheme.sh "npm run test-suite" "platform/node/test/render.test.js" open ./build/binding.xcodeproj -.PHONY: nproj -nproj: - $(RUN) LOOP=uv HTTP=none ASSET=none node/xproj - open ./build/binding.xcodeproj +.PHONY: test-node +test-node: node + npm test + npm run test-suite #### Miscellaneous targets ##################################################### +.PHONY: linux +linux: glfw-app render offline + +.PHONY: test-linux +test-linux: test-* + +.PHONY: glfw-app +glfw-app: + $(RUN) Makefile/glfw-app + +.PHONY: run-glfw-app +run-glfw-app: + $(RUN) run-glfw-app + +.PHONY: run-valgrind-glfw-app +run-valgrind-glfw-app: + $(RUN) run-valgrind-glfw-app + .PHONY: test test: $(RUN) Makefile/test -test-%: +test-%: node_modules/express $(RUN) test-$* +node_modules/express: + npm install express@4.11.1 + .PHONY: check check: $(RUN) BUILDTYPE=Debug ENABLE_COVERAGE=1 check -coveralls: - $(RUN) BUILDTYPE=Debug ENABLE_COVERAGE=1 coveralls - .PHONY: render render: $(RUN) Makefile/mbgl-render @@ -197,10 +164,6 @@ render: offline: $(RUN) Makefile/mbgl-offline -.PHONY: config -config: - $(RUN) config - # Generates a compilation database with ninja for use in clang tooling .PHONY: compdb compdb: @@ -210,32 +173,13 @@ compdb: tidy: $(RUN) tidy -.PHONY: clear_xcode_cache -clear_xcode_cache: -ifeq ($(BUILD), osx) - @CUSTOM_DD=`defaults read com.apple.dt.Xcode IDECustomDerivedDataLocation 2>/dev/null`; \ - if [ $$CUSTOM_DD ]; then \ - echo clearing files in $$CUSTOM_DD older than one day; \ - find $$CUSTOM_DD/mapboxgl-app-* -mtime +1 | xargs rm -rf; \ - find $$CUSTOM_DD/osxapp-* -mtime +1 | xargs rm -rf; \ - fi; \ - if [ -d ~/Library/Developer/Xcode/DerivedData/ ] && [ ! $$CUSTOM_DD ]; then \ - echo 'clearing files in ~/Library/Developer/Xcode/DerivedData/{mapboxgl-app,osxapp}-* older than one day'; \ - find ~/Library/Developer/Xcode/DerivedData/mapboxgl-app-* -mtime +1 | xargs rm -rf; \ - find ~/Library/Developer/Xcode/DerivedData/osxapp-* -mtime +1 | xargs rm -rf; \ - fi -endif - -clean: clear_xcode_cache +clean: -find ./deps/gyp -name "*.pyc" -exec rm {} \; -find ./build -type f -not -path '*/*.xcodeproj/*' -exec rm {} \; - -rm -rf ./gyp/build/ - -rm -rf ./config/*.gypi -rm -rf ./platform/android/MapboxGLAndroidSDK/build \ ./platform/android/MapboxGLAndroidSDKTestApp/build \ ./platform/android/MapboxGLAndroidSDK/src/main/jniLibs \ ./platform/android/MapboxGLAndroidSDKTestApp/src/main/jniLibs \ - ./platform/android/MapboxGLAndroidSDK/src/main/obj.target \ ./platform/android/MapboxGLAndroidSDK/src/main/assets distclean: clean diff --git a/platform/linux/main.cpp b/bin/glfw.cpp index 98fb32075e..98fb32075e 100644 --- a/platform/linux/main.cpp +++ b/bin/glfw.cpp diff --git a/platform/linux/mapboxgl-app.gypi b/bin/glfw.gypi index 533f0b85d2..548c5c2d4d 100644 --- a/platform/linux/mapboxgl-app.gypi +++ b/bin/glfw.gypi @@ -1,34 +1,34 @@ { - 'includes': [ - '../../gyp/common.gypi', - ], 'targets': [ - { 'target_name': 'linuxapp', - 'product_name': 'mapbox-gl', + { + 'target_name': 'glfw-app', + 'product_name': 'mapbox-glfw', 'type': 'executable', 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - 'mbgl.gyp:copy_certificate_bundle', + 'platform-lib', + 'copy_certificate_bundle', + ], + + 'include_dirs': [ + '../platform/default', + '../include', + '../src', ], 'sources': [ - 'main.cpp', - '../default/settings_json.cpp', - '../default/glfw_view.hpp', - '../default/glfw_view.cpp', - '../default/log_stderr.cpp', + 'glfw.cpp', + '../platform/default/settings_json.cpp', + '../platform/default/glfw_view.hpp', + '../platform/default/glfw_view.cpp', + '../platform/default/log_stderr.cpp', ], - 'variables' : { + 'variables': { 'cflags_cc': [ - '<@(opengl_cflags)', - '<@(boost_cflags)', '<@(glfw_cflags)', '<@(variant_cflags)', + '<@(boost_cflags)', ], 'ldflags': [ '<@(glfw_ldflags)', @@ -41,16 +41,12 @@ 'conditions': [ ['OS == "mac"', { 'xcode_settings': { - 'SDKROOT': 'macosx', - 'SUPPORTED_PLATFORMS':'macosx', 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'MACOSX_DEPLOYMENT_TARGET': '10.10', }, }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - }] + 'cflags_cc': [ '<@(cflags_cc)' ], + }], ], - 'link_settings': { 'conditions': [ ['OS == "mac"', { diff --git a/bin/offline.gypi b/bin/offline.gypi index 885a199b36..acdd17a749 100644 --- a/bin/offline.gypi +++ b/bin/offline.gypi @@ -1,49 +1,39 @@ { - 'includes': [ - '../gyp/common.gypi', - ], 'targets': [ - { 'target_name': 'mbgl-offline', + { + 'target_name': 'mbgl-offline', 'product_name': 'mbgl-offline', 'type': 'executable', 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:headless-<(headless_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - 'mbgl.gyp:copy_certificate_bundle', + 'platform-lib', + 'copy_certificate_bundle', ], 'include_dirs': [ + '../include', '../src', ], 'sources': [ - './offline.cpp', + 'offline.cpp', ], - 'variables' : { - 'cflags_cc': [ - '<@(boost_cflags)', - ], + 'cflags_cc': [ + '<@(boost_cflags)', + ], + + 'link_settings': { 'libraries': [ '<@(boost_libprogram_options_static_libs)' ], }, - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - } - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - 'libraries': [ '<@(libraries)' ], - }] - ], + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(boost_cflags)', + ], + } }, ], } diff --git a/bin/render.gypi b/bin/render.gypi index 1a44d7a9ce..31815d3c44 100644 --- a/bin/render.gypi +++ b/bin/render.gypi @@ -1,55 +1,39 @@ { - 'includes': [ - '../gyp/common.gypi', - ], 'targets': [ - { 'target_name': 'mbgl-render', + { + 'target_name': 'mbgl-render', 'product_name': 'mbgl-render', 'type': 'executable', 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:headless-<(headless_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - 'mbgl.gyp:copy_certificate_bundle', + 'platform-lib', + 'copy_certificate_bundle', ], 'include_dirs': [ + '../include', '../src', ], 'sources': [ - './render.cpp', + 'render.cpp', ], - 'variables' : { - 'cflags_cc': [ - '<@(glfw_cflags)', - '<@(boost_cflags)', - ], - 'ldflags': [ - '<@(glfw_ldflags)', - ], + 'cflags_cc': [ + '<@(boost_cflags)', + ], + + 'link_settings': { 'libraries': [ - '<@(glfw_static_libs)', '<@(boost_libprogram_options_static_libs)' ], }, - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(boost_cflags)', + ], + } }, ], } diff --git a/binding.gyp b/binding.gyp index 6cf0d1cd6f..10ed677ba3 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,18 +1,30 @@ { + 'variables': { + 'loop_lib': 'uv', + 'headless_lib': 'glx', + }, + 'conditions': [ + ['OS == "mac"', { + 'variables': { + 'headless_lib': 'cgl', + } + }], + ], 'includes': [ - 'gyp/common.gypi', + 'mbgl.gypi', ], 'targets': [ - { 'target_name': '<(module_name)', + { + 'target_name': '<(module_name)', 'dependencies': [ - 'gyp/mbgl.gyp:core', - 'gyp/mbgl.gyp:platform-<(platform_lib)', - 'gyp/mbgl.gyp:headless-<(headless_lib)', + 'core', ], 'include_dirs': [ '<(node_root_dir)/include/node', "<!(node -e \"require('nan')\")", + 'include', + 'src', # TODO: eliminate ], 'sources': [ @@ -25,9 +37,57 @@ 'platform/node/src/node_request.cpp', 'platform/node/src/util/async_queue.hpp', ], - }, - { 'target_name': 'action_after_build', + 'conditions': [ + ['OS == "mac"', { + 'sources': [ + 'platform/darwin/src/log_nslog.mm', + 'platform/darwin/src/string_nsstring.mm', + 'platform/darwin/src/image.mm', + 'platform/darwin/src/nsthread.mm', + ] + }, { + 'sources': [ + 'platform/default/log_stderr.cpp', + 'platform/default/string_stdlib.cpp', + 'platform/default/thread.cpp', + 'platform/default/image.cpp', + 'platform/default/webp_reader.cpp', + 'platform/default/png_reader.cpp', + 'platform/default/jpeg_reader.cpp', + ], + + 'cflags_cc': [ + '<@(boost_cflags)', + '<@(nunicode_cflags)', + '<@(webp_cflags)', + '<@(libpng_cflags)', + '<@(libjpeg-turbo_cflags)', + ], + + 'link_settings': { + 'libraries': [ + '<@(nunicode_ldflags)', + '<@(nunicode_static_libs)', + '<@(webp_ldflags)', + '<@(webp_static_libs)', + '<@(libpng_ldflags)', + '<@(libpng_static_libs)', + '<@(libjpeg-turbo_ldflags)', + '<@(libjpeg-turbo_static_libs)', + ], + }, + }] + ], + + 'xcode_settings': { + 'OTHER_LDFLAGS':[ + '-Wl,-bind_at_load' + ], + }, + }, + { + 'target_name': 'action_after_build', 'type': 'none', 'dependencies': [ '<(module_name)' ], 'copies': [ @@ -2,9 +2,14 @@ set -euo pipefail -CONFIG_FILE=$1 +INPUT_FILE=$1 +OUTPUT_FILE=$2 -if [ -z ${CONFIG_FILE} ]; then +if [ -z ${INPUT_FILE} ]; then + abort 'You need to specify an input path for the configure.sh file' +fi + +if [ -z ${OUTPUT_FILE} ]; then abort 'You need to specify an output path for the configuration file' fi @@ -16,12 +21,9 @@ function info { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } function warn { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } if [ -e "`pwd`/.git" ]; then - info "This build is within a git repository" - git submodule update --init export MASON_DIR="`pwd`/.mason" export PATH="${MASON_DIR}:${PATH}" else - info "This build is NOT within a git repository" which mason || abort "You must install mason to build mapbox-gl-native (https://github.com/mapbox/mason)" export MASON_DIR="$(dirname $(readlink $(which mason)))" fi @@ -41,6 +43,9 @@ function print_flags { done else warn "* Not using ${NAME}" + for FLAGS in "$@" ; do + CONFIG+=" '${NAME}_${FLAGS}%': [],"$LN + done fi fi } @@ -55,10 +60,7 @@ function print_opengl_flags { } # Load dependencies -source platform/${MASON_PLATFORM}/scripts/configure.sh -if [ -e platform/${MASON_PLATFORM}/scripts/${MASON_PLATFORM_VERSION}/configure.sh ]; then - source platform/${MASON_PLATFORM}/scripts/${MASON_PLATFORM_VERSION}/configure.sh -fi +source ${INPUT_FILE} PYTHON=`which python || abort 'Cannot find python'` @@ -113,6 +115,6 @@ CONFIG+=" } } " -mkdir -p $(dirname "${CONFIG_FILE}") -echo "${CONFIG}" > ${CONFIG_FILE} -cat ${CONFIG_FILE} +mkdir -p $(dirname "${OUTPUT_FILE}") +echo "${CONFIG}" > ${OUTPUT_FILE} +cat ${OUTPUT_FILE} diff --git a/docker/clang-tidy/tidy.sh b/docker/clang-tidy/tidy.sh index 222bd263f8..4c1b74595a 100755 --- a/docker/clang-tidy/tidy.sh +++ b/docker/clang-tidy/tidy.sh @@ -3,7 +3,6 @@ # set -e # set -o pipefail -export FLAVOR=linux export CXX=clang++-3.8 export BUILDTYPE=Release @@ -13,7 +12,7 @@ cd build source ./scripts/travis_helper.sh # install -./platform/${FLAVOR}/scripts/install.sh +./platform/linux/scripts/install.sh export CLANG_TIDY=clang-tidy-3.8 make tidy diff --git a/docker/linux/test.sh b/docker/linux/test.sh index f9d0b5daec..3afb73366c 100755 --- a/docker/linux/test.sh +++ b/docker/linux/test.sh @@ -3,7 +3,6 @@ # set -e # set -o pipefail -export FLAVOR=linux export CXX=g++-4.9 export BUILDTYPE=Release @@ -20,7 +19,7 @@ cd build source ./scripts/travis_helper.sh # install -./platform/${FLAVOR}/scripts/install.sh +./platform/linux/scripts/install.sh # script -./platform/${FLAVOR}/scripts/run.sh +./platform/linux/scripts/run.sh diff --git a/gyp/android.gyp b/gyp/android.gyp deleted file mode 100644 index fbeb4a647b..0000000000 --- a/gyp/android.gyp +++ /dev/null @@ -1,5 +0,0 @@ -{ - 'includes': [ - '../platform/android/mapboxgl-app.gypi', - ], -} diff --git a/gyp/asset-fs.gypi b/gyp/asset-fs.gypi deleted file mode 100644 index 30dc9e07aa..0000000000 --- a/gyp/asset-fs.gypi +++ /dev/null @@ -1,52 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'asset-fs', - 'product_name': 'mbgl-asset-fs', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - - 'sources': [ - '../platform/default/asset_file_source.cpp', - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'variables': { - 'cflags_cc': [ - '<@(boost_cflags)', - ], - 'defines': [ - '-DMBGL_ASSET_FS' - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - }, - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - }], - ], - - 'direct_dependent_settings': { - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CFLAGS': [ '<@(defines)' ], - 'OTHER_CPLUSPLUSFLAGS': [ '<@(defines)' ], - } - }, { - 'cflags': [ '<@(defines)' ], - 'cflags_cc': [ '<@(defines)' ], - }] - ], - }, - }, - ], -} diff --git a/gyp/asset-zip.gypi b/gyp/asset-zip.gypi deleted file mode 100644 index 9011981f6c..0000000000 --- a/gyp/asset-zip.gypi +++ /dev/null @@ -1,74 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'asset-zip', - 'product_name': 'mbgl-asset-zip', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - - 'sources': [ - '../platform/android/src/asset_file_source.cpp', - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'variables': { - 'cflags': [ - '<@(libzip_cflags)', - ], - 'cflags_cc': [ - '<@(libzip_cflags)', - ], - 'ldflags': [ - '<@(libzip_ldflags)', - ], - 'libraries': [ - '<@(libzip_static_libs)', - ], - 'defines': [ - '-DMBGL_ASSET_ZIP' - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CFLAGS': [ '<@(cflags)' ], - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - }, - }, { - 'cflags': [ '<@(cflags)' ], - 'cflags_cc': [ '<@(cflags_cc)' ], - }], - ], - - 'direct_dependent_settings': { - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CFLAGS': [ '<@(defines)' ], - 'OTHER_CPLUSPLUSFLAGS': [ '<@(defines)' ], - } - }, { - 'cflags': [ '<@(defines)' ], - 'cflags_cc': [ '<@(defines)' ], - }] - ], - }, - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } - }, { - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - }, - ], -} diff --git a/gyp/certificates.gypi b/gyp/certificates.gypi deleted file mode 100644 index 1d0c2acf86..0000000000 --- a/gyp/certificates.gypi +++ /dev/null @@ -1,12 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'copy_certificate_bundle', - 'type': 'none', - 'hard_dependency': 1, - 'copies': [{ - 'files': [ '../common/ca-bundle.crt' ], - 'destination': '<(PRODUCT_DIR)' - }], - }, - ] -} diff --git a/gyp/common.gypi b/gyp/common.gypi deleted file mode 100644 index 3972c8f6f9..0000000000 --- a/gyp/common.gypi +++ /dev/null @@ -1,139 +0,0 @@ -{ - 'target_defaults': { - 'default_configuration': 'Release', - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'CLANG_CXX_LIBRARY': 'libc++', - 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', - 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', - 'GCC_ENABLE_CPP_RTTI': 'YES', - 'OTHER_CPLUSPLUSFLAGS': [ - '-std=c++14', - '-Werror', - '-Wall', - '-Wextra', - '-Wshadow', - '-Wno-variadic-macros', - '-frtti', - '-fexceptions', - '${CFLAGS}', - ], - 'GCC_WARN_PEDANTIC': 'YES', - 'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE', - 'MACOSX_DEPLOYMENT_TARGET': '10.10', - }, - }, { - 'cflags_cc': [ - '-std=c++14', - '-Werror', - '-Wall', - '-Wextra', - '-Wshadow', - '-Wno-variadic-macros', - '-Wno-error=unused-parameter', - '-frtti', - '-fexceptions', - '${CFLAGS}', - ], - }], - ['OS=="linux"', { - 'cflags_cc': [ - '-Wno-unknown-pragmas', # We are using '#pragma mark', but it is only available on Darwin. - ], - 'conditions': [ - ['cxx_host != "clang"', { - 'cflags_cc': [ - '-fabi-version=0', - ], - }], - ] - }], - ], - 'target_conditions': [ - ['_type == "static_library"', { - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '-fPIC' ], - 'SKIP_INSTALL': 'YES', - }, - }, { - 'cflags_cc': [ '-fPIC' ], - }], - ['host == "ios"', { - 'xcode_settings': { - 'SDKROOT': 'iphoneos', - 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', - 'IPHONEOS_DEPLOYMENT_TARGET': '7.0', - 'TARGETED_DEVICE_FAMILY': '1,2', - 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', - 'CODE_SIGN_IDENTITY': 'iPhone Developer', - }, - 'configurations': { - 'Release': { - 'xcode_settings': { - 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], - }, - }, - }, - }], - ], - }], - ], - 'configurations': { - 'Debug': { - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '0', - 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', - 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', - 'DEAD_CODE_STRIPPING': 'NO', - 'OTHER_CPLUSPLUSFLAGS': [ '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ], - 'conditions': [ - ['coverage', { - 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', - 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', - 'OTHER_CPLUSPLUSFLAGS': [ '--coverage' ], - }], - ], - }, - }, { - 'cflags_cc': [ '-g', '-O0', '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ], - 'conditions': [ - ['coverage', { 'cflags_cc': [ '--coverage' ] }], - ], - }], - ], - 'defines': [ 'DEBUG' ], - 'target_conditions': [ - ['_type == "executable"', { - 'conditions': [ - ['OS=="mac" and coverage', { - 'xcode_settings': { 'OTHER_LDFLAGS': [ '--coverage' ] }, - }, { - 'ldflags': [ '--coverage' ], - }], - ], - }], - ], - }, - 'Release': { - 'defines': [ 'NDEBUG' ], - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '3', - 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', - 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', - 'DEAD_CODE_STRIPPING': 'NO', - }, - }, { - 'cflags_cc': [ '-g', '-O3' ], - }], - ], - }, - }, - } -} diff --git a/gyp/core.gypi b/gyp/core.gypi deleted file mode 100644 index 06497710d3..0000000000 --- a/gyp/core.gypi +++ /dev/null @@ -1,80 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'core', - 'product_name': 'mbgl-core', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'shaders', - 'version', - ], - - 'sources': [ - '<!@(find ../src -name "*.hpp")', - '<!@(find ../src -name "*.cpp")', - '<!@(find ../src -name "*.c")', - '<!@(find ../src -name "*.h")', - '<!@(find ../include -name "*.hpp")', - '<!@(find ../include -name "*.h")', - '<!@(find ../src -name "*.glsl")', - '../bin/style.json' - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'variables': { - 'cflags_cc': [ - '<@(opengl_cflags)', - '<@(boost_cflags)', - '<@(geojsonvt_cflags)', - '<@(rapidjson_cflags)', - '<@(variant_cflags)', - ], - 'cflags': [ - '<@(opengl_cflags)', - '<@(rapidjson_cflags)', - '-fPIC' - ], - 'ldflags': [ - '<@(opengl_ldflags)', - ], - 'libraries': [ - '<@(geojsonvt_static_libs)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_CFLAGS': [ '<@(cflags)' ], - }, - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - 'cflags': [ '<@(cflags)' ], - }] - ], - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } - }, { - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - - 'direct_dependent_settings': { - 'include_dirs': [ - '../include', - ], - }, - }, - ] -} diff --git a/gyp/headless-cgl.gypi b/gyp/headless-cgl.gypi deleted file mode 100644 index 4b92bdeb54..0000000000 --- a/gyp/headless-cgl.gypi +++ /dev/null @@ -1,19 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'headless-cgl', - 'product_name': 'mbgl-headless-cgl', - 'type': 'static_library', - 'standalone_static_library': 1, - - 'sources': [ - '../platform/default/headless_view.cpp', - '../platform/darwin/src/headless_view_cgl.cpp', - '../platform/default/headless_display.cpp', - ], - - 'include_dirs': [ - '../include', - ], - }, - ], -} diff --git a/gyp/headless-eagl.gypi b/gyp/headless-eagl.gypi deleted file mode 100644 index 0dc482563f..0000000000 --- a/gyp/headless-eagl.gypi +++ /dev/null @@ -1,19 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'headless-eagl', - 'product_name': 'mbgl-headless-eagl', - 'type': 'static_library', - 'standalone_static_library': 1, - - 'sources': [ - '../platform/default/headless_view.cpp', - '../platform/darwin/src/headless_view_eagl.mm', - '../platform/default/headless_display.cpp', - ], - - 'include_dirs': [ - '../include', - ], - }, - ], -} diff --git a/gyp/headless-glx.gypi b/gyp/headless-glx.gypi deleted file mode 100644 index 65dedf7ade..0000000000 --- a/gyp/headless-glx.gypi +++ /dev/null @@ -1,25 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'headless-glx', - 'product_name': 'mbgl-headless-glx', - 'type': 'static_library', - 'standalone_static_library': 1, - - 'sources': [ - '../platform/default/headless_view.cpp', - '../platform/default/headless_view_glx.cpp', - '../platform/default/headless_display.cpp', - ], - - 'include_dirs': [ - '../include', - ], - - 'cflags_cc': [ '<@(opengl_cflags)' ], - - 'link_settings': { - 'libraries': [ '<@(opengl_ldflags)' ], - }, - }, - ], -} diff --git a/gyp/http-android.gypi b/gyp/http-android.gypi deleted file mode 100644 index 749e3f2f4d..0000000000 --- a/gyp/http-android.gypi +++ /dev/null @@ -1,53 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'http-android', - 'product_name': 'mbgl-http-android', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - - 'sources': [ - '../platform/android/src/http_request_android.cpp', - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'variables': { - 'cflags_cc': [ - '<@(boost_cflags)', - '<@(jni.hpp_cflags)', - ], - 'defines': [ - '-DMBGL_HTTP_ANDROID' - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - }, - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - }], - ], - - 'direct_dependent_settings': { - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CFLAGS': [ '<@(defines)' ], - 'OTHER_CPLUSPLUSFLAGS': [ '<@(defines)' ], - } - }, { - 'cflags': [ '<@(defines)' ], - 'cflags_cc': [ '<@(defines)' ], - }] - ], - }, - }, - ], -} diff --git a/gyp/http-curl.gypi b/gyp/http-curl.gypi deleted file mode 100644 index af4c2c5472..0000000000 --- a/gyp/http-curl.gypi +++ /dev/null @@ -1,78 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'http-curl', - 'product_name': 'mbgl-http-curl', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - - 'sources': [ - '../platform/default/http_request_curl.cpp', - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'variables': { - 'cflags_cc': [ - '<@(libcurl_cflags)', - '<@(boost_cflags)', - ], - 'ldflags': [ - '<@(libcurl_ldflags)', - ], - 'libraries': [ - '<@(libcurl_static_libs)', - ], - 'defines': [ - '-DMBGL_HTTP_CURL' - ], - }, - - 'conditions': [ - ['host == "android"', { - 'variables': { - # Android uses libzip and openssl to set CURL's CA bundle. - 'cflags_cc': [ '<@(libzip_cflags)', '<@(openssl_cflags)' ], - 'ldflags': [ '<@(libzip_ldflags)', ], - 'libraries': [ '<@(libzip_static_libs)', ], - }, - }], - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - }, - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - }], - ], - - 'direct_dependent_settings': { - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CFLAGS': [ '<@(defines)' ], - 'OTHER_CPLUSPLUSFLAGS': [ '<@(defines)' ], - } - }, { - 'cflags': [ '<@(defines)' ], - 'cflags_cc': [ '<@(defines)' ], - }] - ], - }, - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } - }, { - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - }, - ], -} diff --git a/gyp/http-nsurl.gypi b/gyp/http-nsurl.gypi deleted file mode 100644 index e22da472ce..0000000000 --- a/gyp/http-nsurl.gypi +++ /dev/null @@ -1,45 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'http-nsurl', - 'product_name': 'mbgl-http-nsurl', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - - 'sources': [ - '../platform/darwin/src/http_request_nsurl.mm', - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'variables': { - 'ldflags': [ - '-framework Foundation', # For NSURLRequest - ], - 'defines': [ - '-DMBGL_HTTP_NSURL' - ], - }, - - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - }, - - 'direct_dependent_settings': { - 'xcode_settings': { - 'OTHER_CFLAGS': [ '<@(defines)' ], - 'OTHER_CPLUSPLUSFLAGS': [ '<@(defines)' ], - } - }, - - 'link_settings': { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - }, - }, - }, - ], -} diff --git a/gyp/ios.gyp b/gyp/ios.gyp deleted file mode 100644 index f07805d315..0000000000 --- a/gyp/ios.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - 'includes': [ - '../platform/ios/app/mapboxgl-app.gypi', - '../platform/ios/framework/framework-ios.gypi', - '../platform/ios/benchmark/benchmark-ios.gypi', - '../test/test.gypi', - ], -} diff --git a/gyp/linux.gyp b/gyp/linux.gyp deleted file mode 100644 index 2815f4fc58..0000000000 --- a/gyp/linux.gyp +++ /dev/null @@ -1,11 +0,0 @@ -{ - 'includes': [ - '../platform/linux/mapboxgl-app.gypi', - ], - - 'conditions': [ - ['test', { 'includes': [ '../test/test.gypi' ] } ], - ['offline', { 'includes': [ '../bin/offline.gypi' ] } ], - ['render', { 'includes': [ '../bin/render.gypi' ] } ], - ], -} diff --git a/gyp/mbgl.gyp b/gyp/mbgl.gyp deleted file mode 100644 index ccf176eb67..0000000000 --- a/gyp/mbgl.gyp +++ /dev/null @@ -1,83 +0,0 @@ -{ - 'includes': [ - 'common.gypi', - 'shaders.gypi', - 'version.gypi', - 'certificates.gypi', - 'core.gypi', - 'none.gypi', - ], - - 'targets': [ - { 'target_name': 'loop', - 'product_name': 'mbgl-loop', - 'type': 'static_library', - 'standalone_static_library': 1, - - 'include_dirs': [ - '../include', - '../src', - ], - - 'conditions': [ - ['loop_lib == "darwin"', { - 'sources': [ - '../platform/darwin/src/async_task.cpp', - '../platform/darwin/src/run_loop.cpp', - '../platform/darwin/src/timer.cpp', - ], - }], - - ['loop_lib == "android"', { - 'sources': [ - '../platform/android/src/async_task.cpp', - '../platform/android/src/run_loop.cpp', - '../platform/android/src/timer.cpp', - ], - }], - - ['loop_lib == "uv"', { - 'sources': [ - '../platform/default/async_task.cpp', - '../platform/default/run_loop.cpp', - '../platform/default/timer.cpp', - ], - - 'cflags_cc': [ - '<@(libuv_cflags)', - ], - - 'link_settings': { - 'libraries': [ - '<@(libuv_static_libs)', - '<@(libuv_ldflags)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(libuv_cflags)' ], - } - }] - ], - }] - ], - }, - ], - - 'conditions': [ - ['headless_lib == "cgl" and host == "osx"', { 'includes': [ 'headless-cgl.gypi' ] } ], - ['headless_lib == "eagl" and host == "ios"', { 'includes': [ 'headless-eagl.gypi' ] } ], - ['headless_lib == "glx" and host == "linux"', { 'includes': [ 'headless-glx.gypi' ] } ], - ['platform_lib == "osx" and host == "osx"', { 'includes': [ 'platform-osx.gypi' ] } ], - ['platform_lib == "ios" and host == "ios"', { 'includes': [ 'platform-ios.gypi' ] } ], - ['platform_lib == "linux"', { 'includes': [ 'platform-linux.gypi' ] } ], - ['platform_lib == "android" and host == "android"', { 'includes': [ 'platform-android.gypi' ] } ], - ['http_lib == "curl"', { 'includes': [ 'http-curl.gypi' ] } ], - ['http_lib == "nsurl" and (host == "osx" or host == "ios")', { 'includes': [ 'http-nsurl.gypi' ] } ], - ['http_lib == "android" and host == "android"', { 'includes': [ 'http-android.gypi' ] } ], - ['asset_lib == "fs"', { 'includes': [ 'asset-fs.gypi' ] } ], - ['asset_lib == "zip"', { 'includes': [ 'asset-zip.gypi' ] } ], - ], -} diff --git a/gyp/none.gypi b/gyp/none.gypi deleted file mode 100644 index ce748bfe6f..0000000000 --- a/gyp/none.gypi +++ /dev/null @@ -1,20 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'http-none', - 'product_name': 'mbgl-http-none', - 'type': 'none', - }, - { 'target_name': 'asset-none', - 'product_name': 'mbgl-asset-none', - 'type': 'none', - }, - { 'target_name': 'cache-none', - 'product_name': 'mbgl-cache-none', - 'type': 'none', - }, - { 'target_name': 'headless-none', - 'product_name': 'mbgl-headless-none', - 'type': 'none', - }, - ], -} diff --git a/gyp/osx.gyp b/gyp/osx.gyp deleted file mode 100644 index 18d5fe1524..0000000000 --- a/gyp/osx.gyp +++ /dev/null @@ -1,14 +0,0 @@ -{ - 'includes': [ - '../platform/osx/app/mapboxgl-app.gypi', - '../platform/osx/sdk/framework-osx.gypi', - '../platform/osx/test/osxtest.gypi', - '../platform/linux/mapboxgl-app.gypi', - ], - - 'conditions': [ - ['test', { 'includes': [ '../test/test.gypi' ] } ], - ['offline', { 'includes': [ '../bin/offline.gypi' ] } ], - ['render', { 'includes': [ '../bin/render.gypi' ] } ], - ], -} diff --git a/gyp/platform-android.gypi b/gyp/platform-android.gypi deleted file mode 100644 index 38692c32be..0000000000 --- a/gyp/platform-android.gypi +++ /dev/null @@ -1,92 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'platform-android', - 'product_name': 'mbgl-platform-android', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'version', - 'loop', - ], - - 'sources': [ - '../platform/android/src/log_android.cpp', - '../platform/default/thread.cpp', - '../platform/default/string_stdlib.cpp', - '../platform/default/image.cpp', - '../platform/default/png_reader.cpp', - '../platform/default/jpeg_reader.cpp', - '../platform/default/default_file_source.cpp', - '../platform/default/online_file_source.cpp', - '../platform/default/mbgl/storage/offline.hpp', - '../platform/default/mbgl/storage/offline.cpp', - '../platform/default/mbgl/storage/offline_database.hpp', - '../platform/default/mbgl/storage/offline_database.cpp', - '../platform/default/mbgl/storage/offline_download.hpp', - '../platform/default/mbgl/storage/offline_download.cpp', - '../platform/default/sqlite3.hpp', - '../platform/default/sqlite3.cpp', - ], - - 'variables': { - 'cflags_cc': [ - '<@(libpng_cflags)', - '<@(libjpeg-turbo_cflags)', - '<@(nunicode_cflags)', - '<@(boost_cflags)', - '<@(sqlite_cflags)', - '<@(rapidjson_cflags)', - '<@(variant_cflags)', - ], - 'ldflags': [ - '<@(libpng_ldflags)', - '<@(libjpeg-turbo_ldflags)', - '<@(nunicode_ldflags)', - '<@(sqlite_ldflags)', - '<@(zlib_ldflags)', - ], - 'libraries': [ - '<@(libpng_static_libs)', - '<@(libjpeg-turbo_static_libs)', - '<@(nunicode_static_libs)', - '<@(sqlite_static_libs)', - '<@(zlib_static_libs)', - ], - }, - - 'include_dirs': [ - '../include', - '../src', - '../platform/default', - ], - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - } - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - }] - ], - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } - }, { - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - - 'direct_dependent_settings': { - 'include_dirs': [ - '../include', - ], - }, - }, - ], -} diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi deleted file mode 100644 index d1e62e7242..0000000000 --- a/gyp/platform-ios.gypi +++ /dev/null @@ -1,141 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'platform-ios', - 'product_name': 'mbgl-platform-ios', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'version', - 'loop', - ], - - 'sources': [ - '../platform/default/default_file_source.cpp', - '../platform/default/online_file_source.cpp', - '../platform/default/mbgl/storage/offline.hpp', - '../platform/default/mbgl/storage/offline.cpp', - '../platform/default/mbgl/storage/offline_database.hpp', - '../platform/default/mbgl/storage/offline_database.cpp', - '../platform/default/mbgl/storage/offline_download.hpp', - '../platform/default/mbgl/storage/offline_download.cpp', - '../platform/default/sqlite3.hpp', - '../platform/default/sqlite3.cpp', - '../platform/darwin/src/log_nslog.mm', - '../platform/darwin/src/string_nsstring.mm', - '../platform/darwin/src/image.mm', - '../platform/darwin/src/nsthread.mm', - '../platform/darwin/src/reachability.m', - '../platform/darwin/src/NSException+MGLAdditions.h', - '../platform/darwin/src/NSString+MGLAdditions.h', - '../platform/darwin/src/NSString+MGLAdditions.m', - '../platform/darwin/src/MGLTypes.m', - '../platform/darwin/src/MGLStyle.mm', - '../platform/darwin/src/MGLGeometry_Private.h', - '../platform/darwin/src/MGLGeometry.mm', - '../platform/darwin/src/MGLShape.m', - '../platform/darwin/src/MGLMultiPoint_Private.h', - '../platform/darwin/src/MGLMultiPoint.mm', - '../platform/darwin/src/MGLPointAnnotation.m', - '../platform/darwin/src/MGLPolyline.mm', - '../platform/darwin/src/MGLPolygon.mm', - '../platform/darwin/src/MGLMapCamera.mm', - '../platform/darwin/src/MGLOfflinePack.mm', - '../platform/darwin/src/MGLOfflinePack_Private.h', - '../platform/darwin/src/MGLOfflineStorage.mm', - '../platform/darwin/src/MGLOfflineStorage_Private.h', - '../platform/darwin/src/MGLOfflineRegion_Private.h', - '../platform/darwin/src/MGLTilePyramidOfflineRegion.mm', - '../platform/darwin/src/MGLAccountManager_Private.h', - '../platform/darwin/src/MGLAccountManager.m', - '../platform/darwin/src/NSBundle+MGLAdditions.h', - '../platform/darwin/src/NSBundle+MGLAdditions.m', - '../platform/darwin/src/NSProcessInfo+MGLAdditions.h', - '../platform/darwin/src/NSProcessInfo+MGLAdditions.m', - '../platform/ios/src/MGLMapboxEvents.h', - '../platform/ios/src/MGLMapboxEvents.m', - '../platform/ios/src/MGLAPIClient.h', - '../platform/ios/src/MGLAPIClient.m', - '../platform/ios/src/MGLLocationManager.h', - '../platform/ios/src/MGLLocationManager.m', - '../platform/ios/src/MGLMapView.mm', - '../platform/ios/src/MGLUserLocation_Private.h', - '../platform/ios/src/MGLUserLocation.m', - '../platform/ios/src/MGLUserLocationAnnotationView.h', - '../platform/ios/src/MGLUserLocationAnnotationView.m', - '../platform/ios/src/MGLAnnotationImage_Private.h', - '../platform/ios/src/MGLAnnotationImage.m', - '../platform/ios/src/MGLCompactCalloutView.h', - '../platform/ios/src/MGLCompactCalloutView.m', - '../platform/ios/vendor/SMCalloutView/SMCalloutView.h', - '../platform/ios/vendor/SMCalloutView/SMCalloutView.m', - '../platform/ios/vendor/Fabric/FABAttributes.h', - '../platform/ios/vendor/Fabric/FABKitProtocol.h', - '../platform/ios/vendor/Fabric/Fabric.h', - '../platform/ios/vendor/Fabric/Fabric+FABKits.h', - ], - - 'variables': { - 'cflags_cc': [ - '<@(boost_cflags)', - '<@(sqlite_cflags)', - '<@(zlib_cflags)', - '<@(rapidjson_cflags)', - '<@(variant_cflags)', - ], - 'ldflags': [ - '<@(sqlite_ldflags)', - '<@(zlib_ldflags)', - ], - 'libraries': [ - '<@(sqlite_static_libs)', - '<@(zlib_static_libs)', - '$(SDKROOT)/System/Library/Frameworks/CoreGraphics.framework', - '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework', - '$(SDKROOT)/System/Library/Frameworks/GLKit.framework', - '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework', - '$(SDKROOT)/System/Library/Frameworks/MobileCoreServices.framework', - '$(SDKROOT)/System/Library/Frameworks/OpenGLES.framework', - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - '$(SDKROOT)/System/Library/Frameworks/Security.framework', - '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework', - '$(SDKROOT)/System/Library/Frameworks/UIKit.framework', - ], - }, - - 'include_dirs': [ - '../platform/ios/include', - '../platform/darwin/include', - '../include', - '../src', - '../platform/default', - ], - - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_ENABLE_MODULES': 'YES', - }, - - 'link_settings': { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - }, - }, - - 'direct_dependent_settings': { - 'include_dirs': [ - '../platform/ios/include', - '../platform/darwin/include', - '../include', - ], - 'mac_bundle_resources': [ - '<!@(find ../platform/ios/resources -type f \! -name "README" \! -name \'.*\')', - '<!@(find ../platform/default/resources -type f \! -name "README" \! -name \'.der\')', - ], - }, - }, - ], -} diff --git a/gyp/platform-linux.gypi b/gyp/platform-linux.gypi deleted file mode 100644 index 3d2c042996..0000000000 --- a/gyp/platform-linux.gypi +++ /dev/null @@ -1,97 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'platform-linux', - 'product_name': 'mbgl-platform-linux', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'version', - 'loop', - ], - - 'sources': [ - '../platform/default/log_stderr.cpp', - '../platform/default/string_stdlib.cpp', - '../platform/default/thread.cpp', - '../platform/default/image.cpp', - '../platform/default/webp_reader.cpp', - '../platform/default/png_reader.cpp', - '../platform/default/jpeg_reader.cpp', - '../platform/default/default_file_source.cpp', - '../platform/default/online_file_source.cpp', - '../platform/default/mbgl/storage/offline.hpp', - '../platform/default/mbgl/storage/offline.cpp', - '../platform/default/mbgl/storage/offline_database.hpp', - '../platform/default/mbgl/storage/offline_database.cpp', - '../platform/default/mbgl/storage/offline_download.hpp', - '../platform/default/mbgl/storage/offline_download.cpp', - '../platform/default/sqlite3.hpp', - '../platform/default/sqlite3.cpp', - ], - - 'variables': { - 'cflags_cc': [ - '<@(opengl_cflags)', - '<@(libpng_cflags)', - '<@(libjpeg-turbo_cflags)', - '<@(nunicode_cflags)', - '<@(boost_cflags)', - '<@(sqlite_cflags)', - '<@(webp_cflags)', - '<@(rapidjson_cflags)', - '<@(variant_cflags)', - ], - 'ldflags': [ - '<@(libpng_ldflags)', - '<@(libjpeg-turbo_ldflags)', - '<@(nunicode_ldflags)', - '<@(sqlite_ldflags)', - '<@(zlib_ldflags)', - '<@(webp_ldflags)', - ], - 'libraries': [ - '<@(libpng_static_libs)', - '<@(libjpeg-turbo_static_libs)', - '<@(nunicode_static_libs)', - '<@(sqlite_static_libs)', - '<@(zlib_static_libs)', - '<@(webp_static_libs)', - ], - }, - - 'include_dirs': [ - '../include', - '../src', - '../platform/default', - ], - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - } - }, { - 'cflags_cc': [ '<@(cflags_cc)' ], - }] - ], - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } - }, { - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - - 'direct_dependent_settings': { - 'include_dirs': [ - '../include', - ], - }, - }, - ], -} diff --git a/gyp/platform-osx.gypi b/gyp/platform-osx.gypi deleted file mode 100644 index 8f81276d54..0000000000 --- a/gyp/platform-osx.gypi +++ /dev/null @@ -1,122 +0,0 @@ -{ - 'targets': [ - { 'target_name': 'platform-osx', - 'product_name': 'mbgl-platform-osx', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'version', - 'loop', - ], - - 'sources': [ - '../platform/default/default_file_source.cpp', - '../platform/default/online_file_source.cpp', - '../platform/default/mbgl/storage/offline.hpp', - '../platform/default/mbgl/storage/offline.cpp', - '../platform/default/mbgl/storage/offline_database.hpp', - '../platform/default/mbgl/storage/offline_database.cpp', - '../platform/default/mbgl/storage/offline_download.hpp', - '../platform/default/mbgl/storage/offline_download.cpp', - '../platform/default/sqlite3.hpp', - '../platform/default/sqlite3.cpp', - '../platform/darwin/src/log_nslog.mm', - '../platform/darwin/src/string_nsstring.mm', - '../platform/darwin/src/image.mm', - '../platform/darwin/src/nsthread.mm', - '../platform/darwin/src/reachability.m', - '../platform/darwin/src/NSException+MGLAdditions.h', - '../platform/darwin/src/NSString+MGLAdditions.h', - '../platform/darwin/src/NSString+MGLAdditions.m', - '../platform/darwin/src/MGLTypes.m', - '../platform/darwin/src/MGLStyle.mm', - '../platform/darwin/src/MGLGeometry_Private.h', - '../platform/darwin/src/MGLGeometry.mm', - '../platform/darwin/src/MGLShape.m', - '../platform/darwin/src/MGLMultiPoint_Private.h', - '../platform/darwin/src/MGLMultiPoint.mm', - '../platform/darwin/src/MGLPointAnnotation.m', - '../platform/darwin/src/MGLPolyline.mm', - '../platform/darwin/src/MGLPolygon.mm', - '../platform/darwin/src/MGLMapCamera.mm', - '../platform/darwin/src/MGLOfflinePack.mm', - '../platform/darwin/src/MGLOfflinePack_Private.h', - '../platform/darwin/src/MGLOfflineStorage.mm', - '../platform/darwin/src/MGLOfflineStorage_Private.h', - '../platform/darwin/src/MGLOfflineRegion_Private.h', - '../platform/darwin/src/MGLTilePyramidOfflineRegion.mm', - '../platform/darwin/src/MGLAccountManager_Private.h', - '../platform/darwin/src/MGLAccountManager.m', - '../platform/darwin/src/NSBundle+MGLAdditions.h', - '../platform/darwin/src/NSBundle+MGLAdditions.m', - '../platform/darwin/src/NSProcessInfo+MGLAdditions.h', - '../platform/darwin/src/NSProcessInfo+MGLAdditions.m', - '../platform/osx/src/MGLMapView_Private.h', - '../platform/osx/src/MGLMapView.mm', - '../platform/osx/src/MGLMapView+IBAdditions.m', - '../platform/osx/src/MGLOpenGLLayer.h', - '../platform/osx/src/MGLOpenGLLayer.mm', - '../platform/osx/src/MGLCompassCell.h', - '../platform/osx/src/MGLCompassCell.m', - '../platform/osx/src/MGLAttributionButton.h', - '../platform/osx/src/MGLAttributionButton.m', - '../platform/osx/src/MGLAnnotationImage.m', - ], - - 'variables': { - 'cflags_cc': [ - '<@(boost_cflags)', - '<@(sqlite_cflags)', - '<@(zlib_cflags)', - '<@(rapidjson_cflags)', - '<@(variant_cflags)', - ], - 'ldflags': [ - '<@(zlib_ldflags)', - ], - 'libraries': [ - '<@(sqlite_static_libs)', - '<@(zlib_static_libs)', - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework', - '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', - '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', - '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework', - ], - }, - - 'include_dirs': [ - '../platform/osx/include', - '../platform/darwin/include', - '../include', - '../src', - '../platform/default', - ], - - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_ENABLE_MODULES': 'YES', - }, - - 'link_settings': { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - }, - }, - - 'direct_dependent_settings': { - 'include_dirs': [ - '../platform/osx/include', - '../platform/darwin/include', - '../include', - ], - 'mac_bundle_resources': [ - '<!@(find ../platform/osx/src/resources -type f \! -name \'.*\')', - ], - }, - }, - ], -} diff --git a/gyp/shaders.gypi b/gyp/shaders.gypi deleted file mode 100644 index 83d40a52f9..0000000000 --- a/gyp/shaders.gypi +++ /dev/null @@ -1,32 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'shaders', - 'type': 'none', - 'hard_dependency': 1, - - 'sources': [ - '<!@(find ../src/mbgl/shader -name "*.glsl")' - ], - - 'rules': [ - { - 'rule_name': 'Build Shaders', - 'message': 'Building shader', - 'extension': 'glsl', - 'inputs': [ '../scripts/build-shaders.py' ], - 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/<(RULE_INPUT_ROOT).hpp' ], - 'action': [ '../scripts/build-shaders.py', '<(RULE_INPUT_PATH)', '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/<(RULE_INPUT_ROOT).hpp' ], - 'process_outputs_as_sources': 1, - } - ], - - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)/include', - ] - } - - }, - ] -} diff --git a/gyp/target-ios-bundle.gypi b/gyp/target-ios-bundle.gypi deleted file mode 100644 index 24fa8b1437..0000000000 --- a/gyp/target-ios-bundle.gypi +++ /dev/null @@ -1,5 +0,0 @@ -{ - 'product_extension': 'app', - 'mac_bundle': 1, - 'includes': [ 'target-ios.gypi' ], -} diff --git a/gyp/target-ios.gypi b/gyp/target-ios.gypi deleted file mode 100644 index 6506ee0622..0000000000 --- a/gyp/target-ios.gypi +++ /dev/null @@ -1,27 +0,0 @@ -{ - 'product_extension': 'app', - 'xcode_settings': { - 'SDKROOT': 'iphoneos', - 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', - 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', - 'TARGETED_DEVICE_FAMILY': '1,2', - 'COPY_PHASE_STRIP': 'NO', - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_ENABLE_MODULES': 'YES', - }, - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'COPY_PHASE_STRIP': 'NO', - }, - }, - 'Release': { - 'xcode_settings': { - 'CODE_SIGN_IDENTITY': 'iPhone Distribution', - 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], - 'COPY_PHASE_STRIP': 'YES', - }, - }, - }, -} diff --git a/gyp/version.gypi b/gyp/version.gypi deleted file mode 100644 index 4efdd079a8..0000000000 --- a/gyp/version.gypi +++ /dev/null @@ -1,29 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'version', - 'type': 'none', - 'hard_dependency': 1, - 'actions': [ - { - 'action_name': 'Build Version Header', - 'inputs': [ - '../scripts/build-version.py', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', - ], - 'action': ['<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)'], - } - ], - 'direct_dependent_settings': { - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', - ], - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)/include', - ] - } - }, - ] -} diff --git a/mbgl.gypi b/mbgl.gypi new file mode 100644 index 0000000000..48eb15d938 --- /dev/null +++ b/mbgl.gypi @@ -0,0 +1,293 @@ +{ + 'target_defaults': { + 'default_configuration': 'Release', + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'CLANG_CXX_LIBRARY': 'libc++', + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', + 'GCC_ENABLE_CPP_RTTI': 'YES', + 'OTHER_CPLUSPLUSFLAGS': [ + '-std=c++14', + '-Werror', + '-Wall', + '-Wextra', + '-Wshadow', + '-Wno-variadic-macros', + '-frtti', + '-fexceptions', + '${CFLAGS}', + ], + 'GCC_WARN_PEDANTIC': 'YES', + 'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE', + 'MACOSX_DEPLOYMENT_TARGET': '10.10', + }, + }, { + 'cflags_cc': [ + '-std=c++14', + '-Werror', + '-Wall', + '-Wextra', + '-Wshadow', + '-Wno-variadic-macros', + '-Wno-error=unused-parameter', + '-frtti', + '-fexceptions', + '${CFLAGS}', + ], + }], + ['OS=="linux"', { + 'cflags_cc': [ + '-Wno-unknown-pragmas', # We are using '#pragma mark', but it is only available on Darwin. + ], + 'conditions': [ + ['cxx_host != "clang"', { + 'cflags_cc': [ + '-fabi-version=0', + ], + }], + ] + }], + ], + 'target_conditions': [ + ['_type == "static_library"', { + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '-fPIC' ], + 'SKIP_INSTALL': 'YES', + }, + }, { + 'cflags_cc': [ '-fPIC' ], + }], + ], + }], + ], + 'configurations': { + 'Debug': { + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '0', + 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', + 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', + 'DEAD_CODE_STRIPPING': 'NO', + 'OTHER_CPLUSPLUSFLAGS': [ '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ], + 'conditions': [ + ['coverage', { + 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', + 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', + 'OTHER_CPLUSPLUSFLAGS': [ '--coverage' ], + }], + ], + }, + }, { + 'cflags_cc': [ '-g', '-O0', '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ], + 'conditions': [ + ['coverage', { 'cflags_cc': [ '--coverage' ] }], + ], + }], + ], + 'defines': [ 'DEBUG' ], + 'target_conditions': [ + ['_type == "executable"', { + 'conditions': [ + ['OS=="mac" and coverage', { + 'xcode_settings': { 'OTHER_LDFLAGS': [ '--coverage' ] }, + }, { + 'ldflags': [ '--coverage' ], + }], + ], + }], + ], + }, + 'Release': { + 'defines': [ 'NDEBUG' ], + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '3', + 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', + 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', + 'DEAD_CODE_STRIPPING': 'NO', + }, + }, { + 'cflags_cc': [ '-g', '-O3' ], + }], + ], + }, + }, + }, + 'targets': [ + { + 'target_name': 'core', + 'product_name': 'mbgl-core', + 'type': 'static_library', + 'standalone_static_library': 1, + 'hard_dependency': 1, + + 'sources': [ + '<!@(find <(DEPTH)/src -name "*.hpp")', + '<!@(find <(DEPTH)/src -name "*.cpp")', + '<!@(find <(DEPTH)/src -name "*.c")', + '<!@(find <(DEPTH)/src -name "*.h")', + '<!@(find <(DEPTH)/include -name "*.hpp")', + '<!@(find <(DEPTH)/include -name "*.h")', + '<!@(find <(DEPTH)/src -name "*.glsl")', + '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', + ], + + 'rules': [ + { + 'rule_name': 'Build Shaders', + 'message': 'Building shader', + 'extension': 'glsl', + 'inputs': [ '<(DEPTH)/scripts/build-shaders.py' ], + 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/<(RULE_INPUT_ROOT).hpp' ], + 'action': [ '<@(_inputs)', '<(RULE_INPUT_PATH)', '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/shader/<(RULE_INPUT_ROOT).hpp' ], + 'process_outputs_as_sources': 1, + } + ], + + 'actions': [ + { + 'action_name': 'Build Version Header', + 'inputs': [ '<(DEPTH)/scripts/build-version.py', ], + 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', ], + 'action': [ '<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)' ], + } + ], + + 'include_dirs': [ + 'include', + 'src', + '<(SHARED_INTERMEDIATE_DIR)/include', + ], + + 'variables': { + 'cflags_cc': [ + '<@(opengl_cflags)', + '<@(boost_cflags)', + '<@(geojsonvt_cflags)', + '<@(rapidjson_cflags)', + '<@(variant_cflags)', + ], + 'cflags': [ + '<@(opengl_cflags)', + '<@(rapidjson_cflags)', + '-fPIC' + ], + 'ldflags': [ + '<@(opengl_ldflags)', + ], + 'libraries': [ + '<@(geojsonvt_static_libs)', + ], + }, + + 'conditions': [ + ['OS == "mac"', { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + 'OTHER_CFLAGS': [ '<@(cflags)' ], + }, + }, { + 'cflags_cc': [ '<@(cflags_cc)' ], + 'cflags': [ '<@(cflags)' ], + }], + + ['headless_lib == "cgl"', { + 'sources': [ + 'platform/default/headless_display.cpp', + 'platform/default/headless_view.cpp', + 'platform/darwin/src/headless_view_cgl.cpp', + ], + + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', + ], + }, + }], + + ['headless_lib == "eagl"', { + 'sources': [ + 'platform/default/headless_display.cpp', + 'platform/default/headless_view.cpp', + 'platform/darwin/src/headless_view_eagl.mm', + ], + }], + + ['headless_lib == "glx"', { + 'sources': [ + 'platform/default/headless_display.cpp', + 'platform/default/headless_view.cpp', + 'platform/default/headless_view_glx.cpp', + ], + + 'cflags_cc': [ '<@(opengl_cflags)' ], + + 'link_settings': { + 'libraries': [ '<@(opengl_ldflags)' ], + }, + }], + + ['loop_lib == "darwin"', { + 'sources': [ + 'platform/darwin/src/async_task.cpp', + 'platform/darwin/src/run_loop.cpp', + 'platform/darwin/src/timer.cpp', + ], + }], + + ['loop_lib == "android"', { + 'sources': [ + 'platform/android/src/async_task.cpp', + 'platform/android/src/run_loop.cpp', + 'platform/android/src/timer.cpp', + ], + }], + + ['loop_lib == "uv"', { + 'sources': [ + 'platform/default/async_task.cpp', + 'platform/default/run_loop.cpp', + 'platform/default/timer.cpp', + ], + + 'cflags_cc': [ + '<@(libuv_cflags)', + ], + + 'link_settings': { + 'libraries': [ + '<@(libuv_static_libs)', + '<@(libuv_ldflags)', + ], + }, + }], + ], + + 'link_settings': { + 'conditions': [ + ['OS == "mac"', { + 'libraries': [ '<@(libraries)' ], + 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } + }, { + 'libraries': [ '<@(libraries)', '<@(ldflags)' ], + }] + ], + }, + }, + { + 'target_name': 'copy_certificate_bundle', + 'type': 'none', + 'hard_dependency': 1, + 'copies': [{ + 'files': [ 'common/ca-bundle.crt' ], + 'destination': '<(PRODUCT_DIR)' + }], + }, + ], +} diff --git a/package.json b/package.json index 0cf4b0ee3f..5d5f751ce2 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,7 @@ "type": "git", "url": "git://github.com/mapbox/mapbox-gl-native.git" }, - "licenses": [ - { - "type": "BSD", - "url": "https://github.com/mapbox/mapbox-gl-native/blob/master/LICENSE.md" - } - ], + "license": "BSD-2-Clause", "dependencies": { "nan": "^2.1.0", "node-pre-gyp": "^0.6.17" diff --git a/platform/android/.gitignore b/platform/android/.gitignore index 57cd31fea2..53e7540178 100644 --- a/platform/android/.gitignore +++ b/platform/android/.gitignore @@ -12,7 +12,6 @@ build/ # JNI MapboxGLAndroidSDK/src/main/jniLibs/ -MapboxGLAndroidSDK/src/main/obj.target/ # Lib assets MapboxGLAndroidSDK/src/main/assets/ diff --git a/platform/android/bitrise.yml b/platform/android/bitrise.yml index f67edac3d8..c1c4407bde 100644 --- a/platform/android/bitrise.yml +++ b/platform/android/bitrise.yml @@ -24,29 +24,15 @@ workflows: envman add --key SKIPCI --value false fi - script: - title: Install Linux Dependencies + title: Build + run_if: '{{enveq "SKIPCI" "false"}}' inputs: - content: |- #!/bin/bash - + set -eu -o pipefail apt-get install -y pkg-config - - script: - title: Build Android SDK For arm - inputs: - - content: |- - #!/bin/bash - - make android -j4 - - is_debug: 'yes' - - script: - title: Run Unit Tests - inputs: - - content: |- - #!/bin/bash - - cd platform/android - ./gradlew testReleaseUnitTest --continue - - is_debug: 'yes' + make android + make test-android - slack: title: Post to Slack run_if: '{{enveq "SKIPCI" "false"}}' @@ -68,47 +54,24 @@ workflows: scheduled: steps: - script: - title: Install Linux Dependencies + title: Build inputs: - content: |- #!/bin/bash + set -eu -o pipefail apt-get install -y pkg-config python-pip python-dev build-essential pip install awscli - - script: - title: Fetch GPG Secring For SDK Signing - inputs: - - content: |- - #!/bin/bash aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg platform/android/MapboxGLAndroidSDK/secring.gpg - opts: - is_expand: true - - script: - title: Inject Signing And Publishing Credentials - inputs: - - content: |- - #!/bin/bash echo "NEXUS_USERNAME=$PUBLISH_NEXUS_USERNAME NEXUS_PASSWORD=$PUBLISH_NEXUS_PASSWORD signing.keyId=$SIGNING_KEYID signing.password=$SIGNING_PASSWORD signing.secretKeyRingFile=secring.gpg" >> platform/android/MapboxGLAndroidSDK/gradle.properties - opts: - is_expand: true - - script: - title: Build Mapbox Android SDK For All ABI - inputs: - - content: |- - #!/bin/bash make apackage -j4 - - script: - title: Publish To Maven Central - inputs: - - content: |- - #!/bin/bash cd platform/android - ./gradlew uploadArchives
\ No newline at end of file + ./gradlew uploadArchives diff --git a/platform/android/mapboxgl-app.gypi b/platform/android/platform.gyp index f9644c8d99..4954c7031c 100644 --- a/platform/android/mapboxgl-app.gypi +++ b/platform/android/platform.gyp @@ -1,69 +1,88 @@ { + 'variables': { + 'loop_lib': 'android', + 'headless_lib': 'none', + }, 'includes': [ - '../../gyp/common.gypi', + '../../mbgl.gypi', ], 'targets': [ - { 'target_name': 'android-lib', + { + 'target_name': 'platform-lib', 'product_name': 'mapbox-gl', 'type': 'shared_library', 'hard_dependency': 1, - 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', + 'core', ], 'include_dirs': [ - '../src', + '../default', + '../../include', + '../../src', # TODO: eliminate ], 'sources': [ - './src/native_map_view.cpp', - './src/jni.cpp', - './src/attach_env.cpp', + 'src/native_map_view.cpp', + 'src/jni.cpp', + 'src/attach_env.cpp', + 'src/log_android.cpp', + 'src/http_request_android.cpp', + 'src/asset_file_source.cpp', + '../default/thread.cpp', + '../default/string_stdlib.cpp', + '../default/image.cpp', + '../default/png_reader.cpp', + '../default/jpeg_reader.cpp', + '../default/default_file_source.cpp', + '../default/online_file_source.cpp', + '../default/mbgl/storage/offline.hpp', + '../default/mbgl/storage/offline.cpp', + '../default/mbgl/storage/offline_database.hpp', + '../default/mbgl/storage/offline_database.cpp', + '../default/mbgl/storage/offline_download.hpp', + '../default/mbgl/storage/offline_download.cpp', + '../default/sqlite3.hpp', + '../default/sqlite3.cpp', ], 'cflags_cc': [ '<@(boost_cflags)', + '<@(rapidjson_cflags)', + '<@(nunicode_cflags)', + '<@(sqlite_cflags)', '<@(variant_cflags)', '<@(jni.hpp_cflags)', + '<@(libzip_cflags)', + '<@(libpng_cflags)', + '<@(libjpeg-turbo_cflags)', ], - 'libraries': [ - '<@(libpng_static_libs)', - '<@(libjpeg-turbo_static_libs)', - '<@(sqlite_static_libs)', - '<@(nunicode_static_libs)', - '<@(libzip_static_libs)', - ], - 'variables': { - 'ldflags': [ + + 'link_settings': { + 'libraries': [ '-llog', '-landroid', '-lEGL', '-lGLESv2', '-lstdc++', '-latomic', - '<@(libpng_ldflags)', - '<@(libjpeg-turbo_ldflags)', + '<@(nunicode_ldflags)', + '<@(nunicode_static_libs)', '<@(sqlite_ldflags)', + '<@(sqlite_static_libs)', '<@(zlib_ldflags)', + '<@(zlib_static_libs)', '<@(libzip_ldflags)', + '<@(libzip_static_libs)', + '<@(libpng_ldflags)', + '<@(libpng_static_libs)', + '<@(libjpeg-turbo_ldflags)', + '<@(libjpeg-turbo_static_libs)', ], }, - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } - }, { - 'libraries': [ '<@(ldflags)' ], - }] - ], }, - - { 'target_name': 'example-custom-layer-lib', + { + 'target_name': 'example-custom-layer-lib', 'product_name': 'example-custom-layer', 'type': 'shared_library', 'hard_dependency': 1, @@ -76,8 +95,8 @@ '../../include', ], - 'variables': { - 'ldflags': [ + 'link_settings': { + 'libraries': [ '-llog', '-landroid', '-lEGL', @@ -86,24 +105,14 @@ '-latomic', ], }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - } - }, { - 'libraries': [ '<@(ldflags)' ], - }] - ], }, - - { 'target_name': 'androidapp', + { + 'target_name': 'all', 'type': 'none', 'hard_dependency': 1, 'dependencies': [ - 'android-lib', + 'platform-lib', 'example-custom-layer-lib', ], @@ -115,17 +124,11 @@ { 'files': [ '../../common/ca-bundle.crt', - '../../platform/default/resources/api_mapbox_com-digicert.der', - '../../platform/default/resources/api_mapbox_com-geotrust.der', - '../../platform/default/resources/star_tilestream_net.der', + '../default/resources/api_mapbox_com-digicert.der', + '../default/resources/api_mapbox_com-geotrust.der', + '../default/resources/star_tilestream_net.der', ], - 'destination': '<(pwd)/../platform/android/MapboxGLAndroidSDK/src/main/assets' - }, - { - 'files': [ - '<(PRODUCT_DIR)/obj.target' - ], - 'destination': '<(pwd)/../platform/android/MapboxGLAndroidSDK/src/main' + 'destination': '<(DEPTH)/platform/android/MapboxGLAndroidSDK/src/main/assets' }, ], @@ -133,13 +136,13 @@ { 'action_name': 'Strip mapbox library', 'inputs': [ '<(PRODUCT_DIR)/lib.target/libmapbox-gl.so' ], - 'outputs': [ '<(pwd)/../platform/android/MapboxGLAndroidSDK/src/main/jniLibs/$(JNIDIR)/libmapbox-gl.so' ], + 'outputs': [ '<(DEPTH)/platform/android/MapboxGLAndroidSDK/src/main/jniLibs/$(JNIDIR)/libmapbox-gl.so' ], 'action': [ '$(STRIP)', '<@(_inputs)', '-o', '<@(_outputs)' ] }, { 'action_name': 'Strip example custom layer library', 'inputs': [ '<(PRODUCT_DIR)/lib.target/libexample-custom-layer.so' ], - 'outputs': [ '<(pwd)/../platform/android/MapboxGLAndroidSDKTestApp/src/main/jniLibs/$(JNIDIR)/libexample-custom-layer.so' ], + 'outputs': [ '<(DEPTH)/platform/android//MapboxGLAndroidSDKTestApp/src/main/jniLibs/$(JNIDIR)/libexample-custom-layer.so' ], 'action': [ '$(STRIP)', '<@(_inputs)', '-o', '<@(_outputs)' ] } ], diff --git a/platform/android/scripts/defaults.mk b/platform/android/scripts/defaults.mk deleted file mode 100644 index f70c852ed1..0000000000 --- a/platform/android/scripts/defaults.mk +++ /dev/null @@ -1,11 +0,0 @@ -HEADLESS ?= none -PLATFORM ?= android -ASSET ?= zip -HTTP ?= android -LOOP ?= android - -GYP_FLAVOR_SUFFIX=-android - -HOST_VERSION ?= arm-v7 - -ENV = $(shell MASON_ANDROID_ABI=$(HOST_VERSION) ./platform/android/scripts/toolchain.sh) diff --git a/platform/android/scripts/install.sh b/platform/android/scripts/install.sh deleted file mode 100755 index e99c3dc75e..0000000000 --- a/platform/android/scripts/install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -mapbox_time "checkout_mason" \ -git submodule update --init .mason - -export MASON_PLATFORM=android -export MASON_ANDROID_ABI=${ANDROID_ABI} - -mapbox_time "android_toolchain" \ -./platform/android/scripts/toolchain.sh diff --git a/platform/android/scripts/run.sh b/platform/android/scripts/run.sh deleted file mode 100755 index 9e87298fe9..0000000000 --- a/platform/android/scripts/run.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -# Add Mason to PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" -export MASON_PLATFORM=android -export MASON_ANDROID_ABI=${ANDROID_ABI} - -################################################################################ -# Build -################################################################################ - -mkdir -p ./platform/android/MapboxGLAndroidSDKTestApp/src/main/res/raw -echo "${MAPBOX_ACCESS_TOKEN}" > ./platform/android/MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt - -mapbox_time "compile_library" \ -make android-lib HOST_VERSION=${ANDROID_ABI} -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "build_apk" \ -make android HOST_VERSION=${ANDROID_ABI} -j${JOBS} BUILDTYPE=${BUILDTYPE} - -################################################################################ -# Deploy -################################################################################ - -if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then - # Install and add awscli to PATH for uploading the results - mapbox_time "install_awscli" \ - pip install --user awscli - export PATH="`python -m site --user-base`/bin:${PATH}" - - mapbox_time_start "deploy_results" - echo "Deploying results..." - - S3_PREFIX=s3://mapbox/mapbox-gl-native/android/build/${TRAVIS_JOB_NUMBER} - APK_OUTPUTS=./platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk - JNILIB=`mason env JNIDIR` - - # ARM64 does not build APK for now - if [ ${JNIDIR} != "arm64-v8a" ] ; then - # Upload either the debug or the release build - if [ ${BUILDTYPE} == "Debug" ] ; then - aws s3 cp \ - ${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-${JNILIB}-debug.apk \ - ${S3_PREFIX}/MapboxGLAndroidSDKTestApp-debug.apk - elif [ ${BUILDTYPE} == "Release" ] ; then - aws s3 cp \ - ${APK_OUTPUTS}/MapboxGLAndroidSDKTestApp-${JNILIB}-release-unsigned.apk \ - ${S3_PREFIX}/MapboxGLAndroidSDKTestApp-release-unsigned.apk - fi - fi - - mapbox_time_finish -fi diff --git a/platform/ios/app/mapboxgl-app.gypi b/platform/ios/app/mapboxgl-app.gypi deleted file mode 100644 index 864755829f..0000000000 --- a/platform/ios/app/mapboxgl-app.gypi +++ /dev/null @@ -1,81 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'iosapp', - 'product_name': 'Mapbox GL', - 'type': 'executable', - 'product_extension': 'app', - 'mac_bundle': 1, - 'mac_bundle_resources': [ - '<!@(find ../platform/ios/app/img -type f)', - './Storyboard.storyboard', - './points.geojson', - './polyline.geojson', - './threestates.geojson', - './Settings.bundle/', - './app-info.plist', - ], - - 'dependencies': [ - 'iossdk', - ], - - 'sources': [ - 'main.m', - 'MBXAppDelegate.h', - 'MBXAppDelegate.m', - 'MBXCustomCalloutView.h', - 'MBXCustomCalloutView.m', - 'MBXOfflinePacksTableViewController.h', - 'MBXOfflinePacksTableViewController.m', - 'MBXViewController.h', - 'MBXViewController.m', - ], - - 'xcode_settings': { - 'SDKROOT': 'iphoneos', - 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', - 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', - 'INFOPLIST_FILE': '../platform/ios/app/app-info.plist', - 'TARGETED_DEVICE_FAMILY': '1,2', - 'COMBINE_HIDPI_IMAGES': 'NO', # disable combining @2x, @3x images into .tiff files - 'COPY_PHASE_STRIP': 'NO', - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_ENABLE_MODULES': 'YES', - 'LD_RUNPATH_SEARCH_PATHS': [ - '$(inherited)', - '@executable_path/Frameworks', - ], - }, - - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'COPY_PHASE_STRIP': 'NO', - }, - }, - 'Release': { - 'xcode_settings': { - 'CODE_SIGN_IDENTITY': 'iPhone Distribution', - 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], - 'COPY_PHASE_STRIP': 'YES', - }, - }, - }, - - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/$(FRAMEWORKS_FOLDER_PATH)', - 'files': [ - '<(PRODUCT_DIR)/Mapbox.framework', - ], - 'xcode_code_sign': 1, - }, - ], - } - ] -} diff --git a/platform/ios/benchmark/benchmark-ios.gypi b/platform/ios/benchmark/benchmark-ios.gypi deleted file mode 100644 index 5962a6b338..0000000000 --- a/platform/ios/benchmark/benchmark-ios.gypi +++ /dev/null @@ -1,78 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'ios-bench', - 'product_name': 'Bench GL', - 'type': 'executable', - 'product_extension': 'app', - 'mac_bundle': 1, - 'mac_bundle_resources': [ - '<!@(find ../platform/ios/benchmark/img -type f)', - 'assets/glyphs', - 'assets/sprites', - 'assets/tiles', - ], - - 'dependencies': [ - 'iossdk', - ], - - 'sources': [ - './main.m', - './MBXBenchAppDelegate.h', - './MBXBenchAppDelegate.m', - './MBXBenchViewController.h', - './MBXBenchViewController.mm', - './locations.hpp', - './locations.cpp', - ], - - 'xcode_settings': { - 'SDKROOT': 'iphoneos', - 'SUPPORTED_PLATFORMS': 'iphoneos', - 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', - 'INFOPLIST_FILE': '../platform/ios/benchmark/app-info.plist', - 'TARGETED_DEVICE_FAMILY': '1,2', - 'COMBINE_HIDPI_IMAGES': 'NO', # don't merge @2x.png images into .tiff files - 'COPY_PHASE_STRIP': 'NO', - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_ENABLE_MODULES': 'YES', - 'LD_RUNPATH_SEARCH_PATHS': [ - '$(inherited)', - '@executable_path/Frameworks', - ], - 'OTHER_LDFLAGS': [ - '-framework CoreLocation', - ], - }, - - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'COPY_PHASE_STRIP': 'NO', - }, - }, - 'Release': { - 'xcode_settings': { - 'CODE_SIGN_IDENTITY': 'iPhone Distribution', - 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], - 'COPY_PHASE_STRIP': 'YES', - }, - }, - }, - - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/$(FRAMEWORKS_FOLDER_PATH)', - 'files': [ - '<(PRODUCT_DIR)/Mapbox.framework', - ], - 'xcode_code_sign': 1, - }, - ], - } - ] -} diff --git a/platform/ios/bitrise.yml b/platform/ios/bitrise.yml index 1322224caf..83dba2239e 100644 --- a/platform/ios/bitrise.yml +++ b/platform/ios/bitrise.yml @@ -28,10 +28,11 @@ workflows: inputs: - content: |- #!/bin/bash - + set -eu -o pipefail gem install jazzy --no-rdoc --no-ri - make ipackage-sim - make itest + export BUILDTYPE=Debug + make ios + make test-ios - is_debug: 'yes' - slack: title: Post to Slack @@ -51,5 +52,3 @@ workflows: failed' - icon_url: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-icon-128.png - icon_url_on_error: https://bitrise-public-content-production.s3.amazonaws.com/slack/bitrise-slack-error-icon-128.png - before_run: - after_run: diff --git a/platform/ios/framework/framework-ios.gypi b/platform/ios/framework/framework-ios.gypi deleted file mode 100644 index 3d733d963a..0000000000 --- a/platform/ios/framework/framework-ios.gypi +++ /dev/null @@ -1,71 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'iossdk', - 'product_name': 'Mapbox', - 'type': 'shared_library', - 'mac_bundle': 1, - - 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - ], - - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'COMBINE_HIDPI_IMAGES': 'NO', # disable combining @2x, @3x images into .tiff files - 'CURRENT_PROJECT_VERSION': '0', - 'DEFINES_MODULE': 'YES', - 'DYLIB_INSTALL_NAME_BASE': '@rpath', - 'INFOPLIST_FILE': '../platform/ios/framework/Info.plist', - 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', - 'LD_RUNPATH_SEARCH_PATHS': [ - '$(inherited)', - '@executable_path/Frameworks', - '@loader_path/Frameworks', - ], - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.sdk.ios', - 'OTHER_LDFLAGS': [ '-stdlib=libc++', '-lstdc++' ], - 'SDKROOT': 'iphoneos', - 'SKIP_INSTALL': 'YES', - 'SUPPORTED_PLATFORMS': [ - 'iphonesimulator', - 'iphoneos', - ], - 'VERSIONING_SYSTEM': 'apple-generic', - }, - - 'mac_framework_headers': [ - 'Mapbox.h', - '<!@(find ../platform/{darwin,ios}/include -type f \! -name \'.*\' \! -name Mapbox.h)', - ], - - 'sources': [ - 'Mapbox.m', - ], - - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'DEAD_CODE_STRIPPING': 'YES', - 'GCC_OPTIMIZATION_LEVEL': '0', - }, - }, - 'Release': { - 'xcode_settings': { - 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], - 'CODE_SIGN_IDENTITY': 'iPhone Distribution', - 'DEAD_CODE_STRIPPING': 'YES', - 'GCC_OPTIMIZATION_LEVEL': 's', - }, - }, - }, - }, - ] -} diff --git a/platform/ios/platform.gyp b/platform/ios/platform.gyp new file mode 100644 index 0000000000..f182767b56 --- /dev/null +++ b/platform/ios/platform.gyp @@ -0,0 +1,382 @@ +{ + 'variables': { + 'loop_lib': 'darwin', + 'headless_lib': 'eagl', + }, + 'xcode_settings': { + # Force all build output to the build directory. Must + # be an absolute path or xcodebuild will ignore it. + 'SYMROOT': '<!(cd ../../build/ios-all && pwd)', + }, + 'includes': [ + '../../mbgl.gypi', + ], + 'target_defaults': { + 'target_conditions': [ + ['_type == "static_library"', { + 'xcode_settings': { + 'SDKROOT': 'iphoneos', + 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', + 'IPHONEOS_DEPLOYMENT_TARGET': '7.0', + 'TARGETED_DEVICE_FAMILY': '1,2', + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', + 'CODE_SIGN_IDENTITY': 'iPhone Developer', + }, + 'configurations': { + 'Release': { + 'xcode_settings': { + 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], + }, + }, + }, + }], + ], + }, + 'targets': [ + { + 'target_name': 'platform-lib', + 'product_name': 'mbgl-platform-ios', + 'type': 'static_library', + 'standalone_static_library': 1, + 'hard_dependency': 1, + 'dependencies': [ + 'core', + ], + + 'include_dirs': [ + 'include', + '../darwin/include', + '../default', + '../../include', + '../../src', # TODO: eliminate + ], + + 'sources': [ + '../default/asset_file_source.cpp', + '../default/default_file_source.cpp', + '../default/online_file_source.cpp', + '../default/mbgl/storage/offline.hpp', + '../default/mbgl/storage/offline.cpp', + '../default/mbgl/storage/offline_database.hpp', + '../default/mbgl/storage/offline_database.cpp', + '../default/mbgl/storage/offline_download.hpp', + '../default/mbgl/storage/offline_download.cpp', + '../default/sqlite3.hpp', + '../default/sqlite3.cpp', + '../darwin/src/http_request_nsurl.mm', + '../darwin/src/log_nslog.mm', + '../darwin/src/string_nsstring.mm', + '../darwin/src/image.mm', + '../darwin/src/nsthread.mm', + '../darwin/src/reachability.m', + '../darwin/src/NSException+MGLAdditions.h', + '../darwin/src/NSString+MGLAdditions.h', + '../darwin/src/NSString+MGLAdditions.m', + '../darwin/src/MGLTypes.m', + '../darwin/src/MGLStyle.mm', + '../darwin/src/MGLGeometry_Private.h', + '../darwin/src/MGLGeometry.mm', + '../darwin/src/MGLShape.m', + '../darwin/src/MGLMultiPoint_Private.h', + '../darwin/src/MGLMultiPoint.mm', + '../darwin/src/MGLPointAnnotation.m', + '../darwin/src/MGLPolyline.mm', + '../darwin/src/MGLPolygon.mm', + '../darwin/src/MGLMapCamera.mm', + '../darwin/src/MGLOfflinePack.mm', + '../darwin/src/MGLOfflinePack_Private.h', + '../darwin/src/MGLOfflineStorage.mm', + '../darwin/src/MGLOfflineStorage_Private.h', + '../darwin/src/MGLOfflineRegion_Private.h', + '../darwin/src/MGLTilePyramidOfflineRegion.mm', + '../darwin/src/MGLAccountManager_Private.h', + '../darwin/src/MGLAccountManager.m', + '../darwin/src/NSBundle+MGLAdditions.h', + '../darwin/src/NSBundle+MGLAdditions.m', + '../darwin/src/NSProcessInfo+MGLAdditions.h', + '../darwin/src/NSProcessInfo+MGLAdditions.m', + 'src/MGLMapboxEvents.h', + 'src/MGLMapboxEvents.m', + 'src/MGLAPIClient.h', + 'src/MGLAPIClient.m', + 'src/MGLLocationManager.h', + 'src/MGLLocationManager.m', + 'src/MGLMapView.mm', + 'src/MGLUserLocation_Private.h', + 'src/MGLUserLocation.m', + 'src/MGLUserLocationAnnotationView.h', + 'src/MGLUserLocationAnnotationView.m', + 'src/MGLAnnotationImage_Private.h', + 'src/MGLAnnotationImage.m', + 'src/MGLCompactCalloutView.h', + 'src/MGLCompactCalloutView.m', + 'vendor/SMCalloutView/SMCalloutView.h', + 'vendor/SMCalloutView/SMCalloutView.m', + 'vendor/Fabric/FABAttributes.h', + 'vendor/Fabric/FABKitProtocol.h', + 'vendor/Fabric/Fabric.h', + 'vendor/Fabric/Fabric+FABKits.h', + ], + + 'variables': { + 'cflags_cc': [ + '<@(boost_cflags)', + '<@(sqlite_cflags)', + '<@(zlib_cflags)', + '<@(rapidjson_cflags)', + '<@(variant_cflags)', + ], + 'ldflags': [ + '<@(sqlite_ldflags)', + '<@(zlib_ldflags)', + ], + 'libraries': [ + '<@(sqlite_static_libs)', + '<@(zlib_static_libs)', + '$(SDKROOT)/System/Library/Frameworks/CoreGraphics.framework', + '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework', + '$(SDKROOT)/System/Library/Frameworks/GLKit.framework', + '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework', + '$(SDKROOT)/System/Library/Frameworks/MobileCoreServices.framework', + '$(SDKROOT)/System/Library/Frameworks/OpenGLES.framework', + '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', + '$(SDKROOT)/System/Library/Frameworks/Security.framework', + '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework', + '$(SDKROOT)/System/Library/Frameworks/UIKit.framework', + ], + }, + + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'CLANG_ENABLE_MODULES': 'YES', + }, + + 'link_settings': { + 'libraries': [ '<@(libraries)' ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ '<@(ldflags)' ], + }, + }, + + 'direct_dependent_settings': { + 'include_dirs': [ + 'include', + '../darwin/include', + '../include', + ], + 'mac_bundle_resources': [ + '<!@(find resources -type f \! -name "README" \! -name \'.*\')', + '<!@(find ../default/resources -type f \! -name "README" \! -name \'.der\')', + ], + }, + }, + { + 'target_name': 'iossdk', + 'product_name': 'Mapbox', + 'type': 'shared_library', + 'mac_bundle': 1, + + 'dependencies': [ + 'platform-lib', + ], + + 'xcode_settings': { + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'COMBINE_HIDPI_IMAGES': 'NO', # disable combining @2x, @3x images into .tiff files + 'CURRENT_PROJECT_VERSION': '0', + 'DEFINES_MODULE': 'YES', + 'DYLIB_INSTALL_NAME_BASE': '@rpath', + 'INFOPLIST_FILE': 'framework/Info.plist', + 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', + 'LD_RUNPATH_SEARCH_PATHS': [ + '$(inherited)', + '@executable_path/Frameworks', + '@loader_path/Frameworks', + ], + 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.sdk.ios', + 'OTHER_LDFLAGS': [ '-stdlib=libc++', '-lstdc++' ], + 'SDKROOT': 'iphoneos', + 'SKIP_INSTALL': 'YES', + 'SUPPORTED_PLATFORMS': [ + 'iphonesimulator', + 'iphoneos', + ], + 'VERSIONING_SYSTEM': 'apple-generic', + }, + + 'mac_framework_headers': [ + 'framework/Mapbox.h', + '<!@(find ../{darwin,ios}/include -type f \! -name \'.*\' \! -name Mapbox.h)', + ], + + 'sources': [ + 'framework/Mapbox.m', + ], + + 'configurations': { + 'Debug': { + 'xcode_settings': { + 'CODE_SIGN_IDENTITY': 'iPhone Developer', + 'DEAD_CODE_STRIPPING': 'YES', + 'GCC_OPTIMIZATION_LEVEL': '0', + }, + }, + 'Release': { + 'xcode_settings': { + 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], + 'CODE_SIGN_IDENTITY': 'iPhone Distribution', + 'DEAD_CODE_STRIPPING': 'YES', + 'GCC_OPTIMIZATION_LEVEL': 's', + }, + }, + }, + }, + { + 'target_name': 'iosapp', + 'product_name': 'Mapbox GL', + 'type': 'executable', + 'product_extension': 'app', + 'mac_bundle': 1, + 'mac_bundle_resources': [ + '<!@(find app/img -type f)', + 'app/Storyboard.storyboard', + 'app/points.geojson', + 'app/polyline.geojson', + 'app/threestates.geojson', + 'app/Settings.bundle/', + 'app/app-info.plist', + ], + + 'dependencies': [ + 'iossdk', + ], + + 'sources': [ + 'app/main.m', + 'app/MBXAppDelegate.h', + 'app/MBXAppDelegate.m', + 'app/MBXCustomCalloutView.h', + 'app/MBXCustomCalloutView.m', + 'app/MBXOfflinePacksTableViewController.h', + 'app/MBXOfflinePacksTableViewController.m', + 'app/MBXViewController.h', + 'app/MBXViewController.m', + ], + + 'xcode_settings': { + 'SDKROOT': 'iphoneos', + 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', + 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', + 'INFOPLIST_FILE': 'app/app-info.plist', + 'TARGETED_DEVICE_FAMILY': '1,2', + 'COMBINE_HIDPI_IMAGES': 'NO', # disable combining @2x, @3x images into .tiff files + 'COPY_PHASE_STRIP': 'NO', + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'CLANG_ENABLE_MODULES': 'YES', + 'LD_RUNPATH_SEARCH_PATHS': [ + '$(inherited)', + '@executable_path/Frameworks', + ], + }, + + 'configurations': { + 'Debug': { + 'xcode_settings': { + 'CODE_SIGN_IDENTITY': 'iPhone Developer', + 'COPY_PHASE_STRIP': 'NO', + }, + }, + 'Release': { + 'xcode_settings': { + 'CODE_SIGN_IDENTITY': 'iPhone Distribution', + 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], + 'COPY_PHASE_STRIP': 'YES', + }, + }, + }, + + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/$(FRAMEWORKS_FOLDER_PATH)', + 'files': [ + '<(PRODUCT_DIR)/Mapbox.framework', + ], + 'xcode_code_sign': 1, + }, + ], + }, + { + 'target_name': 'ios-bench', + 'product_name': 'Bench GL', + 'type': 'executable', + 'product_extension': 'app', + 'mac_bundle': 1, + 'mac_bundle_resources': [ + '<!@(find benchmark/img -type f)', + 'benchmark/assets/glyphs', + 'benchmark/assets/sprites', + 'benchmark/assets/tiles', + ], + + 'dependencies': [ + 'iossdk', + ], + + 'sources': [ + 'benchmark/main.m', + 'benchmark/MBXBenchAppDelegate.h', + 'benchmark/MBXBenchAppDelegate.m', + 'benchmark/MBXBenchViewController.h', + 'benchmark/MBXBenchViewController.mm', + 'benchmark/locations.hpp', + 'benchmark/locations.cpp', + ], + + 'xcode_settings': { + 'SDKROOT': 'iphoneos', + 'SUPPORTED_PLATFORMS': 'iphoneos', + 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', + 'INFOPLIST_FILE': 'benchmark/app-info.plist', + 'TARGETED_DEVICE_FAMILY': '1,2', + 'COMBINE_HIDPI_IMAGES': 'NO', # don't merge @2x.png images into .tiff files + 'COPY_PHASE_STRIP': 'NO', + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'CLANG_ENABLE_MODULES': 'YES', + 'LD_RUNPATH_SEARCH_PATHS': [ + '$(inherited)', + '@executable_path/Frameworks', + ], + 'OTHER_LDFLAGS': [ + '-framework CoreLocation', + ], + }, + + 'configurations': { + 'Debug': { + 'xcode_settings': { + 'CODE_SIGN_IDENTITY': 'iPhone Developer', + 'COPY_PHASE_STRIP': 'NO', + }, + }, + 'Release': { + 'xcode_settings': { + 'CODE_SIGN_IDENTITY': 'iPhone Distribution', + 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], + 'COPY_PHASE_STRIP': 'YES', + }, + }, + }, + + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/$(FRAMEWORKS_FOLDER_PATH)', + 'files': [ + '<(PRODUCT_DIR)/Mapbox.framework', + ], + 'xcode_code_sign': 1, + }, + ], + } + ], +} diff --git a/platform/ios/scripts/after_failure.sh b/platform/ios/scripts/after_failure.sh deleted file mode 100755 index 88a6427f75..0000000000 --- a/platform/ios/scripts/after_failure.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -ls $KIF_SCREENSHOTS/ - -REPO_NAME=$(basename $TRAVIS_REPO_SLUG) - -aws s3 cp $KIF_SCREENSHOTS/ s3://mapbox/$REPO_NAME/ios/tests/$TRAVIS_JOB_NUMBER/ --acl public-read --recursive > /dev/null - -echo http://mapbox.s3.amazonaws.com/$REPO_NAME/ios/tests/$TRAVIS_JOB_NUMBER/index.html diff --git a/platform/ios/scripts/defaults.mk b/platform/ios/scripts/defaults.mk deleted file mode 100644 index 9debff4ce0..0000000000 --- a/platform/ios/scripts/defaults.mk +++ /dev/null @@ -1,9 +0,0 @@ -HEADLESS = eagl -PLATFORM ?= ios -ASSET ?= fs -HTTP ?= nsurl -LOOP ?= darwin - -HOST_VERSION = all - -PROVISIONING_PROFILE ?= 19324a54-7455-4f0b-8e1c-e6957c718ebc diff --git a/platform/ios/scripts/install.sh b/platform/ios/scripts/install.sh deleted file mode 100755 index 437193b1f2..0000000000 --- a/platform/ios/scripts/install.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -git fetch --tags - -mapbox_time "checkout_mason" \ -git submodule update --init .mason - -mapbox_time "install_recent_git" \ -brew install git - -mapbox_time "install_awscli" \ -brew install awscli - -mapbox_time "install_jazzy" \ -gem install jazzy - -mkdir -p ${KIF_SCREENSHOTS} diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index b0f63478df..02a454aaf7 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -72,12 +72,6 @@ echo ${HASH} echo ${HASH} >> ${VERSION} -step "Creating build files…" -export MASON_PLATFORM=ios -export BUILDTYPE=${BUILDTYPE:-Release} -export HOST=ios -make Xcode/ios - PROJ_VERSION=$(git rev-list --count HEAD) if [[ "${BUILD_FOR_DEVICE}" == true ]]; then @@ -91,13 +85,9 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then DEPLOYMENT_POSTPROCESSING=YES \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGN_IDENTITY= \ - -project ./build/ios-all/gyp/mbgl.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ - -target core \ - -target platform-ios \ - -target http-nsurl \ - -target asset-fs \ - -target headless-eagl \ + -target platform-lib \ -jobs ${JOBS} fi @@ -112,7 +102,7 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGN_IDENTITY= \ - -project ./build/ios-all/gyp/ios.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ -target iossdk \ -jobs ${JOBS} @@ -125,13 +115,9 @@ if [[ ${BUILD_STATIC} == true ]]; then ARCHS="x86_64 i386" \ ONLY_ACTIVE_ARCH=NO \ GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ - -project ./build/ios-all/gyp/mbgl.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ - -target core \ - -target platform-ios \ - -target http-nsurl \ - -target asset-fs \ - -target headless-eagl \ + -target platform-lib \ -jobs ${JOBS} fi @@ -143,13 +129,13 @@ if [[ ${BUILD_DYNAMIC} == true ]]; then GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ ENABLE_BITCODE=${ENABLE_BITCODE} \ CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ - -project ./build/ios-all/gyp/ios.xcodeproj \ + -project ./build/ios-all/platform/ios/platform.xcodeproj \ -configuration ${BUILDTYPE} \ -target iossdk \ -jobs ${JOBS} fi -LIBS=(core.a platform-ios.a asset-fs.a http-nsurl.a) +LIBS=(core.a platform-ios.a) # https://medium.com/@syshen/create-an-ios-universal-framework-148eb130a46c if [[ "${BUILD_FOR_DEVICE}" == true ]]; then @@ -159,22 +145,22 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then libtool -static -no_warning_for_no_symbols \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a` \ -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ - ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphoneos/libmbgl-} \ - ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphonesimulator/libmbgl-} + ${LIBS[@]/#/build/ios-all/${BUILDTYPE}-iphoneos/libmbgl-} \ + ${LIBS[@]/#/build/ios-all/${BUILDTYPE}-iphonesimulator/libmbgl-} fi if [[ ${BUILD_DYNAMIC} == true ]]; then step "Copying dynamic framework into place for iOS devices" cp -r \ - gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework \ + build/ios-all/${BUILDTYPE}-iphoneos/${NAME}.framework \ ${OUTPUT}/dynamic/ - cp -r gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM \ + cp -r build/ios-all/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM \ ${OUTPUT}/dynamic/ step "Merging simulator dynamic library into device dynamic library…" lipo \ - gyp/build/${BUILDTYPE}-iphoneos/${NAME}.framework/${NAME} \ - gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework/${NAME} \ + build/ios-all/${BUILDTYPE}-iphoneos/${NAME}.framework/${NAME} \ + build/ios-all/${BUILDTYPE}-iphonesimulator/${NAME}.framework/${NAME} \ -create -output ${OUTPUT}/dynamic/${NAME}.framework/${NAME} | echo fi else @@ -184,15 +170,15 @@ else libtool -static -no_warning_for_no_symbols \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a` \ -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ - ${LIBS[@]/#/gyp/build/${BUILDTYPE}-iphonesimulator/libmbgl-} + ${LIBS[@]/#/build/ios-all/${BUILDTYPE}-iphonesimulator/libmbgl-} fi if [[ ${BUILD_DYNAMIC} == true ]]; then step "Copying dynamic framework into place for iOS Simulator…" cp -r \ - gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework \ + build/ios-all/${BUILDTYPE}-iphonesimulator/${NAME}.framework \ ${OUTPUT}/dynamic/${NAME}.framework - cp -r gyp/build/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM \ + cp -r build/ios-all/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM \ ${OUTPUT}/dynamic/ fi fi diff --git a/platform/ios/scripts/run.sh b/platform/ios/scripts/run.sh deleted file mode 100755 index 44c21e7562..0000000000 --- a/platform/ios/scripts/run.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -source ./platform/ios/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -PUBLISH_TAG=($(git show -s --format=%B | sed -n 's/.*\[publish \([a-z]\{1,\}\)-v\([0-9a-z.\-]\{1,\}\)\].*/\1 \2/p')) -PUBLISH_PLATFORM=${PUBLISH_TAG[0],-} -PUBLISH_VERSION=${PUBLISH_TAG[1],-} - - -################################################################################ -# Build -################################################################################ - -if [[ ${PUBLISH_PLATFORM} = 'ios' ]]; then - # default, with debug symbols - mapbox_time "package_ios_symbols" \ - make ipackage - - mapbox_time "deploy_ios_symbols" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" symbols - - # no debug symbols, for smaller distribution - mapbox_time "package_ios_stripped" \ - make ipackage-strip - - mapbox_time "deploy_ios_stripped" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" - - # dynamic, with debug symbols - mapbox_time "package_ios_dynamic" \ - make iframework - - mapbox_time "deploy_ios_dynamic" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" symbols-dynamic - - # dynamic, without debug symbols - mapbox_time "package_ios_dynamic_stripped" \ - make iframework SYMBOLS=NO - - mapbox_time "deploy_ios_dynamic_stripped" - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" dynamic -else - # build & test iOS - mapbox_time "run_ios_tests" \ - make itest -fi diff --git a/platform/ios/scripts/setup.sh b/platform/ios/scripts/setup.sh deleted file mode 100644 index d115cf9020..0000000000 --- a/platform/ios/scripts/setup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# This script is sourced; do not set -e or -o pipefail here. - -# Ensure mason is on the PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" diff --git a/platform/ios/scripts/test.sh b/platform/ios/scripts/test.sh deleted file mode 100755 index a2515e6fea..0000000000 --- a/platform/ios/scripts/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -# No tests for now. KIF tests are too unreliable. diff --git a/platform/linux/README.md b/platform/linux/README.md index 55f3e71dba..910edcb9a6 100644 --- a/platform/linux/README.md +++ b/platform/linux/README.md @@ -33,14 +33,13 @@ Set the environment variable `MAPBOX_ACCESS_TOKEN` to your [Mapbox access token] export MAPBOX_ACCESS_TOKEN=MYTOKEN -Then, you can then proceed to build the library: +Then, you can then proceed to build the test application: - git submodule update --init - make linux + make glfw-app Set an access token as described below, and then run: - make run-linux + make run-glfw-app ### Test diff --git a/platform/linux/platform.gyp b/platform/linux/platform.gyp new file mode 100644 index 0000000000..0adbd2a2e6 --- /dev/null +++ b/platform/linux/platform.gyp @@ -0,0 +1,97 @@ +{ + 'variables': { + 'loop_lib': 'uv', + 'headless_lib': 'glx', + }, + 'conditions': [ + ['OS == "mac"', { + 'variables': { + 'headless_lib': 'cgl', + } + }], + ], + 'includes': [ + '../../mbgl.gypi', + '../../test/test.gypi', + '../../bin/glfw.gypi', + '../../bin/render.gypi', + '../../bin/offline.gypi', + ], + 'targets': [ + { + 'target_name': 'platform-lib', + 'product_name': 'mbgl-platform-linux', + 'type': 'static_library', + 'standalone_static_library': 1, + 'hard_dependency': 1, + 'dependencies': [ + 'core', + ], + + 'include_dirs': [ + '../default', + '../../include', + '../../src', # TODO: eliminate + ], + + 'sources': [ + '../default/log_stderr.cpp', + '../default/string_stdlib.cpp', + '../default/thread.cpp', + '../default/image.cpp', + '../default/webp_reader.cpp', + '../default/png_reader.cpp', + '../default/jpeg_reader.cpp', + '../default/asset_file_source.cpp', + '../default/http_request_curl.cpp', + '../default/default_file_source.cpp', + '../default/online_file_source.cpp', + '../default/mbgl/storage/offline.hpp', + '../default/mbgl/storage/offline.cpp', + '../default/mbgl/storage/offline_database.hpp', + '../default/mbgl/storage/offline_database.cpp', + '../default/mbgl/storage/offline_download.hpp', + '../default/mbgl/storage/offline_download.cpp', + '../default/sqlite3.hpp', + '../default/sqlite3.cpp', + ], + + 'cflags_cc': [ + '<@(boost_cflags)', + '<@(nunicode_cflags)', + '<@(sqlite_cflags)', + '<@(rapidjson_cflags)', + '<@(variant_cflags)', + '<@(libcurl_cflags)', + '<@(libpng_cflags)', + '<@(libjpeg-turbo_cflags)', + '<@(webp_cflags)', + ], + + 'link_settings': { + 'libraries': [ + '<@(nunicode_ldflags)', + '<@(nunicode_static_libs)', + '<@(sqlite_ldflags)', + '<@(sqlite_static_libs)', + '<@(zlib_ldflags)', + '<@(zlib_static_libs)', + '<@(libcurl_ldflags)', + '<@(libcurl_static_libs)', + '<@(libpng_ldflags)', + '<@(libpng_static_libs)', + '<@(libjpeg-turbo_ldflags)', + '<@(libjpeg-turbo_static_libs)', + '<@(webp_ldflags)', + '<@(webp_static_libs)', + ], + }, + + 'direct_dependent_settings': { + 'include_dirs': [ + '../include', + ], + }, + }, + ], +} diff --git a/platform/linux/scripts/after_script.sh b/platform/linux/scripts/after_script.sh index b5397f1df2..4989f0c444 100755 --- a/platform/linux/scripts/after_script.sh +++ b/platform/linux/scripts/after_script.sh @@ -3,13 +3,9 @@ set -e set -o pipefail -if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then - # Install and add awscli to PATH for uploading the results - pip install --user awscli - export PATH="`python -m site --user-base`/bin:${PATH}" - - REPO_NAME=$(basename $TRAVIS_REPO_SLUG) +JOB=$1 +if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then aws s3 cp --recursive --acl public-read --exclude "*" --include "*/actual.png" test/fixtures \ - s3://mapbox/$REPO_NAME/render-tests/$TRAVIS_JOB_NUMBER + s3://mapbox/mapbox-gl-native/render-tests/$JOB fi diff --git a/platform/linux/scripts/coveralls.sh b/platform/linux/scripts/coveralls.sh index 468fa4774b..1d8d9f060a 100755 --- a/platform/linux/scripts/coveralls.sh +++ b/platform/linux/scripts/coveralls.sh @@ -3,11 +3,22 @@ set -e set -o pipefail -source ./platform/linux/scripts/setup.sh +mapbox_time "install_lcov" \ +mason install lcov 1.12 -################################################################################ -# Coveralls -################################################################################ +# Collect coverage data and save it into coverage.info +mapbox_time "lcov_capture" \ +`mason prefix lcov 1.12`/usr/bin/lcov \ + --quiet \ + --capture \ + --no-external \ + --gcov-tool "gcov-4.9" \ + --directory "src/mbgl" \ + --directory "platform" \ + --directory "include/mbgl" \ + --directory "build/linux-x86_64/${BUILDTYPE}" \ + --base-directory "build/linux-x86_64/${BUILDTYPE}" \ + --output-file "build/linux-x86_64/${BUILDTYPE}/coverage.info" -mapbox_time "make_coveralls" \ -make coveralls -j${JOBS} +mapbox_time "coveralls_upload" \ +coveralls-lcov "build/linux-x86_64/${BUILDTYPE}/coverage.info" diff --git a/platform/linux/scripts/defaults.mk b/platform/linux/scripts/defaults.mk deleted file mode 100644 index 80f1346533..0000000000 --- a/platform/linux/scripts/defaults.mk +++ /dev/null @@ -1,5 +0,0 @@ -HEADLESS ?= glx -PLATFORM ?= linux -ASSET ?= fs -HTTP ?= curl -LOOP ?= uv diff --git a/platform/linux/scripts/install.sh b/platform/linux/scripts/install.sh deleted file mode 100755 index a254d312ec..0000000000 --- a/platform/linux/scripts/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -mapbox_time "checkout_mason" \ -git submodule update --init .mason - -PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" \ -mapbox_time "install_mesa" \ -mason install mesa 10.4.3 diff --git a/platform/linux/scripts/run.sh b/platform/linux/scripts/run.sh deleted file mode 100755 index 1c0c13968a..0000000000 --- a/platform/linux/scripts/run.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -source ./platform/linux/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -################################################################################ -# Build -################################################################################ - -mapbox_time "compile_program" \ -make linux -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_render_binary" \ -make render -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_offline_binary" \ -make offline -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_tests" \ -make test -j${JOBS} BUILDTYPE=${BUILDTYPE} - -################################################################################ -# Test -################################################################################ - -mapbox_time "run_tests" \ -make test-* BUILDTYPE=${BUILDTYPE} diff --git a/platform/linux/scripts/setup.sh b/platform/linux/scripts/setup.sh deleted file mode 100755 index af0eafb5cf..0000000000 --- a/platform/linux/scripts/setup.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# This script is sourced; do not set -e or -o pipefail here. - -# Ensure mason is on the PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -# Set the core file limit to unlimited so a core file is generated upon crash -ulimit -c unlimited -S - -################################################################################ -# X Server setup -################################################################################ - -# Start the mock X server -if [ -f /etc/init.d/xvfb ] ; then - mapbox_time "start_xvfb" \ - sh -e /etc/init.d/xvfb start - sleep 2 # sometimes, xvfb takes some time to start up -fi - -# Make sure we're connecting to xvfb -export DISPLAY=:99.0 - -# Make sure we're loading the 10.4.3 libs we installed manually -export LD_LIBRARY_PATH="`mason prefix mesa 10.4.3`/lib:${LD_LIBRARY_PATH:-}" - -mapbox_time "glxinfo" \ -glxinfo diff --git a/platform/node/bitrise.yml b/platform/node/bitrise.yml index 9b9b4ca064..0b09192ee3 100644 --- a/platform/node/bitrise.yml +++ b/platform/node/bitrise.yml @@ -22,25 +22,20 @@ workflows: else envman add --key SKIPCI --value false fi - - select-xcode-version: - title: Select Xcode version - run_if: '{{enveq "SKIPCI" "false"}}' - script: title: Run build script run_if: '{{enveq "SKIPCI" "false"}}' inputs: - content: |- #!/bin/bash - export TRAVIS_OS_NAME=osx - export TRAVIS_TAG=$BITRISE_GIT_TAG - export TRAVIS_JOB_NUMBER=$BITRISE_BUILD_NUMBER - export NODE_VERSION=4 - export CXX=clang++ - export CC=clang - source ./scripts/set_compiler.sh - ./platform/node/scripts/install.sh - ./platform/node/scripts/run.sh - ./platform/node/scripts/after_script.sh + set -eu -o pipefail + brew unlink node + brew install awscli homebrew/versions/node4-lts + brew link homebrew/versions/node4-lts + make node + make test-node || result=$? + ./platform/node/scripts/after_script.sh ${BITRISE_BUILD_NUMBER} ${BITRISE_GIT_TAG:-} + exit ${result:-0} - slack: title: Post to Slack run_if: '{{enveq "SKIPCI" "false"}}' diff --git a/platform/node/scripts/after_script.sh b/platform/node/scripts/after_script.sh index ae8480e02a..905055ad11 100755 --- a/platform/node/scripts/after_script.sh +++ b/platform/node/scripts/after_script.sh @@ -3,50 +3,20 @@ set -e set -o pipefail -# Inspect binary. -if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - ldd ./lib/mapbox-gl-native.node -else - otool -L ./lib/mapbox-gl-native.node -fi +JOB=$1 +TAG=$2 -PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") +if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then + gzip --stdout node_modules/mapbox-gl-test-suite/render-tests/index.html | \ + aws s3 cp --acl public-read --content-encoding gzip --content-type text/html \ + - s3://mapbox/mapbox-gl-native/render-tests/$JOB/index.html -if [[ ${TRAVIS_TAG} == node-v${PACKAGE_JSON_VERSION} ]]; then - source ~/.nvm/nvm.sh - nvm use $NODE_VERSION + echo http://mapbox.s3.amazonaws.com/mapbox-gl-native/render-tests/$JOB/index.html +fi - npm install aws-sdk +PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") +if [[ $TAG == node-v${PACKAGE_JSON_VERSION} ]]; then ./node_modules/.bin/node-pre-gyp package - - if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - ./node_modules/.bin/node-pre-gyp testpackage - fi - ./node_modules/.bin/node-pre-gyp publish info - - if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - source ./platform/linux/scripts/setup.sh - - rm -rf build - rm -rf lib - npm install --fallback-to-build=false - npm test - fi -fi - -if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then - if [[ ${TRAVIS_OS_NAME} == "linux" ]] ; then - pip install --user awscli - export PATH="`python -m site --user-base`/bin:${PATH}" - else - brew install awscli - fi - - gzip --stdout node_modules/mapbox-gl-test-suite/render-tests/index.html | \ - aws s3 cp --acl public-read --content-encoding gzip --content-type text/html \ - - s3://mapbox/mapbox-gl-native/render-tests/$TRAVIS_JOB_NUMBER/index.html - - echo http://mapbox.s3.amazonaws.com/mapbox-gl-native/render-tests/$TRAVIS_JOB_NUMBER/index.html fi diff --git a/platform/node/scripts/install.sh b/platform/node/scripts/install.sh deleted file mode 100755 index b550933cd9..0000000000 --- a/platform/node/scripts/install.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -git submodule update --init .mason - -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -if [ ${TRAVIS_OS_NAME} == "linux" ]; then - mason install mesa 10.4.3 -fi - -if [ ! -d ~/.nvm ]; then - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash -fi - -source ~/.nvm/nvm.sh - -nvm install $NODE_VERSION -nvm alias default $NODE_VERSION - -node --version -npm --version diff --git a/platform/node/scripts/run.sh b/platform/node/scripts/run.sh deleted file mode 100755 index 73578b110a..0000000000 --- a/platform/node/scripts/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -source ./platform/${TRAVIS_OS_NAME}/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -source ~/.nvm/nvm.sh -nvm use $NODE_VERSION -npm install --build-from-source - -npm test -npm run test-suite diff --git a/platform/osx/app/mapboxgl-app.gypi b/platform/osx/app/mapboxgl-app.gypi deleted file mode 100644 index 8b8cc17276..0000000000 --- a/platform/osx/app/mapboxgl-app.gypi +++ /dev/null @@ -1,77 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'osxapp', - 'product_name': 'Mapbox GL', - 'type': 'executable', - 'product_extension': 'app', - 'mac_bundle': 1, - 'mac_bundle_resources': [ - 'Credits.rtf', - 'Icon.icns', - 'MainMenu.xib', - 'MapDocument.xib', - ], - - 'dependencies': [ - 'osxsdk', - ], - - 'sources': [ - './AppDelegate.h', - './AppDelegate.m', - './DroppedPinAnnotation.h', - './DroppedPinAnnotation.m', - './LocationCoordinate2DTransformer.h', - './LocationCoordinate2DTransformer.m', - './MapDocument.h', - './MapDocument.m', - './OfflinePackNameValueTransformer.h', - './OfflinePackNameValueTransformer.m', - './TimeIntervalTransformer.h', - './TimeIntervalTransformer.m', - './NSValue+Additions.h', - './NSValue+Additions.m', - './main.m', - ], - - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'INFOPLIST_FILE': '../platform/osx/app/Info.plist', - 'LD_RUNPATH_SEARCH_PATHS': [ - '\${inherited}', - '@executable_path/../Frameworks', - ], - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL', - 'SDKROOT': 'macosx', - 'SUPPORTED_PLATFORMS': 'macosx', - }, - - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'COPY_PHASE_STRIP': 'NO', - }, - }, - 'Release': { - 'xcode_settings': { - 'COPY_PHASE_STRIP': 'YES', - }, - }, - }, - - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/${FRAMEWORKS_FOLDER_PATH}', - 'files': [ - '<(PRODUCT_DIR)/Mapbox.framework', - ], - 'xcode_code_sign': 1, - } - ], - }, - ] -} diff --git a/platform/osx/bitrise.yml b/platform/osx/bitrise.yml index 70fe9041bf..7170fa3f66 100644 --- a/platform/osx/bitrise.yml +++ b/platform/osx/bitrise.yml @@ -1,11 +1,6 @@ format_version: 1.1.0 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git -app: - envs: - - BITRISE_APP_TITLE: "Mapbox GL – OS X" - - BITRISE_DEV_BRANCH: "master" - trigger_map: - pattern: "*" is_pull_request_allowed: true @@ -28,12 +23,15 @@ workflows: envman add --key SKIPCI --value false fi - script: - title: Run SDK unit tests + title: Run build script run_if: '{{enveq "SKIPCI" "false"}}' inputs: - content: |- #!/bin/bash - make xctest BUILDTYPE=Debug + set -eu -o pipefail + export BUILDTYPE=Debug + make osx + make test-osx - is_debug: 'yes' - slack: title: Post to Slack diff --git a/platform/osx/platform.gyp b/platform/osx/platform.gyp new file mode 100644 index 0000000000..120e5c592d --- /dev/null +++ b/platform/osx/platform.gyp @@ -0,0 +1,328 @@ +{ + 'variables': { + 'loop_lib': 'darwin', + 'headless_lib': 'cgl', + }, + 'xcode_settings': { + # Force all build output to the build directory. Must + # be an absolute path or xcodebuild will ignore it. + 'SYMROOT': '<!(cd ../../build/osx-x86_64 && pwd)', + }, + 'includes': [ + '../../mbgl.gypi', + '../../test/test.gypi', + '../../bin/glfw.gypi', + '../../bin/render.gypi', + '../../bin/offline.gypi', + ], + 'targets': [ + { + 'target_name': 'platform-lib', + 'product_name': 'mbgl-platform-osx', + 'type': 'static_library', + 'standalone_static_library': 1, + 'hard_dependency': 1, + 'dependencies': [ + 'core', + ], + + 'include_dirs': [ + 'include', + '../darwin/include', + '../default', + '../../include', + '../../src', # TODO: eliminate + ], + + 'sources': [ + '../default/asset_file_source.cpp', + '../default/default_file_source.cpp', + '../default/online_file_source.cpp', + '../default/mbgl/storage/offline.hpp', + '../default/mbgl/storage/offline.cpp', + '../default/mbgl/storage/offline_database.hpp', + '../default/mbgl/storage/offline_database.cpp', + '../default/mbgl/storage/offline_download.hpp', + '../default/mbgl/storage/offline_download.cpp', + '../default/sqlite3.hpp', + '../default/sqlite3.cpp', + '../darwin/src/http_request_nsurl.mm', + '../darwin/src/log_nslog.mm', + '../darwin/src/string_nsstring.mm', + '../darwin/src/image.mm', + '../darwin/src/nsthread.mm', + '../darwin/src/reachability.m', + ], + + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(boost_cflags)', + '<@(sqlite_cflags)', + '<@(zlib_cflags)', + '<@(rapidjson_cflags)', + '<@(variant_cflags)', + ], + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'CLANG_ENABLE_MODULES': 'YES', + }, + + 'link_settings': { + 'libraries': [ + '<@(sqlite_static_libs)', + '<@(zlib_static_libs)', + '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', + '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework', + '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', + '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework', + '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework', + ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ '<@(zlib_ldflags)' ], + }, + }, + }, + { + 'target_name': 'osxsdk', + 'product_name': 'Mapbox', + 'type': 'shared_library', + 'mac_bundle': 1, + + 'dependencies': [ + 'platform-lib', + ], + + 'xcode_settings': { + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'CURRENT_PROJECT_VERSION': '0', + 'DEFINES_MODULE': 'YES', + 'DYLIB_INSTALL_NAME_BASE': '@rpath', + 'INFOPLIST_FILE': 'sdk/Info.plist', + 'LD_RUNPATH_SEARCH_PATHS': [ + '${inherited}', + '@executable_path/../Frameworks', + '@loader_path/Frameworks', + ], + 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL', + 'OTHER_CPLUSPLUSFLAGS': [ + '<@(boost_cflags)', + '<@(variant_cflags)', + ], + 'OTHER_LDFLAGS': [ '-stdlib=libc++', '-lstdc++' ], + 'SDKROOT': 'macosx', + 'SKIP_INSTALL': 'YES', + 'SUPPORTED_PLATFORMS':'macosx', + 'VERSIONING_SYSTEM': 'apple-generic', + }, + + 'mac_framework_headers': [ + 'sdk/Mapbox.h', + '<!@(find ../{darwin,osx}/include -type f \! -name \'.*\')', + ], + + 'mac_bundle_resources': [ + '<!@(find src/resources -type f \! -name \'.*\')', + ], + + 'include_dirs': [ + 'include', + '../darwin/include', + '../../include', + ], + + 'sources': [ + 'sdk/Mapbox.m', + '../darwin/src/NSException+MGLAdditions.h', + '../darwin/src/NSString+MGLAdditions.h', + '../darwin/src/NSString+MGLAdditions.m', + '../darwin/src/MGLTypes.m', + '../darwin/src/MGLStyle.mm', + '../darwin/src/MGLGeometry_Private.h', + '../darwin/src/MGLGeometry.mm', + '../darwin/src/MGLShape.m', + '../darwin/src/MGLMultiPoint_Private.h', + '../darwin/src/MGLMultiPoint.mm', + '../darwin/src/MGLPointAnnotation.m', + '../darwin/src/MGLPolyline.mm', + '../darwin/src/MGLPolygon.mm', + '../darwin/src/MGLMapCamera.mm', + '../darwin/src/MGLOfflinePack.mm', + '../darwin/src/MGLOfflinePack_Private.h', + '../darwin/src/MGLOfflineStorage.mm', + '../darwin/src/MGLOfflineStorage_Private.h', + '../darwin/src/MGLOfflineRegion_Private.h', + '../darwin/src/MGLTilePyramidOfflineRegion.mm', + '../darwin/src/MGLAccountManager_Private.h', + '../darwin/src/MGLAccountManager.m', + '../darwin/src/NSBundle+MGLAdditions.h', + '../darwin/src/NSBundle+MGLAdditions.m', + '../darwin/src/NSProcessInfo+MGLAdditions.h', + '../darwin/src/NSProcessInfo+MGLAdditions.m', + 'src/MGLMapView_Private.h', + 'src/MGLMapView.mm', + 'src/MGLMapView+IBAdditions.m', + 'src/MGLOpenGLLayer.h', + 'src/MGLOpenGLLayer.mm', + 'src/MGLCompassCell.h', + 'src/MGLCompassCell.m', + 'src/MGLAttributionButton.h', + 'src/MGLAttributionButton.m', + 'src/MGLAnnotationImage.m', + ], + + 'configurations': { + 'Debug': { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '0', + }, + }, + 'Release': { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': 's', + }, + }, + }, + + 'direct_dependent_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', + '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework', + ], + }, + }, + { + 'target_name': 'osxtest', + 'product_name': 'osxtest', + 'type': 'loadable_module', + 'mac_xctest_bundle': 1, + + 'dependencies': [ + 'osxsdk', + ], + + 'xcode_settings': { + 'CLANG_ENABLE_MODULES': 'YES', + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'ENABLE_STRICT_OBJC_MSGSEND': 'YES', + 'GCC_DYNAMIC_NO_PIC': 'NO', + 'GCC_NO_COMMON_BLOCKS': 'YES', + 'INFOPLIST_FILE': 'test/Info.plist', + 'LD_RUNPATH_SEARCH_PATHS': [ + '${inherited}', + '@executable_path/../Frameworks', + '@loader_path/../Frameworks', + ], + 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.osxtest', + 'SDKROOT': 'macosx', + 'SKIP_INSTALL': 'YES', + 'SUPPORTED_PLATFORMS':'macosx', + }, + + 'sources': [ + 'test/MGLGeometryTests.mm', + 'test/MGLOfflinePackTests.m', + 'test/MGLOfflineRegionTests.m', + 'test/MGLOfflineStorageTests.m', + 'test/MGLStyleTests.mm', + ], + + 'include_dirs': [ + 'include', + '../darwin/include', + '../../include', + ], + + 'configurations': { + 'Debug': { + 'xcode_settings': { + 'COPY_PHASE_STRIP': 'NO', + 'DEBUG_INFORMATION_FORMAT': 'dwarf', + 'ENABLE_TESTABILITY': 'YES', + 'GCC_OPTIMIZATION_LEVEL': '0', + 'GCC_PREPROCESSOR_DEFINITIONS': [ + 'DEBUG=1', + '${inherited}', + ], + 'ONLY_ACTIVE_ARCH': 'YES', + }, + }, + 'Release': { + 'xcode_settings': { + 'COPY_PHASE_STRIP': 'YES', + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'ENABLE_NS_ASSERTIONS': 'NO', + }, + }, + }, + }, + { + 'target_name': 'osxapp', + 'product_name': 'Mapbox GL', + 'type': 'executable', + 'product_extension': 'app', + 'mac_bundle': 1, + 'mac_bundle_resources': [ + 'app/Credits.rtf', + 'app/Icon.icns', + 'app/MainMenu.xib', + 'app/MapDocument.xib', + ], + + 'dependencies': [ + 'osxsdk', + ], + + 'sources': [ + 'app/AppDelegate.h', + 'app/AppDelegate.m', + 'app/DroppedPinAnnotation.h', + 'app/DroppedPinAnnotation.m', + 'app/LocationCoordinate2DTransformer.h', + 'app/LocationCoordinate2DTransformer.m', + 'app/MapDocument.h', + 'app/MapDocument.m', + 'app/OfflinePackNameValueTransformer.h', + 'app/OfflinePackNameValueTransformer.m', + 'app/TimeIntervalTransformer.h', + 'app/TimeIntervalTransformer.m', + 'app/NSValue+Additions.h', + 'app/NSValue+Additions.m', + 'app/main.m', + ], + + 'xcode_settings': { + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'INFOPLIST_FILE': 'app/Info.plist', + 'LD_RUNPATH_SEARCH_PATHS': [ + '\${inherited}', + '@executable_path/../Frameworks', + ], + 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL', + 'SDKROOT': 'macosx', + 'SUPPORTED_PLATFORMS': 'macosx', + }, + + 'configurations': { + 'Debug': { + 'xcode_settings': { + 'COPY_PHASE_STRIP': 'NO', + }, + }, + 'Release': { + 'xcode_settings': { + 'COPY_PHASE_STRIP': 'YES', + }, + }, + }, + + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/${FRAMEWORKS_FOLDER_PATH}', + 'files': [ + '<(PRODUCT_DIR)/Mapbox.framework', + ], + 'xcode_code_sign': 1, + } + ], + }, + ], +} diff --git a/platform/osx/scripts/configure.sh b/platform/osx/scripts/configure.sh index ece6bba102..e2fa095df9 100644 --- a/platform/osx/scripts/configure.sh +++ b/platform/osx/scripts/configure.sh @@ -2,10 +2,8 @@ BOOST_VERSION=1.59.0 BOOST_LIBPROGRAM_OPTIONS_VERSION=1.59.0 -LIBCURL_VERSION=system GLFW_VERSION=3.1.2 SQLITE_VERSION=3.9.1 -LIBUV_VERSION=1.7.5 ZLIB_VERSION=system NUNICODE_VERSION=1.6 GEOJSONVT_VERSION=4.1.0 diff --git a/platform/osx/scripts/defaults.mk b/platform/osx/scripts/defaults.mk deleted file mode 100644 index be290891d6..0000000000 --- a/platform/osx/scripts/defaults.mk +++ /dev/null @@ -1,5 +0,0 @@ -HEADLESS ?= cgl -PLATFORM ?= osx -ASSET ?= fs -HTTP ?= nsurl -LOOP ?= darwin diff --git a/platform/osx/scripts/install.sh b/platform/osx/scripts/install.sh deleted file mode 100755 index 0f9b5a2752..0000000000 --- a/platform/osx/scripts/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -mapbox_time "checkout_mason" \ -git submodule update --init .mason diff --git a/platform/osx/scripts/osxsdk.xcscheme b/platform/osx/scripts/osxsdk.xcscheme deleted file mode 100644 index e8a7f2ff58..0000000000 --- a/platform/osx/scripts/osxsdk.xcscheme +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "0720" - version = "1.3"> - <BuildAction - parallelizeBuildables = "YES" - buildImplicitDependencies = "YES"> - <BuildActionEntries> - <BuildActionEntry - buildForTesting = "YES" - buildForRunning = "YES" - buildForProfiling = "YES" - buildForArchiving = "YES" - buildForAnalyzing = "YES"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "8E4ECCDD911E8B357970AAED" - BuildableName = "Mapbox.framework" - BlueprintName = "osxsdk" - ReferencedContainer = "container:../build/osx-x86_64/gyp/osx.xcodeproj"> - </BuildableReference> - </BuildActionEntry> - </BuildActionEntries> - </BuildAction> - <TestAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - <TestableReference - skipped = "NO"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "968E0619FB16F6A55E27CDF3" - BuildableName = "osxtest.xctest" - BlueprintName = "osxtest" - ReferencedContainer = "container:../build/osx-x86_64/gyp/osx.xcodeproj"> - </BuildableReference> - </TestableReference> - </Testables> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "8E4ECCDD911E8B357970AAED" - BuildableName = "Mapbox.framework" - BlueprintName = "osxsdk" - ReferencedContainer = "container:../build/osx-x86_64/gyp/osx.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "8E4ECCDD911E8B357970AAED" - BuildableName = "Mapbox.framework" - BlueprintName = "osxsdk" - ReferencedContainer = "container:../build/osx-x86_64/gyp/osx.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - debugDocumentVersioning = "YES"> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "8E4ECCDD911E8B357970AAED" - BuildableName = "Mapbox.framework" - BlueprintName = "osxsdk" - ReferencedContainer = "container:../build/osx-x86_64/gyp/osx.xcodeproj"> - </BuildableReference> - </MacroExpansion> - </ProfileAction> - <AnalyzeAction - buildConfiguration = "Debug"> - </AnalyzeAction> - <ArchiveAction - buildConfiguration = "Release" - revealArchiveInOrganizer = "YES"> - </ArchiveAction> -</Scheme> diff --git a/platform/osx/scripts/osxtest.xcscheme b/platform/osx/scripts/osxtest.xcscheme new file mode 100644 index 0000000000..dbc0577df8 --- /dev/null +++ b/platform/osx/scripts/osxtest.xcscheme @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0720" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "6EE19CDFBCE7BD04FE561812" + BuildableName = "osxtest.xctest" + BlueprintName = "osxtest" + ReferencedContainer = "container:../../build/osx-x86_64/platform/osx/platform.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/platform/osx/scripts/package.sh b/platform/osx/scripts/package.sh deleted file mode 100755 index f4b2d0c899..0000000000 --- a/platform/osx/scripts/package.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -NAME=Mapbox -OUTPUT=build/osx/pkg -OSX_SDK_VERSION=`xcrun --sdk macosx --show-sdk-version` - -if [[ ${#} -eq 0 ]]; then # e.g. "make xpackage" - BUILDTYPE="Release" - GCC_GENERATE_DEBUGGING_SYMBOLS="YES" -else # e.g. "make xpackage-strip" - BUILDTYPE="Release" - GCC_GENERATE_DEBUGGING_SYMBOLS="NO" -fi - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -step "Creating build files..." -export MASON_PLATFORM=osx -export BUILDTYPE=${BUILDTYPE:-Release} -export HOST=osx -make Xcode/osx - -VERSION=${TRAVIS_JOB_NUMBER:-${BITRISE_BUILD_NUMBER:-0}} - -step "Building OS X framework (build ${VERSION})..." -xcodebuild -sdk macosx${OSX_SDK_VERSION} \ - ARCHS="x86_64" \ - ONLY_ACTIVE_ARCH=NO \ - GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ - CURRENT_PROJECT_VERSION=${VERSION} \ - -project ./build/osx-x86_64/gyp/osx.xcodeproj \ - -configuration ${BUILDTYPE} \ - -target osxsdk \ - -jobs ${JOBS} - -TARGET_BUILD_DIR=gyp/build/${BUILDTYPE} -INFOPLIST_PATH=Mapbox.framework/Versions/Current/Resources/Info.plist - -# Uncomment when we're ready to release an official version. -#VERSION=$( git tag | grep ^osx | sed 's/^osx-//' | sort -r | grep -v '\-rc.' | grep -v '\-pre.' | sed -n '1p' | sed 's/^v//' ) -#if [ "$VERSION" ]; then -# plutil \ -# -replace CFBundleShortVersionString -string ${VERSION} \ -# $TARGET_BUILD_DIR/$INFOPLIST_PATH -# plutil \ -# -replace CFBundleVersion -string ${VERSION} \ -# $TARGET_BUILD_DIR/$INFOPLIST_PATH -#fi - -echo $TARGET_BUILD_DIR/Mapbox.framework diff --git a/platform/osx/scripts/run.sh b/platform/osx/scripts/run.sh deleted file mode 100755 index 6d00d1b977..0000000000 --- a/platform/osx/scripts/run.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -source ./platform/osx/scripts/setup.sh - -BUILDTYPE=${BUILDTYPE:-Release} - -################################################################################ -# Build -################################################################################ - -mapbox_time "compile_render_binary" \ -make render -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_offline_binary" \ -make offline -j${JOBS} BUILDTYPE=${BUILDTYPE} - -mapbox_time "compile_tests" \ -make xtest -j${JOBS} BUILDTYPE=${BUILDTYPE} diff --git a/platform/osx/scripts/setup.sh b/platform/osx/scripts/setup.sh deleted file mode 100755 index 502d61d44d..0000000000 --- a/platform/osx/scripts/setup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# This script is sourced; do not set -e or -o pipefail here. - -# Ensure mason is on the PATH -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -# Set the core file limit to unlimited so a core file is generated upon crash -ulimit -c unlimited -S diff --git a/platform/osx/scripts/test.sh b/platform/osx/scripts/test.sh deleted file mode 100755 index f72895d850..0000000000 --- a/platform/osx/scripts/test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -OSX_SDK_VERSION=`xcrun --sdk macosx --show-sdk-version` -OSX_PROJ_PATH=./build/osx-x86_64/gyp/osx.xcodeproj - -export BUILDTYPE=${BUILDTYPE:-Release} - -mkdir -p "${OSX_PROJ_PATH}/xcshareddata/xcschemes" -cp platform/osx/scripts/osxsdk.xcscheme "${OSX_PROJ_PATH}/xcshareddata/xcschemes/osxsdk.xcscheme" - -xcodebuild -verbose \ - -sdk macosx${OSX_SDK_VERSION} \ - -project "${OSX_PROJ_PATH}" \ - -scheme osxsdk \ - test diff --git a/platform/osx/sdk/framework-osx.gypi b/platform/osx/sdk/framework-osx.gypi deleted file mode 100644 index 259066f702..0000000000 --- a/platform/osx/sdk/framework-osx.gypi +++ /dev/null @@ -1,68 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'osxsdk', - 'product_name': 'Mapbox', - 'type': 'shared_library', - 'mac_bundle': 1, - - 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - ], - - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CURRENT_PROJECT_VERSION': '0', - 'DEFINES_MODULE': 'YES', - 'DYLIB_INSTALL_NAME_BASE': '@rpath', - 'INFOPLIST_FILE': '../platform/osx/sdk/Info.plist', - 'LD_RUNPATH_SEARCH_PATHS': [ - '${inherited}', - '@executable_path/../Frameworks', - '@loader_path/Frameworks', - ], - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGL', - 'OTHER_LDFLAGS': [ '-stdlib=libc++', '-lstdc++' ], - 'SDKROOT': 'macosx', - 'SKIP_INSTALL': 'YES', - 'SUPPORTED_PLATFORMS':'macosx', - 'VERSIONING_SYSTEM': 'apple-generic', - }, - - 'mac_framework_headers': [ - './Mapbox.h', - '<!@(find ../platform/{darwin,osx}/include -type f \! -name \'.*\')', - ], - - 'sources': [ - './Mapbox.m', - ], - - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '0', - }, - }, - 'Release': { - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': 's', - }, - }, - }, - - 'direct_dependent_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - '$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework', - ], - }, - }, - ] -} diff --git a/platform/osx/test/osxtest.gypi b/platform/osx/test/osxtest.gypi deleted file mode 100644 index 6165b6fa88..0000000000 --- a/platform/osx/test/osxtest.gypi +++ /dev/null @@ -1,84 +0,0 @@ -{ - 'includes': [ - '../../../gyp/common.gypi', - ], - 'targets': [ - { - 'target_name': 'osxtest', - 'product_name': 'osxtest', - 'type': 'loadable_module', - 'mac_xctest_bundle': 1, - - 'dependencies': [ - 'osxsdk', - ], - - 'variables': { - 'cflags_cc': [ - ], - 'ldflags': [ - '-stdlib=libc++', - '-lstdc++', - ], - }, - - 'xcode_settings': { - 'CLANG_ENABLE_MODULES': 'YES', - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'ENABLE_STRICT_OBJC_MSGSEND': 'YES', - 'GCC_DYNAMIC_NO_PIC': 'NO', - 'GCC_NO_COMMON_BLOCKS': 'YES', - 'INFOPLIST_FILE': '../platform/osx/test/Info.plist', - 'LD_RUNPATH_SEARCH_PATHS': [ - '${inherited}', - '@executable_path/../Frameworks', - '@loader_path/../Frameworks', - ], - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.osxtest', - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - 'SDKROOT': 'macosx', - 'SKIP_INSTALL': 'YES', - 'SUPPORTED_PLATFORMS':'macosx', - }, - - 'sources': [ - './MGLGeometryTests.mm', - './MGLOfflinePackTests.m', - './MGLOfflineRegionTests.m', - './MGLOfflineStorageTests.m', - './MGLStyleTests.mm', - ], - - 'include_dirs': [ - '../../../platform/osx/include', - '../../../platform/darwin/include', - '../../../include', - '../../../src', - ], - - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'COPY_PHASE_STRIP': 'NO', - 'DEBUG_INFORMATION_FORMAT': 'dwarf', - 'ENABLE_TESTABILITY': 'YES', - 'GCC_OPTIMIZATION_LEVEL': '0', - 'GCC_PREPROCESSOR_DEFINITIONS': [ - 'DEBUG=1', - '${inherited}', - ], - 'ONLY_ACTIVE_ARCH': 'YES', - }, - }, - 'Release': { - 'xcode_settings': { - 'COPY_PHASE_STRIP': 'YES', - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'ENABLE_NS_ASSERTIONS': 'NO', - }, - }, - }, - }, - ] -} diff --git a/scripts/clang-tidy.sh b/scripts/clang-tidy.sh index a0a0aa20e4..ee3c1193ea 100755 --- a/scripts/clang-tidy.sh +++ b/scripts/clang-tidy.sh @@ -13,7 +13,7 @@ command -v ${CLANG_TIDY:-clang-tidy} >/dev/null 2>&1 || { exit 1 } -cd build/${HOST}-${HOST_VERSION}/${BUILDTYPE} +cd build/${PLATFORM}-${SUBPLATFORM}/${BUILDTYPE} git ls-files '../../../src/mbgl/*.cpp' '../../../platform/*.cpp' '../../../test/*.cpp' | \ xargs -I{} -P ${JOBS} ${CLANG_TIDY:-clang-tidy} -header-filter='\/mbgl\/' {} diff --git a/scripts/collect-coverage.sh b/scripts/collect-coverage.sh index 0007eebd5b..2e8ad9550b 100755 --- a/scripts/collect-coverage.sh +++ b/scripts/collect-coverage.sh @@ -25,12 +25,12 @@ command -v genhtml >/dev/null 2>&1 || usage lcov \ --quiet \ --zerocounters \ - --directory "build/${HOST_SLUG}/${BUILDTYPE}" \ - --output-file "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" \ + --directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \ + --output-file "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \ >/dev/null 2>&1 # Run all unit tests -./scripts/run_tests.sh "build/${HOST_SLUG}/${BUILDTYPE}/test" +make test-* # Collect coverage data and save it into coverage.info echo "Collecting coverage data..." @@ -41,9 +41,9 @@ lcov \ --directory "src/mbgl" \ --directory "platform" \ --directory "include/mbgl" \ - --directory "build/${HOST_SLUG}/${BUILDTYPE}" \ - --base-directory "build/${HOST_SLUG}/${BUILDTYPE}" \ - --output-file "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" \ + --directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \ + --base-directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \ + --output-file "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \ >/dev/null 2>&1 # Generate HTML report based on coverage.info @@ -59,8 +59,8 @@ genhtml \ --sort \ --demangle-cpp \ --prefix $(pwd -P) \ - --output-directory "build/${HOST_SLUG}/${BUILDTYPE}/coverage" \ - "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" \ + --output-directory "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage" \ + "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \ >/dev/null 2>&1 -echo "Coverage report is now available in build/${HOST_SLUG}/${BUILDTYPE}/coverage/index.html" +echo "Coverage report is now available in build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage/index.html" diff --git a/scripts/coveralls.sh b/scripts/coveralls.sh deleted file mode 100755 index 79e398dc1f..0000000000 --- a/scripts/coveralls.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" - -mapbox_time "install_lcov" \ -mason install lcov 1.12 - -LCOV="`mason prefix lcov 1.12`/usr/bin/lcov" - -mapbox_time "check_mason_lcov" \ -command -v $LCOV > /dev/null 2>&1 || exit 1 - -mapbox_time "remove_coverage_info" \ -rm -f "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" - -# Run all unit tests -./scripts/run_tests.sh "build/${HOST_SLUG}/${BUILDTYPE}/test" - -# Collect coverage data and save it into coverage.info -mapbox_time "lcov_capture" \ -$LCOV \ - --quiet \ - --capture \ - --no-external \ - --gcov-tool "gcov-4.9" \ - --directory "src/mbgl" \ - --directory "platform" \ - --directory "include/mbgl" \ - --directory "build/${HOST_SLUG}/${BUILDTYPE}" \ - --base-directory "build/${HOST_SLUG}/${BUILDTYPE}" \ - --output-file "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" - -mapbox_time "coveralls_upload" \ -coveralls-lcov "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" diff --git a/scripts/flock.py b/scripts/flock.py deleted file mode 100755 index 6ceb585cdc..0000000000 --- a/scripts/flock.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -import fcntl, os, subprocess, sys, errno - -# from http://stackoverflow.com/a/600612 -def mkdir_p(path): - try: - os.makedirs(path) - except OSError as exc: # Python >2.5 - if exc.errno == errno.EEXIST and os.path.isdir(path): - pass - else: raise - -def flock(lockfile, cmd_list, verbose = False): - mkdir_p(os.path.dirname(lockfile)) - fd = os.open(lockfile, os.O_RDONLY | os.O_NOCTTY | os.O_CREAT, 0o666) - fcntl.flock(fd, fcntl.LOCK_EX) - if verbose: - print(' '.join(cmd_list)) - return subprocess.call(cmd_list) - -if '__main__' == __name__: - try: - if sys.argv[1] == '-v': - sys.exit(flock(sys.argv[2], sys.argv[3:], True)) - else: - sys.exit(flock(sys.argv[1], sys.argv[2:])) - except KeyboardInterrupt: - sys.exit(1) diff --git a/scripts/main.mk b/scripts/main.mk index d10fa39d52..a0e6a0d67a 100644 --- a/scripts/main.mk +++ b/scripts/main.mk @@ -1,31 +1,39 @@ -ifeq (,$(V)) - QUIET = @ +ifeq ($(shell uname -s), Darwin) + export PLATFORM ?= osx +else ifeq ($(shell uname -s), Linux) + export PLATFORM ?= linux endif -# Determine host platform -export HOST ?= $(BUILD) - -# Defines host defaults -include platform/$(HOST)/scripts/defaults.mk - -export HOST_VERSION ?= $(BUILD_VERSION) - -# Optionally include version-specific host defaults --include scripts/$(HOST)/$(HOST_VERSION)/defaults.mk --include platform/$(HOST)/scripts/$(HOST_VERSION)/defaults.mk - -export MASON_PLATFORM=$(HOST) -export MASON_PLATFORM_VERSION=$(HOST_VERSION) - -export HOST_SLUG = $(HOST)-$(HOST_VERSION) -CONFIGURE_FILES = platform/$(HOST)/scripts/configure.sh -ifneq (,$(wildcard scripts/$(HOST)/$(HOST_VERSION)/configure.sh)) - CONFIGURE_FILES += scripts/$(HOST)/$(HOST_VERSION)/configure.sh +ifeq ($(PLATFORM),android) + export SUBPLATFORM ?= arm-v7 + GYP_FLAVOR_SUFFIX = -android + ENV = $(shell MASON_ANDROID_ABI=$(SUBPLATFORM) ./platform/android/scripts/toolchain.sh) +else ifeq ($(PLATFORM),ios) + export SUBPLATFORM = all +else ifeq ($(PLATFORM),osx) + export SUBPLATFORM = x86_64 +else + export SUBPLATFORM ?= $(shell uname -m) endif -ifneq (,$(wildcard platform/$(HOST)/scripts/$(HOST_VERSION)/configure.sh)) - CONFIGURE_FILES += platform/$(HOST)/scripts/$(HOST_VERSION)/configure.sh + +ifneq ($(PLATFORM),node) + export MASON_PLATFORM = $(PLATFORM) + export MASON_PLATFORM_VERSION = $(SUBPLATFORM) + export PLATFORM_SLUG = $(PLATFORM)-$(SUBPLATFORM) +else ifeq ($(shell uname -s), Darwin) + export MASON_PLATFORM = osx + export MASON_PLATFORM_VERSION = $(SUBPLATFORM) + export PLATFORM_SLUG = node-osx-$(SUBPLATFORM) +else ifeq ($(shell uname -s), Linux) + export MASON_PLATFORM = linux + export MASON_PLATFORM_VERSION = $(SUBPLATFORM) + export PLATFORM_SLUG = node-linux-$(SUBPLATFORM) endif +export PLATFORM_OUTPUT = ./build/$(PLATFORM_SLUG) +export PLATFORM_CONFIG_INPUT = platform/$(MASON_PLATFORM)/scripts/configure.sh +export PLATFORM_CONFIG_OUTPUT = $(PLATFORM_OUTPUT)/config.gypi + ifneq (,$(findstring clang,$(CXX))) CXX_HOST = "clang" else ifneq (,$(findstring g++,$(CXX))) @@ -39,155 +47,107 @@ COLOR_CYAN = \033[36m COLOR_PINK = \033[35m FORMAT_END = \033[0m -default: ; +# Never remove intermediate files +.SECONDARY: #### Dependencies ############################################################## ifneq (,$(wildcard .git/.)) -SUBMODULES += .mason/mason.sh -.mason/mason.sh: - ./scripts/flock.py .git/Submodule.lock git submodule update --init .mason - -ifeq ($(HOST),ios) -SUBMODULES += platform/ios/vendor/SMCalloutView/SMCalloutView.h -platform/ios/vendor/SMCalloutView/SMCalloutView.h: - ./scripts/flock.py .git/Submodule.lock git submodule update --init platform/ios/vendor/SMCalloutView - -SUBMODULES += platform/ios/test/KIF/KIF.xcodeproj -platform/ios/test/KIF/KIF.xcodeproj: - ./scripts/flock.py .git/Submodule.lock git submodule update --init platform/ios/test/KIF +.mason: + git submodule update --init +else +.mason: ; endif -endif - -# Wildcard targets get removed after build by default, but we want to preserve the config. -.PRECIOUS: config/%.gypi -config/%.gypi: $(SUBMODULES) configure $(CONFIGURE_FILES) - @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" - $(QUIET)$(ENV) ./scripts/flock.py build/Configure.lock ./configure config/$*.gypi -.PHONY: config -config: config/$(HOST_SLUG).gypi +$(PLATFORM_CONFIG_OUTPUT): .mason configure $(PLATFORM_CONFIG_INPUT) + @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Running configure...$(FORMAT_END)\n" + $(ENV) ./configure $(PLATFORM_CONFIG_INPUT) $(PLATFORM_CONFIG_OUTPUT) #### Build files ############################################################### -GYP_FLAGS += -Dhost=$(HOST) -GYP_FLAGS += -Iconfig/$(HOST_SLUG).gypi -GYP_FLAGS += -Dplatform_lib=$(PLATFORM) -GYP_FLAGS += -Dhttp_lib=$(HTTP) -GYP_FLAGS += -Dloop_lib=$(LOOP) -GYP_FLAGS += -Dasset_lib=$(ASSET) -GYP_FLAGS += -Dheadless_lib=$(HEADLESS) -GYP_FLAGS += -Dtest=$(BUILD_TEST) -GYP_FLAGS += -Drender=$(BUILD_RENDER) -GYP_FLAGS += -Doffline=$(BUILD_OFFLINE) +GYP_FLAGS += -I$(PLATFORM_CONFIG_OUTPUT) GYP_FLAGS += -Dcoverage=$(ENABLE_COVERAGE) GYP_FLAGS += -Dcxx_host=$(CXX_HOST) -GYP_FLAGS += --depth=. GYP_FLAGS += -Goutput_dir=. -GYP_FLAGS += --generator-output=./build/$(HOST_SLUG) +GYP_FLAGS += --depth=. +GYP_FLAGS += --generator-output=$(PLATFORM_OUTPUT) .PHONY: Makefile/__project__ -Makefile/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi +Makefile/__project__: $(PLATFORM_CONFIG_OUTPUT) @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) \ - -f make$(GYP_FLAVOR_SUFFIX) + $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f make$(GYP_FLAVOR_SUFFIX) .PHONY: Xcode/__project__ -Xcode/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi +Xcode/__project__: $(PLATFORM_CONFIG_OUTPUT) @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) \ - -f xcode$(GYP_FLAVOR_SUFFIX) + $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f xcode$(GYP_FLAVOR_SUFFIX) .PHONY: Ninja/__project__ -Ninja/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi +Ninja/__project__: $(PLATFORM_CONFIG_OUTPUT) @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp -Gconfig=$(BUILDTYPE) $(GYP_FLAGS) \ - -f ninja + $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f ninja -#### Build individual targets ################################################## +#### Node targets ############################################################## NODE_PRE_GYP = $(shell npm bin)/node-pre-gyp -node/configure: - $(QUIET)$(ENV) $(NODE_PRE_GYP) configure --clang -- \ - $(GYP_FLAGS) -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs= -node/xproj: Xcode/__project__ node/configure - $(QUIET)$(ENV) $(NODE_PRE_GYP) configure --clang -- \ - $(GYP_FLAGS) -f xcode -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs= - $(QUIET)$(ENV) ./platform/node/scripts/create_node_scheme.sh "node test" "`npm bin tape`/tape platform/node/test/js/**/*.test.js" - $(QUIET)$(ENV) ./platform/node/scripts/create_node_scheme.sh "npm run test-suite" "platform/node/test/render.test.js" +Makefile/node: $(PLATFORM_CONFIG_OUTPUT) + $(NODE_PRE_GYP) configure --clang -- $(GYP_FLAGS) \ + -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs= + $(NODE_PRE_GYP) build --clang -Makefile/node: Makefile/__project__ node/configure - @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target node...$(FORMAT_END)\n" - $(QUIET)$(ENV) $(NODE_PRE_GYP) build --clang -- \ - -j$(JOBS) +Xcode/node: $(PLATFORM_CONFIG_OUTPUT) + $(NODE_PRE_GYP) configure --clang -- $(GYP_FLAGS) -f xcode \ + -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs= + +#### Build individual targets ################################################## Makefile/%: Makefile/__project__ @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n" - $(QUIET)$(ENV) $(MAKE) -C build/$(HOST_SLUG) BUILDTYPE=$(BUILDTYPE) $* - -Xcode/node: Xcode/__project__ node/xproj - @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target node...$(FORMAT_END)\n" - xcodebuild \ - $(XCODEBUILD_ARGS) \ - -project ./build/binding.xcodeproj \ - -configuration $(BUILDTYPE) \ - -target mapbox-gl-native \ - -jobs $(JOBS) + $(ENV) $(MAKE) -j$(JOBS) -C $(PLATFORM_OUTPUT) BUILDTYPE=$(BUILDTYPE) $* Xcode/%: Xcode/__project__ @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n" xcodebuild \ - PROVISIONING_PROFILE="$(PROVISIONING_PROFILE)" \ - $(XCODEBUILD_ARGS) \ - -project ./build/$(HOST_SLUG)/gyp/$(HOST).xcodeproj \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGN_IDENTITY= \ + -project $(PLATFORM_OUTPUT)/platform/$(PLATFORM)/platform.xcodeproj \ -configuration $(BUILDTYPE) \ -target $* \ -jobs $(JOBS) Ninja/%: Ninja/__project__ @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) $* + $(ENV) deps/ninja/ninja-$(PLATFORM) -C $(PLATFORM_OUTPUT)/$(BUILDTYPE) $* +#### Tidy ###################################################################### -Ninja/compdb: OUTPUT=build/$(HOST_SLUG)/$(BUILDTYPE)/compile_commands.json +Ninja/compdb: OUTPUT=$(PLATFORM_OUTPUT)/$(BUILDTYPE)/compile_commands.json Ninja/compdb: Ninja/__project__ @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Writing to $(OUTPUT)$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) \ + $(ENV) deps/ninja/ninja-$(PLATFORM) -C $(PLATFORM_OUTPUT)/$(BUILDTYPE) \ -t compdb cc cc_s cxx objc objcxx > $(OUTPUT) -#### Tidy ###################################################################### - tidy: Ninja/compdb @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Generating header files...$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) version shaders + $(ENV) deps/ninja/ninja-$(PLATFORM) -C $(PLATFORM_OUTPUT)/$(BUILDTYPE) version shaders @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Running tidy...$(FORMAT_END)\n" @./scripts/clang-tidy.sh #### Run tests ################################################################# -test-%: Makefile/test - ./scripts/run_tests.sh "build/$(HOST_SLUG)/$(BUILDTYPE)/test" --gtest_filter=$* +run-glfw-app: + $(PLATFORM_OUTPUT)/$(BUILDTYPE)/mapbox-glfw -check: Makefile/test - ./scripts/collect-coverage.sh - -coveralls: Makefile/test - ./scripts/coveralls.sh +run-valgrind-glfw-app: + valgrind --leak-check=full --suppressions=../../../scripts/valgrind.sup $(PLATFORM_OUTPUT)/$(BUILDTYPE)/mapbox-glfw -#### Helper targets ############################################################ +ifneq (,$(shell command -v gdb)) + GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args +endif -.PHONY: print-env -print-env: $(SUBMODULES) - @printf "$(COLOR_PINK)build:$(FORMAT_END) $(BUILD)/$(BUILD_VERSION)\n" - @printf "$(COLOR_PINK)host:$(FORMAT_END) $(HOST)/$(HOST_VERSION)\n" - @printf "$(COLOR_PINK)libs:$(FORMAT_END) " - @printf "headless=$(COLOR_CYAN)%s$(FORMAT_END) " $(HEADLESS) - @printf "platform=$(COLOR_CYAN)%s$(FORMAT_END) " $(PLATFORM) - @printf "asset=$(COLOR_CYAN)%s$(FORMAT_END) " $(ASSET) - @printf "http=$(COLOR_CYAN)%s$(FORMAT_END) " $(HTTP) - @printf "loop=$(COLOR_CYAN)%s$(FORMAT_END) " $(LOOP) - @printf "\n" +test-%: Makefile/test + $(GDB) $(PLATFORM_OUTPUT)/$(BUILDTYPE)/test --gtest_filter=$* -# Never remove intermediate files -.SECONDARY: +check: Makefile/test + ./scripts/collect-coverage.sh diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh deleted file mode 100755 index a4af39d5a9..0000000000 --- a/scripts/run_tests.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -if [ `uname -s` = 'Darwin' ]; then HOST=${HOST:-osx} ; else HOST=${HOST:-linux} ; fi - -CMD=$@ -shift - -# allow writing core files -ulimit -c unlimited -S -echo 'ulimit -c: '`ulimit -c` -if [ -f /proc/sys/kernel/core_pattern ]; then - echo '/proc/sys/kernel/core_pattern: '`cat /proc/sys/kernel/core_pattern` -fi - -if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then - sysctl kernel.core_pattern -fi - -# install test server dependencies -if [ ! -d "test/node_modules/express" ]; then - (cd test; npm install express@4.11.1) -fi - -if command -v gdb >/dev/null 2>&1; then - gdb -batch -return-child-result -ex 'set print thread-events off' \ - -ex 'run' -ex 'thread apply all bt' --args ${CMD} ; -else - ${CMD} ; -fi diff --git a/platform/linux/scripts/tidy.sh b/scripts/tidy.sh index 424c82c3cd..424c82c3cd 100755 --- a/platform/linux/scripts/tidy.sh +++ b/scripts/tidy.sh diff --git a/scripts/set_compiler.sh b/scripts/travis_setup.sh index 161126f044..e9fa87811f 100755 --- a/scripts/set_compiler.sh +++ b/scripts/travis_setup.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# This script is sourced; do not set -e or -o pipefail here. if [ ! -z "${_CXX}" ]; then export CXX="${_CXX}" ; fi if [ ! -z "${_CC}" ]; then export CC="${_CC}" ; fi @@ -25,3 +26,31 @@ fi echo "export CXX=\"${CXX}\"" echo "export CC=\"${CC}\"" ${CXX} --version + +# Ensure mason is on the PATH +export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" + +# Start the mock X server +if [ -f /etc/init.d/xvfb ] ; then + mapbox_time "start_xvfb" \ + sh -e /etc/init.d/xvfb start + sleep 2 # sometimes, xvfb takes some time to start up +fi + +# Make sure we're connecting to xvfb +export DISPLAY=:99.0 + +mapbox_time "checkout_mason" \ +git submodule update --init .mason + +# Install and set up to load a more recent version of mesa +mapbox_time "install_mesa" \ +mason install mesa 10.4.3 +export LD_LIBRARY_PATH="`mason prefix mesa 10.4.3`/lib:${LD_LIBRARY_PATH:-}" + +# Install and set up to load awscli +pip install --user awscli +export PATH="`python -m site --user-base`/bin:${PATH}" + +# Install coveralls gem +gem install coveralls-lcov --no-rdoc --no-ri diff --git a/test/api/render_missing.cpp b/test/api/render_missing.cpp index 8c3a1f8e52..f29a0c2b9c 100644 --- a/test/api/render_missing.cpp +++ b/test/api/render_missing.cpp @@ -45,15 +45,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { std::rethrow_exception(err); } catch (const std::exception& ex) { message = ex.what(); -#ifdef MBGL_HTTP_NSURL - EXPECT_STREQ("Could not connect to the server.", ex.what()); -#elif MBGL_HTTP_CURL - const char* prefix = "Couldn't connect to server:"; - EXPECT_EQ(0, strncmp(prefix, ex.what(), strlen(prefix))) << "Full message is: \"" - << ex.what() << "\""; -#else - FAIL(); -#endif + EXPECT_TRUE(message.find("connect") != std::string::npos); } promise.set_value(); }); diff --git a/test/storage/http_error.cpp b/test/storage/http_error.cpp index 073f48b1b1..dfe4a55973 100644 --- a/test/storage/http_error.cpp +++ b/test/storage/http_error.cpp @@ -69,17 +69,6 @@ TEST_F(Storage, TEST_REQUIRES_SERVER(HTTPConnectionError)) { EXPECT_GT(wait + 0.2, duration) << "Backoff timer fired too late"; ASSERT_NE(nullptr, res.error); EXPECT_EQ(Response::Error::Reason::Connection, res.error->reason); -#ifdef MBGL_HTTP_NSURL - EXPECT_TRUE(res.error->message == - "The operation couldn’t be completed. (NSURLErrorDomain error -1004.)" || - res.error->message == "Could not connect to the server.") - << "Full message is: \"" << res.error->message << "\""; -#elif MBGL_HTTP_CURL - const std::string prefix { "Couldn't connect to server: " }; - EXPECT_STREQ(prefix.c_str(), res.error->message.substr(0, prefix.size()).c_str()) << "Full message is: \"" << res.error->message << "\""; -#else - FAIL(); -#endif ASSERT_FALSE(res.data.get()); EXPECT_FALSE(bool(res.expires)); EXPECT_FALSE(bool(res.modified)); diff --git a/test/storage/http_retry_network_status.cpp b/test/storage/http_retry_network_status.cpp index 249f74c264..94a2bcdc4d 100644 --- a/test/storage/http_retry_network_status.cpp +++ b/test/storage/http_retry_network_status.cpp @@ -70,17 +70,6 @@ TEST_F(Storage, TEST_REQUIRES_SERVER(HTTPNetworkStatusChangePreempt)) { } ASSERT_NE(nullptr, res.error); EXPECT_EQ(Response::Error::Reason::Connection, res.error->reason); -#ifdef MBGL_HTTP_NSURL - EXPECT_TRUE(res.error->message == - "The operation couldn’t be completed. (NSURLErrorDomain error -1004.)" || - res.error->message == "Could not connect to the server.") - << "Full message is: \"" << res.error->message << "\""; -#elif MBGL_HTTP_CURL - const std::string prefix { "Couldn't connect to server: " }; - EXPECT_STREQ(prefix.c_str(), res.error->message.substr(0, prefix.size()).c_str()) << "Full message is: \"" << res.error->message << "\""; -#else - FAIL(); -#endif ASSERT_FALSE(res.data.get()); EXPECT_FALSE(bool(res.expires)); EXPECT_FALSE(bool(res.modified)); diff --git a/test/test.gypi b/test/test.gypi index c93b5b67b8..782d98e43f 100644 --- a/test/test.gypi +++ b/test/test.gypi @@ -1,24 +1,19 @@ { - 'includes': [ - '../gyp/common.gypi', - ], - 'targets': [ - { 'target_name': 'test', + { + 'target_name': 'test', 'type': 'executable', 'include_dirs': [ + '../include', '../src', '../platform/default', 'include', ], 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', - 'mbgl.gyp:headless-<(headless_lib)', + 'platform-lib', + 'copy_certificate_bundle', ], 'sources': [ @@ -96,6 +91,8 @@ 'sprite/sprite_image.cpp', 'sprite/sprite_parser.cpp', 'sprite/sprite_store.cpp', + + 'src/main.cpp', ], 'variables': { @@ -121,30 +118,6 @@ }, 'conditions': [ - ['host == "ios"', { - 'product_name': 'ios-test', - # iOS tests - 'includes': [ - '../gyp/target-ios-bundle.gypi', - ], - 'sources': [ - 'src/main.mm', - '../src/mbgl/util/premultiply.cpp', - ], - 'xcode_settings': { - 'INFOPLIST_FILE': '../test/src/app-info.plist', - }, - 'copies': [ - { 'destination': '<(PRODUCT_DIR)/$(WRAPPER_NAME)/test', - 'files': [ '../test/fixtures' ], - }, - ] - }, { - # non-iOS tests - 'sources': [ - 'src/main.cpp', - ] - }], ['OS == "mac"', { 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], |