diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-07-04 14:19:25 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-07-06 11:45:09 +0200 |
commit | fc48ca18018564e26f0498c4f59f77374c1cadbf (patch) | |
tree | 66ee7f9a7ad3aea590094281cf936c1e0a6ccc76 /cmake | |
parent | adbce36fe6e1a9d95633776ff9fada67289733ae (diff) | |
download | qtlocation-mapboxgl-fc48ca18018564e26f0498c4f59f77374c1cadbf.tar.gz |
[build] use CMake to generate Xcode schemes
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/benchmark.cmake | 7 | ||||
-rw-r--r-- | cmake/core.cmake | 2 | ||||
-rw-r--r-- | cmake/executable.xcscheme | 102 | ||||
-rw-r--r-- | cmake/glfw.cmake | 13 | ||||
-rw-r--r-- | cmake/library.xcscheme | 80 | ||||
-rw-r--r-- | cmake/loop-darwin.cmake | 2 | ||||
-rw-r--r-- | cmake/loop-uv.cmake | 2 | ||||
-rw-r--r-- | cmake/node.cmake | 34 | ||||
-rw-r--r-- | cmake/node.xcscheme | 95 | ||||
-rw-r--r-- | cmake/offline.cmake | 15 | ||||
-rw-r--r-- | cmake/render.cmake | 19 | ||||
-rw-r--r-- | cmake/test.cmake | 11 | ||||
-rw-r--r-- | cmake/xcode.cmake | 75 |
13 files changed, 457 insertions, 0 deletions
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/cmake/executable.xcscheme b/cmake/executable.xcscheme new file mode 100644 index 0000000000..44146a621d --- /dev/null +++ b/cmake/executable.xcscheme @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0830" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </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 = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "YES" + customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </BuildableProductRunnable> + <CommandLineArguments>${XCSCHEME_COMMAND_LINE_ARGS} + </CommandLineArguments> + <EnvironmentVariables> + <EnvironmentVariable + key = "MAPBOX_ACCESS_TOKEN" + value = "$ENV{MAPBOX_ACCESS_TOKEN}" + isEnabled = "YES"> + </EnvironmentVariable> + </EnvironmentVariables> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "YES" + customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}" + debugDocumentVersioning = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> 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/cmake/library.xcscheme b/cmake/library.xcscheme new file mode 100644 index 0000000000..320a2f851f --- /dev/null +++ b/cmake/library.xcscheme @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0830" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + </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"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> 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/cmake/node.xcscheme b/cmake/node.xcscheme new file mode 100644 index 0000000000..0daffa46e6 --- /dev/null +++ b/cmake/node.xcscheme @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0810" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "YES" + customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <PathRunnable + runnableDebuggingMode = "0" + FilePath = "${XCSCHEME_NODE_EXECUTABLE}"> + </PathRunnable> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </MacroExpansion> + <CommandLineArguments>${XCSCHEME_COMMAND_LINE_ARGS} + </CommandLineArguments> + <EnvironmentVariables> + <EnvironmentVariable + key = "PATH" + value = "${XCSCHEME_NODE_PATH}:$PATH" + isEnabled = "YES"> + </EnvironmentVariable> + </EnvironmentVariables> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "YES" + customWorkingDirectory = "${XCSCHEME_WORKING_DIRECTORY}" + debugDocumentVersioning = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "${XCSCHEME_BLUEPRINT_ID}" + BuildableName = "${XCSCHEME_BUILDABLE_NAME}" + BlueprintName = "${XCSCHEME_BLUEPRINT_NAME}" + ReferencedContainer = "container:${XCSCHEME_CONTAINER}"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> 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() |