summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-07-04 14:19:25 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-07-06 11:45:09 +0200
commitfc48ca18018564e26f0498c4f59f77374c1cadbf (patch)
tree66ee7f9a7ad3aea590094281cf936c1e0a6ccc76
parentadbce36fe6e1a9d95633776ff9fada67289733ae (diff)
downloadqtlocation-mapboxgl-fc48ca18018564e26f0498c4f59f77374c1cadbf.tar.gz
[build] use CMake to generate Xcode schemes
-rw-r--r--CMakeLists.txt1
-rw-r--r--Makefile31
-rw-r--r--cmake/benchmark.cmake7
-rw-r--r--cmake/core.cmake2
-rw-r--r--cmake/executable.xcscheme (renamed from platform/macos/scripts/executable.xcscheme)46
-rw-r--r--cmake/glfw.cmake13
-rw-r--r--cmake/library.xcscheme (renamed from platform/macos/scripts/library.xcscheme)26
-rw-r--r--cmake/loop-darwin.cmake2
-rw-r--r--cmake/loop-uv.cmake2
-rw-r--r--cmake/node.cmake34
-rw-r--r--cmake/node.xcscheme (renamed from platform/macos/scripts/node.xcscheme)38
-rw-r--r--cmake/offline.cmake15
-rw-r--r--cmake/render.cmake19
-rw-r--r--cmake/test.cmake11
-rw-r--r--cmake/xcode.cmake75
-rwxr-xr-xplatform/macos/scripts/create_scheme.sh40
-rw-r--r--platform/qt/qt.cmake4
17 files changed, 237 insertions, 129 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e84b3a6da2..189f033b79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ set(CMAKE_CXX_STANDARD 14)
include(cmake/mbgl.cmake)
include(cmake/mason.cmake)
+include(cmake/xcode.cmake)
option(WITH_CXX11ABI "Use cxx11abi mason packages" OFF)
option(WITH_COVERAGE "Enable coverage reports" OFF)
diff --git a/Makefile b/Makefile
index ba2f1ae31d..f694d19b52 100644
--- a/Makefile
+++ b/Makefile
@@ -70,31 +70,10 @@ MACOS_XCODEBUILD = xcodebuild \
-configuration $(BUILDTYPE) \
-workspace $(MACOS_WORK_PATH)
-
-MACOS_XCSCHEMES += platform/macos/scripts/executable.xcscheme
-MACOS_XCSCHEMES += platform/macos/scripts/library.xcscheme
-MACOS_XCSCHEMES += platform/macos/scripts/node.xcscheme
-
-$(MACOS_PROJ_PATH): $(BUILD_DEPS) $(MACOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings $(MACOS_XCSCHEMES)
+$(MACOS_PROJ_PATH): $(BUILD_DEPS) $(MACOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings
mkdir -p $(MACOS_OUTPUT_PATH)
(cd $(MACOS_OUTPUT_PATH) && cmake -G Xcode ../..)
- @# 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-benchmark 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 "$@"
@@ -408,14 +387,6 @@ $(MACOS_QT_PROJ_PATH): $(BUILD_DEPS)
-DWITH_CXX11ABI=$(shell scripts/check-cxx11abi.sh) \
-DWITH_COVERAGE=${WITH_COVERAGE})
- @# Create Xcode schemes so that we can use xcodebuild from the command line. CMake doesn't
- @# create these automatically.
- XCODEPROJ=$(MACOS_QT_PROJ_PATH) SCHEME_NAME=mbgl-qt SCHEME_TYPE=executable platform/macos/scripts/create_scheme.sh
- XCODEPROJ=$(MACOS_QT_PROJ_PATH) SCHEME_NAME=mbgl-test SCHEME_TYPE=executable platform/macos/scripts/create_scheme.sh
- XCODEPROJ=$(MACOS_QT_PROJ_PATH) SCHEME_NAME=mbgl-benchmark SCHEME_TYPE=executable platform/macos/scripts/create_scheme.sh
- XCODEPROJ=$(MACOS_QT_PROJ_PATH) SCHEME_NAME=mbgl-core SCHEME_TYPE=library BUILDABLE_NAME=libmbgl-core.a BLUEPRINT_NAME=mbgl-core platform/macos/scripts/create_scheme.sh
- XCODEPROJ=$(MACOS_QT_PROJ_PATH) SCHEME_NAME=qmapboxgl SCHEME_TYPE=library BUILDABLE_NAME=libqmapboxgl.dylib BLUEPRINT_NAME=qmapboxgl platform/macos/scripts/create_scheme.sh
-
.PHONY: qtproj
qtproj: $(MACOS_QT_PROJ_PATH)
open $(MACOS_QT_PROJ_PATH)
diff --git a/cmake/benchmark.cmake b/cmake/benchmark.cmake
index f4c59fa01e..1dfca27e6c 100644
--- a/cmake/benchmark.cmake
+++ b/cmake/benchmark.cmake
@@ -25,3 +25,10 @@ target_add_mason_package(mbgl-benchmark PRIVATE vector-tile)
mbgl_platform_benchmark()
create_source_groups(mbgl-benchmark)
+
+xcode_create_scheme(
+ TARGET mbgl-benchmark
+ OPTIONAL_ARGS
+ "--benchmark_filter=Category.*"
+ "--benchmark_repetitions=1"
+)
diff --git a/cmake/core.cmake b/cmake/core.cmake
index c4e4d2abc7..ff2b4ba53c 100644
--- a/cmake/core.cmake
+++ b/cmake/core.cmake
@@ -32,3 +32,5 @@ target_add_mason_package(mbgl-core PRIVATE vector-tile)
mbgl_platform_core()
create_source_groups(mbgl-core)
+
+xcode_create_scheme(TARGET mbgl-core)
diff --git a/platform/macos/scripts/executable.xcscheme b/cmake/executable.xcscheme
index c6a8d04d30..44146a621d 100644
--- a/platform/macos/scripts/executable.xcscheme
+++ b/cmake/executable.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0810"
+ LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,10 +14,10 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -32,10 +32,10 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -47,7 +47,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "YES"
- customWorkingDirectory = "{{WORKING_DIRECTORY}}"
+ customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
@@ -56,22 +56,18 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</BuildableProductRunnable>
- <CommandLineArguments>
- <CommandLineArgument
- argument = "--gtest_filter="
- isEnabled = "NO">
- </CommandLineArgument>
+ <CommandLineArguments>${XCSCHEME_COMMAND_LINE_ARGS}
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "MAPBOX_ACCESS_TOKEN"
- value = "{{MAPBOX_ACCESS_TOKEN}}"
+ value = "$ENV{MAPBOX_ACCESS_TOKEN}"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
@@ -83,16 +79,16 @@
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "YES"
- customWorkingDirectory = "{{WORKING_DIRECTORY}}"
+ customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
diff --git a/cmake/glfw.cmake b/cmake/glfw.cmake
index 744477e39a..b176fbb5bc 100644
--- a/cmake/glfw.cmake
+++ b/cmake/glfw.cmake
@@ -43,3 +43,16 @@ target_add_mason_package(mbgl-glfw PRIVATE variant)
mbgl_platform_glfw()
create_source_groups(mbgl-glfw)
+
+xcode_create_scheme(
+ TARGET mbgl-glfw
+ OPTIONAL_ARGS
+ "--style=file.json"
+ "--lon=0"
+ "--lat=0"
+ "--zoom=1"
+ "--bearing=0"
+ "--pitch=0"
+ "--fullscreen"
+ "--benchmark"
+)
diff --git a/platform/macos/scripts/library.xcscheme b/cmake/library.xcscheme
index 5472d3c821..320a2f851f 100644
--- a/platform/macos/scripts/library.xcscheme
+++ b/cmake/library.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "0810"
+ LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,10 +14,10 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -45,10 +45,10 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -63,10 +63,10 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake
index 92ea631809..46511d2548 100644
--- a/cmake/loop-darwin.cmake
+++ b/cmake/loop-darwin.cmake
@@ -17,3 +17,5 @@ target_include_directories(mbgl-loop-darwin
)
create_source_groups(mbgl-loop-darwin)
+
+xcode_create_scheme(TARGET mbgl-loop-darwin) \ No newline at end of file
diff --git a/cmake/loop-uv.cmake b/cmake/loop-uv.cmake
index 182b0d6f90..8840040963 100644
--- a/cmake/loop-uv.cmake
+++ b/cmake/loop-uv.cmake
@@ -19,3 +19,5 @@ target_link_libraries(mbgl-loop-uv
)
create_source_groups(mbgl-loop-uv)
+
+xcode_create_scheme(TARGET mbgl-loop-uv) \ No newline at end of file
diff --git a/cmake/node.cmake b/cmake/node.cmake
index 6833cb983f..8626534271 100644
--- a/cmake/node.cmake
+++ b/cmake/node.cmake
@@ -53,3 +53,37 @@ add_custom_command(
mbgl_platform_node()
create_source_groups(mbgl-node)
+
+xcode_create_scheme(
+ TARGET mbgl-node
+)
+
+xcode_create_scheme(
+ TARGET mbgl-node
+ TYPE node
+ NAME "node tests"
+ ARGS
+ "`npm bin tape`/tape platform/node/test/js/**/*.test.js"
+)
+
+xcode_create_scheme(
+ TARGET mbgl-node
+ TYPE node
+ NAME "node render tests"
+ ARGS
+ "platform/node/test/render.test.js"
+ OPTIONAL_ARGS
+ "group"
+ "test"
+)
+
+xcode_create_scheme(
+ TARGET mbgl-node
+ TYPE node
+ NAME "node query tests"
+ ARGS
+ "platform/node/test/query.test.js"
+ OPTIONAL_ARGS
+ "group"
+ "test"
+)
diff --git a/platform/macos/scripts/node.xcscheme b/cmake/node.xcscheme
index 6f541deca3..0daffa46e6 100644
--- a/platform/macos/scripts/node.xcscheme
+++ b/cmake/node.xcscheme
@@ -14,10 +14,10 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -38,34 +38,30 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "YES"
- customWorkingDirectory = "{{WORKING_DIRECTORY}}"
+ customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<PathRunnable
runnableDebuggingMode = "0"
- FilePath = "{{NODE_PATH}}/node">
+ FilePath = "${XCSCHEME_NODE_EXECUTABLE}">
</PathRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</MacroExpansion>
- <CommandLineArguments>
- <CommandLineArgument
- argument = "{{NODE_ARGUMENT}}"
- isEnabled = "YES">
- </CommandLineArgument>
+ <CommandLineArguments>${XCSCHEME_COMMAND_LINE_ARGS}
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "PATH"
- value = "{{NODE_PATH}}:$PATH"
+ value = "${XCSCHEME_NODE_PATH}:$PATH"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
@@ -77,15 +73,15 @@
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "YES"
- customWorkingDirectory = "{{WORKING_DIRECTORY}}"
+ customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
- BlueprintIdentifier = "{{BLUEPRINT_ID}}"
- BuildableName = "{{BUILDABLE_NAME}}"
- BlueprintName = "{{BLUEPRINT_NAME}}"
- ReferencedContainer = "container:{{CONTAINER}}">
+ BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}"
+ BuildableName = "${XCSCHEME_BUILDABLE_NAME}"
+ BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}"
+ ReferencedContainer = "container:${XCSCHEME_CONTAINER}">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
diff --git a/cmake/offline.cmake b/cmake/offline.cmake
index d0124e661f..1ec3f61e36 100644
--- a/cmake/offline.cmake
+++ b/cmake/offline.cmake
@@ -25,3 +25,18 @@ target_add_mason_package(mbgl-offline PRIVATE boost_libprogram_options)
mbgl_platform_offline()
create_source_groups(mbgl-offline)
+
+xcode_create_scheme(
+ TARGET mbgl-offline
+ OPTIONAL_ARGS
+ "--style=file.json"
+ "--north=37.2"
+ "--west=-122.8"
+ "--south=38.1"
+ "--east=-121.7"
+ "--minZoom=0.0"
+ "--maxZoom=15.0"
+ "--pixelRatio=1.0"
+ "--token="
+ "--output=offline.db"
+)
diff --git a/cmake/render.cmake b/cmake/render.cmake
index 023b3c21e3..407e1ca8ef 100644
--- a/cmake/render.cmake
+++ b/cmake/render.cmake
@@ -20,3 +20,22 @@ target_add_mason_package(mbgl-render PRIVATE boost_libprogram_options)
mbgl_platform_render()
create_source_groups(mbgl-render)
+
+xcode_create_scheme(
+ TARGET mbgl-render
+ OPTIONAL_ARGS
+ "--style=file.json"
+ "--lon=0"
+ "--lat=0"
+ "--zoom=0"
+ "--bearing=0"
+ "--pitch=0"
+ "--width=512"
+ "--height=512"
+ "--ratio=1"
+ "--token="
+ "--debug"
+ "--output=out.png"
+ "--cache=cache.sqlite"
+ "--assets=."
+)
diff --git a/cmake/test.cmake b/cmake/test.cmake
index 8a5233f5a5..5e404577ed 100644
--- a/cmake/test.cmake
+++ b/cmake/test.cmake
@@ -40,3 +40,14 @@ target_add_mason_package(mbgl-test PRIVATE shelf-pack)
mbgl_platform_test()
create_source_groups(mbgl-test)
+
+xcode_create_scheme(
+ TARGET mbgl-test
+ OPTIONAL_ARGS
+ "--gtest_filter=Category.*"
+ "--gtest_repeat=0"
+ "--gtest_shuffle=0"
+ "--gtest_break_on_failure=0"
+ "--gtest_throw_on_failure=0"
+ "--gtest_catch_exceptions=0"
+ )
diff --git a/cmake/xcode.cmake b/cmake/xcode.cmake
new file mode 100644
index 0000000000..3537009330
--- /dev/null
+++ b/cmake/xcode.cmake
@@ -0,0 +1,75 @@
+function(get_target_filename OUTPUT TARGET)
+ get_target_property(_TYPE "${TARGET}" TYPE)
+ get_target_property(_PREFIX "${TARGET}" PREFIX)
+ if(NOT _PREFIX AND NOT _PREFIX STREQUAL "")
+ set(_PREFIX "${CMAKE_${_TYPE}_PREFIX}")
+ endif()
+ get_target_property(_BASENAME "${TARGET}" OUTPUT_NAME)
+ if(NOT _BASENAME)
+ get_target_property(_BASENAME "${TARGET}" NAME)
+ endif()
+ get_target_property(_SUFFIX "${TARGET}" SUFFIX)
+ if(NOT _SUFFIX AND NOT _SUFFIX STREQUAL "")
+ set(_SUFFIX "${CMAKE_${_TYPE}_SUFFIX}")
+ endif()
+ set(${OUTPUT} "${_PREFIX}${_BASENAME}${_SUFFIX}" PARENT_SCOPE)
+endfunction()
+
+function(xcode_create_scheme)
+ if (NOT CMAKE_GENERATOR STREQUAL "Xcode")
+ return()
+ endif()
+
+ cmake_parse_arguments(XCSCHEME "" "TARGET;TYPE;NAME" "ARGS;OPTIONAL_ARGS" ${ARGN})
+
+ if(XCSCHEME_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "xcode_create_scheme() called with unrecognized arguments: ${XCSCHEME_UNPARSED_ARGUMENTS}")
+ endif()
+
+ if(NOT XCSCHEME_TARGET)
+ message(FATAL_ERROR "xcode_create_scheme() called without required argument TARGET")
+ endif()
+
+ if(NOT XCSCHEME_TYPE)
+ get_target_property(_TYPE "${XCSCHEME_TARGET}" TYPE)
+ if (_TYPE MATCHES "^.*_LIBRARY$")
+ set(XCSCHEME_TYPE "library")
+ elseif(_TYPE STREQUAL "EXECUTABLE")
+ set(XCSCHEME_TYPE "executable")
+ else()
+ message(FATAL_ERROR "xcode_create_scheme() could not determine type of ${XCSCHEME_TARGET}")
+ endif()
+ endif()
+
+ if(NOT XCSCHEME_NAME)
+ set(XCSCHEME_NAME "${XCSCHEME_TARGET}")
+ endif()
+
+ set(XCODEPROJ_PATH "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.xcodeproj")
+ set(XCSCHEME_OUTPUT_FILE "${XCODEPROJ_PATH}/xcshareddata/xcschemes/${XCSCHEME_NAME}.xcscheme")
+
+ # Prevent overwriting of the scheme file on every CMake rerun.
+ if (EXISTS "${XCSCHEME_OUTPUT_FILE}")
+ return()
+ endif()
+
+ file(RELATIVE_PATH XCSCHEME_CONTAINER "${CMAKE_SOURCE_DIR}" "${XCODEPROJ_PATH}")
+ string(RANDOM LENGTH 24 ALPHABET "0123456789ABCDEF" XCSCHEME_BLUEPRINT_ID)
+ get_target_filename(XCSCHEME_BUILDABLE_NAME "${XCSCHEME_TARGET}")
+ set(XCSCHEME_BLUEPRINT_NAME "${XCSCHEME_TARGET}")
+ set(XCSCHEME_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
+ set(XCSCHEME_NODE_EXECUTABLE "${NodeJS_EXECUTABLE}")
+ get_filename_component(XCSCHEME_NODE_PATH "${NodeJS_EXECUTABLE}" DIRECTORY)
+
+ set(XCSCHEME_COMMAND_LINE_ARGS "")
+ foreach(_ARG IN LISTS XCSCHEME_ARGS)
+ set(XCSCHEME_COMMAND_LINE_ARGS "${XCSCHEME_COMMAND_LINE_ARGS}\n <CommandLineArgument\n argument = \"${_ARG}\"\n isEnabled = \"YES\">\n </CommandLineArgument>")
+ endforeach()
+ foreach(_ARG IN LISTS XCSCHEME_OPTIONAL_ARGS)
+ set(XCSCHEME_COMMAND_LINE_ARGS "${XCSCHEME_COMMAND_LINE_ARGS}\n <CommandLineArgument\n argument = \"${_ARG}\"\n isEnabled = \"NO\">\n </CommandLineArgument>")
+ endforeach()
+
+ configure_file(
+ "${CMAKE_SOURCE_DIR}/cmake/${XCSCHEME_TYPE}.xcscheme"
+ "${XCSCHEME_OUTPUT_FILE}")
+endfunction()
diff --git a/platform/macos/scripts/create_scheme.sh b/platform/macos/scripts/create_scheme.sh
deleted file mode 100755
index 5a609130d8..0000000000
--- a/platform/macos/scripts/create_scheme.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-
-set -u
-
-XCODEPROJ=${XCODEPROJ:-build/macos/mbgl.xcodeproj}
-OUTPUT="${XCODEPROJ}/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 "${XCODEPROJ}/xcshareddata/xcschemes"
-
-sed "\
-s#{{BLUEPRINT_ID}}#${BLUEPRINT_ID}#;\
-s#{{BLUEPRINT_NAME}}#${BLUEPRINT_NAME}#;\
-s#{{BUILDABLE_NAME}}#${BUILDABLE_NAME}#;\
-s#{{CONTAINER}}#${XCODEPROJ}#;\
-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/qt/qt.cmake b/platform/qt/qt.cmake
index cee0d1080c..e5b96bfe93 100644
--- a/platform/qt/qt.cmake
+++ b/platform/qt/qt.cmake
@@ -76,6 +76,8 @@ add_executable(mbgl-qt
platform/qt/resources/common.qrc
)
+xcode_create_scheme(TARGET mbgl-qt)
+
if(WITH_QT_4)
include(platform/qt/qt4.cmake)
else()
@@ -107,3 +109,5 @@ add_custom_command(
${CMAKE_SOURCE_DIR}/platform/qt/include
${CMAKE_CURRENT_BINARY_DIR}/platform/qt/include
)
+
+xcode_create_scheme(TARGET qmapboxgl)