[build] use CMake to generate Xcode schemes
This commit is contained in:
@@ -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)
|
||||
|
||||
31
Makefile
31
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)
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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>
|
||||
@@ -17,3 +17,5 @@ target_include_directories(mbgl-loop-darwin
|
||||
)
|
||||
|
||||
create_source_groups(mbgl-loop-darwin)
|
||||
|
||||
xcode_create_scheme(TARGET mbgl-loop-darwin)
|
||||
@@ -19,3 +19,5 @@ target_link_libraries(mbgl-loop-uv
|
||||
)
|
||||
|
||||
create_source_groups(mbgl-loop-uv)
|
||||
|
||||
xcode_create_scheme(TARGET mbgl-loop-uv)
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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>
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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=."
|
||||
)
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
75
cmake/xcode.cmake
Normal file
75
cmake/xcode.cmake
Normal file
@@ -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()
|
||||
@@ -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}"
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user