diff options
83 files changed, 2006 insertions, 2764 deletions
diff --git a/.gitignore b/.gitignore index 16fd245107..626ee2a3a1 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ xcuserdata /platform/ios/benchmark/assets/tiles/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6 **/token /platform/macos/macos.xcworkspace/xcshareddata/macos.xcscmblueprint +/platform/ios/pkg diff --git a/.mason b/.mason -Subproject fc590c762474eae5bb78c3c825247face0aed9a +Subproject 3ddc419c01ba94f3122dda05e8ec83dac1f27b0 diff --git a/.travis.yml b/.travis.yml index 211a6f9f81..8dda5e5e22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,31 +5,32 @@ git: addons_shortcuts: addons_clang35: &clang35 apt: - sources: [ 'ubuntu-toolchain-r-test' ] - packages: [ 'clang-3.5', 'libstdc++-4.9-dev', 'libstdc++6', 'libllvm3.4', + sources: [ 'ubuntu-toolchain-r-test', 'george-edison55-precise-backports' ] + packages: [ 'clang-3.5', 'libstdc++-4.9-dev', 'libstdc++6', 'libllvm3.4', 'cmake', 'cmake-data', 'mesa-utils', 'libxi-dev', 'libglu1-mesa-dev', 'x11proto-randr-dev', 'x11proto-xext-dev', 'libxrandr-dev', 'x11proto-xf86vidmode-dev', 'libxxf86vm-dev', 'libxcursor-dev', 'libxinerama-dev' ] addons_gcc5: &gcc5 apt: - sources: [ 'ubuntu-toolchain-r-test' ] - packages: [ 'gdb', 'g++-5', 'gcc-5', + sources: [ 'ubuntu-toolchain-r-test', 'george-edison55-precise-backports' ] + packages: [ 'gdb', 'g++-5', 'gcc-5', 'cmake', 'cmake-data', 'mesa-utils', 'libxi-dev', 'libglu1-mesa-dev', 'x11proto-randr-dev', 'x11proto-xext-dev', 'libxrandr-dev', 'x11proto-xf86vidmode-dev', 'libxxf86vm-dev', 'libxcursor-dev', 'libxinerama-dev' ] addons_qt4: &qt4 apt: - sources: [ 'ubuntu-toolchain-r-test' ] - packages: [ 'g++-5', 'gcc-5', 'libjemalloc-dev', + sources: [ 'ubuntu-toolchain-r-test', 'george-edison55-precise-backports' ] + packages: [ 'g++-5', 'gcc-5', 'libjemalloc-dev', 'cmake', 'cmake-data', 'mesa-utils', 'qt4-default' ] addons_qt5: &qt5 apt: - sources: [ 'ubuntu-toolchain-r-test' ] - packages: [ 'g++-5', 'gcc-5', + sources: [ 'ubuntu-toolchain-r-test', 'george-edison55-precise-backports' ] + packages: [ 'g++-5', 'gcc-5', 'cmake', 'cmake-data', 'mesa-utils', 'libc6-dbg', 'qt5-default', 'libqt5opengl5-dev', 'qtdeclarative5-dev', 'qtpositioning5-dev', 'qtlocation5-dev' ] env: global: - TERM: dumb - CCACHE: 1 + - CCACHE_MAXSIZE: 384M # AWS - secure: "MZHblLZXG/jWf2w0ZFlxCLDwx2qtGgRDODQyg1BR7JIuMz6AtWv8XR/sUczWLbiABCL0a/NzJF1g4v2pI7X69IntcjOdIABBgTh7++6+1TJ0Kp8viEltb55nQG3lHy/R6fOaI7Pj9tuCX0PCRtGA5C/fGnodLGEjy3RVOJ09ln0=" - secure: "KaSQbhgjtV7ZCkesHmvrNsbQVjk5SPfGKB1VkWenRGYhLF45HpSRNwSxMQddZ566Pg7qIFgF1iWl/B0QW3B6AWL5WmzQ5AOJgwS876pNIc/UT7ubMPtgAtjpvw1bQvQP3B8MrB+3OE5c6tD+a3LhR9krV//dOsfErR5Yy+3Mbkc=" @@ -41,6 +42,7 @@ install: - source ./scripts/travis_setup.sh before_script: - ccache --zero-stats + - cmake --version script: - make linux - make test-linux @@ -119,37 +121,38 @@ matrix: script: - make tidy - # Qt 4 - Release - - os: linux - sudo: required - dist: trusty - language: cpp - compiler: "qt4-gcc5-release" - env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5 - addons: *qt4 - script: - - make qt-app - - LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so make test-qt-Memory.*:*.Load + # # Qt 4 - Release + # - os: linux + # sudo: required + # dist: trusty + # language: cpp + # compiler: "qt4-gcc5-release" + # env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5 + # addons: *qt4 + # script: + # - make qt-app + # - LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so make test-qt-Memory.*:*.Load - # Qt 5 - Release - - os: linux - sudo: required - dist: trusty - language: cpp - compiler: "qt5-gcc5-release" - env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5 - addons: *qt5 - script: - - make qt-app - - make qt-qml-app - - make test-valgrind-qt--*.Load + # # Qt 5 - Release + # - os: linux + # sudo: required + # dist: trusty + # language: cpp + # compiler: "qt5-gcc5-release" + # env: BUILDTYPE=Release _CXX=g++-5 _CC=gcc-5 + # addons: *qt5 + # script: + # - make qt-app + # - make qt-qml-app + # - make test-valgrind-qt--*.Load cache: directories: - $HOME/.ccache - $HOME/.cache/pip - - $HOME/build/mapbox/mapbox-gl-native/.binaries - - $HOME/build/mapbox/mapbox-gl-native/.scripts + - .mason + - node_modules + - mason_packages/.binaries notifications: slack: diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..e81bfe2e57 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.2) +project(mbgl LANGUAGES CXX C) +include(cmake/npm.cmake) +include(cmake/mason.cmake) +include(cmake/mbgl.cmake) + +mason_use(geometry 0.8.0) +mason_use(variant 1.1.0) +mason_use(unique_resource dev) +mason_use(rapidjson 1.0.2) +mason_use(boost 1.60.0) +mason_use(geojson 0.1.4) +mason_use(geojsonvt 6.1.2) +mason_use(supercluster 0.2.0) +mason_use(kdbush 0.1.1) +mason_use(earcut 0.11) +mason_use(protozero 1.3.0) +mason_use(gtest 1.7.0) +mason_use(pixelmatch 0.9.0) + +set(CMAKE_CONFIGURATION_TYPES Debug Release) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wshadow -Wno-variadic-macros -Wno-unknown-pragmas") + +if(NOT EXISTS ${CMAKE_SOURCE_DIR}/platform/${MBGL_PLATFORM}/config.cmake) + message(ERROR "Can't find config.cmake file for platform ${MBGL_PLATFORM}") +endif() + +include(platform/${MBGL_PLATFORM}/config.cmake) + +include(cmake/core-files.cmake) +include(cmake/shaders.cmake) +include(cmake/core.cmake) + +if(COMMAND mbgl_platform_test) + include(cmake/test-files.cmake) + include(cmake/test.cmake) +endif() + +if(COMMAND mbgl_platform_glfw) + include(cmake/glfw.cmake) +endif() + +if(COMMAND mbgl_platform_render) + include(cmake/render.cmake) +endif() + +if(COMMAND mbgl_platform_offline) + include(cmake/offline.cmake) +endif() + +if(COMMAND mbgl_platform_node) + include(cmake/node.cmake) +endif() @@ -1,5 +1,11 @@ export BUILDTYPE ?= Debug +ifeq ($(BUILDTYPE), Release) +else ifeq ($(BUILDTYPE), Debug) +else + $(error BUILDTYPE must be Debug or Release) +endif + ifeq ($(shell uname -s), Darwin) HOST_PLATFORM = macos HOST_PLATFORM_VERSION = $(shell uname -m) @@ -30,6 +36,7 @@ else export XCPRETTY ?= | xcpretty endif +.PHONY: default default: test-$(BUILD_PLATFORM) ifneq (,$(wildcard .git/.)) @@ -43,55 +50,96 @@ endif node_modules: package.json npm update # Install dependencies but don't run our own install script. -GYP = deps/run_gyp --depth=. -Goutput_dir=. +BUILD_DEPS += .mason/mason +BUILD_DEPS += Makefile +BUILD_DEPS += node_modules -CONFIG_DEPENDENCIES = .mason/mason configure +#### macOS targets ############################################################## -# Depend on gyp includes plus directories, so that projects are regenerated when -# files are added or removed. -GYP_DEPENDENCIES = mbgl.gypi test/test.gypi benchmark/benchmark.gypi bin/*.gypi $(shell find src include -type d) node_modules +ifeq ($(HOST_PLATFORM), macos) -#### macOS targets ############################################################## +export PATH := $(shell pwd)/platform/macos:$(PATH) MACOS_OUTPUT_PATH = build/macos -MACOS_PROJ_PATH = $(MACOS_OUTPUT_PATH)/platform/macos/platform.xcodeproj +MACOS_PROJ_PATH = $(MACOS_OUTPUT_PATH)/mbgl.xcodeproj MACOS_WORK_PATH = platform/macos/macos.xcworkspace MACOS_USER_DATA_PATH = $(MACOS_WORK_PATH)/xcuserdata/$(USER).xcuserdatad +MACOS_COMPDB_PATH = $(MACOS_OUTPUT_PATH)/compdb/$(BUILDTYPE) -$(MACOS_OUTPUT_PATH)/config.gypi: platform/macos/scripts/configure.sh $(CONFIG_DEPENDENCIES) - ./configure $< $@ macos +MACOS_XCODEBUILD = xcodebuild \ + -derivedDataPath $(MACOS_OUTPUT_PATH) \ + -configuration $(BUILDTYPE) \ + -workspace $(MACOS_WORK_PATH) -$(MACOS_OUTPUT_PATH)/mbgl.xcconfig: $(MACOS_OUTPUT_PATH)/config.gypi - ./scripts/export-xcconfig.py $< $@ -$(MACOS_PROJ_PATH): platform/macos/platform.gyp $(MACOS_OUTPUT_PATH)/config.gypi $(MACOS_OUTPUT_PATH)/mbgl.xcconfig $(GYP_DEPENDENCIES) - $(GYP) -f xcode --generator-output=$(MACOS_OUTPUT_PATH) $< +MACOS_XCSCHEMES += platform/macos/scripts/executable.xcscheme +MACOS_XCSCHEMES += platform/macos/scripts/library.xcscheme +MACOS_XCSCHEMES += platform/macos/scripts/node.xcscheme -macos: $(MACOS_PROJ_PATH) - set -o pipefail && xcodebuild \ - -derivedDataPath $(MACOS_OUTPUT_PATH) \ - -configuration $(BUILDTYPE) \ - -workspace $(MACOS_WORK_PATH) -scheme CI build $(XCPRETTY) +$(MACOS_PROJ_PATH): $(BUILD_DEPS) $(MACOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings $(MACOS_XCSCHEMES) + mkdir -p $(MACOS_OUTPUT_PATH) + (cd $(MACOS_OUTPUT_PATH) && cmake -G Xcode ../..) -xproj: $(MACOS_PROJ_PATH) $(MACOS_WORK_PATH) + @# Create Xcode schemes so that we can use xcodebuild from the command line. CMake doesn't + @# create these automatically. + SCHEME_NAME=mbgl-test SCHEME_TYPE=executable platform/macos/scripts/create_scheme.sh + SCHEME_NAME=mbgl-render SCHEME_TYPE=executable platform/macos/scripts/create_scheme.sh + SCHEME_NAME=mbgl-offline SCHEME_TYPE=executable platform/macos/scripts/create_scheme.sh + SCHEME_NAME=mbgl-glfw SCHEME_TYPE=executable platform/macos/scripts/create_scheme.sh + SCHEME_NAME=mbgl-core SCHEME_TYPE=library BUILDABLE_NAME=libmbgl-core.a BLUEPRINT_NAME=mbgl-core platform/macos/scripts/create_scheme.sh + SCHEME_NAME=mbgl-node SCHEME_TYPE=library BUILDABLE_NAME=mbgl-node.node BLUEPRINT_NAME=mbgl-node platform/macos/scripts/create_scheme.sh + + @# Create schemes for running node tests. These have all of the environment variables set to + @# launch in the correct location. + SCHEME_NAME="node tests" SCHEME_TYPE=node BUILDABLE_NAME=mbgl-node.node BLUEPRINT_NAME=mbgl-node NODE_ARGUMENT="`npm bin tape`/tape platform/node/test/js/**/*.test.js" platform/macos/scripts/create_scheme.sh + SCHEME_NAME="node render tests" SCHEME_TYPE=node BUILDABLE_NAME=mbgl-node.node BLUEPRINT_NAME=mbgl-node NODE_ARGUMENT="platform/node/test/render.test.js" platform/macos/scripts/create_scheme.sh + SCHEME_NAME="node query tests" SCHEME_TYPE=node BUILDABLE_NAME=mbgl-node.node BLUEPRINT_NAME=mbgl-node NODE_ARGUMENT="platform/node/test/query.test.js" platform/macos/scripts/create_scheme.sh + +$(MACOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings: platform/macos/WorkspaceSettings.xcsettings mkdir -p "$(MACOS_USER_DATA_PATH)" - cp platform/macos/WorkspaceSettings.xcsettings "$(MACOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings" + cp platform/macos/WorkspaceSettings.xcsettings "$@" + +.PHONY: macos +macos: $(MACOS_PROJ_PATH) + set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'CI' build $(XCPRETTY) + +.PHONY: xproj +xproj: $(MACOS_PROJ_PATH) open $(MACOS_WORK_PATH) -test-macos: macos node_modules - ulimit -c unlimited && ($(MACOS_OUTPUT_PATH)/Build/Products/$(BUILDTYPE)/test & pid=$$! && wait $$pid \ +.PHONY: test-macos +test-macos: $(MACOS_PROJ_PATH) + set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-test' build $(XCPRETTY) + ulimit -c unlimited && ($(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-test & pid=$$! && wait $$pid \ || (lldb -c /cores/core.$$pid --batch --one-line 'thread backtrace all' --one-line 'quit' && exit 1)) - set -o pipefail && xcodebuild \ - -derivedDataPath $(MACOS_OUTPUT_PATH) \ - -configuration $(BUILDTYPE) \ - -workspace $(MACOS_WORK_PATH) -scheme CI test $(XCPRETTY) + set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'CI' test $(XCPRETTY) + +.PHONY: glfw-app +glfw-app: $(MACOS_PROJ_PATH) + set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-glfw' build $(XCPRETTY) + "$(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-glfw" + +.PHONY: render +render: $(MACOS_PROJ_PATH) + set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-render' build $(XCPRETTY) +.PHONY: offline +offline: $(MACOS_PROJ_PATH) + set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-offline' build $(XCPRETTY) + +.PHONY: node +node: $(MACOS_PROJ_PATH) + set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-node' build $(XCPRETTY) + +.PHONY: xpackage xpackage: $(MACOS_PROJ_PATH) SYMBOLS=$(SYMBOLS) ./platform/macos/scripts/package.sh +.PHONY: xdocument xdocument: OUTPUT=$(OUTPUT) ./platform/macos/scripts/document.sh +.PHONY: genstrings genstrings: genstrings -u -o platform/macos/sdk/Base.lproj platform/darwin/src/*.{m,mm} genstrings -u -o platform/macos/sdk/Base.lproj platform/macos/src/*.{m,mm} @@ -100,279 +148,195 @@ genstrings: textutil -convert txt -extension strings -inputencoding UTF-16 -encoding UTF-8 {} \; mv platform/macos/sdk/Base.lproj/Foundation.strings platform/darwin/resources/Base.lproj/ +$(MACOS_COMPDB_PATH)/Makefile: + mkdir -p $(MACOS_COMPDB_PATH) + (cd $(MACOS_COMPDB_PATH) && cmake ../../../.. \ + -DCMAKE_BUILD_TYPE=$(BUILDTYPE) \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON) + +.PHONY: +compdb: $(BUILD_DEPS) $(TEST_DEPS) $(MACOS_COMPDB_PATH)/Makefile + @$(MAKE) -C $(MACOS_COMPDB_PATH) cmake_check_build_system + +.PHONY: clang-tools +clang-tools: compdb + if test -z $(CLANG_TIDY); then .mason/mason install clang-tidy 3.8.0; fi + if test -z $(CLANG_FORMAT); then .mason/mason install clang-format 3.8.0; fi + $(MAKE) -C $(MACOS_COMPDB_PATH) mbgl-headers + +.PHONY: tidy +tidy: clang-tools + scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) + +.PHONY: check +check: clang-tools + scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) --diff + +endif + #### iOS targets ############################################################## +ifeq ($(HOST_PLATFORM), macos) + IOS_OUTPUT_PATH = build/ios -IOS_PROJ_PATH = $(IOS_OUTPUT_PATH)/platform/ios/platform.xcodeproj +IOS_PROJ_PATH = $(IOS_OUTPUT_PATH)/mbgl.xcodeproj IOS_WORK_PATH = platform/ios/ios.xcworkspace IOS_USER_DATA_PATH = $(IOS_WORK_PATH)/xcuserdata/$(USER).xcuserdatad -$(IOS_OUTPUT_PATH)/config.gypi: platform/ios/scripts/configure.sh $(CONFIG_DEPENDENCIES) - ./configure $< $@ ios - -$(IOS_OUTPUT_PATH)/mbgl.xcconfig: $(IOS_OUTPUT_PATH)/config.gypi - ./scripts/export-xcconfig.py $< $@ - -$(IOS_PROJ_PATH): platform/ios/platform.gyp $(IOS_OUTPUT_PATH)/config.gypi $(IOS_OUTPUT_PATH)/mbgl.xcconfig $(GYP_DEPENDENCIES) - $(GYP) -f xcode --generator-output=$(IOS_OUTPUT_PATH) $< - -ios: $(IOS_PROJ_PATH) - set -o pipefail && xcodebuild \ +IOS_XCODEBUILD_SIM = xcodebuild \ ARCHS=x86_64 ONLY_ACTIVE_ARCH=YES \ -derivedDataPath $(IOS_OUTPUT_PATH) \ -configuration $(BUILDTYPE) -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' \ - -workspace $(IOS_WORK_PATH) -scheme CI build $(XCPRETTY) + -workspace $(IOS_WORK_PATH) -iproj: $(IOS_PROJ_PATH) +$(IOS_PROJ_PATH): $(IOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings $(BUILD_DEPS) + mkdir -p $(IOS_OUTPUT_PATH) + (cd $(IOS_OUTPUT_PATH) && cmake -G Xcode ../.. \ + -DCMAKE_TOOLCHAIN_FILE=../../platform/ios/toolchain.cmake \ + -DMBGL_PLATFORM=ios) + +$(IOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings: platform/ios/WorkspaceSettings.xcsettings mkdir -p "$(IOS_USER_DATA_PATH)" - cp platform/ios/WorkspaceSettings.xcsettings "$(IOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings" + cp platform/ios/WorkspaceSettings.xcsettings "$@" + +.PHONY: ios +ios: $(IOS_PROJ_PATH) + set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' build $(XCPRETTY) + +.PHONY: iproj +iproj: $(IOS_PROJ_PATH) open $(IOS_WORK_PATH) -test-ios: ios - ios-sim start --devicetypeid 'com.apple.CoreSimulator.SimDeviceType.iPhone-6,9.3' - ios-sim launch $(IOS_OUTPUT_PATH)/Build/Products/$(BUILDTYPE)-iphonesimulator/ios-test.app --verbose --devicetypeid 'com.apple.CoreSimulator.SimDeviceType.iPhone-6,9.3' - set -o pipefail && xcodebuild \ - ARCHS=x86_64 ONLY_ACTIVE_ARCH=YES \ - -derivedDataPath $(IOS_OUTPUT_PATH) \ - -configuration $(BUILDTYPE) -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' \ - -workspace $(IOS_WORK_PATH) -scheme CI test $(XCPRETTY) +.PHONY: test-ios +test-ios: $(IOS_PROJ_PATH) + set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' test $(XCPRETTY) +.PHONY: ipackage ipackage: $(IOS_PROJ_PATH) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \ ./platform/ios/scripts/package.sh +.PHONY: ipackage-strip ipackage-strip: $(IOS_PROJ_PATH) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO \ ./platform/ios/scripts/package.sh +.PHONY: ipackage-sim ipackage-sim: $(IOS_PROJ_PATH) BUILDTYPE=Debug FORMAT=dynamic BUILD_DEVICE=false SYMBOLS=$(SYMBOLS) \ ./platform/ios/scripts/package.sh +.PHONY: iframework iframework: $(IOS_PROJ_PATH) FORMAT=dynamic BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \ ./platform/ios/scripts/package.sh +.PHONY: ifabric ifabric: $(IOS_PROJ_PATH) FORMAT=static BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO SELF_CONTAINED=YES \ ./platform/ios/scripts/package.sh +.PHONY: idocument idocument: OUTPUT=$(OUTPUT) ./platform/ios/scripts/document.sh -#### Android targets ##################################################### - -ANDROID_ENV = platform/android/scripts/toolchain.sh -ANDROID_ABIS = arm-v5 arm-v7 arm-v8 x86 x86-64 mips - -style-code-android: - node platform/android/scripts/generate-style-code.js - -define ANDROID_RULES -build/android-$1/config.gypi: platform/android/scripts/configure.sh $(CONFIG_DEPENDENCIES) - $$(shell $(ANDROID_ENV) $1) ./configure $$< $$@ android $1 - -build/android-$1/Makefile: platform/android/platform.gyp build/android-$1/config.gypi $(GYP_DEPENDENCIES) - $$(shell $(ANDROID_ENV) $1) $(GYP) -f make-android -I build/android-$1/config.gypi \ - --generator-output=build/android-$1 $$< - -android-lib-$1: build/android-$1/Makefile - $$(shell $(ANDROID_ENV) $1) $(MAKE) -j$(JOBS) -C build/android-$1 all - -android-$1: android-lib-$1 style-code-android - cd platform/android && ./gradlew --parallel --max-workers=$(JOBS) assemble$(BUILDTYPE) - -apackage: android-lib-$1 -endef - -$(foreach abi,$(ANDROID_ABIS),$(eval $(call ANDROID_RULES,$(abi)))) - -android: android-arm-v7 - -test-android: - cd platform/android && ./gradlew testReleaseUnitTest --continue - -apackage: - cd platform/android && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) - -#### Node targets ##################################################### - -NODE_PRE_GYP = $(shell npm bin)/node-pre-gyp -NODE_OUTPUT_PATH = build/node-$(BUILD_PLATFORM)-$(BUILD_PLATFORM_VERSION) - -ifeq ($(BUILDTYPE), Debug) - NODE_DEBUG = "--debug" -endif - -$(NODE_OUTPUT_PATH)/config.gypi: platform/$(BUILD_PLATFORM)/scripts/configure.sh $(CONFIG_DEPENDENCIES) - ./configure $< $@ $(BUILD_PLATFORM) $(BUILD_PLATFORM_VERSION) - -node: $(NODE_OUTPUT_PATH)/config.gypi node_modules $(GYP_DEPENDENCIES) - $(NODE_PRE_GYP) configure --clang $(NODE_DEBUG) -- -I$< \ - -Dcoverage= -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs= - $(NODE_PRE_GYP) build --clang - -xnode: $(NODE_OUTPUT_PATH)/config.gypi $(GYP_DEPENDENCIES) - $(NODE_PRE_GYP) configure --clang -- -I$< \ - -Dcoverage= -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs= \ - -f xcode - ./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: test-node -test-node: node - npm test - npm run test-memory - npm run test-suite - -#### Qt targets ##################################################### - -QT_OUTPUT_PATH = build/qt-$(BUILD_PLATFORM)-$(BUILD_PLATFORM_VERSION) -QT_MAKEFILE = $(QT_OUTPUT_PATH)/Makefile - -# Cross compilation support -QT_ENV = $(shell MASON_PLATFORM_VERSION=$(BUILD_PLATFORM_VERSION) ./platform/qt/scripts/toolchain.sh) - -$(QT_OUTPUT_PATH)/config.gypi: platform/qt/scripts/configure.sh $(CONFIG_DEPENDENCIES) - $(QT_ENV) ./configure $< $@ $(BUILD_PLATFORM) $(BUILD_PLATFORM_VERSION) - -GYP_FLAVOR = make -ifneq ($(HOST_PLATFORM),$(BUILD_PLATFORM)) - ifeq ($(BUILD_PLATFORM), linux) - GYP_FLAVOR = make-linux - else ifeq ($(BUILD_PLATFORM), macos) - GYP_FLAVOR = make-mac - endif endif -$(QT_MAKEFILE): platform/qt/platform.gyp $(QT_OUTPUT_PATH)/config.gypi $(GYP_DEPENDENCIES) - $(QT_ENV) $(GYP) -f $(GYP_FLAVOR) -I $(QT_OUTPUT_PATH)/config.gypi \ - --generator-output=$(QT_OUTPUT_PATH) $< - -qt-lib: $(QT_MAKEFILE) - $(QT_ENV) $(MAKE) -j$(JOBS) -C $(QT_OUTPUT_PATH) qt-lib - -qt-app: $(QT_MAKEFILE) - $(QT_ENV) $(MAKE) -j$(JOBS) -C $(QT_OUTPUT_PATH) qt-app - -qt-qml-app: $(QT_MAKEFILE) - $(QT_ENV) $(MAKE) -j$(JOBS) -C $(QT_OUTPUT_PATH) qt-qml-app - -test-qt-%: $(QT_MAKEFILE) node_modules - $(QT_ENV) $(MAKE) -j$(JOBS) -C $(QT_OUTPUT_PATH) test - $(GDB) $(QT_OUTPUT_PATH)/$(BUILDTYPE)/test --gtest_catch_exceptions=0 --gtest_filter=$* - -test-qt: test-qt-* - -run-qt-app: qt-app - cd $(QT_OUTPUT_PATH)/$(BUILDTYPE) && ./qmapboxgl - -run-qt-qml-app: qt-qml-app - cd $(QT_OUTPUT_PATH)/$(BUILDTYPE) && ./qquickmapboxgl - -test-valgrind-qt-%: $(QT_MAKEFILE) node_modules - $(QT_ENV) $(MAKE) -j$(JOBS) -C $(QT_OUTPUT_PATH) test - .mason/mason install valgrind latest - ./scripts/valgrind.sh $(QT_OUTPUT_PATH)/$(BUILDTYPE)/test --gtest_catch_exceptions=0 --gtest_filter=$* - -test-valgrind-qt: test-valgrind-qt-* - -run-valgrind-qt-app: qt-app - .mason/mason install valgrind latest - ./scripts/valgrind.sh $(QT_OUTPUT_PATH)/$(BUILDTYPE)/qmapboxgl --test -platform offscreen - #### Linux targets ##################################################### -LINUX_OUTPUT_PATH = build/linux-$(BUILD_PLATFORM_VERSION) -LINUX_MAKEFILE = $(LINUX_OUTPUT_PATH)/Makefile +ifeq ($(HOST_PLATFORM), linux) -$(LINUX_OUTPUT_PATH)/config.gypi: platform/linux/scripts/configure.sh $(CONFIG_DEPENDENCIES) - ./configure $< $@ linux $(BUILD_PLATFORM_VERSION) +export PATH := $(shell pwd)/platform/linux:$(PATH) +export LINUX_OUTPUT_PATH = build/linux-$(shell uname -m)/$(BUILDTYPE) +LINUX_BUILD = $(LINUX_OUTPUT_PATH)/build.ninja +NINJA = platform/linux/ninja -$(LINUX_MAKEFILE): platform/linux/platform.gyp $(LINUX_OUTPUT_PATH)/config.gypi $(GYP_DEPENDENCIES) - $(GYP) -f make -I $(LINUX_OUTPUT_PATH)/config.gypi \ - --generator-output=$(LINUX_OUTPUT_PATH) $< +$(LINUX_BUILD): $(BUILD_DEPS) + mkdir -p $(LINUX_OUTPUT_PATH) + (cd $(LINUX_OUTPUT_PATH) && cmake -G Ninja ../../.. \ + -DCMAKE_BUILD_TYPE=$(BUILDTYPE) \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON) +.PHONY: linux linux: glfw-app render offline -test-linux: node_modules test-* +test-linux: run-test-* -render: $(LINUX_MAKEFILE) - $(MAKE) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-render +.PHONY: linux-render +render: $(LINUX_BUILD) + $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-render -offline: $(LINUX_MAKEFILE) - $(MAKE) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-offline +.PHONY: linux-offline +offline: $(LINUX_BUILD) + $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-offline -glfw-app: $(LINUX_MAKEFILE) - $(MAKE) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) glfw-app +.PHONY: glfw-app +glfw-app: $(LINUX_BUILD) + $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-glfw -test: $(LINUX_MAKEFILE) - $(MAKE) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) test +.PHONY: test +test: $(LINUX_BUILD) + $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-test +.PHONY: run-glfw-app run-glfw-app: glfw-app - cd $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) && ./mapbox-glfw + cd $(LINUX_OUTPUT_PATH) && ./mbgl-glfw + +.PHONY: node +node: $(LINUX_BUILD) + $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-node ifneq (,$(shell which gdb)) GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args endif -test-%: test - $(GDB) $(LINUX_OUTPUT_PATH)/$(BUILDTYPE)/test --gtest_catch_exceptions=0 --gtest_filter=$* +run-test-%: test + $(GDB) $(LINUX_OUTPUT_PATH)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$* +.PHONY: coverage coverage: test - scripts/collect-coverage.sh $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) + scripts/collect-coverage.sh $(LINUX_OUTPUT_PATH) -# Generates a compilation database with ninja for use in clang tooling -compdb: node_modules compdb-$(BUILD_PLATFORM) +.PHONY: compdb +compdb: $(LINUX_BUILD) + # Ninja generator already outputs the file at the right location -compdb-linux: platform/linux/platform.gyp $(LINUX_OUTPUT_PATH)/config.gypi - $(GYP) -f ninja -I $(LINUX_OUTPUT_PATH)/config.gypi \ - --generator-output=$(LINUX_OUTPUT_PATH) $< - deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) \ - -t compdb cc cc_s cxx objc objcxx > $(LINUX_OUTPUT_PATH)/$(BUILDTYPE)/compile_commands.json +.PHONY: tidy +tidy: compdb + $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-headers + scripts/clang-tidy.sh $(LINUX_OUTPUT_PATH) -compdb-macos: platform/macos/platform.gyp $(MACOS_OUTPUT_PATH)/config.gypi - $(GYP) -f ninja -I $(MACOS_OUTPUT_PATH)/config.gypi \ - --generator-output=$(MACOS_OUTPUT_PATH) $< - deps/ninja/ninja-macos -C $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) \ - -t compdb cc cc_s cxx objc objcxx > $(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/compile_commands.json - -tidy: compdb tidy-$(BUILD_PLATFORM) - -clang-tools-linux: +.PHONY: clang-tools +clang-tools: if test -z $(CLANG_TIDY); then .mason/mason install clang-tidy 3.8.0; fi if test -z $(CLANG_FORMAT); then .mason/mason install clang-format 3.8.0; fi - deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) headers - -tidy-linux: clang-tools-linux - scripts/clang-tools.sh $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) + deps/ninja/ninja-linux -C $(LINUX_OUTPUT_PATH) headers -clang-tools-macos: - if test -z $(CLANG_TIDY); then .mason/mason install clang-tidy 3.8.0; fi - if test -z $(CLANG_FORMAT); then .mason/mason install clang-format 3.8.0; fi - deps/ninja/ninja-macos -C $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) headers +.PHONY: tidy +tidy: clang-tools + scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) -tidy-macos: clang-tools-macos - scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) +.PHONY: check +check: compdb clang-tools + scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) --diff -check: compdb check-$(BUILD_PLATFORM) +endif -check-linux: clang-tools-linux - scripts/clang-tools.sh $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) --diff +#### Node targets ############################################################## -check-macos: clang-tools-macos - scripts/clang-tools.sh $(MACOS_OUTPUT_PATH)/$(BUILDTYPE) --diff +.PHONY: test-node +test-node: node + npm test + npm run test-suite #### Miscellaneous targets ##################################################### style-code: node scripts/generate-style-code.js +.PHONY: clean clean: - -find ./deps/gyp -name "*.pyc" -exec rm {} \; -rm -rf ./build \ ./platform/android/MapboxGLAndroidSDK/build \ ./platform/android/MapboxGLAndroidSDKTestApp/build \ @@ -380,6 +344,7 @@ clean: ./platform/android/MapboxGLAndroidSDKTestApp/src/main/jniLibs \ ./platform/android/MapboxGLAndroidSDK/src/main/assets +.PHONY: distclean distclean: clean -rm -rf ./mason_packages -rm -rf ./node_modules diff --git a/benchmark/benchmark.gypi b/benchmark/benchmark.gypi deleted file mode 100644 index 011ac16584..0000000000 --- a/benchmark/benchmark.gypi +++ /dev/null @@ -1,87 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'benchmark-lib', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'core', - ], - - 'include_dirs': [ - '../include', - '../src', - '../platform/default', - 'include', - 'src', - ], - - 'sources': [ - 'parse/filter.cpp', - - - 'src/mbgl/benchmark/benchmark.cpp' - ], - - 'variables': { - 'cflags_cc': [ - '<@(benchmark_cflags)', - '<@(rapidjson_cflags)', - ], - 'ldflags': [ - '<@(benchmark_ldflags)', - ], - 'libraries': [ - '<@(benchmark_static_libs)', - ], - }, - - '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', - ], - - # Force the linker to include all the objects from the lib-benchmark archive. Otherwise they'd - # be discarded because there are no undefined symbols to pull them in, and the resulting - # executable would run zero tests. - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-Wl,-force_load,<(PRODUCT_DIR)/libbenchmark-lib.a', - ], - } - }, { - 'link_settings': { - 'ldflags': [ - '-Wl,-whole-archive <(PRODUCT_DIR)/libbenchmark-lib.a -Wl,-no-whole-archive', - ], - }, - }], - ], - }, - }, - ] -} diff --git a/bin/glfw.gypi b/bin/glfw.gypi deleted file mode 100644 index dbf73e5abe..0000000000 --- a/bin/glfw.gypi +++ /dev/null @@ -1,61 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'glfw-app', - 'product_name': 'mapbox-glfw', - 'type': 'executable', - - 'dependencies': [ - 'core', - 'platform-lib', - 'copy_certificate_bundle', - ], - - 'include_dirs': [ - '../platform/default', - '../include', - '../src', - ], - - 'sources': [ - 'glfw.cpp', - '../platform/default/settings_json.cpp', - '../platform/default/glfw_view.hpp', - '../platform/default/glfw_view.cpp', - '../platform/default/log_stderr.cpp', - ], - - 'variables': { - 'cflags_cc': [ - '<@(glfw_cflags)', - ], - 'ldflags': [ - '<@(glfw_ldflags)', - ], - 'libraries': [ - '<@(glfw_static_libs)', - ], - }, - - '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)' ], - }] - ], - }, - }, - ], -} diff --git a/bin/offline.gypi b/bin/offline.gypi deleted file mode 100644 index 295cbd0a01..0000000000 --- a/bin/offline.gypi +++ /dev/null @@ -1,40 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'mbgl-offline', - 'product_name': 'mbgl-offline', - 'type': 'executable', - - 'dependencies': [ - 'core', - 'platform-lib', - 'copy_certificate_bundle', - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'sources': [ - 'offline.cpp', - ], - - 'cflags_cc': [ - '<@(boost_cflags)', - ], - - 'link_settings': { - 'libraries': [ - '<@(boost_libprogram_options_static_libs)' - ], - }, - - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(boost_cflags)', - ], - } - }, - ], -} diff --git a/bin/render.gypi b/bin/render.gypi deleted file mode 100644 index b6ae668981..0000000000 --- a/bin/render.gypi +++ /dev/null @@ -1,40 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'mbgl-render', - 'product_name': 'mbgl-render', - 'type': 'executable', - - 'dependencies': [ - 'core', - 'platform-lib', - 'copy_certificate_bundle', - ], - - 'include_dirs': [ - '../include', - '../src', - ], - - 'sources': [ - 'render.cpp', - ], - - 'cflags_cc': [ - '<@(boost_cflags)', - ], - - 'link_settings': { - 'libraries': [ - '<@(boost_libprogram_options_static_libs)' - ], - }, - - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(boost_cflags)', - ], - } - }, - ], -} diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index acd8129260..0000000000 --- a/binding.gyp +++ /dev/null @@ -1,107 +0,0 @@ -{ - 'variables': { - 'loop_lib': 'uv', - 'headless_lib': 'glx', - }, - 'conditions': [ - ['OS == "mac"', { - 'variables': { - 'headless_lib': 'cgl', - } - }], - ], - 'includes': [ - 'mbgl.gypi', - ], - 'targets': [ - { - 'target_name': '<(module_name)', - 'dependencies': [ - 'core', - ], - - 'include_dirs': [ - '<(node_root_dir)/include/node', - "<!(node -e \"require('nan')\")", - 'include', - 'src', # TODO: eliminate - ], - - 'sources': [ - 'platform/node/src/node_mapbox_gl_native.cpp', - 'platform/node/src/node_log.hpp', - 'platform/node/src/node_log.cpp', - 'platform/node/src/node_map.hpp', - 'platform/node/src/node_map.cpp', - 'platform/node/src/node_request.hpp', - 'platform/node/src/node_request.cpp', - 'platform/node/src/node_feature.hpp', - 'platform/node/src/node_feature.cpp', - 'platform/node/src/util/async_queue.hpp', - ], - - '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_static_libs)', - '<@(nunicode_ldflags)', - '<@(webp_static_libs)', - '<@(webp_ldflags)', - '<@(libpng_static_libs)', - '<@(libpng_ldflags)', - '<@(libjpeg-turbo_static_libs)', - '<@(libjpeg-turbo_ldflags)', - ], - }, - }] - ], - - 'ldflags': [ - '-Wl,-z,now', - ], - - 'xcode_settings': { - 'OTHER_LDFLAGS':[ - '-Wl,-bind_at_load' - ], - }, - }, - { - 'target_name': 'action_after_build', - 'type': 'none', - 'dependencies': [ '<(module_name)' ], - 'copies': [ - { - 'files': [ '<(PRODUCT_DIR)/<(module_name).node' ], - 'destination': '<(module_path)' - } - ] - } - ] -} diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake new file mode 100644 index 0000000000..d817909e33 --- /dev/null +++ b/cmake/core-files.cmake @@ -0,0 +1,465 @@ +# Do not edit. Regenerate this with ./scripts/generate-core-files.sh + +set(MBGL_CORE_FILES + # algorithm + src/mbgl/algorithm/covered_by_children.hpp + src/mbgl/algorithm/generate_clip_ids.cpp + src/mbgl/algorithm/generate_clip_ids.hpp + src/mbgl/algorithm/generate_clip_ids_impl.hpp + src/mbgl/algorithm/update_renderables.hpp + + # annotation + include/mbgl/annotation/annotation.hpp + src/mbgl/annotation/annotation_manager.cpp + src/mbgl/annotation/annotation_manager.hpp + src/mbgl/annotation/annotation_source.cpp + src/mbgl/annotation/annotation_source.hpp + src/mbgl/annotation/annotation_tile.cpp + src/mbgl/annotation/annotation_tile.hpp + src/mbgl/annotation/fill_annotation_impl.cpp + src/mbgl/annotation/fill_annotation_impl.hpp + src/mbgl/annotation/line_annotation_impl.cpp + src/mbgl/annotation/line_annotation_impl.hpp + src/mbgl/annotation/shape_annotation_impl.cpp + src/mbgl/annotation/shape_annotation_impl.hpp + src/mbgl/annotation/style_sourced_annotation_impl.cpp + src/mbgl/annotation/style_sourced_annotation_impl.hpp + src/mbgl/annotation/symbol_annotation_impl.cpp + src/mbgl/annotation/symbol_annotation_impl.hpp + + # clipper + src/clipper/clipper.cpp + src/clipper/clipper.hpp + + # csscolorparser + src/csscolorparser/csscolorparser.cpp + src/csscolorparser/csscolorparser.hpp + + # geometry + src/mbgl/geometry/anchor.hpp + src/mbgl/geometry/binpack.hpp + src/mbgl/geometry/buffer.hpp + src/mbgl/geometry/circle_buffer.cpp + src/mbgl/geometry/circle_buffer.hpp + src/mbgl/geometry/collision_box_buffer.cpp + src/mbgl/geometry/collision_box_buffer.hpp + src/mbgl/geometry/debug_font_buffer.cpp + src/mbgl/geometry/debug_font_buffer.hpp + src/mbgl/geometry/debug_font_data.hpp + src/mbgl/geometry/elements_buffer.cpp + src/mbgl/geometry/elements_buffer.hpp + src/mbgl/geometry/feature_index.cpp + src/mbgl/geometry/feature_index.hpp + src/mbgl/geometry/fill_buffer.cpp + src/mbgl/geometry/fill_buffer.hpp + src/mbgl/geometry/glyph_atlas.cpp + src/mbgl/geometry/glyph_atlas.hpp + src/mbgl/geometry/icon_buffer.cpp + src/mbgl/geometry/icon_buffer.hpp + src/mbgl/geometry/line_atlas.cpp + src/mbgl/geometry/line_atlas.hpp + src/mbgl/geometry/line_buffer.cpp + src/mbgl/geometry/line_buffer.hpp + src/mbgl/geometry/static_vertex_buffer.cpp + src/mbgl/geometry/static_vertex_buffer.hpp + src/mbgl/geometry/text_buffer.cpp + src/mbgl/geometry/text_buffer.hpp + src/mbgl/geometry/vao.cpp + src/mbgl/geometry/vao.hpp + + # gl + include/mbgl/gl/gl.hpp + include/mbgl/gl/gl_helper.hpp + include/mbgl/gl/gl_values.hpp + src/mbgl/gl/debugging.cpp + src/mbgl/gl/debugging.hpp + src/mbgl/gl/gl.cpp + src/mbgl/gl/gl_config.cpp + src/mbgl/gl/gl_config.hpp + src/mbgl/gl/object_store.cpp + src/mbgl/gl/object_store.hpp + + # map + include/mbgl/map/camera.hpp + include/mbgl/map/map.hpp + include/mbgl/map/mode.hpp + include/mbgl/map/update.hpp + include/mbgl/map/view.hpp + src/mbgl/map/change.hpp + src/mbgl/map/map.cpp + src/mbgl/map/transform.cpp + src/mbgl/map/transform.hpp + src/mbgl/map/transform_state.cpp + src/mbgl/map/transform_state.hpp + src/mbgl/map/view.cpp + src/mbgl/map/zoom_history.hpp + + # math + include/mbgl/math/clamp.hpp + include/mbgl/math/minmax.hpp + include/mbgl/math/wrap.hpp + + # mbgl + include/mbgl/mbgl.hpp + + # parsedate + src/parsedate/parsedate.c + src/parsedate/parsedate.h + + # platform + include/mbgl/platform/event.hpp + include/mbgl/platform/log.hpp + include/mbgl/platform/platform.hpp + src/mbgl/platform/event.cpp + src/mbgl/platform/log.cpp + + # platform/darwin + include/mbgl/platform/darwin/reachability.h + + # platform/default + include/mbgl/platform/default/glfw_view.hpp + include/mbgl/platform/default/headless_display.hpp + include/mbgl/platform/default/headless_view.hpp + include/mbgl/platform/default/settings_json.hpp + + # renderer + src/mbgl/renderer/bucket.hpp + src/mbgl/renderer/circle_bucket.cpp + src/mbgl/renderer/circle_bucket.hpp + src/mbgl/renderer/debug_bucket.cpp + src/mbgl/renderer/debug_bucket.hpp + src/mbgl/renderer/fill_bucket.cpp + src/mbgl/renderer/fill_bucket.hpp + src/mbgl/renderer/frame_history.cpp + src/mbgl/renderer/frame_history.hpp + src/mbgl/renderer/line_bucket.cpp + src/mbgl/renderer/line_bucket.hpp + src/mbgl/renderer/paint_parameters.hpp + src/mbgl/renderer/painter.cpp + src/mbgl/renderer/painter.hpp + src/mbgl/renderer/painter_background.cpp + src/mbgl/renderer/painter_circle.cpp + src/mbgl/renderer/painter_clipping.cpp + src/mbgl/renderer/painter_debug.cpp + src/mbgl/renderer/painter_fill.cpp + src/mbgl/renderer/painter_line.cpp + src/mbgl/renderer/painter_raster.cpp + src/mbgl/renderer/painter_symbol.cpp + src/mbgl/renderer/raster_bucket.cpp + src/mbgl/renderer/raster_bucket.hpp + src/mbgl/renderer/render_item.hpp + src/mbgl/renderer/render_pass.hpp + src/mbgl/renderer/render_tile.cpp + src/mbgl/renderer/render_tile.hpp + src/mbgl/renderer/symbol_bucket.cpp + src/mbgl/renderer/symbol_bucket.hpp + + # shader + src/mbgl/shader/circle_shader.cpp + src/mbgl/shader/circle_shader.hpp + src/mbgl/shader/collision_box_shader.cpp + src/mbgl/shader/collision_box_shader.hpp + src/mbgl/shader/icon_shader.cpp + src/mbgl/shader/icon_shader.hpp + src/mbgl/shader/line_shader.cpp + src/mbgl/shader/line_shader.hpp + src/mbgl/shader/linepattern_shader.cpp + src/mbgl/shader/linepattern_shader.hpp + src/mbgl/shader/linesdf_shader.cpp + src/mbgl/shader/linesdf_shader.hpp + src/mbgl/shader/outline_shader.cpp + src/mbgl/shader/outline_shader.hpp + src/mbgl/shader/outlinepattern_shader.cpp + src/mbgl/shader/outlinepattern_shader.hpp + src/mbgl/shader/pattern_shader.cpp + src/mbgl/shader/pattern_shader.hpp + src/mbgl/shader/plain_shader.cpp + src/mbgl/shader/plain_shader.hpp + src/mbgl/shader/raster_shader.cpp + src/mbgl/shader/raster_shader.hpp + src/mbgl/shader/sdf_shader.cpp + src/mbgl/shader/sdf_shader.hpp + src/mbgl/shader/shader.cpp + src/mbgl/shader/shader.hpp + src/mbgl/shader/shaders.hpp + src/mbgl/shader/uniform.cpp + src/mbgl/shader/uniform.hpp + + # sprite + include/mbgl/sprite/sprite_image.hpp + src/mbgl/sprite/sprite_atlas.cpp + src/mbgl/sprite/sprite_atlas.hpp + src/mbgl/sprite/sprite_image.cpp + src/mbgl/sprite/sprite_parser.cpp + src/mbgl/sprite/sprite_parser.hpp + src/mbgl/sprite/sprite_store.cpp + src/mbgl/sprite/sprite_store.hpp + src/mbgl/sprite/sprite_store_observer.hpp + + # storage + include/mbgl/storage/default_file_source.hpp + include/mbgl/storage/file_source.hpp + include/mbgl/storage/network_status.hpp + include/mbgl/storage/offline.hpp + include/mbgl/storage/online_file_source.hpp + include/mbgl/storage/resource.hpp + include/mbgl/storage/response.hpp + src/mbgl/storage/asset_file_source.hpp + src/mbgl/storage/http_file_source.hpp + src/mbgl/storage/network_status.cpp + src/mbgl/storage/resource.cpp + src/mbgl/storage/response.cpp + + # style + include/mbgl/style/conversion.hpp + include/mbgl/style/filter.hpp + include/mbgl/style/filter_evaluator.hpp + include/mbgl/style/function.hpp + include/mbgl/style/layer.hpp + include/mbgl/style/property_value.hpp + include/mbgl/style/source.hpp + include/mbgl/style/transition_options.hpp + include/mbgl/style/types.hpp + src/mbgl/style/bucket_parameters.cpp + src/mbgl/style/bucket_parameters.hpp + src/mbgl/style/calculation_parameters.hpp + src/mbgl/style/cascade_parameters.hpp + src/mbgl/style/class_dictionary.cpp + src/mbgl/style/class_dictionary.hpp + src/mbgl/style/layer.cpp + src/mbgl/style/layer_impl.cpp + src/mbgl/style/layer_impl.hpp + src/mbgl/style/layout_property.hpp + src/mbgl/style/observer.hpp + src/mbgl/style/paint_property.hpp + src/mbgl/style/parser.cpp + src/mbgl/style/parser.hpp + src/mbgl/style/property_evaluator.cpp + src/mbgl/style/property_evaluator.hpp + src/mbgl/style/property_parsing.cpp + src/mbgl/style/property_parsing.hpp + src/mbgl/style/query_parameters.hpp + src/mbgl/style/rapidjson_conversion.hpp + src/mbgl/style/source.cpp + src/mbgl/style/source_impl.cpp + src/mbgl/style/source_impl.hpp + src/mbgl/style/source_observer.hpp + src/mbgl/style/style.cpp + src/mbgl/style/style.hpp + src/mbgl/style/tile_source_impl.cpp + src/mbgl/style/tile_source_impl.hpp + src/mbgl/style/types.cpp + src/mbgl/style/update_parameters.hpp + + # style/conversion + include/mbgl/style/conversion/constant.hpp + include/mbgl/style/conversion/filter.hpp + include/mbgl/style/conversion/function.hpp + include/mbgl/style/conversion/geojson.hpp + include/mbgl/style/conversion/layer.hpp + include/mbgl/style/conversion/make_property_setters.hpp + include/mbgl/style/conversion/property_setter.hpp + include/mbgl/style/conversion/property_value.hpp + include/mbgl/style/conversion/source.hpp + include/mbgl/style/conversion/tileset.hpp + + # style/layers + include/mbgl/style/layers/background_layer.hpp + include/mbgl/style/layers/circle_layer.hpp + include/mbgl/style/layers/custom_layer.hpp + include/mbgl/style/layers/fill_layer.hpp + include/mbgl/style/layers/line_layer.hpp + include/mbgl/style/layers/raster_layer.hpp + include/mbgl/style/layers/symbol_layer.hpp + src/mbgl/style/layers/background_layer.cpp + src/mbgl/style/layers/background_layer_impl.cpp + src/mbgl/style/layers/background_layer_impl.hpp + src/mbgl/style/layers/background_layer_properties.cpp + src/mbgl/style/layers/background_layer_properties.hpp + src/mbgl/style/layers/circle_layer.cpp + src/mbgl/style/layers/circle_layer_impl.cpp + src/mbgl/style/layers/circle_layer_impl.hpp + src/mbgl/style/layers/circle_layer_properties.cpp + src/mbgl/style/layers/circle_layer_properties.hpp + src/mbgl/style/layers/custom_layer.cpp + src/mbgl/style/layers/custom_layer_impl.cpp + src/mbgl/style/layers/custom_layer_impl.hpp + src/mbgl/style/layers/fill_layer.cpp + src/mbgl/style/layers/fill_layer_impl.cpp + src/mbgl/style/layers/fill_layer_impl.hpp + src/mbgl/style/layers/fill_layer_properties.cpp + src/mbgl/style/layers/fill_layer_properties.hpp + src/mbgl/style/layers/line_layer.cpp + src/mbgl/style/layers/line_layer_impl.cpp + src/mbgl/style/layers/line_layer_impl.hpp + src/mbgl/style/layers/line_layer_properties.cpp + src/mbgl/style/layers/line_layer_properties.hpp + src/mbgl/style/layers/raster_layer.cpp + src/mbgl/style/layers/raster_layer_impl.cpp + src/mbgl/style/layers/raster_layer_impl.hpp + src/mbgl/style/layers/raster_layer_properties.cpp + src/mbgl/style/layers/raster_layer_properties.hpp + src/mbgl/style/layers/symbol_layer.cpp + src/mbgl/style/layers/symbol_layer_impl.cpp + src/mbgl/style/layers/symbol_layer_impl.hpp + src/mbgl/style/layers/symbol_layer_properties.cpp + src/mbgl/style/layers/symbol_layer_properties.hpp + + # style/sources + include/mbgl/style/sources/geojson_source.hpp + include/mbgl/style/sources/raster_source.hpp + include/mbgl/style/sources/vector_source.hpp + src/mbgl/style/sources/geojson_source.cpp + src/mbgl/style/sources/geojson_source_impl.cpp + src/mbgl/style/sources/geojson_source_impl.hpp + src/mbgl/style/sources/raster_source.cpp + src/mbgl/style/sources/raster_source_impl.cpp + src/mbgl/style/sources/raster_source_impl.hpp + src/mbgl/style/sources/vector_source.cpp + src/mbgl/style/sources/vector_source_impl.cpp + src/mbgl/style/sources/vector_source_impl.hpp + + # text + src/mbgl/text/check_max_angle.cpp + src/mbgl/text/check_max_angle.hpp + src/mbgl/text/collision_feature.cpp + src/mbgl/text/collision_feature.hpp + src/mbgl/text/collision_tile.cpp + src/mbgl/text/collision_tile.hpp + src/mbgl/text/get_anchors.cpp + src/mbgl/text/get_anchors.hpp + src/mbgl/text/glyph.cpp + src/mbgl/text/glyph.hpp + src/mbgl/text/glyph_pbf.cpp + src/mbgl/text/glyph_pbf.hpp + src/mbgl/text/glyph_range.hpp + src/mbgl/text/glyph_set.cpp + src/mbgl/text/glyph_set.hpp + src/mbgl/text/glyph_store.cpp + src/mbgl/text/glyph_store.hpp + src/mbgl/text/glyph_store_observer.hpp + src/mbgl/text/placement_config.hpp + src/mbgl/text/quads.cpp + src/mbgl/text/quads.hpp + src/mbgl/text/shaping.cpp + src/mbgl/text/shaping.hpp + + # tile + src/mbgl/tile/geojson_tile.cpp + src/mbgl/tile/geojson_tile.hpp + src/mbgl/tile/geometry_tile.cpp + src/mbgl/tile/geometry_tile.hpp + src/mbgl/tile/geometry_tile_data.cpp + src/mbgl/tile/geometry_tile_data.hpp + src/mbgl/tile/raster_tile.cpp + src/mbgl/tile/raster_tile.hpp + src/mbgl/tile/tile.cpp + src/mbgl/tile/tile.hpp + src/mbgl/tile/tile_cache.cpp + src/mbgl/tile/tile_cache.hpp + src/mbgl/tile/tile_id.hpp + src/mbgl/tile/tile_id_io.cpp + src/mbgl/tile/tile_loader.hpp + src/mbgl/tile/tile_loader_impl.hpp + src/mbgl/tile/tile_observer.hpp + src/mbgl/tile/tile_worker.cpp + src/mbgl/tile/tile_worker.hpp + src/mbgl/tile/vector_tile.cpp + src/mbgl/tile/vector_tile.hpp + + # util + include/mbgl/util/async_request.hpp + include/mbgl/util/char_array_buffer.hpp + include/mbgl/util/chrono.hpp + include/mbgl/util/color.hpp + include/mbgl/util/compression.hpp + include/mbgl/util/constants.hpp + include/mbgl/util/convert.hpp + include/mbgl/util/default_styles.hpp + include/mbgl/util/enum.hpp + include/mbgl/util/exception.hpp + include/mbgl/util/feature.hpp + include/mbgl/util/font_stack.hpp + include/mbgl/util/geo.hpp + include/mbgl/util/geojson.hpp + include/mbgl/util/geometry.hpp + include/mbgl/util/image.hpp + include/mbgl/util/noncopyable.hpp + include/mbgl/util/optional.hpp + include/mbgl/util/projection.hpp + include/mbgl/util/range.hpp + include/mbgl/util/run_loop.hpp + include/mbgl/util/string.hpp + include/mbgl/util/tileset.hpp + include/mbgl/util/timer.hpp + include/mbgl/util/traits.hpp + include/mbgl/util/unitbezier.hpp + include/mbgl/util/util.hpp + include/mbgl/util/variant.hpp + include/mbgl/util/work_request.hpp + include/mbgl/util/work_task.hpp + src/mbgl/util/async_task.hpp + src/mbgl/util/chrono.cpp + src/mbgl/util/clip_id.cpp + src/mbgl/util/clip_id.hpp + src/mbgl/util/clip_lines.cpp + src/mbgl/util/clip_lines.hpp + src/mbgl/util/color.cpp + src/mbgl/util/compression.cpp + src/mbgl/util/constants.cpp + src/mbgl/util/convert.cpp + src/mbgl/util/default_styles.cpp + src/mbgl/util/dtoa.cpp + src/mbgl/util/dtoa.hpp + src/mbgl/util/exclusive.hpp + src/mbgl/util/font_stack.cpp + src/mbgl/util/geo.cpp + src/mbgl/util/grid_index.cpp + src/mbgl/util/grid_index.hpp + src/mbgl/util/http_header.cpp + src/mbgl/util/http_header.hpp + src/mbgl/util/interpolate.hpp + src/mbgl/util/intersection_tests.cpp + src/mbgl/util/intersection_tests.hpp + src/mbgl/util/io.cpp + src/mbgl/util/io.hpp + src/mbgl/util/mapbox.cpp + src/mbgl/util/mapbox.hpp + src/mbgl/util/mat2.cpp + src/mbgl/util/mat2.hpp + src/mbgl/util/mat3.cpp + src/mbgl/util/mat3.hpp + src/mbgl/util/mat4.cpp + src/mbgl/util/mat4.hpp + src/mbgl/util/math.cpp + src/mbgl/util/math.hpp + src/mbgl/util/merge_lines.cpp + src/mbgl/util/merge_lines.hpp + src/mbgl/util/premultiply.cpp + src/mbgl/util/premultiply.hpp + src/mbgl/util/ptr.hpp + src/mbgl/util/rapidjson.hpp + src/mbgl/util/raster.cpp + src/mbgl/util/raster.hpp + src/mbgl/util/rect.hpp + src/mbgl/util/std.hpp + src/mbgl/util/stopwatch.cpp + src/mbgl/util/stopwatch.hpp + src/mbgl/util/thread.hpp + src/mbgl/util/thread_context.cpp + src/mbgl/util/thread_context.hpp + src/mbgl/util/thread_local.hpp + src/mbgl/util/tile_coordinate.hpp + src/mbgl/util/tile_cover.cpp + src/mbgl/util/tile_cover.hpp + src/mbgl/util/token.hpp + src/mbgl/util/url.cpp + src/mbgl/util/url.hpp + src/mbgl/util/utf.hpp + src/mbgl/util/version_info.cpp + src/mbgl/util/work_queue.cpp + src/mbgl/util/work_queue.hpp + src/mbgl/util/work_request.cpp + src/mbgl/util/worker.cpp + src/mbgl/util/worker.hpp +) diff --git a/cmake/core.cmake b/cmake/core.cmake new file mode 100644 index 0000000000..266a5c92a2 --- /dev/null +++ b/cmake/core.cmake @@ -0,0 +1,52 @@ +set(MBGL_VERSION_DEPS package.json) +if(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD) + set(MBGL_VERSION_DEPS ${MBGL_VERSION_DEPS} .git/HEAD) +endif() + +add_custom_command( + OUTPUT ${MBGL_GENERATED}/include/mbgl/util/version.hpp + DEPENDS ${MBGL_VERSION_DEPS} + COMMAND ${CMAKE_SOURCE_DIR}/scripts/build-version.py ${MBGL_GENERATED} + VERBATIM +) + +add_custom_target(mbgl-headers DEPENDS + ${MBGL_GENERATED}/include/mbgl/util/version.hpp + ${MBGL_SHADER_FILES} +) + +add_library(mbgl-core STATIC + ${MBGL_CORE_FILES} +) + +add_dependencies(mbgl-core + mbgl-headers +) + +target_compile_options(mbgl-core + PRIVATE -fPIC + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-core + PUBLIC include + PUBLIC src # TODO: make private + PRIVATE ${MBGL_GENERATED}/include +) + +target_add_mason_package(mbgl-core PUBLIC geometry) +target_add_mason_package(mbgl-core PUBLIC variant) +target_add_mason_package(mbgl-core PRIVATE unique_resource) +target_add_mason_package(mbgl-core PRIVATE rapidjson) +target_add_mason_package(mbgl-core PRIVATE boost) +target_add_mason_package(mbgl-core PRIVATE geojson) +target_add_mason_package(mbgl-core PRIVATE geojsonvt) +target_add_mason_package(mbgl-core PRIVATE supercluster) +target_add_mason_package(mbgl-core PRIVATE kdbush) +target_add_mason_package(mbgl-core PRIVATE earcut) +target_add_mason_package(mbgl-core PRIVATE protozero) + +mbgl_platform_core() + +create_source_groups(mbgl-core) +target_append_xcconfig(mbgl-core) diff --git a/cmake/glfw.cmake b/cmake/glfw.cmake new file mode 100644 index 0000000000..67eac0934d --- /dev/null +++ b/cmake/glfw.cmake @@ -0,0 +1,27 @@ +add_executable(mbgl-glfw + bin/glfw.cpp +) + +target_sources(mbgl-glfw + PRIVATE include/mbgl/platform/default/glfw_view.hpp + PRIVATE platform/default/glfw_view.cpp + PRIVATE include/mbgl/platform/default/settings_json.hpp + PRIVATE platform/default/settings_json.cpp +) + +target_compile_options(mbgl-glfw + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-glfw + PRIVATE include + PRIVATE src # TODO: eliminate +) + +target_link_libraries(mbgl-glfw + PRIVATE mbgl-core +) + +target_add_mason_package(mbgl-glfw PRIVATE glfw) + +mbgl_platform_glfw() diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake new file mode 100644 index 0000000000..16bc62537c --- /dev/null +++ b/cmake/loop-darwin.cmake @@ -0,0 +1,18 @@ +add_library(mbgl-loop STATIC + platform/darwin/src/async_task.cpp + platform/darwin/src/run_loop.cpp + platform/darwin/src/timer.cpp +) + +target_compile_options(mbgl-loop + PRIVATE -fPIC + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-loop + PUBLIC include + PRIVATE src +) + +create_source_groups(mbgl-loop) +target_append_xcconfig(mbgl-loop) diff --git a/cmake/loop-uv.cmake b/cmake/loop-uv.cmake new file mode 100644 index 0000000000..d44f43580c --- /dev/null +++ b/cmake/loop-uv.cmake @@ -0,0 +1,19 @@ +add_library(mbgl-loop STATIC + platform/default/async_task.cpp + platform/default/run_loop.cpp + platform/default/timer.cpp +) + +target_compile_options(mbgl-loop + PRIVATE -fPIC + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-loop + PUBLIC include + PRIVATE src +) + +target_add_mason_package(mbgl-loop PUBLIC libuv) + +create_source_groups(mbgl-loop) diff --git a/cmake/mason.cmake b/cmake/mason.cmake new file mode 100644 index 0000000000..7954b53522 --- /dev/null +++ b/cmake/mason.cmake @@ -0,0 +1,117 @@ +set(_mason_command ${CMAKE_SOURCE_DIR}/.mason/mason) +string(RANDOM LENGTH 16 _mason_invocation) + +if(EXISTS "${_mason_command}") +else() + execute_process( + COMMAND git submodule update --init .mason + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +endif() + +function(_mason_valid_args package version) + if(NOT package OR NOT version) + message(FATAL_ERROR "No package name or version given") + endif() +endfunction() + +function(_mason_install package version) + set(_mason_failed) + execute_process( + COMMAND ${_mason_command} install ${package} ${version} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE _mason_failed) + if(_mason_failed) + message(FATAL_ERROR "[Mason] Could not install Mason package") + endif() +endfunction() + +function(_mason_get_flags package version) + set(_mason_flags) + set(_mason_failed) + execute_process( + COMMAND ${_mason_command} cflags ${package} ${version} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE _mason_flags + RESULT_VARIABLE _mason_failed + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(_mason_failed) + message(FATAL_ERROR "[Mason] Could not get flags for package ${package} ${version}") + endif() + + # Extract -I and -isystem to {package}_INCLUDE_DIRS + string(REGEX MATCHALL "(^| +)-(I|isystem) *([^ ]+)" _mason_include_dirs "${_mason_flags}") + string(REGEX REPLACE "(^| +)-(I|isystem) *" "" _mason_include_dirs "${_mason_include_dirs}") + string(STRIP "${_mason_include_dirs}" _mason_include_dirs) + list(REMOVE_DUPLICATES _mason_include_dirs) + set(_mason_include_dirs "${_mason_include_dirs}" PARENT_SCOPE) + + # Extract -D definitions to {package}_DEFINITIONS + string(REGEX MATCHALL "(^| +)-D *([^ ]+)" _mason_definitions "${_mason_flags}") + string(REGEX REPLACE "(^| +)-D *" "\\1" _mason_definitions "${_mason_definitions}") + string(STRIP "${_mason_definitions}" _mason_definitions) + set(_mason_definitions "${_mason_definitions}" PARENT_SCOPE) + + # Store all other flags in {package}_OPTIONS + string(REGEX REPLACE "(^| +)-(D|I|isystem) *([^ ]+)" "" _mason_options "${_mason_flags}") + string(STRIP "${_mason_options}" _mason_options) + set(_mason_options "${_mason_options}" PARENT_SCOPE) +endfunction() + +function(_mason_get_libs package version) + set(_mason_failed) + set(_mason_static_libs) + execute_process( + COMMAND ${_mason_command} static_libs ${package} ${version} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE _mason_static_libs + RESULT_VARIABLE _mason_failed + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(_mason_failed) + message(FATAL_ERROR "[Mason] Could not get static libraries for package ${package} ${version}") + endif() + + set(_mason_failed) + set(_mason_ldflags) + execute_process( + COMMAND ${_mason_command} ldflags ${package} ${version} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE _mason_ldflags + RESULT_VARIABLE _mason_failed + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(_mason_failed) + message(FATAL_ERROR "[Mason] Could not get linker flags for package ${package} ${version}") + endif() + + set(_mason_libraries) + list(APPEND _mason_libraries ${_mason_static_libs} ${_mason_ldflags}) + set(_mason_libraries ${_mason_libraries} PARENT_SCOPE) +endfunction() + +macro(mason_use package version) + _mason_valid_args("${package}" "${version}") + + if(MASON_${package}_INVOCATION STREQUAL ${_mason_invocation}) + # Check that the previous invocation of mason_use didn't select another version of this package + if(NOT MASON_${package}_VERSION STREQUAL ${version}) + message(FATAL_ERROR "[Mason] Already using ${package} ${MASON_${package}_VERSION}. Cannot select version ${version}.") + endif() + else() + _mason_install("${package}" "${version}") + _mason_get_flags("${package}" "${version}") + _mason_get_libs("${package}" "${version}") + set(MASON_${package}_INCLUDE_DIRS "${_mason_include_dirs}" CACHE STRING "${package} include directories" FORCE) + set(MASON_${package}_DEFINITIONS "${_mason_definitions}" CACHE STRING "${package} definitions" FORCE) + set(MASON_${package}_OPTIONS "${_mason_options}" CACHE STRING "${package} compiler options" FORCE) + set(MASON_${package}_LIBRARIES "${_mason_libraries}" CACHE STRING "${package} libraries" FORCE) + set(MASON_${package}_VERSION "${version}" CACHE INTERNAL "${package} version" FORCE) + set(MASON_${package}_INVOCATION "${_mason_invocation}" CACHE INTERNAL "${package} invocation ID" FORCE) + endif() +endmacro() + +macro(target_add_mason_package target visibility package) + mason_use("${package}" "${MASON_${package}_VERSION}") + target_include_directories(${target} ${visibility} "${MASON_${package}_INCLUDE_DIRS}") + target_compile_definitions(${target} ${visibility} "${MASON_${package}_DEFINITIONS}") + target_compile_options(${target} ${visibility} "${MASON_${package}_OPTIONS}") + target_link_libraries(${target} ${visibility} "${MASON_${package}_LIBRARIES}") +endmacro() diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake new file mode 100644 index 0000000000..105c8822e9 --- /dev/null +++ b/cmake/mbgl.cmake @@ -0,0 +1,50 @@ +if (NOT DEFINED MBGL_PLATFORM) + if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(MBGL_PLATFORM "macos") + else() + set(MBGL_PLATFORM "linux") + endif() +endif() + +if(MBGL_PLATFORM STREQUAL "macos") + set(ENV{MASON_PLATFORM} "osx") +else() + set(ENV{MASON_PLATFORM} ${MBGL_PLATFORM}) +endif() + +set(MBGL_GENERATED ${CMAKE_BINARY_DIR}/generated/${CMAKE_CFG_INTDIR}) + +# Generate source groups so the files are properly sorted in IDEs like Xcode. +function(create_source_groups target) + get_target_property(sources ${target} SOURCES) + foreach(file ${sources}) + get_filename_component(file "${file}" ABSOLUTE) + string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" group "${file}") + get_filename_component(group "${group}" DIRECTORY) + string(REPLACE "/" "\\" group "${group}") + source_group("${group}" FILES "${file}") + endforeach() +endfunction() + +function(_write_xcconfig_var target var) + get_property(result TARGET ${target} PROPERTY INTERFACE_${var} SET) + if (result) + get_property(result TARGET ${target} PROPERTY INTERFACE_${var}) + string(REPLACE ";" "\" \"" result "${result}") + string(REPLACE "-" "_" target "${target}") + file(APPEND "${CMAKE_BINARY_DIR}/config.xcconfig" "${target}_${var} = \"${result}\"\n") + endif() +endfunction() + +function(target_append_xcconfig target) + file(APPEND "${CMAKE_BINARY_DIR}/config.xcconfig" "\n// ${target}\n") + _write_xcconfig_var(${target} INCLUDE_DIRECTORIES) + _write_xcconfig_var(${target} COMPILE_DEFINITIONS) + _write_xcconfig_var(${target} COMPILE_OPTIONS) + _write_xcconfig_var(${target} LINK_LIBRARIES) +endfunction() + +# Start a new file when we're running CMake +file(WRITE "${CMAKE_BINARY_DIR}/config.xcconfig" "// Do not edit -- generated by CMake\n") + +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10) diff --git a/cmake/node.cmake b/cmake/node.cmake new file mode 100644 index 0000000000..9c8c6b074b --- /dev/null +++ b/cmake/node.cmake @@ -0,0 +1,52 @@ +if(NOT EXISTS ${CMAKE_SOURCE_DIR}/node_modules/node-cmake/FindNodeJS.cmake) + message(FATAL_ERROR "Can't find node-cmake") +endif() + +set(NodeJS_CXX_STANDARD 14 CACHE INTERNAL "Use C++14" FORCE) +set(NodeJS_DOWNLOAD ON CACHE INTERNAL "Download node.js sources" FORCE) +set(NodeJS_USE_CLANG_STDLIB OFF CACHE BOOL "Don't use libc++ by default" FORCE) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/node_modules/node-cmake) +find_package(NodeJS) + +add_nodejs_module(mbgl-node + platform/node/src/node_mapbox_gl_native.cpp +) + +target_sources(mbgl-node + PRIVATE platform/node/src/node_log.hpp + PRIVATE platform/node/src/node_log.cpp + PRIVATE platform/node/src/node_map.hpp + PRIVATE platform/node/src/node_map.cpp + PRIVATE platform/node/src/node_request.hpp + PRIVATE platform/node/src/node_request.cpp + PRIVATE platform/node/src/node_feature.hpp + PRIVATE platform/node/src/node_feature.cpp + PRIVATE platform/node/src/util/async_queue.hpp + + # We are compiling with the uv loop, but since this target already has the headers for libuv, + # we don't have to install it manually. + PRIVATE platform/default/async_task.cpp + PRIVATE platform/default/run_loop.cpp + PRIVATE platform/default/timer.cpp +) + +target_compile_options(mbgl-node + PRIVATE -fPIC + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-node + PRIVATE src # TODO: eliminate +) + +target_link_libraries(mbgl-node + PRIVATE mbgl-core +) + +add_custom_command( + TARGET mbgl-node + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mbgl-node> ${CMAKE_SOURCE_DIR}/lib/mapbox-gl-native.node +) + +mbgl_platform_node() diff --git a/cmake/npm.cmake b/cmake/npm.cmake new file mode 100644 index 0000000000..bb456666e2 --- /dev/null +++ b/cmake/npm.cmake @@ -0,0 +1,20 @@ +function(cache_executable_path name variable) + # Obtain paths to node and npm and cache it, so when e.g. Xcode reruns CMake, we still have the + # variables from the original invocation + if(NOT ${variable}) + set(_which_output) + execute_process( + COMMAND which ${name} + OUTPUT_VARIABLE _which_output + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(_which_output STREQUAL "") + message(STATUS "Using cached ${name}: ${${variable}}") + else() + set(${variable} "${_which_output}" CACHE PATH "Path to ${name} executable") + message(STATUS "Using ${name}: ${${variable}}") + endif() + endif() +endfunction() + +cache_executable_path(node _node) +cache_executable_path(npm _npm) diff --git a/cmake/offline.cmake b/cmake/offline.cmake new file mode 100644 index 0000000000..c2959e7492 --- /dev/null +++ b/cmake/offline.cmake @@ -0,0 +1,21 @@ +add_executable(mbgl-offline + bin/offline.cpp +) + +target_compile_options(mbgl-offline + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-offline + PRIVATE include + PRIVATE src # TODO: eliminate +) + +target_link_libraries(mbgl-offline + PRIVATE mbgl-core +) + +target_add_mason_package(mbgl-offline PRIVATE boost) +target_add_mason_package(mbgl-offline PRIVATE boost_libprogram_options) + +mbgl_platform_offline() diff --git a/cmake/render.cmake b/cmake/render.cmake new file mode 100644 index 0000000000..3cf79cc0cc --- /dev/null +++ b/cmake/render.cmake @@ -0,0 +1,21 @@ +add_executable(mbgl-render + bin/render.cpp +) + +target_compile_options(mbgl-render + PRIVATE -fvisibility-inlines-hidden +) + +target_include_directories(mbgl-render + PRIVATE include + PRIVATE src # TODO: eliminate +) + +target_link_libraries(mbgl-render + PRIVATE mbgl-core +) + +target_add_mason_package(mbgl-render PRIVATE boost) +target_add_mason_package(mbgl-render PRIVATE boost_libprogram_options) + +mbgl_platform_render() diff --git a/cmake/shaders.cmake b/cmake/shaders.cmake new file mode 100644 index 0000000000..5a16fa682f --- /dev/null +++ b/cmake/shaders.cmake @@ -0,0 +1,29 @@ +function(add_shader VAR name) + set(shader_build_cmd ${CMAKE_SOURCE_DIR}/scripts/build-shaders.py) + set(shader_file_prefix ${CMAKE_SOURCE_DIR}/node_modules/mapbox-gl-shaders/src) + set(shader_source_prefix ${MBGL_GENERATED}/include/mbgl/shader) + + add_custom_command( + OUTPUT ${shader_source_prefix}/${name}.vertex.hpp ${shader_source_prefix}/${name}.fragment.hpp + COMMAND ${shader_build_cmd} ${shader_file_prefix}/${name}.vertex.glsl ${shader_source_prefix}/${name}.vertex.hpp + COMMAND ${shader_build_cmd} ${shader_file_prefix}/${name}.fragment.glsl ${shader_source_prefix}/${name}.fragment.hpp + DEPENDS ${shader_file_prefix}/${name}.vertex.glsl + DEPENDS ${shader_file_prefix}/${name}.fragment.glsl + VERBATIM + ) + set(${VAR} ${${VAR}} ${shader_source_prefix}/${name}.vertex.hpp ${shader_source_prefix}/${name}.fragment.hpp PARENT_SCOPE) +endfunction() + +add_shader(MBGL_SHADER_FILES circle) +add_shader(MBGL_SHADER_FILES collisionbox) +add_shader(MBGL_SHADER_FILES debug) +add_shader(MBGL_SHADER_FILES fill) +add_shader(MBGL_SHADER_FILES icon) +add_shader(MBGL_SHADER_FILES line) +add_shader(MBGL_SHADER_FILES linepattern) +add_shader(MBGL_SHADER_FILES linesdfpattern) +add_shader(MBGL_SHADER_FILES outline) +add_shader(MBGL_SHADER_FILES outlinepattern) +add_shader(MBGL_SHADER_FILES pattern) +add_shader(MBGL_SHADER_FILES raster) +add_shader(MBGL_SHADER_FILES sdf) diff --git a/cmake/test-files.cmake b/cmake/test-files.cmake new file mode 100644 index 0000000000..d6c6215291 --- /dev/null +++ b/cmake/test-files.cmake @@ -0,0 +1,100 @@ +# Do not edit. Regenerate this with ./scripts/generate-test-files.sh + +set(MBGL_TEST_FILES + # algorithm + test/algorithm/covered_by_children.cpp + test/algorithm/generate_clip_ids.cpp + test/algorithm/mock.hpp + test/algorithm/update_renderables.cpp + + # api + test/api/annotations.cpp + test/api/api_misuse.cpp + test/api/custom_layer.cpp + test/api/render_missing.cpp + test/api/repeated_render.cpp + test/api/set_style.cpp + + # geometry + test/geometry/binpack.cpp + + # gl + test/gl/object.cpp + + # include/mbgl + test/include/mbgl/test.hpp + + # map + test/map/map.cpp + test/map/transform.cpp + + # math + test/math/clamp.cpp + test/math/minmax.cpp + + # sprite + test/sprite/sprite_atlas.cpp + test/sprite/sprite_image.cpp + test/sprite/sprite_parser.cpp + test/sprite/sprite_store.cpp + + # src + test/src/main.cpp + + # src/mbgl/test + test/src/mbgl/test/fixture_log_observer.cpp + test/src/mbgl/test/fixture_log_observer.hpp + test/src/mbgl/test/stub_file_source.cpp + test/src/mbgl/test/stub_file_source.hpp + test/src/mbgl/test/stub_style_observer.hpp + test/src/mbgl/test/test.cpp + test/src/mbgl/test/util.cpp + test/src/mbgl/test/util.hpp + + # storage + test/storage/asset_file_source.cpp + test/storage/default_file_source.cpp + test/storage/headers.cpp + test/storage/http_file_source.cpp + test/storage/offline.cpp + test/storage/offline_database.cpp + test/storage/offline_download.cpp + test/storage/online_file_source.cpp + test/storage/resource.cpp + + # style + test/style/filter.cpp + test/style/functions.cpp + test/style/glyph_store.cpp + test/style/source.cpp + test/style/style.cpp + test/style/style_layer.cpp + test/style/style_parser.cpp + test/style/tile_source.cpp + test/style/variant.cpp + + # text + test/text/quads.cpp + + # tile + test/tile/geometry_tile_data.cpp + test/tile/tile_id.cpp + + # util + test/util/async_task.cpp + test/util/geo.cpp + test/util/image.cpp + test/util/mapbox.cpp + test/util/memory.cpp + test/util/merge_lines.cpp + test/util/number_conversions.cpp + test/util/projection.cpp + test/util/run_loop.cpp + test/util/text_conversions.cpp + test/util/thread.cpp + test/util/thread_local.cpp + test/util/tile_cover.cpp + test/util/timer.cpp + test/util/token.cpp + test/util/work_queue.cpp +) diff --git a/cmake/test.cmake b/cmake/test.cmake new file mode 100644 index 0000000000..6cce8d248d --- /dev/null +++ b/cmake/test.cmake @@ -0,0 +1,35 @@ +add_executable(mbgl-test + ${MBGL_TEST_FILES} +) + +cache_executable_path(node _node) + +target_compile_options(mbgl-test + PRIVATE -fvisibility-inlines-hidden +) + +set_source_files_properties(test/src/mbgl/test/util.cpp PROPERTIES COMPILE_FLAGS -DNODE_EXECUTABLE="${_node}") + +target_include_directories(mbgl-test + PRIVATE include + PRIVATE src # TODO: eliminate + PRIVATE test/include + PRIVATE test/src + PRIVATE platform/default +) + +target_link_libraries(mbgl-test + PRIVATE mbgl-core +) + +target_add_mason_package(mbgl-test PRIVATE geometry) +target_add_mason_package(mbgl-test PRIVATE variant) +target_add_mason_package(mbgl-test PRIVATE unique_resource) +target_add_mason_package(mbgl-test PRIVATE rapidjson) +target_add_mason_package(mbgl-test PRIVATE gtest) +target_add_mason_package(mbgl-test PRIVATE pixelmatch) +target_add_mason_package(mbgl-test PRIVATE boost) +target_add_mason_package(mbgl-test PRIVATE geojson) +target_add_mason_package(mbgl-test PRIVATE geojsonvt) + +mbgl_platform_test() diff --git a/configure b/configure deleted file mode 100755 index c3a3ae3191..0000000000 --- a/configure +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -INPUT_FILE=$1 -OUTPUT_FILE=$2 -export MASON_PLATFORM=$3 -export MASON_PLATFORM_VERSION=${4:-} - -if [ "${MASON_PLATFORM}" = "macos" ]; then - export MASON_PLATFORM=osx -fi - -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 - -# Make sure we clear all colors -trap '>&2 echo -en "\033[0m"' TERM INT - -function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } -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 - export MASON_DIR="`pwd`/.mason" - export PATH="${MASON_DIR}:${PATH}" -else - 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 - -# You can override the function for a particular set of flags by defining a -# print_XXX_flags function in your dependencies.sh file -function print_flags { - local NAME=$1; shift - if [ "$(type -t print_${NAME}_flags)" = 'function' ]; then - print_${NAME}_flags - else - local VERSION=`echo "${NAME}_VERSION" | tr "[:lower:]-." "[:upper:]__"` - if [ ! -z ${!VERSION:-} ] ; then - mason install ${NAME} ${!VERSION} - for FLAGS in "$@" ; do - flags=$(mason ${FLAGS} ${NAME} ${!VERSION}) || exit 1 - CONFIG+=" '${NAME}_${FLAGS}%': $(quote_flags $flags),"$LN - done - else - warn "* Not using ${NAME}" - for FLAGS in "$@" ; do - CONFIG+=" '${NAME}_${FLAGS}%': [],"$LN - done - fi - fi -} - -function print_default_flags { - : -} - -function print_opengl_flags { - CONFIG+=" 'opengl_cflags%': [],"$LN - CONFIG+=" 'opengl_ldflags%': [],"$LN -} - -function print_qt_flags { - : -} - -# Load dependencies -source ${INPUT_FILE} - -PYTHON=`which python || abort 'Cannot find python'` - ->&2 echo -en "\033[1m\033[32m* Using " ->&2 ${PYTHON} --version ->&2 echo -en "\033[0m"; - -function quote_flags { - ${PYTHON} -c "import sys, re; print filter(None, re.split('(?<!-framework)\s+', ' '.join(sys.argv[1:])))" "$@" -} - -LN=$'\n' - -CONFIG="# Do not edit. Generated by the configure script. -{ - 'target_defaults': { - 'cflags%': [], - 'default_configuration': 'Release', - 'defines': [], - 'include_dirs': [], - 'libraries': [], -" - -print_default_flags - -CONFIG+=" },"$LN -CONFIG+=" 'variables': {"$LN - -print_opengl_flags -print_qt_flags - -print_flags unique_resource cflags -print_flags protozero cflags -print_flags boost cflags -print_flags boost_libprogram_options static_libs -print_flags openssl static_libs cflags ldflags -print_flags libcurl static_libs cflags ldflags -print_flags glfw static_libs cflags ldflags -print_flags libpng static_libs cflags ldflags -print_flags libjpeg-turbo static_libs cflags ldflags -print_flags sqlite static_libs cflags ldflags -print_flags libuv static_libs cflags ldflags -print_flags zlib static_libs cflags ldflags -print_flags nunicode static_libs cflags ldflags -print_flags libzip static_libs cflags ldflags -print_flags geometry cflags -print_flags geojson static_libs cflags ldflags -print_flags geojsonvt cflags -print_flags supercluster cflags -print_flags kdbush cflags -print_flags variant cflags -print_flags rapidjson static_libs cflags ldflags -print_flags gtest static_libs cflags ldflags -print_flags pixelmatch static_libs cflags ldflags -print_flags webp static_libs cflags ldflags -print_flags jni.hpp cflags -print_flags earcut cflags -print_flags benchmark static_libs cflags ldflags - -CONFIG+=" } -} -" - -mkdir -p $(dirname "${OUTPUT_FILE}") -echo "${CONFIG}" > ${OUTPUT_FILE} -cat ${OUTPUT_FILE} diff --git a/docker/Dockerfile b/docker/Dockerfile index ef98a71430..64f1ca3c87 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,5 +12,5 @@ RUN apt-get update -y RUN apt-get install -y git-core python-pip curl automake libtool make cmake pkg-config python-pip \ libc6 libstdc++6 zlib1g-dev libcurl4-openssl-dev libpng-dev libsqlite3-dev \ xvfb libglu1-mesa-dev libxrandr-dev libxinerama-dev libxi-dev libxcursor-dev xutils-dev \ - mesa-utils libxxf86vm-dev x11proto-xf86vidmode-dev && \ + mesa-utils libxxf86vm-dev x11proto-xf86vidmode-dev cmake && \ pip install awscli diff --git a/docker/george-edison55-precise-backports.gpg.key b/docker/george-edison55-precise-backports.gpg.key new file mode 100644 index 0000000000..69971cfce8 --- /dev/null +++ b/docker/george-edison55-precise-backports.gpg.key @@ -0,0 +1,13 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: SKS 1.1.5 +Comment: Hostname: keyserver.ubuntu.com + +mI0ETFYUegEEAMF062ZPYWxX0blpJpLCz/oEXwvxJoQg1Sz4uD4Fs1FCfRwHMlydwbGvEjEr +QG39OXf1y1+lGVI73BLcuDd/n0yBLN9brycDspZKnQ25VaRB6sl8EDR8XM5tiA/diW1EIygS +Ad/NuwXv236e+1E+zvik6faeoxygJbbj0KN67Hx7ABEBAAG0HUxhdW5jaHBhZCBHZW9yZ2Ug +RWRpc29uJ3MgUFBBiLYEEwECACAFAkxWFHoCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAK +CRAITs/Fgoq3JpJ0A/9RquDizs5oUhyqqT4t4EHEIH9+ckl/3cQj0peN5APA5TOqAS4iVxic +GO3YB7yY4a+v5qQUalOMNAQRUigi3IwCcOSs94Bt5f7lK6xbU7mIO2D5a7cUCjN36FXe+oWp +4s5odz5+9OZrIVzJw/NOdgneLqh2ts5jWGYmOg7POJk9mQ== +=ItbQ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/docker/george-edison55-precise-backports.list b/docker/george-edison55-precise-backports.list new file mode 100644 index 0000000000..2bae784dd6 --- /dev/null +++ b/docker/george-edison55-precise-backports.list @@ -0,0 +1,2 @@ +deb http://ppa.launchpad.net/george-edison55/precise-backports/ubuntu precise main +deb-src http://ppa.launchpad.net/george-edison55/precise-backports/ubuntu precise main diff --git a/docker/launchpad.gpg.key b/docker/launchpad.gpg.key deleted file mode 100644 index ebe1b1ec33..0000000000 --- a/docker/launchpad.gpg.key +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mI0ESuBvRwEEAMi4cDba7xlKaaoXjO1n1HX8RKrkW+HEIl79nSOSJyvzysajs7zU -ow/OzCQp9NswqrDmNuH1+lPTTRNAGtK8r2ouq2rnXT1mTl23dpgHZ9spseR73s4Z -BGw/ag4bpU5dNUStvfmHhIjVCuiSpNn7cyy1JSSvSs3N2mxteKjXLBf7ABEBAAG0 -GkxhdW5jaHBhZCBUb29sY2hhaW4gYnVpbGRziLYEEwECACAFAkrgb0cCGwMGCwkI -BwMCBBUCCAMEFgIDAQIeAQIXgAAKCRAek3eiup7yfzGKA/4xzUqNACSlB+k+DxFF -HqkwKa/ziFiAlkLQyyhm+iqz80htRZr7Ls/ZRYZl0aSU56/hLe0V+TviJ1s8qdN2 -lamkKdXIAFfavA04nOnTzyIBJ82EAUT3Nh45skMxo4z4iZMNmsyaQpNl/m/lNtOL -hR64v5ZybofB2EWkMxUzX8D/FQ== -=LcUQ ------END PGP PUBLIC KEY BLOCK----- diff --git a/docker/llvm-snapshot.gpg.key b/docker/llvm-snapshot.gpg.key deleted file mode 100644 index aa6b105aa3..0000000000 --- a/docker/llvm-snapshot.gpg.key +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.12 (GNU/Linux) - -mQINBFE9lCwBEADi0WUAApM/mgHJRU8lVkkw0CHsZNpqaQDNaHefD6Rw3S4LxNmM -EZaOTkhP200XZM8lVdbfUW9xSjA3oPldc1HG26NjbqqCmWpdo2fb+r7VmU2dq3NM -R18ZlKixiLDE6OUfaXWKamZsXb6ITTYmgTO6orQWYrnW6ckYHSeaAkW0wkDAryl2 -B5v8aoFnQ1rFiVEMo4NGzw4UX+MelF7rxaaregmKVTPiqCOSPJ1McC1dHFN533FY -Wh/RVLKWo6npu+owtwYFQW+zyQhKzSIMvNujFRzhIxzxR9Gn87MoLAyfgKEzrbbT -DhqqNXTxS4UMUKCQaO93TzetX/EBrRpJj+vP640yio80h4Dr5pAd7+LnKwgpTDk1 -G88bBXJAcPZnTSKu9I2c6KY4iRNbvRz4i+ZdwwZtdW4nSdl2792L7Sl7Nc44uLL/ -ZqkKDXEBF6lsX5XpABwyK89S/SbHOytXv9o4puv+65Ac5/UShspQTMSKGZgvDauU -cs8kE1U9dPOqVNCYq9Nfwinkf6RxV1k1+gwtclxQuY7UpKXP0hNAXjAiA5KS5Crq -7aaJg9q2F4bub0mNU6n7UI6vXguF2n4SEtzPRk6RP+4TiT3bZUsmr+1ktogyOJCc -Ha8G5VdL+NBIYQthOcieYCBnTeIH7D3Sp6FYQTYtVbKFzmMK+36ERreL/wARAQAB -tD1TeWx2ZXN0cmUgTGVkcnUgLSBEZWJpYW4gTExWTSBwYWNrYWdlcyA8c3lsdmVz -dHJlQGRlYmlhbi5vcmc+iQI4BBMBAgAiBQJRPZQsAhsDBgsJCAcDAgYVCAIJCgsE -FgIDAQIeAQIXgAAKCRAVz00Yr090Ibx+EADArS/hvkDF8juWMXxh17CgR0WZlHCC -9CTBWkg5a0bNN/3bb97cPQt/vIKWjQtkQpav6/5JTVCSx2riL4FHYhH0iuo4iAPR -udC7Cvg8g7bSPrKO6tenQZNvQm+tUmBHgFiMBJi92AjZ/Qn1Shg7p9ITivFxpLyX -wpmnF1OKyI2Kof2rm4BFwfSWuf8Fvh7kDMRLHv+MlnK/7j/BNpKdozXxLcwoFBmn -l0WjpAH3OFF7Pvm1LJdf1DjWKH0Dc3sc6zxtmBR/KHHg6kK4BGQNnFKujcP7TVdv -gMYv84kun14pnwjZcqOtN3UJtcx22880DOQzinoMs3Q4w4o05oIF+sSgHViFpc3W -R0v+RllnH05vKZo+LDzc83DQVrdwliV12eHxrMQ8UYg88zCbF/cHHnlzZWAJgftg -hB08v1BKPgYRUzwJ6VdVqXYcZWEaUJmQAPuAALyZESw94hSo28FAn0/gzEc5uOYx -K+xG/lFwgAGYNb3uGM5m0P6LVTfdg6vDwwOeTNIExVk3KVFXeSQef2ZMkhwA7wya -KJptkb62wBHFE+o9TUdtMCY6qONxMMdwioRE5BYNwAsS1PnRD2+jtlI0DzvKHt7B -MWd8hnoUKhMeZ9TNmo+8CpsAtXZcBho0zPGz/R8NlJhAWpdAZ1CmcPo83EW86Yq7 -BxQUKnNHcwj2ebkCDQRRPZQsARAA4jxYmbTHwmMjqSizlMJYNuGOpIidEdx9zQ5g -zOr431/VfWq4S+VhMDhs15j9lyml0y4ok215VRFwrAREDg6UPMr7ajLmBQGau0Fc -bvZJ90l4NjXp5p0NEE/qOb9UEHT7EGkEhaZ1ekkWFTWCgsy7rRXfZLxB6sk7pzLC -DshyW3zjIakWAnpQ5j5obiDy708pReAuGB94NSyb1HoW/xGsGgvvCw4r0w3xPStw -F1PhmScE6NTBIfLliea3pl8vhKPlCh54Hk7I8QGjo1ETlRP4Qll1ZxHJ8u25f/ta -RES2Aw8Hi7j0EVcZ6MT9JWTI83yUcnUlZPZS2HyeWcUj+8nUC8W4N8An+aNps9l/ -21inIl2TbGo3Yn1JQLnA1YCoGwC34g8QZTJhElEQBN0X29ayWW6OdFx8MDvllbBV -ymmKq2lK1U55mQTfDli7S3vfGz9Gp/oQwZ8bQpOeUkc5hbZszYwP4RX+68xDPfn+ -M9udl+qW9wu+LyePbW6HX90LmkhNkkY2ZzUPRPDHZANU5btaPXc2H7edX4y4maQa -xenqD0lGh9LGz/mps4HEZtCI5CY8o0uCMF3lT0XfXhuLksr7Pxv57yue8LLTItOJ -d9Hmzp9G97SRYYeqU+8lyNXtU2PdrLLq7QHkzrsloG78lCpQcalHGACJzrlUWVP/ -fN3Ht3kAEQEAAYkCHwQYAQIACQUCUT2ULAIbDAAKCRAVz00Yr090IbhWEADbr50X -OEXMIMGRLe+YMjeMX9NG4jxs0jZaWHc/WrGR+CCSUb9r6aPXeLo+45949uEfdSsB -pbaEdNWxF5Vr1CSjuO5siIlgDjmT655voXo67xVpEN4HhMrxugDJfCa6z97P0+ML -PdDxim57uNqkam9XIq9hKQaurxMAECDPmlEXI4QT3eu5qw5/knMzDMZj4Vi6hovL -wvvAeLHO/jsyfIdNmhBGU2RWCEZ9uo/MeerPHtRPfg74g+9PPfP6nyHD2Wes6yGd -oVQwtPNAQD6Cj7EaA2xdZYLJ7/jW6yiPu98FFWP74FN2dlyEA2uVziLsfBrgpS4l -tVOlrO2YzkkqUGrybzbLpj6eeHx+Cd7wcjI8CalsqtL6cG8cUEjtWQUHyTbQWAgG -5VPEgIAVhJ6RTZ26i/G+4J8neKyRs4vz+57UGwY6zI4AB1ZcWGEE3Bf+CDEDgmnP -LSwbnHefK9IljT9XU98PelSryUO/5UPw7leE0akXKB4DtekToO226px1VnGp3Bov -1GBGvpHvL2WizEwdk+nfk8LtrLzej+9FtIcq3uIrYnsac47Pf7p0otcFeTJTjSq3 -krCaoG4Hx0zGQG2ZFpHrSrZTVy6lxvIdfi0beMgY6h78p6M9eYZHQHc02DjFkQXN -bXb5c6gCHESH5PXwPU4jQEE7Ib9J6sbk7ZT2Mw== -=j+4q ------END PGP PUBLIC KEY BLOCK----- diff --git a/docker/llvm.list b/docker/llvm.list deleted file mode 100644 index 2ca079d9d6..0000000000 --- a/docker/llvm.list +++ /dev/null @@ -1,2 +0,0 @@ -deb http://llvm.org/apt/precise/ llvm-toolchain-precise main -deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise main diff --git a/docker/ubuntu-toolchain-r.gpg.key b/docker/ubuntu-toolchain-r.gpg.key new file mode 100644 index 0000000000..854eef8520 --- /dev/null +++ b/docker/ubuntu-toolchain-r.gpg.key @@ -0,0 +1,13 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: SKS 1.1.5 +Comment: Hostname: keyserver.ubuntu.com + +mI0ESuBvRwEEAMi4cDba7xlKaaoXjO1n1HX8RKrkW+HEIl79nSOSJyvzysajs7zUow/OzCQp +9NswqrDmNuH1+lPTTRNAGtK8r2ouq2rnXT1mTl23dpgHZ9spseR73s4ZBGw/ag4bpU5dNUSt +vfmHhIjVCuiSpNn7cyy1JSSvSs3N2mxteKjXLBf7ABEBAAG0GkxhdW5jaHBhZCBUb29sY2hh +aW4gYnVpbGRziLYEEwECACAFAkrgb0cCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRAe +k3eiup7yfzGKA/4xzUqNACSlB+k+DxFFHqkwKa/ziFiAlkLQyyhm+iqz80htRZr7Ls/ZRYZl +0aSU56/hLe0V+TviJ1s8qdN2lamkKdXIAFfavA04nOnTzyIBJ82EAUT3Nh45skMxo4z4iZMN +msyaQpNl/m/lNtOLhR64v5ZybofB2EWkMxUzX8D/FQ== +=LcUQ +-----END PGP PUBLIC KEY BLOCK-----
\ No newline at end of file diff --git a/docker/ubuntu-toolchain-r.list b/docker/ubuntu-toolchain-r.list index 2ff8535f95..741f4528e2 100644 --- a/docker/ubuntu-toolchain-r.list +++ b/docker/ubuntu-toolchain-r.list @@ -1,2 +1,2 @@ deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main -deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main +deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main
\ No newline at end of file diff --git a/mbgl.gypi b/mbgl.gypi deleted file mode 100644 index 7f31d4619a..0000000000 --- a/mbgl.gypi +++ /dev/null @@ -1,341 +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', - 'ALWAYS_SEARCH_USER_PATHS': 'NO', - 'COMBINE_HIDPI_IMAGES': 'YES', - }, - }, { - '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. - ], - }], - ], - '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': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf', - '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', - }, - }, 'OS=="android"', { - 'cflags_cc': [ '-g', '-Os', '-fvisibility=hidden' ], - }, { - 'cflags_cc': [ '-g', '-O3' ], - }], - ], - }, - }, - }, - 'configurations': { - 'Debug': { - 'xcode_settings': { - 'ENABLE_TESTABILITY': 'YES', - 'ONLY_ACTIVE_ARCH': 'YES', - }, - }, - }, - 'targets': [ - { - 'target_name': 'headers', - 'type': 'none', - - 'sources': [ - '<!@(find -H <(DEPTH)/node_modules/mapbox-gl-shaders -name "*.glsl")', - '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', - ], - - 'rules': [ - { - 'rule_name': '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': 'version', - 'message': 'Bulding version header', - 'inputs': [ '<(DEPTH)/scripts/build-version.py', ], - 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', ], - 'action': [ '<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)' ], - }, - ], - - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)/include', - ], - }, - }, - { - 'target_name': 'core', - 'product_name': 'mbgl-core', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - - 'dependencies': [ - 'headers', - ], - - '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")', - ], - - 'include_dirs': [ - 'include', - 'src', - ], - - 'variables': { - 'cflags_cc': [ - '<@(opengl_cflags)', - '<@(protozero_cflags)', - '<@(boost_cflags)', - '<@(geometry_cflags)', - '<@(geojson_cflags)', - '<@(geojsonvt_cflags)', - '<@(supercluster_cflags)', - '<@(kdbush_cflags)', - '<@(rapidjson_cflags)', - '<@(variant_cflags)', - '<@(earcut_cflags)', - '<@(unique_resource_cflags)', - ], - 'cflags': [ - '<@(opengl_cflags)', - '<@(rapidjson_cflags)', - '-fPIC' - ], - 'ldflags': [ - '<@(opengl_ldflags)', - ], - 'libraries': [ - '<@(geojson_static_libs)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'OTHER_CFLAGS': [ '<@(cflags)' ], - 'BITCODE_GENERATION_MODE': 'bitcode', - }, - }, { - '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)' ], - }] - ], - }, - - 'direct_dependent_settings': { - 'cflags_cc': [ - '<@(variant_cflags)', - '<@(geometry_cflags)', - '<@(geojson_cflags)', - '<@(unique_resource_cflags)', - ], - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ - '<@(variant_cflags)', - '<@(geometry_cflags)', - '<@(geojson_cflags)', - '<@(unique_resource_cflags)', - ], - }, - }, - }, - { - '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 5a96d0defd..96d302974b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ }, "license": "BSD-2-Clause", "dependencies": { - "nan": "^2.3.5", "node-pre-gyp": "^0.6.28" }, "devDependencies": { @@ -24,7 +23,7 @@ "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#4d1f89514bf03536c8e682439df165c33a37122a", "mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae", "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#8e38705747dee1279a8503d05593543eb9af3ce1", - "node-gyp": "^3.3.1", + "node-cmake": "^1.2.1", "request": "^2.72.0", "tape": "^4.5.1" }, @@ -33,7 +32,7 @@ }, "scripts": { "preinstall": "npm install node-pre-gyp", - "install": "node-pre-gyp install --fallback-to-build=false || make node", + "install": "node-pre-gyp install --fallback-to-build=false || BUILDTYPE=Release make node", "test": "tape platform/node/test/js/**/*.test.js", "test-memory": "node --expose-gc platform/node/test/memory.test.js", "test-suite": "node platform/node/test/render.test.js && node platform/node/test/query.test.js" diff --git a/platform/android/bitrise.yml b/platform/android/bitrise.yml index 5eb5cfa508..b7508f3836 100644 --- a/platform/android/bitrise.yml +++ b/platform/android/bitrise.yml @@ -31,7 +31,7 @@ workflows: #!/bin/bash set -eu -o pipefail curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - - sudo apt-get install -y pkg-config nodejs + sudo apt-get install -y pkg-config nodejs cmake export BUILDTYPE=Release make android make test-android diff --git a/platform/android/platform.gyp b/platform/android/platform.gyp deleted file mode 100644 index f8e8b33b08..0000000000 --- a/platform/android/platform.gyp +++ /dev/null @@ -1,166 +0,0 @@ -{ - 'variables': { - 'loop_lib': 'android', - 'OS': 'android', - 'headless_lib': 'none', - 'coverage': 0, - }, - 'includes': [ - '../../mbgl.gypi', - ], - 'targets': [ - { - 'target_name': 'platform-lib', - 'product_name': 'mapbox-gl', - 'type': 'shared_library', - 'hard_dependency': 1, - 'dependencies': [ - 'core', - ], - - 'include_dirs': [ - '../default', - '../../include', - '../../src', # TODO: eliminate - ], - - 'sources': [ - 'src/native_map_view.cpp', - 'src/jni.cpp', - 'src/java_types.cpp', - 'src/attach_env.cpp', - 'src/log_android.cpp', - 'src/http_file_source.cpp', - 'src/asset_file_source.cpp', - 'src/thread.cpp', - 'src/style/value.cpp', - 'src/style/sources/sources.cpp', - 'src/style/layers/layers.cpp', - 'src/style/layers/layer.cpp', - 'src/style/layers/background_layer.cpp', - 'src/style/layers/circle_layer.cpp', - 'src/style/layers/fill_layer.cpp', - 'src/style/layers/line_layer.cpp', - 'src/style/layers/raster_layer.cpp', - 'src/style/layers/symbol_layer.cpp', - 'src/style/layers/custom_layer.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)', - '<@(geojson_cflags)', - '<@(rapidjson_cflags)', - '<@(nunicode_cflags)', - '<@(sqlite_cflags)', - '<@(jni.hpp_cflags)', - '<@(libzip_cflags)', - '<@(libpng_cflags)', - '<@(libjpeg-turbo_cflags)', - ], - - 'link_settings': { - 'libraries': [ - '-llog', - '-landroid', - '-lEGL', - '-lGLESv2', - '-lstdc++', - '-latomic', - '<@(nunicode_static_libs)', - '<@(nunicode_ldflags)', - '<@(sqlite_static_libs)', - '<@(sqlite_ldflags)', - '<@(zlib_static_libs)', - '<@(zlib_ldflags)', - '<@(libzip_static_libs)', - '<@(libzip_ldflags)', - '<@(libpng_static_libs)', - '<@(libpng_ldflags)', - '<@(libjpeg-turbo_static_libs)', - '<@(libjpeg-turbo_ldflags)', - '<@(geojson_static_libs)' - ], - }, - }, - { - 'target_name': 'example-custom-layer-lib', - 'product_name': 'example-custom-layer', - 'type': 'shared_library', - 'hard_dependency': 1, - - 'sources': [ - './src/example_custom_layer.cpp', - ], - - 'include_dirs': [ - '../../include', - ], - - 'link_settings': { - 'libraries': [ - '-llog', - '-landroid', - '-lEGL', - '-lGLESv2', - '-lstdc++', - '-latomic', - ], - }, - }, - { - 'target_name': 'all', - 'type': 'none', - 'hard_dependency': 1, - - 'dependencies': [ - 'platform-lib', - 'example-custom-layer-lib', - ], - - 'variables': { - 'pwd': '<!(pwd)', - }, - - 'copies': [ - { - 'files': [ - '../../common/ca-bundle.crt', - '../default/resources/api_mapbox_com-digicert.der', - '../default/resources/api_mapbox_com-geotrust.der', - '../default/resources/star_tilestream_net.der', - ], - 'destination': '<(DEPTH)/platform/android/MapboxGLAndroidSDK/src/main/assets' - }, - ], - - 'actions': [ - { - 'action_name': 'Strip mapbox library', - 'inputs': [ '<(PRODUCT_DIR)/lib.target/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': [ '<(DEPTH)/platform/android//MapboxGLAndroidSDKTestApp/src/main/jniLibs/$(JNIDIR)/libexample-custom-layer.so' ], - 'action': [ '$(STRIP)', '<@(_inputs)', '-o', '<@(_outputs)' ] - } - ], - }, - ], -} diff --git a/platform/android/scripts/configure.sh b/platform/android/scripts/configure.sh deleted file mode 100644 index 1c26108e11..0000000000 --- a/platform/android/scripts/configure.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -UNIQUE_RESOURCE_VERSION=dev -PROTOZERO_VERSION=1.3.0 -BOOST_VERSION=1.60.0 -LIBPNG_VERSION=1.6.20 -LIBJPEG_TURBO_VERSION=1.4.2 -SQLITE_VERSION=3.9.1 -ZLIB_VERSION=system -NUNICODE_VERSION=1.6 -LIBZIP_VERSION=0.11.2 -GEOMETRY_VERSION=0.8.0 -GEOJSON_VERSION=0.1.4 -GEOJSONVT_VERSION=6.1.2 -SUPERCLUSTER_VERSION=0.2.0 -KDBUSH_VERSION=0.1.1 -VARIANT_VERSION=1.1.0 -RAPIDJSON_VERSION=1.0.2 -JNI_HPP_VERSION=2.0.0 -EARCUT_VERSION=0.11 - -export MASON_ANDROID_ABI=${MASON_PLATFORM_VERSION} diff --git a/platform/ios/WorkspaceSettings.xcsettings b/platform/ios/WorkspaceSettings.xcsettings index a2d959210c..20a7accf01 100644 --- a/platform/ios/WorkspaceSettings.xcsettings +++ b/platform/ios/WorkspaceSettings.xcsettings @@ -3,11 +3,15 @@ <plist version="1.0"> <dict> <key>BuildLocationStyle</key> - <string>UseAppPreferences</string> + <string>CustomLocation</string> + <key>CustomBuildIntermediatesPath</key> + <string>../../build/ios</string> <key>CustomBuildLocationType</key> - <string>RelativeToDerivedData</string> + <string>RelativeToWorkspace</string> + <key>CustomBuildProductsPath</key> + <string>../../build/ios</string> <key>DerivedDataCustomLocation</key> - <string>../../build</string> + <string>../../build/ios</string> <key>DerivedDataLocationStyle</key> <string>WorkspaceRelativePath</string> <key>IssueFilterStyle</key> diff --git a/platform/ios/bitrise.yml b/platform/ios/bitrise.yml index 6e4771273f..f87a97b7d6 100644 --- a/platform/ios/bitrise.yml +++ b/platform/ios/bitrise.yml @@ -29,6 +29,7 @@ workflows: - content: |- #!/bin/bash set -eu -o pipefail + brew install cmake brew tap mapbox/homebrew-ios-sim-3 brew install mapbox/homebrew-ios-sim-3/ios-sim gem install xcpretty --no-rdoc --no-ri diff --git a/platform/ios/config.cmake b/platform/ios/config.cmake new file mode 100644 index 0000000000..28bef0cfeb --- /dev/null +++ b/platform/ios/config.cmake @@ -0,0 +1,60 @@ +macro(mbgl_platform_core) + set_xcode_property(mbgl-core IPHONEOS_DEPLOYMENT_TARGET "8.0") + set_xcode_property(mbgl-core ENABLE_BITCODE "YES") + set_xcode_property(mbgl-core BITCODE_GENERATION_MODE bitcode) + + target_sources(mbgl-core + # Loop + PRIVATE platform/darwin/src/async_task.cpp + PRIVATE platform/darwin/src/run_loop.cpp + PRIVATE platform/darwin/src/timer.cpp + + # File source + PRIVATE platform/darwin/src/http_file_source.mm + PRIVATE platform/default/asset_file_source.cpp + PRIVATE platform/default/default_file_source.cpp + PRIVATE platform/default/online_file_source.cpp + + # Offline + PRIVATE platform/default/mbgl/storage/offline.cpp + PRIVATE platform/default/mbgl/storage/offline_database.cpp + PRIVATE platform/default/mbgl/storage/offline_database.hpp + PRIVATE platform/default/mbgl/storage/offline_download.cpp + PRIVATE platform/default/mbgl/storage/offline_download.hpp + PRIVATE platform/default/sqlite3.cpp + PRIVATE platform/default/sqlite3.hpp + + # Misc + PRIVATE platform/darwin/src/log_nslog.mm + PRIVATE platform/darwin/src/nsthread.mm + PRIVATE platform/darwin/src/reachability.m + PRIVATE platform/darwin/src/string_nsstring.mm + + # Image handling + PRIVATE platform/darwin/src/image.mm + + # Headless view + PRIVATE platform/darwin/src/headless_view_eagl.mm + PRIVATE platform/default/headless_display.cpp + PRIVATE platform/default/headless_view.cpp + ) + + target_compile_options(mbgl-core + PRIVATE -fobjc-arc + ) + + # TODO: Remove this by converting to ARC + set_source_files_properties( + platform/darwin/src/headless_view_eagl.mm + PROPERTIES + COMPILE_FLAGS -fno-objc-arc + ) + + target_include_directories(mbgl-core + PRIVATE platform/default + ) + + target_link_libraries(mbgl-core + PUBLIC -lz + ) +endmacro()
\ No newline at end of file diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index bfd5a5e8a9..8fe54e7712 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ 40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */; }; 40FDA76B1CCAAA6800442548 /* MBXAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40FDA76A1CCAAA6800442548 /* MBXAnnotationView.m */; }; 554180421D2E97DE00012372 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 554180411D2E97DE00012372 /* OpenGLES.framework */; }; + 55D8C9961D0F18CE00F42F10 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 55D8C9951D0F18CE00F42F10 /* libsqlite3.tbd */; }; DA0CD5901CF56F6A00A5F5A5 /* MGLFeatureTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */; }; DA17BE301CC4BAC300402C41 /* MGLMapView_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */; }; DA17BE311CC4BDAA00402C41 /* MGLMapView_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */; }; @@ -156,7 +157,6 @@ DA88488B1CBB037E00AB86E3 /* SMCalloutView.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848891CBB037E00AB86E3 /* SMCalloutView.h */; }; DA88488C1CBB037E00AB86E3 /* SMCalloutView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88488A1CBB037E00AB86E3 /* SMCalloutView.m */; }; DA88488E1CBB047F00AB86E3 /* reachability.h in Headers */ = {isa = PBXBuildFile; fileRef = DA88488D1CBB047F00AB86E3 /* reachability.h */; }; - DA8848901CBB048E00AB86E3 /* reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88488F1CBB048E00AB86E3 /* reachability.m */; }; DA8933A31CCC95B000E68420 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA89339F1CCC951200E68420 /* Localizable.strings */; }; DA8933BC1CCD2CA100E68420 /* Foundation.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933BA1CCD2CA100E68420 /* Foundation.strings */; }; DA8933BF1CCD2CAD00E68420 /* Foundation.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DA8933BD1CCD2CAD00E68420 /* Foundation.stringsdict */; }; @@ -200,7 +200,6 @@ DAA4E4291CBB730400178DFB /* NSBundle+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848131CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m */; }; DAA4E42A1CBB730400178DFB /* NSProcessInfo+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848161CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m */; }; DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848181CBAFA6200AB86E3 /* NSString+MGLAdditions.m */; }; - DAA4E42C1CBB730400178DFB /* reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88488F1CBB048E00AB86E3 /* reachability.m */; }; DAA4E42D1CBB730400178DFB /* MGLAnnotationImage.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848411CBAFB9800AB86E3 /* MGLAnnotationImage.m */; }; DAA4E42E1CBB730400178DFB /* MGLAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848431CBAFB9800AB86E3 /* MGLAPIClient.m */; }; DAA4E42F1CBB730400178DFB /* MGLCompactCalloutView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848451CBAFB9800AB86E3 /* MGLCompactCalloutView.m */; }; @@ -211,7 +210,6 @@ DAA4E4341CBB730400178DFB /* MGLUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88484E1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m */; }; DAA4E4351CBB730400178DFB /* SMCalloutView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88488A1CBB037E00AB86E3 /* SMCalloutView.m */; }; DAABF73D1CBC59BB005B1825 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAABF73B1CBC59BB005B1825 /* libmbgl-core.a */; }; - DAABF73E1CBC59BB005B1825 /* libmbgl-platform-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAABF73C1CBC59BB005B1825 /* libmbgl-platform-ios.a */; }; DABCABAC1CB80692000A7C39 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DABCABAB1CB80692000A7C39 /* main.m */; }; DABCABAF1CB80692000A7C39 /* MBXBenchAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DABCABAE1CB80692000A7C39 /* MBXBenchAppDelegate.m */; }; DABCABB21CB80692000A7C39 /* MBXBenchViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = DABCABB11CB80692000A7C39 /* MBXBenchViewController.mm */; }; @@ -349,6 +347,8 @@ 40FDA7691CCAAA6800442548 /* MBXAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBXAnnotationView.h; sourceTree = "<group>"; }; 40FDA76A1CCAAA6800442548 /* MBXAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXAnnotationView.m; sourceTree = "<group>"; }; 554180411D2E97DE00012372 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 55D8C9941D0F133500F42F10 /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = config.xcconfig; path = ../../build/ios/config.xcconfig; sourceTree = "<group>"; }; + 55D8C9951D0F18CE00F42F10 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLFeatureTests.mm; path = ../../darwin/test/MGLFeatureTests.mm; sourceTree = "<group>"; }; DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapView_Internal.h; sourceTree = "<group>"; }; DA1DC94A1CB6C1C2006E619F /* Mapbox GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mapbox GL.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -495,7 +495,6 @@ DAA4E4061CBB5CBF00178DFB /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; DAA4E4131CBB71D400178DFB /* libMapbox.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMapbox.a; sourceTree = BUILT_PRODUCTS_DIR; }; DAABF73B1CBC59BB005B1825 /* libmbgl-core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libmbgl-core.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - DAABF73C1CBC59BB005B1825 /* libmbgl-platform-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libmbgl-platform-ios.a"; sourceTree = BUILT_PRODUCTS_DIR; }; DABCABA81CB80692000A7C39 /* Bench GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Bench GL.app"; sourceTree = BUILT_PRODUCTS_DIR; }; DABCABAB1CB80692000A7C39 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; DABCABAD1CB80692000A7C39 /* MBXBenchAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MBXBenchAppDelegate.h; sourceTree = "<group>"; }; @@ -507,7 +506,6 @@ DABCABBB1CB80692000A7C39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; DABCABBF1CB80717000A7C39 /* locations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = locations.cpp; sourceTree = "<group>"; }; DABCABC01CB80717000A7C39 /* locations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = locations.hpp; sourceTree = "<group>"; }; - DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = ../../build/ios/mbgl.xcconfig; sourceTree = "<group>"; }; DAC49C621CD07D74009E1AA3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; }; DAD165691CF41981001FF4B9 /* MGLFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLFeature.h; sourceTree = "<group>"; }; DAD1656A1CF41981001FF4B9 /* MGLFeature_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLFeature_Private.h; sourceTree = "<group>"; }; @@ -539,7 +537,7 @@ buildActionMask = 2147483647; files = ( DAABF73D1CBC59BB005B1825 /* libmbgl-core.a in Frameworks */, - DAABF73E1CBC59BB005B1825 /* libmbgl-platform-ios.a in Frameworks */, + 55D8C9961D0F18CE00F42F10 /* libsqlite3.tbd in Frameworks */, DA27C24E1CBB3811000B0ECD /* GLKit.framework in Frameworks */, DAA4E4051CBB5C9E00178DFB /* ImageIO.framework in Frameworks */, DAA4E4071CBB5CBF00178DFB /* MobileCoreServices.framework in Frameworks */, @@ -643,8 +641,8 @@ 36F1153B1D46080700878E1A /* libmbgl-core.a */, 36F1153C1D46080700878E1A /* libmbgl-platform-ios.a */, 554180411D2E97DE00012372 /* OpenGLES.framework */, + 55D8C9951D0F18CE00F42F10 /* libsqlite3.tbd */, DAABF73B1CBC59BB005B1825 /* libmbgl-core.a */, - DAABF73C1CBC59BB005B1825 /* libmbgl-platform-ios.a */, DAA4E4021CBB5C2F00178DFB /* CoreGraphics.framework */, DA27C24D1CBB3811000B0ECD /* GLKit.framework */, DAA4E4041CBB5C9E00178DFB /* ImageIO.framework */, @@ -848,7 +846,7 @@ isa = PBXGroup; children = ( DA35A2D11CCAB25200E826B2 /* jazzy.yml */, - DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */, + 55D8C9941D0F133500F42F10 /* config.xcconfig */, ); name = Configuration; sourceTree = "<group>"; @@ -1399,7 +1397,6 @@ DA88488C1CBB037E00AB86E3 /* SMCalloutView.m in Sources */, DA35A2B81CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAD1657A1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */, - DA8848901CBB048E00AB86E3 /* reachability.m in Sources */, DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, @@ -1457,7 +1454,6 @@ DAA4E41E1CBB730400178DFB /* MGLMapCamera.mm in Sources */, 4018B1C81CDC287F00F666AF /* MGLAnnotationView.mm in Sources */, DAA4E4341CBB730400178DFB /* MGLUserLocationAnnotationView.m in Sources */, - DAA4E42C1CBB730400178DFB /* reachability.m in Sources */, DAA4E4311CBB730400178DFB /* MGLMapboxEvents.m in Sources */, DAA4E4231CBB730400178DFB /* MGLPolygon.mm in Sources */, DAA4E42A1CBB730400178DFB /* NSProcessInfo+MGLAdditions.m in Sources */, @@ -1703,9 +1699,9 @@ }; DA2E885A1CC036F400F24E7B /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */; + baseConfigurationReference = 55D8C9941D0F133500F42F10 /* config.xcconfig */; buildSettings = { - HEADER_SEARCH_PATHS = ../../include; + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1722,9 +1718,9 @@ }; DA2E885B1CC036F400F24E7B /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */; + baseConfigurationReference = 55D8C9941D0F133500F42F10 /* config.xcconfig */; buildSettings = { - HEADER_SEARCH_PATHS = ../../include; + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1741,7 +1737,7 @@ }; DA8847DB1CBAF91600AB86E3 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */; + baseConfigurationReference = 55D8C9941D0F133500F42F10 /* config.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; CURRENT_PROJECT_VERSION = 1; @@ -1749,11 +1745,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - HEADER_SEARCH_PATHS = ( - ../default, - ../../include, - ../../src, - ); + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1767,12 +1759,7 @@ "$(geometry_cflags)", "$(geojson_cflags)", ); - OTHER_LDFLAGS = ( - "$(sqlite_ldflags)", - "$(zlib_ldflags)", - "$(opengl_ldflags)", - "$(geojson_static_libs)", - ); + OTHER_LDFLAGS = "$(mbgl_core_LINK_LIBRARIES)"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios; PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; @@ -1783,7 +1770,7 @@ }; DA8847DC1CBAF91600AB86E3 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */; + baseConfigurationReference = 55D8C9941D0F133500F42F10 /* config.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; CURRENT_PROJECT_VERSION = 1; @@ -1791,11 +1778,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - HEADER_SEARCH_PATHS = ( - ../default, - ../../include, - ../../src, - ); + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1809,12 +1792,7 @@ "$(geometry_cflags)", "$(geojson_cflags)", ); - OTHER_LDFLAGS = ( - "$(sqlite_ldflags)", - "$(zlib_ldflags)", - "$(opengl_ldflags)", - "$(geojson_static_libs)", - ); + OTHER_LDFLAGS = "$(mbgl_core_LINK_LIBRARIES)"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios; PRODUCT_NAME = Mapbox; SKIP_INSTALL = YES; @@ -1847,18 +1825,10 @@ }; DAA4E41A1CBB71D500178DFB /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */; + baseConfigurationReference = 55D8C9941D0F133500F42F10 /* config.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; - HEADER_SEARCH_PATHS = ( - ../default, - ../../include, - ../../src, - ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/build/Debug-iphoneos", - ); + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "$(sqlite_cflags)", @@ -1870,10 +1840,7 @@ ); OTHER_LDFLAGS = ( "-ObjC", - "$(sqlite_ldflags)", - "$(zlib_ldflags)", - "$(opengl_ldflags)", - "$(geojson_static_libs)", + "$(mbgl_core_LINK_LIBRARIES)", ); PRODUCT_NAME = Mapbox; PUBLIC_HEADERS_FOLDER_PATH = Headers; @@ -1883,18 +1850,10 @@ }; DAA4E41B1CBB71D500178DFB /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */; + baseConfigurationReference = 55D8C9941D0F133500F42F10 /* config.xcconfig */; buildSettings = { BITCODE_GENERATION_MODE = bitcode; - HEADER_SEARCH_PATHS = ( - ../default, - ../../include, - ../../src, - ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/build/Debug-iphoneos", - ); + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "$(sqlite_cflags)", @@ -1906,10 +1865,7 @@ ); OTHER_LDFLAGS = ( "-ObjC", - "$(sqlite_ldflags)", - "$(zlib_ldflags)", - "$(opengl_ldflags)", - "$(geojson_static_libs)", + "$(mbgl_core_LINK_LIBRARIES)", ); PRODUCT_NAME = Mapbox; PUBLIC_HEADERS_FOLDER_PATH = Headers; diff --git a/platform/ios/ios.xcworkspace/contents.xcworkspacedata b/platform/ios/ios.xcworkspace/contents.xcworkspacedata index 929ade2fee..08503d2be1 100644 --- a/platform/ios/ios.xcworkspace/contents.xcworkspacedata +++ b/platform/ios/ios.xcworkspace/contents.xcworkspacedata @@ -11,6 +11,6 @@ location = "group:uitest/KIF/KIF.xcodeproj"> </FileRef> <FileRef - location = "group:../../build/ios/platform/ios/platform.xcodeproj"> + location = "group:../../build/ios/mbgl.xcodeproj"> </FileRef> </Workspace> diff --git a/platform/ios/platform.gyp b/platform/ios/platform.gyp deleted file mode 100644 index 4cb26091d4..0000000000 --- a/platform/ios/platform.gyp +++ /dev/null @@ -1,149 +0,0 @@ -{ - 'variables': { - 'loop_lib': 'darwin', - 'headless_lib': 'eagl', - 'coverage': 0, - }, - 'includes': [ - '../../build/ios/config.gypi', - '../../mbgl.gypi', - '../../test/test.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', - }, - }], - ], - }, - 'targets': [ - { - 'target_name': 'test', - 'type': 'executable', - 'product_name': 'ios-test', - 'product_extension': 'app', - 'mac_bundle': 1, - - 'dependencies': [ - 'test-lib', - 'platform-lib', - ], - - 'sources': [ - '../../test/src/main.mm', -# '../../src/mbgl/util/premultiply.cpp', - ], - - 'xcode_settings': { - 'SDKROOT': 'iphoneos', - 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', - 'INFOPLIST_FILE': '../../test/src/app-info.plist', - 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', - 'TARGETED_DEVICE_FAMILY': '1,2', - 'COPY_PHASE_STRIP': 'NO', - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_ENABLE_MODULES': 'YES', - 'CODE_SIGN_IDENTITY': 'iPhone Developer', - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.MapboxGLUnitTest', - }, - - 'copies': [{ - 'destination': '<(PRODUCT_DIR)/$(WRAPPER_NAME)/test', - 'files': [ '../../test/fixtures' ], - }], - - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/CoreGraphics.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', - ], - }, - }, - { - '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 - '<(SHARED_INTERMEDIATE_DIR)/include', - ], - - '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_file_source.mm', - '../darwin/src/log_nslog.mm', - '../darwin/src/string_nsstring.mm', - '../darwin/src/image.mm', - '../darwin/src/nsthread.mm', - '../darwin/src/reachability.m', - ], - - 'variables': { - 'cflags_cc': [ - '<@(sqlite_cflags)', - '<@(zlib_cflags)', - '<@(rapidjson_cflags)', - ], - 'ldflags': [ - '<@(sqlite_ldflags)', - '<@(zlib_ldflags)', - ], - 'libraries': [ - '<@(sqlite_static_libs)', - '<@(zlib_static_libs)', - ], - }, - - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_ENABLE_MODULES': 'YES', - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'BITCODE_GENERATION_MODE': 'bitcode', - }, - },], - ], - - 'link_settings': { - 'libraries': [ '<@(libraries)' ], - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - }, - }, - }, - ], -} diff --git a/platform/ios/scripts/configure.sh b/platform/ios/scripts/configure.sh deleted file mode 100644 index 82599f0fe9..0000000000 --- a/platform/ios/scripts/configure.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -UNIQUE_RESOURCE_VERSION=dev -PROTOZERO_VERSION=1.3.0 -BOOST_VERSION=1.60.0 -SQLITE_VERSION=system -ZLIB_VERSION=system -GEOMETRY_VERSION=0.8.0 -GEOJSON_VERSION=0.1.4 -GEOJSONVT_VERSION=6.1.2 -SUPERCLUSTER_VERSION=0.2.0 -KDBUSH_VERSION=0.1.1 -VARIANT_VERSION=1.1.0 -RAPIDJSON_VERSION=1.0.2 -GTEST_VERSION=1.7.0 -PIXELMATCH_VERSION=0.9.0 -EARCUT_VERSION=0.11 diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index c012934203..b431bd689d 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -5,9 +5,9 @@ set -o pipefail set -u NAME=Mapbox -OUTPUT=build/ios/pkg +OUTPUT=platform/ios/pkg DERIVED_DATA=build/ios -PRODUCTS=${DERIVED_DATA}/Build/Products +PRODUCTS=${DERIVED_DATA} BUILDTYPE=${BUILDTYPE:-Debug} BUILD_FOR_DEVICE=${BUILD_DEVICE:-true} @@ -150,7 +150,7 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework/${NAME} \ -create -output ${OUTPUT}/dynamic/${NAME}.framework/${NAME} | echo fi - + cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/Settings.bundle ${STATIC_SETTINGS_DIR} else if [[ ${BUILD_STATIC} == true ]]; then @@ -175,7 +175,7 @@ else ${OUTPUT}/dynamic/ fi fi - + cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/Settings.bundle ${STATIC_SETTINGS_DIR} fi diff --git a/platform/ios/toolchain.cmake b/platform/ios/toolchain.cmake new file mode 100644 index 0000000000..60dbac07c7 --- /dev/null +++ b/platform/ios/toolchain.cmake @@ -0,0 +1,136 @@ +# From https://github.com/OtherLevels/ios-cmake +# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake +# files which are included with CMake 2.8.4 +# It has been altered for iOS development + +# Options: +# +# IOS_PLATFORM = OS (default) or SIMULATOR or SIMULATOR64 +# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders +# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch. +# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch. +# +# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder +# By default this location is automatcially chosen based on the IOS_PLATFORM value above. +# If set manually, it will override the default location and force the user of a particular Developer Platform +# +# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder +# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value. +# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path. +# If set manually, this will force the use of a specific SDK version + +# Macros: +# +# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE) +# A convenience macro for setting xcode specific properties on targets +# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1") +# +# find_host_package (PROGRAM ARGS) +# A macro used to find executable programs on the host system, not within the iOS environment. +# Thanks to the android-cmake project for providing the command + +# Standard settings +set (CMAKE_SYSTEM_NAME Darwin) +set (CMAKE_SYSTEM_VERSION 1) +set (UNIX True) +set (APPLE True) +set (IOS True) + +# Required as of cmake 2.8.10 +set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE) + +# Determine the cmake host system version so we know where to find the iOS SDKs +find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin) +if (CMAKE_UNAME) + exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) + string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") +endif (CMAKE_UNAME) + +# Force the compilers to gcc for iOS +include (CMakeForceCompiler) +set(XCODE_TOOLCHAIN /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain) +set(XCODE_BIN ${XCODE_TOOLCHAIN}/usr/bin) +set(CMAKE_C_COMPILER ${XCODE_BIN}/clang) +set(CMAKE_CXX_COMPILER ${XCODE_BIN}/clang++) +set(CMAKE_FIND_ROOT_PATH ${XCODE_TOOLCHAIN_ROOT}) +set(CMAKE_AR ar CACHE FILEPATH "" FORCE) + +# Skip the platform compiler checks for cross compiling +set (CMAKE_CXX_COMPILER_WORKS TRUE) +set (CMAKE_C_COMPILER_WORKS TRUE) + +# All iOS/Darwin specific settings - some may be redundant +set (CMAKE_SHARED_LIBRARY_PREFIX "lib") +set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set (CMAKE_SHARED_MODULE_PREFIX "lib") +set (CMAKE_SHARED_MODULE_SUFFIX ".so") +set (CMAKE_MODULE_EXISTS 1) +set (CMAKE_DL_LIBS "") + +set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") +set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") +set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") + + +# This was required for Other C++ Flags to be set for enabling bitcode in a static lib. +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode") + + +set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") +set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") + +set (CMAKE_PLATFORM_HAS_INSTALLNAME 1) +set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names") +set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names") +set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") +set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") +set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") + + +# Point to the latest SDK. +set (CMAKE_OSX_SYSROOT "iphoneos" CACHE string "Sysroot used for iOS support") + + + +set (CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" CACHE string "Build architecture for iOS") + +# Set the find root to the iOS developer roots and to user defined paths +set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root") + +# default to searching for frameworks first +set (CMAKE_FIND_FRAMEWORK FIRST) + +# set up the default search directories for frameworks +set (CMAKE_SYSTEM_FRAMEWORK_PATH + ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks + ${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks + ${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks +) + +# only search the iOS sdks, not the remainder of the host filesystem +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + + +# This little macro lets you set any XCode specific property +macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) + set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE}) +endmacro (set_xcode_property) + + +# This macro lets you find executable programs on the host system +macro (find_host_package) + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) + set (IOS FALSE) + + find_package(${ARGN}) + + set (IOS TRUE) + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endmacro (find_host_package) diff --git a/platform/linux/config.cmake b/platform/linux/config.cmake new file mode 100644 index 0000000000..814a249849 --- /dev/null +++ b/platform/linux/config.cmake @@ -0,0 +1,105 @@ +mason_use(glfw 3.1.2) +mason_use(boost_libprogram_options 1.60.0) +mason_use(sqlite 3.9.1) +mason_use(libuv 1.7.5) +mason_use(nunicode 1.6) +mason_use(libpng 1.6.20) +mason_use(libjpeg-turbo 1.4.2) +mason_use(webp 0.5.0) + +include(cmake/loop-uv.cmake) + +macro(mbgl_platform_core) + target_sources(mbgl-core + # File source + PRIVATE platform/default/asset_file_source.cpp + PRIVATE platform/default/default_file_source.cpp + PRIVATE platform/default/http_file_source.cpp + PRIVATE platform/default/online_file_source.cpp + + # Offline + PRIVATE platform/default/mbgl/storage/offline.cpp + PRIVATE platform/default/mbgl/storage/offline_database.cpp + PRIVATE platform/default/mbgl/storage/offline_database.hpp + PRIVATE platform/default/mbgl/storage/offline_download.cpp + PRIVATE platform/default/mbgl/storage/offline_download.hpp + PRIVATE platform/default/sqlite3.cpp + PRIVATE platform/default/sqlite3.hpp + + # Misc + PRIVATE platform/default/log_stderr.cpp + PRIVATE platform/default/string_stdlib.cpp + PRIVATE platform/default/thread.cpp + + # Image handling + PRIVATE platform/default/image.cpp + PRIVATE platform/default/jpeg_reader.cpp + PRIVATE platform/default/png_reader.cpp + PRIVATE platform/default/webp_reader.cpp + + # Headless view + PRIVATE platform/default/headless_display.cpp + PRIVATE platform/default/headless_view.cpp + PRIVATE platform/default/headless_view_glx.cpp + ) + + target_include_directories(mbgl-core + PRIVATE platform/default + ) + + target_add_mason_package(mbgl-core PUBLIC sqlite) + target_add_mason_package(mbgl-core PUBLIC nunicode) + target_add_mason_package(mbgl-core PUBLIC libpng) + target_add_mason_package(mbgl-core PUBLIC libjpeg-turbo) + target_add_mason_package(mbgl-core PUBLIC webp) + + target_link_libraries(mbgl-core + PUBLIC -lz + PUBLIC -lcurl + PUBLIC -lGL + PUBLIC -lX11 + ) +endmacro() + + +macro(mbgl_platform_glfw) + target_link_libraries(mbgl-glfw + PRIVATE mbgl-loop + ) +endmacro() + + +macro(mbgl_platform_render) + target_link_libraries(mbgl-render + PRIVATE mbgl-loop + ) +endmacro() + + +macro(mbgl_platform_offline) + target_link_libraries(mbgl-offline + PRIVATE mbgl-loop + ) +endmacro() + + +macro(mbgl_platform_test) + target_sources(mbgl-test + PRIVATE test/src/main.cpp + ) + + set_source_files_properties( + test/src/main.cpp + PROPERTIES + COMPILE_FLAGS -DWORK_DIRECTORY="${CMAKE_SOURCE_DIR}" + ) + + target_link_libraries(mbgl-test + PRIVATE mbgl-loop + ) +endmacro() + + +macro(mbgl_platform_node) + # Enabling node module by defining this macro +endmacro() diff --git a/platform/linux/ninja b/platform/linux/ninja Binary files differnew file mode 100755 index 0000000000..189832fdb4 --- /dev/null +++ b/platform/linux/ninja diff --git a/platform/linux/platform.gyp b/platform/linux/platform.gyp deleted file mode 100644 index 7adf5337c4..0000000000 --- a/platform/linux/platform.gyp +++ /dev/null @@ -1,125 +0,0 @@ -{ - 'variables': { - 'loop_lib': 'uv', - 'headless_lib': 'glx', - 'coverage': '<!(echo $ENABLE_COVERAGE)>', - }, - 'conditions': [ - ['OS == "mac"', { - 'variables': { - 'headless_lib': 'cgl', - } - }], - ], - 'includes': [ - '../../mbgl.gypi', - '../../test/test.gypi', - '../../benchmark/benchmark.gypi', - '../../bin/glfw.gypi', - '../../bin/render.gypi', - '../../bin/offline.gypi', - ], - 'targets': [ - { - 'target_name': 'test', - 'type': 'executable', - - 'dependencies': [ - 'test-lib', - 'platform-lib', - 'copy_certificate_bundle', - ], - - 'sources': [ - '../../test/src/main.cpp', - ], - }, - { - 'target_name': 'benchmark', - 'type': 'executable', - - 'dependencies': [ - 'benchmark-lib', - 'platform-lib', - ], - - 'sources': [ - '../../benchmark/src/main.cpp', - ], - }, - { - '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_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', - ], - - 'cflags_cc': [ - '<@(boost_cflags)', - '<@(nunicode_cflags)', - '<@(sqlite_cflags)', - '<@(rapidjson_cflags)', - '<@(libcurl_cflags)', - '<@(libpng_cflags)', - '<@(libjpeg-turbo_cflags)', - '<@(webp_cflags)', - ], - - 'link_settings': { - 'libraries': [ - '<@(nunicode_static_libs)', - '<@(nunicode_ldflags)', - '<@(sqlite_static_libs)', - '<@(sqlite_ldflags)', - '<@(zlib_static_libs)', - '<@(zlib_ldflags)', - '<@(libcurl_static_libs)', - '<@(libcurl_ldflags)', - '<@(libpng_static_libs)', - '<@(libpng_ldflags)', - '<@(libjpeg-turbo_static_libs)', - '<@(libjpeg-turbo_ldflags)', - '<@(webp_static_libs)', - '<@(webp_ldflags)', - ], - }, - - 'direct_dependent_settings': { - 'include_dirs': [ - '../include', - ], - }, - }, - ], -} diff --git a/platform/linux/scripts/configure.sh b/platform/linux/scripts/configure.sh deleted file mode 100644 index 3d37994868..0000000000 --- a/platform/linux/scripts/configure.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -CXX11ABI=${CXX11ABI:-$(scripts/check-cxx11abi.sh)} - -UNIQUE_RESOURCE_VERSION=dev -PROTOZERO_VERSION=1.3.0 -BOOST_VERSION=1.60.0 -BOOST_LIBPROGRAM_OPTIONS_VERSION=1.60.0 -LIBCURL_VERSION=system -GLFW_VERSION=3.1.2 -LIBPNG_VERSION=1.6.20 -LIBJPEG_TURBO_VERSION=1.4.2 -SQLITE_VERSION=3.9.1 -LIBUV_VERSION=1.7.5 -ZLIB_VERSION=system -NUNICODE_VERSION=1.6 -GEOMETRY_VERSION=0.8.0 -GEOJSON_VERSION=0.1.4${CXX11ABI:-} -GEOJSONVT_VERSION=6.1.2 -SUPERCLUSTER_VERSION=0.2.0 -KDBUSH_VERSION=0.1.1 -VARIANT_VERSION=1.1.0 -RAPIDJSON_VERSION=1.0.2 -GTEST_VERSION=1.7.0${CXX11ABI:-} -PIXELMATCH_VERSION=0.9.0 -WEBP_VERSION=0.5.0 -EARCUT_VERSION=0.11 -BENCHMARK_VERSION=1.0.0 - -function print_opengl_flags { - CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN - CONFIG+=" 'opengl_ldflags%': $(quote_flags $(pkg-config gl x11 --libs)),"$LN -} diff --git a/platform/macos/WorkspaceSettings.xcsettings b/platform/macos/WorkspaceSettings.xcsettings index a2d959210c..88a45c15ce 100644 --- a/platform/macos/WorkspaceSettings.xcsettings +++ b/platform/macos/WorkspaceSettings.xcsettings @@ -3,11 +3,15 @@ <plist version="1.0"> <dict> <key>BuildLocationStyle</key> - <string>UseAppPreferences</string> + <string>CustomLocation</string> + <key>CustomBuildIntermediatesPath</key> + <string>../../build/macos</string> <key>CustomBuildLocationType</key> - <string>RelativeToDerivedData</string> + <string>RelativeToWorkspace</string> + <key>CustomBuildProductsPath</key> + <string>../../build/macos</string> <key>DerivedDataCustomLocation</key> - <string>../../build</string> + <string>../../build/macos</string> <key>DerivedDataLocationStyle</key> <string>WorkspaceRelativePath</string> <key>IssueFilterStyle</key> diff --git a/platform/macos/bitrise.yml b/platform/macos/bitrise.yml index ce622ef0f8..0987049437 100644 --- a/platform/macos/bitrise.yml +++ b/platform/macos/bitrise.yml @@ -29,6 +29,7 @@ workflows: - content: |- #!/bin/bash set -eu -o pipefail + brew install cmake gem install xcpretty --no-rdoc --no-ri export BUILDTYPE=Debug make macos diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake new file mode 100644 index 0000000000..fcb2c9a3e3 --- /dev/null +++ b/platform/macos/config.cmake @@ -0,0 +1,113 @@ +mason_use(glfw 3.1.2) +mason_use(boost_libprogram_options 1.60.0) + +include(cmake/loop-darwin.cmake) + +macro(mbgl_platform_core) + target_sources(mbgl-core + # File source + PRIVATE platform/darwin/src/http_file_source.mm + PRIVATE platform/default/asset_file_source.cpp + PRIVATE platform/default/default_file_source.cpp + PRIVATE platform/default/online_file_source.cpp + + # Offline + PRIVATE platform/default/mbgl/storage/offline.cpp + PRIVATE platform/default/mbgl/storage/offline_database.cpp + PRIVATE platform/default/mbgl/storage/offline_database.hpp + PRIVATE platform/default/mbgl/storage/offline_download.cpp + PRIVATE platform/default/mbgl/storage/offline_download.hpp + PRIVATE platform/default/sqlite3.cpp + PRIVATE platform/default/sqlite3.hpp + + # Misc + PRIVATE platform/darwin/src/log_nslog.mm + PRIVATE platform/darwin/src/nsthread.mm + PRIVATE platform/darwin/src/reachability.m + PRIVATE platform/darwin/src/string_nsstring.mm + + # Image handling + PRIVATE platform/darwin/src/image.mm + + # Headless view + PRIVATE platform/darwin/src/headless_view_cgl.cpp + PRIVATE platform/default/headless_display.cpp + PRIVATE platform/default/headless_view.cpp + ) + + target_compile_options(mbgl-core + PRIVATE -fobjc-arc + ) + + target_include_directories(mbgl-core + PRIVATE platform/default + ) + + target_link_libraries(mbgl-core + PUBLIC -lz + ) +endmacro() + + +macro(mbgl_platform_glfw) + target_link_libraries(mbgl-glfw + PRIVATE mbgl-loop + PRIVATE "-lsqlite3" + ) +endmacro() + + +macro(mbgl_platform_render) + target_link_libraries(mbgl-render + PRIVATE mbgl-loop + PRIVATE "-framework Foundation" + PRIVATE "-framework CoreGraphics" + PRIVATE "-framework OpenGL" + PRIVATE "-framework ImageIO" + PRIVATE "-framework CoreServices" + PRIVATE "-lsqlite3" + ) +endmacro() + + +macro(mbgl_platform_offline) + target_link_libraries(mbgl-offline + PRIVATE mbgl-loop + PRIVATE "-framework Foundation" + PRIVATE "-framework CoreGraphics" + PRIVATE "-framework OpenGL" + PRIVATE "-framework ImageIO" + PRIVATE "-framework CoreServices" + PRIVATE "-lsqlite3" + ) +endmacro() + + +macro(mbgl_platform_test) + target_sources(mbgl-test + PRIVATE test/src/main.cpp + ) + + set_source_files_properties( + test/src/main.cpp + PROPERTIES + COMPILE_FLAGS -DWORK_DIRECTORY="${CMAKE_SOURCE_DIR}" + ) + + target_link_libraries(mbgl-test + PRIVATE mbgl-loop + PRIVATE "-framework Foundation" + PRIVATE "-framework CoreGraphics" + PRIVATE "-framework OpenGL" + PRIVATE "-framework ImageIO" + PRIVATE "-framework CoreServices" + PRIVATE "-lsqlite3" + ) +endmacro() + + +macro(mbgl_platform_node) + target_link_libraries(mbgl-node + PRIVATE "-framework Foundation" + ) +endmacro() diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index ed980294a9..25af9015ac 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -8,6 +8,10 @@ /* Begin PBXBuildFile section */ 52BECB0A1CC5A26F009CD791 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */; }; + 5548BE781D09E718005DDE81 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; }; + 5548BE7D1D0ACCD6005DDE81 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; }; + 558F18221D0B13B100123F46 /* libmbgl-loop.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 558F18211D0B13B000123F46 /* libmbgl-loop.a */; }; + 55D9B4B11D005D3900C1CCE2 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 55D9B4B01D005D3900C1CCE2 /* libz.tbd */; }; DA0CD58E1CF56F5800A5F5A5 /* MGLFeatureTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */; }; DA35A2A41CC9EB1A00E826B2 /* MGLCoordinateFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA35A2A61CC9EB2700E826B2 /* MGLCoordinateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */; }; @@ -31,7 +35,6 @@ DA8933AE1CCD290700E68420 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933AB1CCD290700E68420 /* Localizable.strings */; }; DA8933B51CCD2C2500E68420 /* Foundation.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933B31CCD2C2500E68420 /* Foundation.strings */; }; DA8933B81CCD2C2D00E68420 /* Foundation.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DA8933B61CCD2C2D00E68420 /* Foundation.stringsdict */; }; - DAB6924A1CC75A31005AAB54 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; }; DAC2ABC51CC6D343006D18C4 /* MGLAnnotationImage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */; }; DACC22141CF3D3E200D220D9 /* MGLFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = DACC22121CF3D3E200D220D9 /* MGLFeature.h */; settings = {ATTRIBUTES = (Public, ); }; }; DACC22151CF3D3E200D220D9 /* MGLFeature.mm in Sources */ = {isa = PBXBuildFile; fileRef = DACC22131CF3D3E200D220D9 /* MGLFeature.mm */; }; @@ -46,8 +49,6 @@ DAE6C3321CC30DB200DB3429 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3281CC30DB200DB3429 /* Mapbox.framework */; }; DAE6C33D1CC30DB200DB3429 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3281CC30DB200DB3429 /* Mapbox.framework */; }; DAE6C33E1CC30DB200DB3429 /* Mapbox.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3281CC30DB200DB3429 /* Mapbox.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - DAE6C3471CC31D1200DB3429 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; }; - DAE6C3481CC31D1200DB3429 /* libmbgl-platform-macos.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3461CC31D1200DB3429 /* libmbgl-platform-macos.a */; }; DAE6C35A1CC31E0400DB3429 /* MGLAccountManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE6C34A1CC31E0400DB3429 /* MGLAccountManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; DAE6C35B1CC31E0400DB3429 /* MGLAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE6C34B1CC31E0400DB3429 /* MGLAnnotation.h */; settings = {ATTRIBUTES = (Public, ); }; }; DAE6C35C1CC31E0400DB3429 /* MGLGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE6C34C1CC31E0400DB3429 /* MGLGeometry.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -148,6 +149,11 @@ /* Begin PBXFileReference section */ 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + 5548BE791D0ACBB2005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = "<group>"; }; + 5548BE7B1D0ACBBD005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = "<group>"; }; + 558F18211D0B13B000123F46 /* libmbgl-loop.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop.a"; path = "../../build/osx/Debug/libmbgl-loop.a"; sourceTree = "<group>"; }; + 55D9B4B01D005D3900C1CCE2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 55FE0E8D1D100A0900FD240B /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = config.xcconfig; path = ../../build/macos/config.xcconfig; sourceTree = "<group>"; }; DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLFeatureTests.mm; path = ../../darwin/test/MGLFeatureTests.mm; sourceTree = "<group>"; }; DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCoordinateFormatter.h; sourceTree = "<group>"; }; DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLCoordinateFormatter.m; sourceTree = "<group>"; }; @@ -255,7 +261,6 @@ DAE6C3BB1CC31F2E00DB3429 /* default_marker.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = default_marker.pdf; sourceTree = "<group>"; }; DAE6C3BC1CC31F2E00DB3429 /* mapbox.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = mapbox.pdf; sourceTree = "<group>"; }; DAE6C3C11CC31F4500DB3429 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mapbox.h; path = src/Mapbox.h; sourceTree = SOURCE_ROOT; }; - DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = ../../build/macos/mbgl.xcconfig; sourceTree = "<group>"; }; DAE6C3C61CC3499100DB3429 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLGeometryTests.mm; path = ../../darwin/test/MGLGeometryTests.mm; sourceTree = "<group>"; }; DAE6C3C91CC34BD800DB3429 /* MGLOfflinePackTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflinePackTests.m; path = ../../darwin/test/MGLOfflinePackTests.m; sourceTree = "<group>"; }; @@ -278,9 +283,10 @@ buildActionMask = 2147483647; files = ( 52BECB0A1CC5A26F009CD791 /* SystemConfiguration.framework in Frameworks */, - DAE6C3471CC31D1200DB3429 /* libmbgl-core.a in Frameworks */, - DAE6C3481CC31D1200DB3429 /* libmbgl-platform-macos.a in Frameworks */, + 5548BE781D09E718005DDE81 /* libmbgl-core.a in Frameworks */, + 558F18221D0B13B100123F46 /* libmbgl-loop.a in Frameworks */, DAE6C3C71CC3499100DB3429 /* libsqlite3.tbd in Frameworks */, + 55D9B4B11D005D3900C1CCE2 /* libz.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -288,8 +294,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DAB6924A1CC75A31005AAB54 /* libmbgl-core.a in Frameworks */, DAE6C3321CC30DB200DB3429 /* Mapbox.framework in Frameworks */, + 5548BE7D1D0ACCD6005DDE81 /* libmbgl-core.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -451,6 +457,10 @@ DAE6C31E1CC308BC00DB3429 /* Frameworks */ = { isa = PBXGroup; children = ( + 558F18211D0B13B000123F46 /* libmbgl-loop.a */, + 5548BE7B1D0ACBBD005DDE81 /* libmbgl-loop-darwin.a */, + 5548BE791D0ACBB2005DDE81 /* libmbgl-loop-darwin.a */, + 55D9B4B01D005D3900C1CCE2 /* libz.tbd */, 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */, DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */, DAE6C3461CC31D1200DB3429 /* libmbgl-platform-macos.a */, @@ -538,7 +548,7 @@ DAE6C3C41CC31F7800DB3429 /* Configuration */ = { isa = PBXGroup; children = ( - DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */, + 55FE0E8D1D100A0900FD240B /* config.xcconfig */, ); name = Configuration; sourceTree = "<group>"; @@ -924,7 +934,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; + SYMROOT = "$(PROJECT_DIR)/cmake"; }; name = Debug; }; @@ -961,7 +971,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; + SYMROOT = "$(PROJECT_DIR)/cmake"; }; name = Release; }; @@ -1016,7 +1026,7 @@ }; DAE6C33F1CC30DB200DB3429 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */; + baseConfigurationReference = 55FE0E8D1D100A0900FD240B /* config.xcconfig */; buildSettings = { COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -1026,25 +1036,15 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = ( - ../default, - ../../include, - ../../src, + "$(mbgl_core_INCLUDE_DIRECTORIES)", + "$(mbgl_loop_INCLUDE_DIRECTORIES)", ); INFOPLIST_FILE = "$(SRCROOT)/sdk/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - OTHER_CPLUSPLUSFLAGS = ( - "$(OTHER_CFLAGS)", - "$(zlib_cflags)", - "$(rapidjson_cflags)", - "$(variant_cflags)", - "$(geometry_cflags)", - "$(geojson_cflags)", - ); OTHER_LDFLAGS = ( - "$(zlib_ldflags)", - "$(opengl_ldflags)", - "$(geojson_static_libs)", + "$(mbgl_core_LINK_LIBRARIES)", + "$(mbgl_loop_LINK_LIBRARIES)", ); PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = Mapbox; @@ -1056,7 +1056,7 @@ }; DAE6C3401CC30DB200DB3429 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */; + baseConfigurationReference = 55FE0E8D1D100A0900FD240B /* config.xcconfig */; buildSettings = { COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -1066,25 +1066,15 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = ( - ../default, - ../../include, - ../../src, + "$(mbgl_core_INCLUDE_DIRECTORIES)", + "$(mbgl_loop_INCLUDE_DIRECTORIES)", ); INFOPLIST_FILE = "$(SRCROOT)/sdk/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - OTHER_CPLUSPLUSFLAGS = ( - "$(OTHER_CFLAGS)", - "$(zlib_cflags)", - "$(rapidjson_cflags)", - "$(variant_cflags)", - "$(geometry_cflags)", - "$(geojson_cflags)", - ); OTHER_LDFLAGS = ( - "$(zlib_ldflags)", - "$(opengl_ldflags)", - "$(geojson_static_libs)", + "$(mbgl_core_LINK_LIBRARIES)", + "$(mbgl_loop_LINK_LIBRARIES)", ); PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = Mapbox; @@ -1096,10 +1086,10 @@ }; DAE6C3411CC30DB200DB3429 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */; + baseConfigurationReference = 55FE0E8D1D100A0900FD240B /* config.xcconfig */; buildSettings = { COMBINE_HIDPI_IMAGES = YES; - HEADER_SEARCH_PATHS = ../../include; + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; OTHER_CPLUSPLUSFLAGS = ( @@ -1115,10 +1105,10 @@ }; DAE6C3421CC30DB200DB3429 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */; + baseConfigurationReference = 55FE0E8D1D100A0900FD240B /* config.xcconfig */; buildSettings = { COMBINE_HIDPI_IMAGES = YES; - HEADER_SEARCH_PATHS = ../../include; + HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; OTHER_CPLUSPLUSFLAGS = ( diff --git a/platform/macos/macos.xcworkspace/contents.xcworkspacedata b/platform/macos/macos.xcworkspace/contents.xcworkspacedata index 67a33490e9..65341f19fa 100644 --- a/platform/macos/macos.xcworkspace/contents.xcworkspacedata +++ b/platform/macos/macos.xcworkspace/contents.xcworkspacedata @@ -5,6 +5,6 @@ location = "container:macos.xcodeproj"> </FileRef> <FileRef - location = "group:../../build/macos/platform/macos/platform.xcodeproj"> + location = "group:../../build/macos/mbgl.xcodeproj"> </FileRef> </Workspace> diff --git a/platform/macos/macos.xcworkspace/xcshareddata/xcschemes/mbgl-offline.xcscheme b/platform/macos/macos.xcworkspace/xcshareddata/xcschemes/mbgl-offline.xcscheme deleted file mode 100644 index 90ba9db153..0000000000 --- a/platform/macos/macos.xcworkspace/xcshareddata/xcschemes/mbgl-offline.xcscheme +++ /dev/null @@ -1,92 +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 = "960D5BDFBD73C605ACCF58C2" - BuildableName = "mbgl-offline" - BlueprintName = "mbgl-offline" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> - </BuildableReference> - </BuildActionEntry> - </BuildActionEntries> - </BuildAction> - <TestAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - </Testables> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "960D5BDFBD73C605ACCF58C2" - BuildableName = "mbgl-offline" - BlueprintName = "mbgl-offline" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "YES" - customWorkingDirectory = "$(PROJECT_DIR)/../.." - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "960D5BDFBD73C605ACCF58C2" - BuildableName = "mbgl-offline" - BlueprintName = "mbgl-offline" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - debugDocumentVersioning = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "960D5BDFBD73C605ACCF58C2" - BuildableName = "mbgl-offline" - BlueprintName = "mbgl-offline" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - </ProfileAction> - <AnalyzeAction - buildConfiguration = "Debug"> - </AnalyzeAction> - <ArchiveAction - buildConfiguration = "Release" - revealArchiveInOrganizer = "YES"> - </ArchiveAction> -</Scheme> diff --git a/platform/macos/ninja b/platform/macos/ninja Binary files differnew file mode 100755 index 0000000000..64fcacc550 --- /dev/null +++ b/platform/macos/ninja diff --git a/platform/macos/platform.gyp b/platform/macos/platform.gyp deleted file mode 100644 index 68ab4ce467..0000000000 --- a/platform/macos/platform.gyp +++ /dev/null @@ -1,104 +0,0 @@ -{ - 'variables': { - 'loop_lib': 'darwin', - 'headless_lib': 'cgl', - 'coverage': 0, - }, - 'includes': [ - '../../build/macos/config.gypi', - '../../mbgl.gypi', - '../../test/test.gypi', - '../../benchmark/benchmark.gypi', - '../../bin/glfw.gypi', - '../../bin/render.gypi', - '../../bin/offline.gypi', - ], - 'targets': [ - { - 'target_name': 'test', - 'type': 'executable', - - 'dependencies': [ - 'test-lib', - 'platform-lib', - ], - - 'sources': [ - '../../test/src/main.cpp', - ], - }, - { - 'target_name': 'benchmark', - 'type': 'executable', - - 'dependencies': [ - 'benchmark-lib', - 'platform-lib', - ], - - 'sources': [ - '../../benchmark/src/main.cpp', - ], - }, - { - 'target_name': 'platform-lib', - 'product_name': 'mbgl-platform-macos', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'core', - ], - - 'include_dirs': [ - 'include', - '../darwin/include', - '../default', - '../../include', - '../../src', # TODO: eliminate - '<(SHARED_INTERMEDIATE_DIR)/include', - ], - - '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_file_source.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': [ - '<@(sqlite_cflags)', - '<@(zlib_cflags)', - '<@(rapidjson_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', - ], - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '<@(zlib_ldflags)' ], - }, - }, - }, - ], -} diff --git a/platform/macos/scripts/configure.sh b/platform/macos/scripts/configure.sh deleted file mode 100644 index d408eef7e4..0000000000 --- a/platform/macos/scripts/configure.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -UNIQUE_RESOURCE_VERSION=dev -PROTOZERO_VERSION=1.3.0 -BOOST_VERSION=1.60.0 -BOOST_LIBPROGRAM_OPTIONS_VERSION=1.60.0 -GLFW_VERSION=3.1.2 -SQLITE_VERSION=3.9.1 -ZLIB_VERSION=system -NUNICODE_VERSION=1.6 -GEOMETRY_VERSION=0.8.0 -GEOJSON_VERSION=0.1.4 -GEOJSONVT_VERSION=6.1.2 -SUPERCLUSTER_VERSION=0.2.0 -KDBUSH_VERSION=0.1.1 -VARIANT_VERSION=1.1.0 -RAPIDJSON_VERSION=1.0.2 -GTEST_VERSION=1.7.0 -PIXELMATCH_VERSION=0.9.0 -EARCUT_VERSION=0.11 -BENCHMARK_VERSION=1.0.0 diff --git a/platform/macos/scripts/create_scheme.sh b/platform/macos/scripts/create_scheme.sh new file mode 100755 index 0000000000..71f0e0855b --- /dev/null +++ b/platform/macos/scripts/create_scheme.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -u + +CONTAINER=build/macos/mbgl.xcodeproj +OUTPUT="${CONTAINER}/xcshareddata/xcschemes/${SCHEME_NAME}.xcscheme" + +# Required ENV vars: +# - SCHEME_TYPE: type of the scheme +# - SCHEME_NAME: name of the scheme + +# Optional ENV vars: +# - NODE_ARGUMENT (defaults to "") +# - BUILDABLE_NAME (defaults ot SCHEME_NAME) +# - BLUEPRINT_NAME (defaults ot SCHEME_NAME) + + +# Try to reuse the existing Blueprint ID if the scheme already exists. +if [ -f "${OUTPUT}" ]; then + BLUEPRINT_ID=$(sed -n "s/[ \t]*BlueprintIdentifier *= *\"\([A-Z0-9]\{24\}\)\"/\\1/p" "${OUTPUT}" | head -1) +fi + +NODE_ARGUMENT=${NODE_ARGUMENT:-} +MAPBOX_ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN:-} +BLUEPRINT_ID=${BLUEPRINT_ID:-$(hexdump -n 12 -v -e '/1 "%02X"' /dev/urandom)} +BUILDABLE_NAME=${BUILDABLE_NAME:-${SCHEME_NAME}} +BLUEPRINT_NAME=${BLUEPRINT_NAME:-${SCHEME_NAME}} + +mkdir -p "${CONTAINER}/xcshareddata/xcschemes" + +sed "\ +s#{{BLUEPRINT_ID}}#${BLUEPRINT_ID}#;\ +s#{{BLUEPRINT_NAME}}#${BLUEPRINT_NAME}#;\ +s#{{BUILDABLE_NAME}}#${BUILDABLE_NAME}#;\ +s#{{CONTAINER}}#${CONTAINER}#;\ +s#{{MAPBOX_ACCESS_TOKEN}}#${MAPBOX_ACCESS_TOKEN}#;\ +s#{{WORKING_DIRECTORY}}#$(pwd)#;\ +s#{{NODE_PATH}}#$(dirname `which node`)#;\ +s#{{NODE_ARGUMENT}}#${NODE_ARGUMENT}#" \ + platform/macos/scripts/${SCHEME_TYPE}.xcscheme > "${OUTPUT}" diff --git a/platform/macos/macos.xcworkspace/xcshareddata/xcschemes/test.xcscheme b/platform/macos/scripts/executable.xcscheme index bc8a3350f1..4353aad846 100644 --- a/platform/macos/macos.xcworkspace/xcshareddata/xcschemes/test.xcscheme +++ b/platform/macos/scripts/executable.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0720" + LastUpgradeVersion = "0730" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -14,10 +14,10 @@ buildForAnalyzing = "YES"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "DC37A7F85AC5E5958672B4F8" - BuildableName = "test" - BlueprintName = "test" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </BuildActionEntry> </BuildActionEntries> @@ -32,10 +32,10 @@ <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "DC37A7F85AC5E5958672B4F8" - BuildableName = "test" - BlueprintName = "test" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </MacroExpansion> <AdditionalOptions> @@ -46,8 +46,7 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" - useCustomWorkingDirectory = "YES" - customWorkingDirectory = "$(PROJECT_DIR)/../.." + useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" @@ -56,10 +55,10 @@ runnableDebuggingMode = "0"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "DC37A7F85AC5E5958672B4F8" - BuildableName = "test" - BlueprintName = "test" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </BuildableProductRunnable> <CommandLineArguments> @@ -68,6 +67,13 @@ isEnabled = "NO"> </CommandLineArgument> </CommandLineArguments> + <EnvironmentVariables> + <EnvironmentVariable + key = "MAPBOX_ACCESS_TOKEN" + value = "{{MAPBOX_ACCESS_TOKEN}}" + isEnabled = "YES"> + </EnvironmentVariable> + </EnvironmentVariables> <AdditionalOptions> </AdditionalOptions> </LaunchAction> @@ -81,10 +87,10 @@ runnableDebuggingMode = "0"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "DC37A7F85AC5E5958672B4F8" - BuildableName = "test" - BlueprintName = "test" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </BuildableProductRunnable> </ProfileAction> diff --git a/platform/macos/macos.xcworkspace/xcshareddata/xcschemes/mbgl-render.xcscheme b/platform/macos/scripts/library.xcscheme index c176861999..012bc900c2 100644 --- a/platform/macos/macos.xcworkspace/xcshareddata/xcschemes/mbgl-render.xcscheme +++ b/platform/macos/scripts/library.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0720" + LastUpgradeVersion = "0730" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -14,10 +14,10 @@ buildForAnalyzing = "YES"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "D27AE71B9B193AD277AD4CFE" - BuildableName = "mbgl-render" - BlueprintName = "mbgl-render" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </BuildActionEntry> </BuildActionEntries> @@ -29,15 +29,6 @@ shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> </Testables> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D27AE71B9B193AD277AD4CFE" - BuildableName = "mbgl-render" - BlueprintName = "mbgl-render" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> - </BuildableReference> - </MacroExpansion> <AdditionalOptions> </AdditionalOptions> </TestAction> @@ -46,22 +37,20 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" - useCustomWorkingDirectory = "YES" - customWorkingDirectory = "$(PROJECT_DIR)/../.." + useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> + <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "D27AE71B9B193AD277AD4CFE" - BuildableName = "mbgl-render" - BlueprintName = "mbgl-render" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> - </BuildableProductRunnable> + </MacroExpansion> <AdditionalOptions> </AdditionalOptions> </LaunchAction> @@ -71,16 +60,15 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> + <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "D27AE71B9B193AD277AD4CFE" - BuildableName = "mbgl-render" - BlueprintName = "mbgl-render" - ReferencedContainer = "container:../../build/macos/platform/macos/platform.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> - </BuildableProductRunnable> + </MacroExpansion> </ProfileAction> <AnalyzeAction buildConfiguration = "Debug"> diff --git a/platform/macos/scripts/macostest.xcscheme b/platform/macos/scripts/macostest.xcscheme deleted file mode 100644 index ba6f6a6f4b..0000000000 --- a/platform/macos/scripts/macostest.xcscheme +++ /dev/null @@ -1,56 +0,0 @@ -<?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 = "macostest.xctest" - BlueprintName = "macostest" - ReferencedContainer = "container:../../build/macos/platform/macos/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/node/scripts/node.xcscheme b/platform/macos/scripts/node.xcscheme index 52a89fb81f..361ed58a37 100644 --- a/platform/node/scripts/node.xcscheme +++ b/platform/macos/scripts/node.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0700" + LastUpgradeVersion = "0730" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -14,10 +14,10 @@ buildForAnalyzing = "YES"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "{{BLUEPRINT_IDENTIFIER}}" - BuildableName = "action_after_build" - BlueprintName = "action_after_build" - ReferencedContainer = "container:build/binding.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </BuildActionEntry> </BuildActionEntries> @@ -50,10 +50,10 @@ <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "{{BLUEPRINT_IDENTIFIER}}" - BuildableName = "action_after_build" - BlueprintName = "action_after_build" - ReferencedContainer = "container:build/binding.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </MacroExpansion> <CommandLineArguments> @@ -81,10 +81,10 @@ <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "{{BLUEPRINT_IDENTIFIER}}" - BuildableName = "action_after_build" - BlueprintName = "action_after_build" - ReferencedContainer = "container:build/binding.xcodeproj"> + BlueprintIdentifier = "{{BLUEPRINT_ID}}" + BuildableName = "{{BUILDABLE_NAME}}" + BlueprintName = "{{BLUEPRINT_NAME}}" + ReferencedContainer = "container:{{CONTAINER}}"> </BuildableReference> </MacroExpansion> </ProfileAction> diff --git a/platform/macos/scripts/package.sh b/platform/macos/scripts/package.sh index c2a015b346..603ecd179c 100755 --- a/platform/macos/scripts/package.sh +++ b/platform/macos/scripts/package.sh @@ -7,7 +7,7 @@ set -u NAME=Mapbox OUTPUT=build/macos/pkg DERIVED_DATA=build/macos -PRODUCTS=${DERIVED_DATA}/Build/Products +PRODUCTS=${DERIVED_DATA} BUILDTYPE=${BUILDTYPE:-Release} GCC_GENERATE_DEBUGGING_SYMBOLS=${SYMBOLS:-YES} diff --git a/platform/node/bitrise.yml b/platform/node/bitrise.yml index b43b85d69a..b968554781 100644 --- a/platform/node/bitrise.yml +++ b/platform/node/bitrise.yml @@ -29,6 +29,7 @@ workflows: - content: |- #!/bin/bash set -eu -o pipefail + brew install cmake brew unlink node brew install awscli homebrew/versions/node4-lts brew link homebrew/versions/node4-lts diff --git a/platform/node/scripts/create_node_scheme.sh b/platform/node/scripts/create_node_scheme.sh deleted file mode 100755 index 5b97918aea..0000000000 --- a/platform/node/scripts/create_node_scheme.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -NAME=$1 -shift -CMD=$@ -DIR="build/binding.xcodeproj/xcshareddata/xcschemes" -mkdir -p "${DIR}" - -sed "s#{{NODE_PATH}}#$(dirname `which node`)#;s#{{BLUEPRINT_IDENTIFIER}}#$(hexdump -n 12 -v -e '/1 "%02X"' /dev/urandom)#;s#{{WORKING_DIRECTORY}}#$(pwd)#;s#{{NODE_ARGUMENT}}#${CMD}#" platform/node/scripts/node.xcscheme > "${DIR}/${NAME}.xcscheme" diff --git a/platform/qt/app/qmapboxgl.gypi b/platform/qt/app/qmapboxgl.gypi deleted file mode 100644 index 22b4e1281e..0000000000 --- a/platform/qt/app/qmapboxgl.gypi +++ /dev/null @@ -1,58 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'qt-app', - 'product_name': 'qmapboxgl', - 'type': 'executable', - - 'includes': [ - '../qt.gypi', - ], - - 'dependencies': [ - 'qt-lib', - ], - - 'sources': [ - 'main.cpp', - 'mapwindow.cpp', - 'mapwindow.hpp', - 'source.qrc', - ], - - 'include_dirs': [ - '../include', - ], - - 'variables': { - 'cflags': [ - '<@(opengl_cflags)', - '<@(qt_core_cflags)', - '<@(qt_gui_cflags)', - '<@(qt_opengl_cflags)', - '-fPIC', - # Qt4 generates code with unused variables. - '-Wno-unused-variable', - ], - 'ldflags': [ - '<@(opengl_ldflags)', - '<@(qt_core_ldflags)', - '<@(qt_gui_ldflags)', - '<@(qt_opengl_ldflags)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags)' ], - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - }, - }, { - 'cflags_cc': [ '<@(cflags)' ], - 'libraries': [ '<@(ldflags)' ], - }], - ], - }, - ], -} diff --git a/platform/qt/bitrise-qt4.yml b/platform/qt/bitrise-qt4.yml index aeff150ee7..baa58a0308 100644 --- a/platform/qt/bitrise-qt4.yml +++ b/platform/qt/bitrise-qt4.yml @@ -29,6 +29,7 @@ workflows: - content: |- #!/bin/bash set -eu -o pipefail + brew install cmake brew install qt brew link qt brew linkapps qt diff --git a/platform/qt/bitrise-qt5.yml b/platform/qt/bitrise-qt5.yml index a612263e48..9c60e45119 100644 --- a/platform/qt/bitrise-qt5.yml +++ b/platform/qt/bitrise-qt5.yml @@ -29,6 +29,7 @@ workflows: - content: |- #!/bin/bash set -eu -o pipefail + brew install cmake brew install qt5 brew link qt5 --force brew linkapps qt5 diff --git a/platform/qt/platform.gyp b/platform/qt/platform.gyp deleted file mode 100644 index cb46aab07e..0000000000 --- a/platform/qt/platform.gyp +++ /dev/null @@ -1,237 +0,0 @@ -{ - 'variables': { - 'loop_lib': 'qt', - 'conditions': [ - ['OS == "mac"', { - 'headless_lib': 'cgl', - }, { - 'headless_lib': 'glx', - }] - ], - 'qtlibversion': '1.0.0', - 'coverage': 0, - }, - 'conditions': [ - ['<(qt_version_major) == 5', { - 'includes': [ 'qmlapp/qquickmapboxgl.gypi' ], - }], - ], - 'includes': [ - 'app/qmapboxgl.gypi', - '../../mbgl.gypi', - '../../test/test.gypi', - ], - 'targets': [ - { - 'target_name': 'platform-lib', - 'product_name': 'mbgl-platform-qt', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - - 'dependencies': [ - 'core', - ], - - 'includes': [ - 'qt.gypi', - ], - - 'sources': [ - '../default/asset_file_source.cpp', - '../default/default_file_source.cpp', - '../default/log_stderr.cpp', - '../default/mbgl/storage/offline.cpp', - '../default/mbgl/storage/offline_database.cpp', - '../default/mbgl/storage/offline_download.cpp', - '../default/online_file_source.cpp', - '../default/sqlite3.cpp', - 'include/qmapbox.hpp', - 'include/qmapboxgl.hpp', - 'include/qquickmapboxgl.hpp', - 'include/qquickmapboxglstyleproperty.hpp', - 'qmapbox.qrc', - 'src/async_task.cpp', - 'src/async_task_impl.hpp', - 'src/http_file_source.cpp', - 'src/http_file_source.hpp', - 'src/http_request.cpp', - 'src/http_request.hpp', - 'src/image.cpp', - 'src/qmapbox.cpp', - 'src/qmapboxgl.cpp', - 'src/qmapboxgl_p.hpp', - 'src/qquickmapboxgl.cpp', - 'src/qquickmapboxglstyleproperty.cpp', - 'src/qquickmapboxglrenderer.cpp', - 'src/qquickmapboxglrenderer.hpp', - 'src/run_loop.cpp', - 'src/run_loop_impl.hpp', - 'src/string_stdlib.cpp', - 'src/timer.cpp', - 'src/timer_impl.hpp', - ], - - 'variables': { - 'cflags': [ - '<@(boost_cflags)', - '<@(geojson_cflags)', - '<@(libjpeg-turbo_cflags)', - '<@(nunicode_cflags)', - '<@(opengl_cflags)', - '<@(qt_core_cflags)', - '<@(qt_gui_cflags)', - '<@(qt_network_cflags)', - '<@(rapidjson_cflags)', - '<@(sqlite_cflags)', - '-fPIC', - ], - 'ldflags': [ - '<@(nunicode_ldflags)', - '<@(opengl_ldflags)', - '<@(qt_core_ldflags)', - '<@(qt_gui_ldflags)', - '<@(qt_network_ldflags)', - '<@(sqlite_ldflags)', - '<@(zlib_ldflags)', - ], - 'libraries': [ - '<@(geojson_static_libs)', - '<@(libjpeg-turbo_static_libs)', - '<@(nunicode_static_libs)', - '<@(sqlite_static_libs)', - '<@(zlib_static_libs)', - ], - }, - - 'include_dirs': [ - 'include', - '../default', - '../../include', - '../../src', # TODO: eliminate - ], - - 'conditions': [ - ['<(qt_image_decoders) == 0', { - 'sources': [ - '../default/jpeg_reader.cpp', - '../default/webp_reader.cpp', - ], - 'variables': { - 'cflags': [ - '<@(libjpeg-turbo_cflags)', - '<@(webp_cflags)', - ], - 'ldflags': [ - '<@(libjpeg-turbo_ldflags)', - '<@(webp_ldflags)', - ], - 'libraries': [ - '<@(libjpeg-turbo_static_libs)', - '<@(webp_static_libs)', - ], - }, - }, { - 'variables': { - 'cflags': [ - '-DQT_IMAGE_DECODERS', - ], - }, - }], - ['<(qt_version_major) == 4', { - 'variables': { - 'cflags': [ - '<@(qt_opengl_cflags)', - # Qt4 generates code with unused variables. - '-Wno-unused-variable', - ], - 'ldflags': [ - '<@(qt_opengl_ldflags)', - ], - }, - }], - ['<(qt_version_major) == 5', { - 'variables': { - 'cflags': [ - '<@(qt_location_cflags)', - '<@(qt_positioning_cflags)', - '<@(qt_quick_cflags)', - ], - 'ldflags': [ - '<@(qt_location_ldflags)', - '<@(qt_positioning_ldflags)', - '<@(qt_quick_ldflags)', - ], - }, - }, { - 'sources/': [ [ 'exclude', 'qquick*' ] ], - }], - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags)' ], - }, - 'sources': [ - '../darwin/src/nsthread.mm', - ], - }, { - 'cflags_cc': [ '<@(cflags)' ], - 'sources': [ - '../default/thread.cpp', - ], - }] - ], - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'libraries': [ - '<@(libraries)', - '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', - ], - 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } - }, { - 'libraries': [ '<@(libraries)', '<@(ldflags)' ], - }] - ], - }, - }, - { - 'target_name': 'qt-lib', - 'product_name': 'qmapboxgl', - 'type': 'shared_library', - 'product_extension': 'so.<(qtlibversion)', - - 'includes': [ - 'qt.gypi', - ], - - 'dependencies': [ - 'platform-lib', - ], - - 'link_settings': { - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ '-all_load' ], - 'LD_DYLIB_INSTALL_NAME': '@executable_path/libqmapboxgl.so.<(qtlibversion)', - } - }] - ], - }, - }, - { - 'target_name': 'test', - 'type': 'executable', - - 'dependencies': [ - 'test-lib', - 'platform-lib', - ], - - 'sources': [ - '../../test/src/main.cpp', - ], - }, - ], -} diff --git a/platform/qt/qmlapp/qquickmapboxgl.gypi b/platform/qt/qmlapp/qquickmapboxgl.gypi deleted file mode 100644 index 7b539a52f2..0000000000 --- a/platform/qt/qmlapp/qquickmapboxgl.gypi +++ /dev/null @@ -1,60 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'qt-qml-app', - 'product_name': 'qquickmapboxgl', - 'type': 'executable', - - 'includes': [ - '../qt.gypi', - ], - - 'dependencies': [ - 'qt-lib', - ], - - 'sources': [ - 'main.cpp', - 'qml.qrc', - ], - - 'include_dirs': [ - '../include', - ], - - 'variables': { - 'cflags': [ - '<@(opengl_cflags)', - '<@(qt_core_cflags)', - '<@(qt_gui_cflags)', - '<@(qt_location_cflags)', - '<@(qt_positioning_cflags)', - '<@(qt_qml_cflags)', - '<@(qt_quick_cflags)', - '-fPIC', - ], - 'ldflags': [ - '<@(opengl_ldflags)', - '<@(qt_core_ldflags)', - '<@(qt_gui_ldflags)', - '<@(qt_location_ldflags)', - '<@(qt_positioning_ldflags)', - '<@(qt_qml_ldflags)', - '<@(qt_quick_ldflags)', - ], - }, - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags)' ], - 'OTHER_LDFLAGS': [ '<@(ldflags)' ], - }, - }, { - 'cflags_cc': [ '<@(cflags)' ], - 'libraries': [ '<@(ldflags)' ], - }], - ], - }, - ], -} diff --git a/platform/qt/qt.gypi b/platform/qt/qt.gypi deleted file mode 100644 index e98b3254b0..0000000000 --- a/platform/qt/qt.gypi +++ /dev/null @@ -1,20 +0,0 @@ -{ - 'rules': [ - { - 'rule_name': 'MOC files', - 'extension': 'hpp', - 'process_outputs_as_sources': 1, - 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/moc_<(RULE_INPUT_ROOT).cpp' ], - 'action': [ '<(qt_moc)', '<(RULE_INPUT_PATH)', '-o', '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/moc_<(RULE_INPUT_ROOT).cpp' ], - 'message': 'Generating MOC <(RULE_INPUT_ROOT).cpp', - }, - { - 'rule_name': 'QRC files', - 'extension': 'qrc', - 'process_outputs_as_sources': 1, - 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/qrc_<(RULE_INPUT_ROOT).cpp' ], - 'action': [ '<(qt_rcc)', '<(RULE_INPUT_PATH)', '-name', '<(RULE_INPUT_ROOT)', '-o', '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/qrc_<(RULE_INPUT_ROOT).cpp' ], - 'message': 'Generating QRC <(RULE_INPUT_ROOT).cpp', - }, - ], -} diff --git a/platform/qt/scripts/configure.sh b/platform/qt/scripts/configure.sh deleted file mode 100644 index 23f4b0bf52..0000000000 --- a/platform/qt/scripts/configure.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash - -CXX11ABI=${CXX11ABI:-$(scripts/check-cxx11abi.sh)} - -UNIQUE_RESOURCE_VERSION=dev -PROTOZERO_VERSION=1.3.0 -BOOST_VERSION=1.60.0 -GEOMETRY_VERSION=0.8.0 -GEOJSON_VERSION=0.1.4${CXX11ABI:-} -GEOJSONVT_VERSION=6.1.2 -SUPERCLUSTER_VERSION=0.2.0 -KDBUSH_VERSION=0.1.1 -GTEST_VERSION=1.7.0${CXX11ABI:-} -LIBJPEG_TURBO_VERSION=1.4.2 -PIXELMATCH_VERSION=0.9.0 -RAPIDJSON_VERSION=1.0.2 -SQLITE_VERSION=3.9.1 -VARIANT_VERSION=1.1.0 -ZLIB_VERSION=system -WEBP_VERSION=0.5.0 -EARCUT_VERSION=0.11 - -function print_default_flags { - CONFIG+=" 'cflags': $(quote_flags -fvisibility=hidden -D__QT__),"$LN -} - -if [ "$MASON_PLATFORM" == "osx" ]; then - # XXX: Argh, adding the __QT__ flag here because GYP for OSX does - # not respect the `cflags` variable above and we need it to reach - # the utests somehow. Gonna be fixed properly when we move to CMake. - function print_opengl_flags { - CONFIG+=" 'opengl_cflags%': ['-D__QT__'],"$LN - CONFIG+=" 'opengl_ldflags%': ['-framework OpenGL', '-framework CoreFoundation'],"$LN - } -else - function print_opengl_flags { - CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN - CONFIG+=" 'opengl_ldflags%': $(quote_flags $(pkg-config gl x11 --libs)),"$LN - } -fi - -function print_qt_flags { - mason install Qt system - - QMAKE="qmake" - if [ ! $(which ${QMAKE} 2>/dev/null) ]; then - QMAKE="qmake-qt5" - fi - - QT_VERSION_MAJOR=$(${QMAKE} -query QT_VERSION | cut -d. -f1) - CONFIG+=" 'qt_version_major%': ['${QT_VERSION_MAJOR}'],"$LN - CONFIG+=" 'qt_image_decoders%': [0],"$LN - - CONFIG+=" 'qt_core_cflags%': $(quote_flags $(mason cflags Qt system "QtCore")),"$LN - CONFIG+=" 'qt_gui_cflags%': $(quote_flags $(mason cflags Qt system "QtGui")),"$LN - CONFIG+=" 'qt_opengl_cflags%': $(quote_flags $(mason cflags Qt system "QtOpenGL")),"$LN - CONFIG+=" 'qt_network_cflags%': $(quote_flags $(mason cflags Qt system "QtNetwork")),"$LN - - CONFIG+=" 'qt_core_ldflags%': $(quote_flags $(mason ldflags Qt system "QtCore")),"$LN - CONFIG+=" 'qt_gui_ldflags%': $(quote_flags $(mason ldflags Qt system "QtGui")),"$LN - CONFIG+=" 'qt_opengl_ldflags%': $(quote_flags $(mason ldflags Qt system "QtOpenGL")),"$LN - CONFIG+=" 'qt_network_ldflags%': $(quote_flags $(mason ldflags Qt system "QtNetwork")),"$LN - - if [ ${QT_VERSION_MAJOR} -gt 4 ]; then - CONFIG+=" 'qt_location_cflags%': $(quote_flags $(mason cflags Qt system "QtLocation")),"$LN - CONFIG+=" 'qt_qml_cflags%': $(quote_flags $(mason cflags Qt system "QtQml")), "$LN - CONFIG+=" 'qt_quick_cflags%': $(quote_flags $(mason cflags Qt system "QtQuick")), "$LN - CONFIG+=" 'qt_positioning_cflags%': $(quote_flags $(mason cflags Qt system "QtPositioning")),"$LN - - CONFIG+=" 'qt_location_ldflags%': $(quote_flags $(mason ldflags Qt system "QtLocation")),"$LN - CONFIG+=" 'qt_qml_ldflags%': $(quote_flags $(mason ldflags Qt system "QtQml")), "$LN - CONFIG+=" 'qt_quick_ldflags%': $(quote_flags $(mason ldflags Qt system "QtQuick")), "$LN - CONFIG+=" 'qt_positioning_ldflags%': $(quote_flags $(mason ldflags Qt system "QtPositioning")),"$LN - fi - - if hash moc 2>/dev/null && hash rcc 2>/dev/null; then - CONFIG+=" 'qt_moc%': '$(which moc)',"$LN - CONFIG+=" 'qt_rcc%': '$(which rcc)',"$LN - elif [ ${QT_VERSION_MAJOR} -gt 4 ] ; then - CONFIG+=" 'qt_moc%': '$(pkg-config Qt${QT_VERSION_MAJOR}Core --variable=host_bins)/moc',"$LN - CONFIG+=" 'qt_rcc%': '$(pkg-config Qt${QT_VERSION_MAJOR}Core --variable=host_bins)/rcc',"$LN - else - CONFIG+=" 'qt_moc%': '$(pkg-config QtCore --variable=moc_location)',"$LN - CONFIG+=" 'qt_rcc%': '$(pkg-config QtCore --variable=rcc_location)',"$LN - fi -} - -CONFIGURE_SUPLATFORM=platform/qt/scripts/configure-${MASON_PLATFORM_VERSION}.sh - -if [ -f $CONFIGURE_SUPLATFORM ]; then - source $CONFIGURE_SUPLATFORM -fi diff --git a/scripts/clang-tools.sh b/scripts/clang-tools.sh index f26b065263..6a10740c77 100755 --- a/scripts/clang-tools.sh +++ b/scripts/clang-tools.sh @@ -18,6 +18,8 @@ command -v ${CLANG_TIDY} >/dev/null 2>&1 || { cd $1 +CDUP=$(git rev-parse --show-cdup) + function check_tidy() { echo "Running clang-tidy on $0..." if [[ -n $1 ]] && [[ $1 == "--fix" ]]; then @@ -34,7 +36,7 @@ function check_tidy() { function check_format() { echo "Running clang-format on $0..." - ${CLANG_FORMAT} -i ../../../$0 + ${CLANG_FORMAT} -i ${CDUP}/$0 } export CLANG_TIDY CLANG_FORMAT @@ -61,6 +63,6 @@ if [ -n $2 ] && [ $2 == "--diff" ]; then fi echo "All looks good!" else - git ls-files '../../../src/mbgl/*.cpp' '../../../platform/*.cpp' '../../../test/*.cpp' | \ + git ls-files '${CDUP}/src/mbgl/*.cpp' '${CDUP}/platform/*.cpp' '${CDUP}/test/*.cpp' | \ xargs -I{} -P ${JOBS} bash -c 'check_tidy' {} fi diff --git a/scripts/generate-core-files.sh b/scripts/generate-core-files.sh new file mode 100755 index 0000000000..a14239b8f2 --- /dev/null +++ b/scripts/generate-core-files.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +echo "# Do not edit. Regenerate this with ./scripts/generate-core-files.sh" > cmake/core-files.cmake +echo "" >> cmake/core-files.cmake +echo "set(MBGL_CORE_FILES" >> cmake/core-files.cmake +PREFIX= +for FILE in $(find include src -type f -a \( -name "*.hpp" -o -name "*.cpp" -o -name "*.h" -o -name "*.c" \) | perl -p -e "s/^((src|include)\/(mbgl\/)?(.+)\/\w+\.\w+)$/\$4#\$1/g" | sort) ; do + CURRENT_PREFIX="${FILE%#*}" + if [ "${PREFIX}" != "${CURRENT_PREFIX}" ]; then + if [ ! -z "${PREFIX}" ]; then echo "" >> cmake/core-files.cmake ; fi + echo " # ${CURRENT_PREFIX}" >> cmake/core-files.cmake + PREFIX="${CURRENT_PREFIX}" + fi + echo " ${FILE#*#}" >> cmake/core-files.cmake +done +echo ")" >> cmake/core-files.cmake +git diff cmake/core-files.cmake diff --git a/scripts/generate-test-files.sh b/scripts/generate-test-files.sh new file mode 100755 index 0000000000..0af6828c66 --- /dev/null +++ b/scripts/generate-test-files.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +echo "# Do not edit. Regenerate this with ./scripts/generate-test-files.sh" > cmake/test-files.cmake +echo "" >> cmake/test-files.cmake +echo "set(MBGL_TEST_FILES" >> cmake/test-files.cmake +PREFIX= +for FILE in $(find test -type f -a \( -name "*.hpp" -o -name "*.cpp" -o -name "*.h" -o -name "*.c" \) | sort) ; do + CURRENT_PREFIX=$(dirname ${FILE#test/}) + if [ "${PREFIX}" != "${CURRENT_PREFIX}" ]; then + if [ ! -z "${PREFIX}" ]; then echo "" >> cmake/test-files.cmake ; fi + echo " # ${CURRENT_PREFIX}" >> cmake/test-files.cmake + PREFIX="${CURRENT_PREFIX}" + fi + echo " ${FILE}" >> cmake/test-files.cmake +done +echo ")" >> cmake/test-files.cmake +git diff cmake/test-files.cmake diff --git a/scripts/travis_setup.sh b/scripts/travis_setup.sh index dfd045224a..ae8dda46b5 100755 --- a/scripts/travis_setup.sh +++ b/scripts/travis_setup.sh @@ -43,6 +43,10 @@ export DISPLAY=:99.0 mapbox_time "checkout_mason" \ git submodule update --init .mason +# Touch package.json so that we are definitely going to run an npm update action +mapbox_time "touch_package_json" \ +touch package.json + # Install and set up to load a more recent version of mesa mapbox_time "install_mesa" \ mason install mesa 11.2.2 diff --git a/test/src/main.cpp b/test/src/main.cpp index a481dc5dc3..d01cf75ffc 100644 --- a/test/src/main.cpp +++ b/test/src/main.cpp @@ -1,5 +1,20 @@ #include <mbgl/test.hpp> +#include <unistd.h> +#include <cstring> +#include <cerrno> +#include <cstdio> + +#define xstr(s) str(s) +#define str(s) #s int main(int argc, char *argv[]) { +#ifdef WORK_DIRECTORY + const int result = chdir(xstr(WORK_DIRECTORY)); + if (result != 0) { + fprintf(stderr, "failed to change directory: %s\n", strerror(errno)); + return errno; + } +#endif + return mbgl::runTests(argc, argv); } diff --git a/test/src/mbgl/test/util.cpp b/test/src/mbgl/test/util.cpp index 4021fd89b1..393d65b667 100644 --- a/test/src/mbgl/test/util.cpp +++ b/test/src/mbgl/test/util.cpp @@ -14,10 +14,17 @@ #include <unistd.h> +#ifndef NODE_EXECUTABLE +#define NODE_EXECUTABLE node +#endif + +#define xstr(s) str(s) +#define str(s) #s + namespace mbgl { namespace test { -Server::Server(const char* executable) { +Server::Server(const char* script) { int input[2]; int output[2]; @@ -48,14 +55,18 @@ Server::Server(const char* executable) { close(output[1]); close(output[0]); + const char* executable = xstr(NODE_EXECUTABLE); + + fprintf(stderr, "executable: %s\n", executable); + // Launch the actual server process. - int ret = execl(executable, executable, nullptr); + int ret = execl(executable, executable, script, nullptr); // This call should not return. In case execl failed, we exit anyway. if (ret < 0) { Log::Error(Event::Setup, "Failed to start server: %s", strerror(errno)); } - exit(0); + abort(); } else { // This is the parent process. diff --git a/test/src/mbgl/test/util.hpp b/test/src/mbgl/test/util.hpp index 30108a8866..66499c6fd6 100644 --- a/test/src/mbgl/test/util.hpp +++ b/test/src/mbgl/test/util.hpp @@ -59,7 +59,7 @@ namespace test { class Server { public: - Server(const char* executable); + Server(const char* script); ~Server(); private: diff --git a/test/test.gypi b/test/test.gypi deleted file mode 100644 index 82bd02bd83..0000000000 --- a/test/test.gypi +++ /dev/null @@ -1,169 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'test-lib', - 'type': 'static_library', - 'standalone_static_library': 1, - 'hard_dependency': 1, - 'dependencies': [ - 'core', - ], - - 'include_dirs': [ - '../include', - '../src', - '../platform/default', - 'include', - 'src', - ], - - 'sources': [ - 'util/async_task.cpp', - 'util/geo.cpp', - 'util/image.cpp', - 'util/mapbox.cpp', - 'util/memory.cpp', - 'util/merge_lines.cpp', - 'util/run_loop.cpp', - 'util/number_conversions.cpp', - 'util/text_conversions.cpp', - 'util/thread.cpp', - 'util/thread_local.cpp', - 'util/tile_cover.cpp', - 'util/timer.cpp', - 'util/token.cpp', - 'util/work_queue.cpp', - 'util/projection.cpp', - - 'algorithm/covered_by_children.cpp', - 'algorithm/generate_clip_ids.cpp', - 'algorithm/mock.hpp', - 'algorithm/update_renderables.cpp', - - 'api/annotations.cpp', - 'api/api_misuse.cpp', - 'api/repeated_render.cpp', - 'api/render_missing.cpp', - 'api/set_style.cpp', - 'api/custom_layer.cpp', - - 'geometry/binpack.cpp', - - 'gl/object.cpp', - - 'map/map.cpp', - 'map/transform.cpp', - - 'math/minmax.cpp', - 'math/clamp.cpp', - - 'text/quads.cpp', - - 'tile/geometry_tile_data.cpp', - 'tile/tile_id.cpp', - - 'storage/offline.cpp', - 'storage/offline_database.cpp', - 'storage/offline_download.cpp', - 'storage/asset_file_source.cpp', - 'storage/default_file_source.cpp', - 'storage/http_file_source.cpp', - 'storage/online_file_source.cpp', - 'storage/headers.cpp', - 'storage/resource.cpp', - - 'style/glyph_store.cpp', - 'style/source.cpp', - 'style/style.cpp', - 'style/style_layer.cpp', - 'style/tile_source.cpp', - 'style/filter.cpp', - 'style/functions.cpp', - 'style/style_parser.cpp', - - 'sprite/sprite_atlas.cpp', - 'sprite/sprite_image.cpp', - 'sprite/sprite_parser.cpp', - 'sprite/sprite_store.cpp', - - 'src/mbgl/test/stub_file_source.hpp', - 'src/mbgl/test/stub_file_source.cpp', - 'src/mbgl/test/util.hpp', - 'src/mbgl/test/util.cpp', - 'src/mbgl/test/fixture_log_observer.hpp', - 'src/mbgl/test/fixture_log_observer.cpp', - 'src/mbgl/test/test.cpp' - ], - - 'variables': { - 'cflags_cc': [ - '<@(gtest_cflags)', - '<@(opengl_cflags)', - '<@(protozero_cflags)', - '<@(boost_cflags)', - '<@(sqlite_cflags)', - '<@(geojsonvt_cflags)', - '<@(supercluster_cflags)', - '<@(kdbush_cflags)', - '<@(rapidjson_cflags)', - '<@(pixelmatch_cflags)', - '<@(earcut_cflags)', - ], - 'ldflags': [ - '<@(gtest_ldflags)', - '<@(sqlite_ldflags)', - ], - 'libraries': [ - '<@(gtest_static_libs)', - '<@(sqlite_static_libs)' - ], - }, - - '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', - ], - - # Force the linker to include all the objects from the lib-test archive. Otherwise they'd - # be discarded because there are no undefined symbols to pull them in, and the resulting - # executable would run zero tests. - - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-Wl,-force_load,<(PRODUCT_DIR)/libtest-lib.a', - ], - } - }, { - 'link_settings': { - 'ldflags': [ - '-Wl,-whole-archive <(PRODUCT_DIR)/libtest-lib.a -Wl,-no-whole-archive', - ], - }, - }], - ], - }, - }, - ] -} |