macOS Metal + AppKit app (#2205)
Co-authored-by: mwilsnd <mwilsnd@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
6
.bazelrc
@@ -1,10 +1,10 @@
|
||||
# https://github.com/aspect-build/rules_js/issues/1408
|
||||
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
|
||||
|
||||
# TODO: remove with bazel 7.x
|
||||
common --enable_bzlmod
|
||||
|
||||
common --enable_platform_specific_config
|
||||
# TODO: remove once bazel flips this flag
|
||||
common --incompatible_disallow_empty_glob
|
||||
|
||||
coverage --experimental_ui_max_stdouterr_bytes=10485760
|
||||
|
||||
common:macos --linkopt=-L/opt/homebrew/lib
|
||||
@@ -1 +1 @@
|
||||
7.0.0
|
||||
7.1.0
|
||||
|
||||
@@ -9,10 +9,14 @@ BinPackParameters: false
|
||||
ColumnLimit: 120
|
||||
IncludeBlocks: Preserve
|
||||
IndentWidth: 4
|
||||
Language: Cpp
|
||||
PackConstructorInitializers: Never
|
||||
PenaltyBreakAssignment: 80
|
||||
SortIncludes: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
Standard: c++17
|
||||
---
|
||||
Language: Cpp
|
||||
---
|
||||
Language: ObjC
|
||||
BasedOnStyle: Google
|
||||
...
|
||||
|
||||
2
.github/workflows/ios-ci.yml
vendored
@@ -77,8 +77,6 @@ jobs:
|
||||
${{ runner.os }}-bazel-
|
||||
path: ~/.cache/bazel
|
||||
|
||||
- run: cp bazel/example_config.bzl bazel/config.bzl
|
||||
|
||||
- name: Check debug symbols
|
||||
run: bazel run //platform:check-public-symbols --//:renderer=metal
|
||||
|
||||
|
||||
94
.github/workflows/macos-ci.yml
vendored
@@ -4,48 +4,11 @@ on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- opengl-2
|
||||
- macos-*.*.x
|
||||
tags:
|
||||
- 'macos-*'
|
||||
paths:
|
||||
- CMakeLists.txt
|
||||
- 'platform/ios/**'
|
||||
- 'platform/darwin/**'
|
||||
- ".github/workflows/macos-ci.yml"
|
||||
- "bin/**"
|
||||
- "expression-test/**"
|
||||
- "include/**"
|
||||
- "metrics/**"
|
||||
- "platform/default/**"
|
||||
- "render-test/**"
|
||||
- "scripts/**"
|
||||
- "src/**"
|
||||
- "test/**"
|
||||
- "vendor/**"
|
||||
- ".gitmodules"
|
||||
- "!**/*.md"
|
||||
- main
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- opengl-2
|
||||
paths:
|
||||
- CMakeLists.txt
|
||||
- 'platform/ios/**'
|
||||
- 'platform/darwin/**'
|
||||
- ".github/workflows/macos-ci.yml"
|
||||
- "bin/**"
|
||||
- "expression-test/**"
|
||||
- "include/**"
|
||||
- "metrics/**"
|
||||
- "platform/default/**"
|
||||
- "render-test/**"
|
||||
- "scripts/**"
|
||||
- "src/**"
|
||||
- "test/**"
|
||||
- "vendor/**"
|
||||
- ".gitmodules"
|
||||
- "!**/*.md"
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
# cancel jobs on PRs only
|
||||
@@ -55,15 +18,10 @@ concurrency:
|
||||
jobs:
|
||||
build:
|
||||
name: MacOS CI Tests
|
||||
runs-on: [self-hosted, macOS, ARM64]
|
||||
env:
|
||||
BUILDTYPE: Debug
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
|
||||
runs-on: [macos-14]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: platform/ios
|
||||
working-directory: platform/macos
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
@@ -72,31 +30,23 @@ jobs:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- name: Cache Bazel
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
node-version: 18
|
||||
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-bazel-
|
||||
path: ~/.cache/bazel
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install bazelisk webp libuv webp icu4c jpeg-turbo glfw
|
||||
brew link icu4c --force
|
||||
|
||||
- name: npm install
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Run macOS Objective-C tests
|
||||
run: |
|
||||
../macos/scripts/run-in-macos-gui-env.sh "make macos-test"
|
||||
|
||||
- name: npm install # C++ tests are run with root as working directory
|
||||
run: npm ci --ignore-scripts
|
||||
working-directory: .
|
||||
|
||||
- name: Run macOS C++ unit tests
|
||||
run: |
|
||||
cmake -S . -B "$BUILD_DIR"
|
||||
cmake --build "$BUILD_DIR" --target mbgl-test-runner
|
||||
ctest -VV --test-dir "$BUILD_DIR" -R mbgl-test-runner
|
||||
env:
|
||||
BUILD_DIR: ../../../maplibre-gl-native-macostestbuild
|
||||
|
||||
- name: Check public symbols
|
||||
run: make darwin-check-public-symbols
|
||||
|
||||
- name: Lint plist files
|
||||
run: make macos-lint
|
||||
- name: Build AppKit app, GLFW app, cache tool, render tool for macOS
|
||||
run: bazel build //platform/macos/app:macos_app //platform/glfw:glfw_app //bin:cache_tool //bin:render_tool --//:renderer=metal
|
||||
|
||||
- name: Generate Xcode project for macOS
|
||||
run: bazel run //platform/macos:xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags="--//:renderer=metal"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ repos:
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
args: [--allow-multiple-documents]
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v18.1.2
|
||||
hooks:
|
||||
|
||||
13
BUILD.bazel
@@ -139,6 +139,9 @@ cc_library(
|
||||
"@platforms//os:ios": [
|
||||
"//vendor:icu",
|
||||
],
|
||||
"@platforms//os:osx": [
|
||||
"//vendor:icu",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":metal_renderer": [
|
||||
@@ -240,3 +243,13 @@ js_library(
|
||||
":node_modules/ejs",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "maplibre_lib",
|
||||
srcs = [],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = select({
|
||||
"@platforms//os:macos": ["//platform:macos-objcpp"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
20
WORKSPACE
@@ -0,0 +1,20 @@
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("//platform/darwin:bazel/darwin_config_repository_rule.bzl", "darwin_config")
|
||||
|
||||
http_archive(
|
||||
name = "glfw",
|
||||
build_file = "@//vendor:glfw.BUILD",
|
||||
integrity = "sha256-tewASycS/Qjohh3CcUKPBId1IAot9xnM9XUUO6dJo+k=",
|
||||
strip_prefix = "glfw-3.4",
|
||||
url = "https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip",
|
||||
)
|
||||
|
||||
new_local_repository(
|
||||
name = "libuv",
|
||||
build_file = "@//vendor:libuv.BUILD",
|
||||
path = "/opt/homebrew/opt/libuv",
|
||||
)
|
||||
|
||||
darwin_config(
|
||||
name = "darwin_config",
|
||||
)
|
||||
|
||||
@@ -68,6 +68,14 @@ WARNING_FLAGS = {
|
||||
"-Wno-tautological-constant-compare",
|
||||
"-Wno-gnu-anonymous-struct",
|
||||
] + GCC_CLANG_COMMON_FLAGS,
|
||||
"macos": [
|
||||
"-Wno-newline-eof",
|
||||
"-Wno-nested-anon-types",
|
||||
"-Wno-c++11-narrowing",
|
||||
"-Wno-pointer-to-int-cast",
|
||||
"-Wno-tautological-constant-compare",
|
||||
"-Wno-gnu-anonymous-struct",
|
||||
] + GCC_CLANG_COMMON_FLAGS,
|
||||
"linux": GCC_CLANG_COMMON_FLAGS,
|
||||
"windows": MSVC_FLAGS,
|
||||
}
|
||||
|
||||
23
bin/BUILD.bazel
Normal file
@@ -0,0 +1,23 @@
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
||||
|
||||
cc_binary(
|
||||
name = "cache_tool",
|
||||
srcs = [
|
||||
"cache.cpp",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||
deps = [
|
||||
"//platform:macos-objcpp",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "render_tool",
|
||||
srcs = [
|
||||
"render.cpp",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||
deps = [
|
||||
"//platform:macos-objcpp",
|
||||
],
|
||||
)
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <fstream>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
args::ArgumentParser argumentParser("Mapbox GL render tool");
|
||||
args::ArgumentParser argumentParser("MapLibre Native render tool");
|
||||
args::HelpFlag helpFlag(argumentParser, "help", "Display this help menu", {"help"});
|
||||
|
||||
args::ValueFlag<std::string> backendValue(argumentParser, "Backend", "Rendering backend", {"backend"});
|
||||
|
||||
@@ -7,11 +7,11 @@ class RendererBackend;
|
||||
|
||||
class BackendScope {
|
||||
public:
|
||||
/// There are two types of scopes: Creating an "Implicit" scope tells Mapbox
|
||||
/// GL that the supporting windowing system has already activated the GL
|
||||
/// Backend and that no further actions are required. Creating an "Explicit"
|
||||
/// scope actually enables the GL Backend, and disables it when the
|
||||
/// BackendScope is destroyed.
|
||||
/// There are two types of scopes: Creating an "Implicit" scope tells MapLibre
|
||||
/// Native that the supporting windowing system has already activated the
|
||||
/// RenderBackend and that no further actions are required. Creating an "Explicit"
|
||||
/// scope (the default) actually enables the RenderBackend, and disables it when
|
||||
/// the BackendScope is destroyed.
|
||||
enum class ScopeType : bool {
|
||||
Implicit,
|
||||
Explicit,
|
||||
|
||||
@@ -1,6 +1,82 @@
|
||||
load("@aspect_rules_js//js:defs.bzl", "js_binary")
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS", "WARNING_FLAGS")
|
||||
|
||||
objc_library(
|
||||
name = "macos-objcpp",
|
||||
srcs = [
|
||||
"//platform/darwin:darwin_objcpp_custom_drawable_srcs",
|
||||
"//platform/darwin:darwin_objcpp_srcs",
|
||||
"//platform/darwin:darwin_private_hdrs",
|
||||
"//platform/darwin:generated_style_srcs",
|
||||
"//platform/macos:macos_objcpp_srcs",
|
||||
"//platform/macos:macos_private_hdrs",
|
||||
"//platform/macos:macos_public_hdrs",
|
||||
],
|
||||
hdrs = [
|
||||
"//platform/darwin:include/mbgl/util/image+MLNAdditions.hpp",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
|
||||
"-fcxx-modules",
|
||||
"-fmodules",
|
||||
"-Wno-vla-extension",
|
||||
"-Wno-gnu-conditional-omitted-operand",
|
||||
"-Wno-deprecated-declarations",
|
||||
],
|
||||
includes = [
|
||||
"darwin/include",
|
||||
"darwin/src",
|
||||
"macos/src",
|
||||
],
|
||||
module_name = "MapLibre",
|
||||
sdk_frameworks = [
|
||||
"Metal",
|
||||
"MetalKit",
|
||||
"QuartzCore",
|
||||
"CoreGraphics",
|
||||
"CoreLocation",
|
||||
"AppKit",
|
||||
"SystemConfiguration",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"macos-objc",
|
||||
"//:mbgl-core",
|
||||
"//platform/darwin:darwin-generated-style-artifacts",
|
||||
"//platform/darwin:darwin-objcpp",
|
||||
"//platform/default:mbgl-default",
|
||||
],
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "macos-objc",
|
||||
srcs = [
|
||||
"//platform/darwin:darwin_objc_hdrs",
|
||||
"//platform/darwin:darwin_objc_srcs",
|
||||
"//platform/darwin:darwin_private_hdrs",
|
||||
"//platform/macos:macos_objc_srcs",
|
||||
"//platform/macos:macos_private_hdrs",
|
||||
"//platform/macos:macos_public_hdrs",
|
||||
],
|
||||
copts = select({
|
||||
"@platforms//os:ios": WARNING_FLAGS["ios"],
|
||||
"@platforms//os:macos": WARNING_FLAGS["macos"],
|
||||
}) + MAPLIBRE_FLAGS + [
|
||||
"-fmodules",
|
||||
"-Wno-deprecated-declarations",
|
||||
],
|
||||
includes = [
|
||||
"darwin/include",
|
||||
"darwin/src",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//:mbgl-core",
|
||||
"//platform/darwin:darwin-generated-style-artifacts",
|
||||
"//platform/darwin:darwin-objc",
|
||||
"//platform/default:mbgl-default",
|
||||
],
|
||||
)
|
||||
|
||||
# Objcpp files for the iOS source
|
||||
objc_library(
|
||||
name = "objcpp-sdk",
|
||||
@@ -68,7 +144,10 @@ objc_library(
|
||||
hdrs = [
|
||||
"//platform/darwin:include/mbgl/util/image+MLNAdditions.hpp",
|
||||
],
|
||||
copts = WARNING_FLAGS["ios"] + MAPLIBRE_FLAGS + [
|
||||
copts = select({
|
||||
"@platforms//os:ios": WARNING_FLAGS["ios"],
|
||||
"@platforms//os:macos": WARNING_FLAGS["macos"],
|
||||
}) + MAPLIBRE_FLAGS + [
|
||||
"-fmodules",
|
||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||
"-Wno-variadic-macros",
|
||||
@@ -187,9 +266,9 @@ objc_library(
|
||||
objc_library(
|
||||
name = "iosapp",
|
||||
srcs = [
|
||||
"//platform/ios:ios_app_srcs",
|
||||
"//platform/darwin:app/CustomStyleLayerExample.h",
|
||||
"//platform/darwin:app/CustomStyleLayerExample.m",
|
||||
"//platform/ios:ios_app_srcs",
|
||||
],
|
||||
defines = ["GLES_SILENCE_DEPRECATION"],
|
||||
includes = [
|
||||
|
||||
@@ -272,6 +272,7 @@ objc_library(
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"darwin-objc",
|
||||
"//:mbgl-core",
|
||||
"//platform/default:mbgl-default",
|
||||
],
|
||||
|
||||
18
platform/darwin/bazel/darwin_config_repository_rule.bzl
Normal file
@@ -0,0 +1,18 @@
|
||||
def _impl(ctx):
|
||||
config_dir = ctx.workspace_root.get_child("platform", "darwin", "bazel")
|
||||
config = config_dir.get_child("config.bzl")
|
||||
example_config = config_dir.get_child("example_config.bzl")
|
||||
|
||||
ctx.watch(config)
|
||||
ctx.watch(example_config)
|
||||
|
||||
ctx.file("BUILD.bazel", "")
|
||||
if config.exists:
|
||||
ctx.file("config.bzl", ctx.read(config))
|
||||
else:
|
||||
ctx.file("config.bzl", ctx.read(example_config))
|
||||
|
||||
darwin_config = repository_rule(
|
||||
implementation = _impl,
|
||||
local = True,
|
||||
)
|
||||
@@ -1,14 +1,13 @@
|
||||
# cp example_config config.bzl
|
||||
# if you want to override this file
|
||||
|
||||
# Find your team ID inside a .mobileprovision file or in your keychain (Apple development: your@email -> Get Info -> Organizational Unit)
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID = "TC45MCF93C"
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_NAME = "iOS Team Provisioning Profile: *"
|
||||
BUNDLE_ID_PREFIX = "com.firstnamelastname"
|
||||
|
||||
# Change the BUILD_MODE to "xcode" below if you experience problems with
|
||||
# not finding a provisioning profile when building.
|
||||
# https://github.com/MobileNativeFoundation/rules_xcodeproj/blob/main/docs/bazel.md#xcodeproj-build_mode
|
||||
BUILD_MODE = "bazel"
|
||||
|
||||
# Enter your API key for MapTiler here, if you have one.
|
||||
API_KEY = "0000000000"
|
||||
|
||||
# Semantic version number to include in plist files.
|
||||
SEM_VER = "0.0.0"
|
||||
SEM_VER = "0.0.0"
|
||||
@@ -155,10 +155,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (void)startUpdatingHeading;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
/**
|
||||
Stops the generation of heading updates.
|
||||
*/
|
||||
- (void)stopUpdatingHeading;
|
||||
#endif
|
||||
|
||||
/**
|
||||
Dissmisses immediately the heading calibration view from screen.
|
||||
|
||||
@@ -94,9 +94,11 @@
|
||||
[self.locationManager startUpdatingLocation];
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
- (void)stopUpdatingHeading {
|
||||
[self.locationManager stopUpdatingHeading];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)stopUpdatingLocation {
|
||||
[self.locationManager stopUpdatingLocation];
|
||||
@@ -105,7 +107,9 @@
|
||||
- (void)dealloc
|
||||
{
|
||||
[self.locationManager stopUpdatingLocation];
|
||||
#if TARGET_OS_IPHONE
|
||||
[self.locationManager stopUpdatingHeading];
|
||||
#endif
|
||||
self.locationManager.delegate = nil;
|
||||
self.delegate = nil;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,12 @@ cc_library(
|
||||
"src/mbgl/util/timer.cpp",
|
||||
"src/mbgl/util/webp_reader.cpp",
|
||||
],
|
||||
"@platforms//os:ios": [],
|
||||
"@platforms//os:osx": [
|
||||
"src/mbgl/util/async_task.cpp",
|
||||
"src/mbgl/util/run_loop.cpp",
|
||||
"src/mbgl/util/timer.cpp",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
hdrs = [
|
||||
"include/mbgl/gfx/headless_backend.hpp",
|
||||
@@ -96,11 +101,27 @@ cc_library(
|
||||
includes = [
|
||||
"include",
|
||||
],
|
||||
linkopts = select({
|
||||
"@platforms//os:macos": [
|
||||
"-lsqlite3",
|
||||
"-luv",
|
||||
"-lz",
|
||||
"-lcurl",
|
||||
"-lpng",
|
||||
"-ljpeg",
|
||||
"-lwebp",
|
||||
"-licuuc ",
|
||||
"-licui18n",
|
||||
"-licudata",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = [
|
||||
"//platform:__pkg__",
|
||||
"//platform/darwin:__pkg__",
|
||||
"//platform/ios:__pkg__",
|
||||
"//platform/linux:__pkg__",
|
||||
"//platform/macos:__pkg__",
|
||||
"//test:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
@@ -112,5 +133,10 @@ cc_library(
|
||||
"@platforms//os:linux": [
|
||||
"default-collator",
|
||||
],
|
||||
"@platforms//os:osx": [
|
||||
":default-collator",
|
||||
"//platform/darwin:darwin-loop",
|
||||
"@libuv",
|
||||
],
|
||||
}),
|
||||
)
|
||||
|
||||
58
platform/glfw/BUILD.bazel
Normal file
@@ -0,0 +1,58 @@
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
||||
|
||||
objc_library(
|
||||
name = "metal_backend",
|
||||
srcs = [
|
||||
"glfw_backend.hpp",
|
||||
"glfw_metal_backend.h",
|
||||
"glfw_metal_backend.mm",
|
||||
"metal_backend.h",
|
||||
"metal_backend.mm",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||
deps = [
|
||||
"//:maplibre_lib",
|
||||
"@glfw",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "glfw_app",
|
||||
srcs = glob(
|
||||
[
|
||||
"*.cpp",
|
||||
"*.hpp",
|
||||
],
|
||||
exclude = [
|
||||
"glfw_*_backend.*",
|
||||
],
|
||||
) +
|
||||
select({
|
||||
"//:metal_renderer": [
|
||||
],
|
||||
"//conditions:default": [
|
||||
"glfw_gl_backend.cpp",
|
||||
"glfw_gl_backend.hpp",
|
||||
],
|
||||
}),
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
|
||||
linkopts = [
|
||||
"-lglfw",
|
||||
] + select({
|
||||
"@platforms//os:macos": [
|
||||
"-framework Cocoa",
|
||||
"-framework IOKit",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = [
|
||||
"@rules_xcodeproj//xcodeproj:generated",
|
||||
],
|
||||
deps = [
|
||||
"//:maplibre_lib",
|
||||
"@glfw",
|
||||
] + select({
|
||||
"@platforms//os:macos": ["metal_backend"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
35
platform/glfw/glfw_metal_backend.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "glfw_backend.hpp"
|
||||
#include "metal_backend.h"
|
||||
|
||||
#include <mbgl/gfx/renderable.hpp>
|
||||
#include <mbgl/mtl/renderer_backend.hpp>
|
||||
|
||||
struct GLFWwindow;
|
||||
@class NSWindow;
|
||||
|
||||
class GLFWMetalBackend final : public GLFWBackend {
|
||||
public:
|
||||
GLFWMetalBackend(GLFWwindow *window_, const bool capFrameRate);
|
||||
~GLFWMetalBackend() = default;
|
||||
mbgl::gfx::RendererBackend &getRendererBackend() override;
|
||||
void setSize(mbgl::Size) override;
|
||||
mbgl::Size getSize() const override;
|
||||
|
||||
private:
|
||||
NSWindow *window;
|
||||
MetalBackend rendererBackend;
|
||||
};
|
||||
|
||||
namespace mbgl {
|
||||
namespace gfx {
|
||||
|
||||
template <>
|
||||
std::unique_ptr<GLFWBackend> Backend::Create<mbgl::gfx::Backend::Type::Metal>(GLFWwindow *window,
|
||||
bool capFrameRate) {
|
||||
return std::make_unique<GLFWMetalBackend>(window, capFrameRate);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mbgl
|
||||
26
platform/glfw/glfw_metal_backend.mm
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "glfw_metal_backend.h"
|
||||
|
||||
#include "metal_backend.h"
|
||||
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <GLFW/glfw3native.h>
|
||||
|
||||
GLFWMetalBackend::GLFWMetalBackend(GLFWwindow* window_, const bool capFrameRate)
|
||||
:
|
||||
window(glfwGetCocoaWindow(window_)),
|
||||
rendererBackend(window)
|
||||
{
|
||||
}
|
||||
|
||||
mbgl::gfx::RendererBackend& GLFWMetalBackend::getRendererBackend() {
|
||||
return rendererBackend;
|
||||
}
|
||||
|
||||
void GLFWMetalBackend::setSize(mbgl::Size size) {
|
||||
rendererBackend.setSize(size);
|
||||
}
|
||||
|
||||
mbgl::Size GLFWMetalBackend::getSize() const {
|
||||
return rendererBackend.getSize();
|
||||
}
|
||||
@@ -150,33 +150,37 @@ GLFWView::GLFWView(bool fullscreen_,
|
||||
}
|
||||
|
||||
#if __APPLE__
|
||||
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GL_TRUE);
|
||||
glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GL_TRUE);
|
||||
#endif
|
||||
|
||||
#if MBGL_WITH_EGL
|
||||
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
|
||||
#endif
|
||||
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
|
||||
if (mbgl::gfx::Backend::GetType() != mbgl::gfx::Backend::Type::OpenGL) {
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
} else {
|
||||
#if __APPLE__
|
||||
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GL_TRUE);
|
||||
#endif
|
||||
|
||||
#if MBGL_WITH_EGL
|
||||
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
|
||||
#endif
|
||||
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
|
||||
glfwWindowHint(GLFW_RED_BITS, 8);
|
||||
glfwWindowHint(GLFW_GREEN_BITS, 8);
|
||||
glfwWindowHint(GLFW_BLUE_BITS, 8);
|
||||
glfwWindowHint(GLFW_ALPHA_BITS, 8);
|
||||
glfwWindowHint(GLFW_STENCIL_BITS, 8);
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
}
|
||||
|
||||
glfwWindowHint(GLFW_RED_BITS, 8);
|
||||
glfwWindowHint(GLFW_GREEN_BITS, 8);
|
||||
glfwWindowHint(GLFW_BLUE_BITS, 8);
|
||||
glfwWindowHint(GLFW_ALPHA_BITS, 8);
|
||||
glfwWindowHint(GLFW_STENCIL_BITS, 8);
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
window = glfwCreateWindow(width, height, "Mapbox GL", monitor, nullptr);
|
||||
window = glfwCreateWindow(width, height, "MapLibre Native", monitor, nullptr);
|
||||
if (!window) {
|
||||
glfwTerminate();
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "failed to initialize window");
|
||||
@@ -196,6 +200,12 @@ GLFWView::GLFWView(bool fullscreen_,
|
||||
|
||||
backend = GLFWBackend::Create(window, benchmark);
|
||||
|
||||
#ifdef __APPLE__
|
||||
int fbW, fbH;
|
||||
glfwGetFramebufferSize(window, &fbW, &fbH);
|
||||
backend->setSize({fbW, fbH});
|
||||
#endif
|
||||
|
||||
pixelRatio = static_cast<float>(backend->getSize().width) / width;
|
||||
|
||||
glfwMakeContextCurrent(nullptr);
|
||||
@@ -837,6 +847,12 @@ void GLFWView::onWindowResize(GLFWwindow *window, int width, int height) {
|
||||
view->width = width;
|
||||
view->height = height;
|
||||
view->map->setSize({static_cast<uint32_t>(view->width), static_cast<uint32_t>(view->height)});
|
||||
|
||||
#ifdef __APPLE__
|
||||
int fbW, fbH;
|
||||
glfwGetFramebufferSize(window, &fbW, &fbH);
|
||||
view->backend->setSize({fbW, fbH});
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLFWView::onFramebufferResize(GLFWwindow *window, int width, int height) {
|
||||
@@ -1030,7 +1046,7 @@ void GLFWView::setShouldClose() {
|
||||
}
|
||||
|
||||
void GLFWView::setWindowTitle(const std::string &title) {
|
||||
glfwSetWindowTitle(window, (std::string{"Mapbox GL: "} + title).c_str());
|
||||
glfwSetWindowTitle(window, (std::string{"MapLibre Native (GLFW): "} + title).c_str());
|
||||
}
|
||||
|
||||
void GLFWView::onDidFinishLoadingStyle() {
|
||||
|
||||
@@ -36,7 +36,7 @@ void quit_handler(int) {
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
args::ArgumentParser argumentParser("Mapbox GL GLFW example");
|
||||
args::ArgumentParser argumentParser("MapLibre Native GLFW example");
|
||||
args::HelpFlag helpFlag(argumentParser, "help", "Display this help menu", {'h', "help"});
|
||||
|
||||
args::Flag fullscreenFlag(argumentParser, "fullscreen", "Toggle fullscreen", {'f', "fullscreen"});
|
||||
@@ -206,7 +206,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Load style
|
||||
if (style.empty()) {
|
||||
const char* url = getenv("MAPBOX_STYLE_URL");
|
||||
const char* url = getenv("MLN_STYLE_URL");
|
||||
if (url == nullptr) {
|
||||
mbgl::util::DefaultStyle newStyle = orderedStyles[0];
|
||||
style = newStyle.getUrl();
|
||||
|
||||
20
platform/glfw/metal_backend.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/mtl/renderer_backend.hpp>
|
||||
#include <mbgl/gfx/renderable.hpp>
|
||||
#include <mbgl/mtl/texture2d.hpp>
|
||||
#include <mbgl/gfx/context.hpp>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
class MetalBackend final : public mbgl::mtl::RendererBackend, public mbgl::gfx::Renderable {
|
||||
public:
|
||||
MetalBackend(NSWindow *window);
|
||||
|
||||
mbgl::gfx::Renderable &getDefaultRenderable() override;
|
||||
void activate() override;
|
||||
void deactivate() override;
|
||||
void updateAssumedState() override;
|
||||
void setSize(mbgl::Size size_);
|
||||
mbgl::Size getSize() const;
|
||||
};
|
||||
134
platform/glfw/metal_backend.mm
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "metal_backend.h"
|
||||
|
||||
#include <mbgl/mtl/renderable_resource.hpp>
|
||||
#include <Metal/Metal.hpp>
|
||||
#include <QuartzCore/CAMetalLayer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class MetalRenderableResource final: public mtl::RenderableResource {
|
||||
public:
|
||||
MetalRenderableResource(MetalBackend &backend):
|
||||
rendererBackend(backend),
|
||||
commandQueue(NS::TransferPtr(backend.getDevice()->newCommandQueue())),
|
||||
swapchain(NS::TransferPtr(CA::MetalLayer::layer()))
|
||||
{
|
||||
swapchain->setDevice(backend.getDevice().get());
|
||||
}
|
||||
|
||||
void setBackendSize(mbgl::Size size_) {
|
||||
size = size_;
|
||||
swapchain->setDrawableSize({size.width, size.height});
|
||||
buffersInvalid = true;
|
||||
}
|
||||
|
||||
mbgl::Size getSize() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void bind() override {
|
||||
surface = NS::TransferPtr(swapchain->nextDrawable());
|
||||
auto texSize = mbgl::Size{
|
||||
static_cast<uint32_t>(swapchain->drawableSize().width),
|
||||
static_cast<uint32_t>(swapchain->drawableSize().height)};
|
||||
|
||||
commandBuffer = NS::TransferPtr(commandQueue->commandBuffer());
|
||||
renderPassDescriptor = NS::TransferPtr(MTL::RenderPassDescriptor::renderPassDescriptor());
|
||||
renderPassDescriptor->colorAttachments()->object(0)->setTexture(surface->texture());
|
||||
|
||||
if (buffersInvalid || !depthTexture || !stencilTexture) {
|
||||
buffersInvalid = false;
|
||||
depthTexture = rendererBackend.getContext().createTexture2D();
|
||||
depthTexture->setSize(texSize);
|
||||
depthTexture->setFormat(gfx::TexturePixelType::Depth, gfx::TextureChannelDataType::Float);
|
||||
depthTexture->setSamplerConfiguration(
|
||||
{gfx::TextureFilterType::Linear, gfx::TextureWrapType::Clamp, gfx::TextureWrapType::Clamp});
|
||||
static_cast<mtl::Texture2D*>(depthTexture.get())->setUsage(
|
||||
MTL::TextureUsageShaderRead | MTL::TextureUsageShaderWrite | MTL::TextureUsageRenderTarget);
|
||||
|
||||
stencilTexture = rendererBackend.getContext().createTexture2D();
|
||||
stencilTexture->setSize(texSize);
|
||||
stencilTexture->setFormat(gfx::TexturePixelType::Stencil, gfx::TextureChannelDataType::UnsignedByte);
|
||||
stencilTexture->setSamplerConfiguration(
|
||||
{gfx::TextureFilterType::Linear, gfx::TextureWrapType::Clamp, gfx::TextureWrapType::Clamp});
|
||||
static_cast<mtl::Texture2D*>(stencilTexture.get())
|
||||
->setUsage(MTL::TextureUsageShaderRead | MTL::TextureUsageShaderWrite | MTL::TextureUsageRenderTarget);
|
||||
}
|
||||
|
||||
if (depthTexture) {
|
||||
depthTexture->create();
|
||||
if (auto* depthTarget = renderPassDescriptor->depthAttachment()) {
|
||||
depthTarget->setTexture(static_cast<mtl::Texture2D*>(depthTexture.get())->getMetalTexture());
|
||||
}
|
||||
}
|
||||
if (stencilTexture) {
|
||||
stencilTexture->create();
|
||||
if (auto* stencilTarget = renderPassDescriptor->stencilAttachment()) {
|
||||
stencilTarget->setTexture(static_cast<mtl::Texture2D*>(stencilTexture.get())->getMetalTexture());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void swap() override {
|
||||
commandBuffer->presentDrawable(surface.get());
|
||||
commandBuffer->commit();
|
||||
commandBuffer.reset();
|
||||
renderPassDescriptor.reset();
|
||||
}
|
||||
|
||||
const mtl::RendererBackend& getBackend() const override {
|
||||
return rendererBackend;
|
||||
}
|
||||
|
||||
const mtl::MTLCommandBufferPtr& getCommandBuffer() const override {
|
||||
return commandBuffer;
|
||||
}
|
||||
|
||||
mtl::MTLBlitPassDescriptorPtr getUploadPassDescriptor() const override {
|
||||
return NS::TransferPtr(MTL::BlitPassDescriptor::alloc()->init());
|
||||
}
|
||||
|
||||
const mtl::MTLRenderPassDescriptorPtr& getRenderPassDescriptor() const override {
|
||||
return renderPassDescriptor;
|
||||
}
|
||||
|
||||
NS::SharedPtr<CA::MetalLayer> getSwapchain() {
|
||||
return swapchain;
|
||||
}
|
||||
|
||||
private:
|
||||
MetalBackend &rendererBackend;
|
||||
NS::SharedPtr<MTL::CommandQueue> commandQueue;
|
||||
NS::SharedPtr<MTL::CommandBuffer> commandBuffer;
|
||||
NS::SharedPtr<MTL::RenderPassDescriptor> renderPassDescriptor;
|
||||
NS::SharedPtr<CA::MetalDrawable> surface;
|
||||
NS::SharedPtr<CA::MetalLayer> swapchain;
|
||||
gfx::Texture2DPtr depthTexture;
|
||||
gfx::Texture2DPtr stencilTexture;
|
||||
mbgl::Size size;
|
||||
bool buffersInvalid = true;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
MetalBackend::MetalBackend(NSWindow *window):
|
||||
mbgl::mtl::RendererBackend(mbgl::gfx::ContextMode::Unique),
|
||||
mbgl::gfx::Renderable(mbgl::Size{0, 0}, std::make_unique<mbgl::MetalRenderableResource>(*this))
|
||||
{
|
||||
window.contentView.layer = (__bridge CALayer *)getDefaultRenderable().getResource<mbgl::MetalRenderableResource>().getSwapchain().get();
|
||||
window.contentView.wantsLayer = YES;
|
||||
}
|
||||
|
||||
mbgl::gfx::Renderable &MetalBackend::getDefaultRenderable() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void MetalBackend::activate() {}
|
||||
void MetalBackend::deactivate() {}
|
||||
void MetalBackend::updateAssumedState() {}
|
||||
|
||||
void MetalBackend::setSize(mbgl::Size size_) {
|
||||
getResource<mbgl::MetalRenderableResource>().setBackendSize(size_);
|
||||
}
|
||||
|
||||
mbgl::Size MetalBackend::getSize() const { return getResource<mbgl::MetalRenderableResource>().getSize(); }
|
||||
@@ -3,12 +3,12 @@ load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "a
|
||||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework")
|
||||
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
|
||||
load("@build_bazel_rules_apple//apple:versioning.bzl", "apple_bundle_version")
|
||||
load("@darwin_config//:config.bzl", "BUNDLE_ID_PREFIX")
|
||||
load(
|
||||
"@rules_xcodeproj//xcodeproj:defs.bzl",
|
||||
"top_level_target",
|
||||
"xcodeproj",
|
||||
)
|
||||
load("//platform/ios/bazel:config.bzl", "BUILD_MODE", "BUNDLE_ID_PREFIX")
|
||||
load(
|
||||
"//platform/ios/bazel:files.bzl",
|
||||
"MLN_IOS_PRIVATE_HEADERS",
|
||||
@@ -250,7 +250,6 @@ filegroup(
|
||||
xcodeproj(
|
||||
name = "xcodeproj",
|
||||
bazel_env = {"PATH": "/bin:/usr/bin:/usr/local/bin:/opt/homebrew/bin"},
|
||||
build_mode = BUILD_MODE,
|
||||
default_xcode_configuration = "Debug",
|
||||
extra_files = [
|
||||
":extra_files",
|
||||
|
||||
@@ -87,10 +87,10 @@ brew install bazelisk
|
||||
|
||||
#### Creating `config.bzl`
|
||||
|
||||
You need to configure Bazel. Copy the example config from `platform/ios`.
|
||||
You may want to configure Bazel, otherwise the default config gets used.
|
||||
|
||||
```
|
||||
cp platform/ios/bazel/example_config.bzl platform/ios/bazel/config.bzl
|
||||
cp platform/darwin/bazel/example_config.bzl platform/darwin/bazel/config.bzl
|
||||
```
|
||||
|
||||
You need to set your `BUNDLE_ID_PREFIX` to be unique (ideally use a domain that you own in reverse domain name notation).
|
||||
@@ -123,9 +123,7 @@ Try to run the example App in the simulator and on a device to confirm your setu
|
||||
|
||||
#### Troubleshooting Provisioning Profiles
|
||||
|
||||
If no provisioning profile was found, you could try changing the `BUILD_MODE` in `config.bzl` to `"xcode"`. Try the steps in this section again afterwards.
|
||||
|
||||
If on the other hand you get a Python `KeyError` when processing provisioning profiles, you probably have some _really_ old or corrupted profiles.
|
||||
If you get a Python `KeyError` when processing provisioning profiles, you probably have some _really_ old or corrupted profiles.
|
||||
Have a look through `~/Library/MobileDevice/Provisioning\ Profiles` and remove any expired profiles.
|
||||
|
||||
#### Using Bazel from the Command Line
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
load("//platform/ios/bazel:config.bzl", "API_KEY", "SEM_VER")
|
||||
load("@darwin_config//:config.bzl", "API_KEY", "SEM_VER")
|
||||
|
||||
def info_plist(name, base_info_plist, out, **kwargs):
|
||||
native.genrule(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
load("@build_bazel_rules_apple//apple:apple.bzl", "local_provisioning_profile")
|
||||
load("@darwin_config//:config.bzl", "APPLE_MOBILE_PROVISIONING_PROFILE_NAME", "APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID")
|
||||
load("@rules_xcodeproj//xcodeproj:defs.bzl", "xcode_provisioning_profile")
|
||||
load("config.bzl", "APPLE_MOBILE_PROVISIONING_PROFILE_NAME", "APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID")
|
||||
|
||||
def configure_device_profiles():
|
||||
local_provisioning_profile(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
|
||||
load("//platform/ios/bazel:config.bzl", "BUNDLE_ID_PREFIX")
|
||||
load("@darwin_config//:config.bzl", "BUNDLE_ID_PREFIX")
|
||||
|
||||
cc_library(
|
||||
name = "ios_test_runner_lib",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test")
|
||||
load("//platform/ios/bazel:config.bzl", "BUNDLE_ID_PREFIX")
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
||||
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
|
||||
load("@darwin_config//:config.bzl", "BUNDLE_ID_PREFIX")
|
||||
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
|
||||
|
||||
cc_library(
|
||||
name = "test_cpp_srcs",
|
||||
|
||||
1
platform/macos/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
MapLibre.xcodeproj
|
||||
@@ -1,10 +1,16 @@
|
||||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_command_line_application")
|
||||
load(
|
||||
"@rules_xcodeproj//xcodeproj:defs.bzl",
|
||||
"top_level_target",
|
||||
"xcodeproj",
|
||||
)
|
||||
load(
|
||||
"bazel/files.bzl",
|
||||
"MLN_MACOS_PRIVATE_HEADERS",
|
||||
"MLN_MACOS_PUBLIC_HEADERS",
|
||||
"MLN_MACOS_PUBLIC_METAL_HEADERS",
|
||||
"MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE",
|
||||
"MLN_MACOS_PUBLIC_OBJCPP_OPENGL_SOURCE",
|
||||
"MLN_MACOS_PUBLIC_OBJCPP_SOURCE",
|
||||
"MLN_MACOS_PUBLIC_OBJC_SOURCE",
|
||||
)
|
||||
@@ -17,16 +23,13 @@ filegroup(
|
||||
|
||||
filegroup(
|
||||
name = "macos_public_hdrs",
|
||||
srcs = MLN_MACOS_PUBLIC_HEADERS,
|
||||
srcs = MLN_MACOS_PUBLIC_HEADERS + MLN_MACOS_PUBLIC_METAL_HEADERS,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "macos_objcpp_srcs",
|
||||
srcs = MLN_MACOS_PUBLIC_OBJCPP_SOURCE + select({
|
||||
"//:metal_renderer": MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE,
|
||||
"//conditions:default": MLN_MACOS_PUBLIC_OBJCPP_OPENGL_SOURCE,
|
||||
}),
|
||||
srcs = MLN_MACOS_PUBLIC_OBJCPP_SOURCE + MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@@ -36,6 +39,41 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
macos_command_line_application(
|
||||
name = "MapLibreMac",
|
||||
minimum_deployment_os_version = "13.0",
|
||||
minimum_os_version = "13.0",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//platform:macos-objcpp"],
|
||||
)
|
||||
|
||||
xcodeproj(
|
||||
name = "xcodeproj",
|
||||
bazel_env = {"PATH": "/bin:/usr/bin:/usr/local/bin:/opt/homebrew/bin"},
|
||||
default_xcode_configuration = "Debug",
|
||||
minimum_xcode_version = "14",
|
||||
project_name = "MapLibre",
|
||||
tags = ["manual"],
|
||||
top_level_targets = [
|
||||
top_level_target(
|
||||
"//platform/macos:MapLibreMac",
|
||||
target_environments = [
|
||||
"simulator",
|
||||
],
|
||||
),
|
||||
top_level_target(
|
||||
"//platform/macos/app:macos_app",
|
||||
),
|
||||
top_level_target(
|
||||
"//platform/glfw:glfw_app",
|
||||
),
|
||||
],
|
||||
xcode_configurations = {
|
||||
"Debug": {"//command_line_option:compilation_mode": "dbg"},
|
||||
"Release": {"//command_line_option:compilation_mode": "opt"},
|
||||
},
|
||||
)
|
||||
|
||||
exports_files(
|
||||
MLN_MACOS_PRIVATE_HEADERS +
|
||||
MLN_MACOS_PUBLIC_HEADERS +
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
# Contributing to the Mapbox Maps SDK for macOS
|
||||
|
||||
This document explains how to build the Mapbox Maps SDK for macOS from source. It is intended for advanced developers who wish to contribute to Mapbox GL and the Mapbox Maps SDK for iOS.
|
||||
|
||||
## Requirements
|
||||
|
||||
See the "Requirements" section in [INSTALL.md](INSTALL.md).
|
||||
|
||||
## Building the SDK
|
||||
|
||||
Build and package the SDK by using one of the following commands:
|
||||
|
||||
* `make xproj` opens the macOS project in Xcode
|
||||
* `make xpackage` builds a dynamic framework in the Debug configuration, including debug symbols.
|
||||
* `make xdocument` generates API documentation using jazzy.
|
||||
|
||||
You can customize the build output by passing the following arguments into the `make` invocation:
|
||||
|
||||
* `BUILDTYPE=Release` will optimize for distribution. Defaults to `Debug`.
|
||||
* `SYMBOLS=NO` strips the build output of any debug symbols, yielding much smaller binaries. Defaults to `YES`.
|
||||
|
||||
An example command that creates a dynamic framework suitable for distribution:
|
||||
|
||||
```bash
|
||||
make xpackage BUILDTYPE=Release SYMBOLS=NO
|
||||
```
|
||||
|
||||
The products of these build commands can be found in the `build/macos/pkg` folder at the base of the repository.
|
||||
|
||||
## Contributing
|
||||
|
||||
### Making any symbol public
|
||||
|
||||
To add any Objective-C type, constant, or member to the macOS maps SDK’s public interface:
|
||||
|
||||
1. Ensure that the symbol is pure Objective-C and does not rely on any language features specific to Objective-C++ or the C11 dialect of C – so no namespaced types or classes named with emoji! 🙃 Most projects that depend on this SDK are either written in pure Objective-C (GNU99 dialect) or Swift, which cannot yet bridge C++ types.
|
||||
1. Name the symbol according to [Cocoa naming conventions](https://developer.apple.com/library/prerelease/content/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html#//apple_ref/doc/uid/10000146i). Use the `MLN` class prefix to avoid conflicts with client code. If the symbol has an analogue in MapKit, name the symbol according to MapKit.
|
||||
1. Provide full documentation comments. We use [jazzy](https://github.com/realm/jazzy/) to produce the documentation found in the SDK distribution. We also recognize that many developers rely on Xcode’s Quick Help feature. jazzy supports Markdown formatting; however, Quick Help supports only [HeaderDoc](https://developer.apple.com/legacy/library/documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html) syntax and a subset of Doxygen syntax. For hyperlinks, use HTML syntax, which is recognized by both tools.
|
||||
|
||||
### Making a type or constant public
|
||||
|
||||
To add an Objective-C class, protocol, category, typedef, enumeration, or global constant to the macOS maps SDK’s public interface:
|
||||
|
||||
1. _(Optional.)_ Add the macro `MLN_EXPORT` prior to the declaration for classes and global constants. To use this macro, include `MLNFoundation.h`. You can check whether all public symbols are exported correctly by running `make darwin-check-public-symbols`.
|
||||
1. _(Optional.)_ Add the type or constant’s name to the relevant category in the `custom_categories` section of [the jazzy configuration file](./jazzy.yml). This is required for classes and protocols and also recommended for any other type that is strongly associated with a particular class or protocol. If you leave out this step, the symbol will appear in an “Other” section in the generated HTML documentation’s table of contents.
|
||||
1. _(Optional.)_ If the symbol would also be publicly exposed in the iOS maps SDK, consult [the companion iOS document](../ios/DEVELOPING.md#making-a-type-or-constant-public) for further instructions.
|
||||
|
||||
### Adding a source code file
|
||||
|
||||
To add an Objective-C header or implementation file to the macOS maps SDK:
|
||||
|
||||
1. Add the file to the “dynamic” target’s Headers or Compile Sources build phase, as appropriate. You can either use the Build Phases tab of the project editor or the Target Membership section of the File inspector.
|
||||
1. Audit new headers for nullability. Typically, you will wrap a header with `NS_ASSUME_NONNULL_BEGIN` and `NS_ASSUME_NONNULL_END`.
|
||||
1. _(Optional.)_ If it’s a public header, change its visibility from Project to Public and import it in [the macOS SDK’s umbrella header](./src/Mapbox.h).
|
||||
1. _(Optional.)_ If the file would also be used by the iOS maps SDK, make sure it’s in [platform/darwin/src/](../darwin/src/), then consult [the companion iOS document](../ios/DEVELOPING.md#adding-a-source-code-file) for further instructions.
|
||||
1. Run `scripts/generate-file-lists.js` to update the generated source file list for third party build systems.
|
||||
|
||||
### Adding a resource
|
||||
|
||||
To add a resource (such as an image, SSL certificate, property list, or strings table) to the macOS maps SDK:
|
||||
|
||||
1. Add the header to the Copy Bundle Resources build phase of the “dynamic” target. You can either use the Build Phases tab of the project editor or the Target Membership section of the File inspector.
|
||||
1. _(Optional.)_ If the resource would also be used by the iOS maps SDK, make sure it’s in [platform/darwin/resources/](../darwin/resources/), then consult [the companion iOS document](../ios/DEVELOPING.md#adding-a-resource) for further instructions.
|
||||
|
||||
### Adding user-facing text
|
||||
|
||||
To add or update text that the user may see in the macOS maps SDK:
|
||||
|
||||
1. Make sure the implementation file imports [NSBundle+MLNAdditions.h](../darwin/src/NSBundle+MLNAdditions.h).
|
||||
1. Use the `NSLocalizedStringWithDefaultValue()` macro:
|
||||
* `key` is a unique identifier that won’t change if the user-facing text ever needs to change.
|
||||
* `tbl` is `Foundation` in code shared between the iOS and macOS maps SDKs, or `nil` otherwise.
|
||||
* `bundle` is `nil`; the redefined macro looks for the SDK bundle at runtime and ignores this argument.
|
||||
* `val` is the English string.
|
||||
1. _(Optional.)_ When dealing with a number followed by a pluralized word, do not split the string. Instead, use a format string and make `val` ambiguous, like `%d file(s)`. Then pluralize for English in the appropriate [.stringsdict file](https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPInternational/StringsdictFileFormat/StringsdictFileFormat.html). See [platform/darwin/resources/en.lproj/Foundation.stringsdict](../darwin/resources/en.lproj/Foundation.stringsdict) for an example. Localizers should do likewise for their languages.
|
||||
1. Run `make genstrings` and commit any changes it makes to .strings files. The make rule also updates the iOS maps SDK’s strings tables.
|
||||
|
||||
### Adding a localization
|
||||
|
||||
Translations of all the Mapbox GL Native SDKs are managed [in Transifex](https://www.transifex.com/mapbox/mapbox-gl-native/). If your language already has a translation, feel free to complete or proofread it. Otherwise, please [request your language](https://www.transifex.com/mapbox/mapbox-gl-native/languages/). Note that we’re primarily interested in languages that macOS supports as system languages.
|
||||
|
||||
Once you’ve finished translating the SDK into a new language in Transifex, perform these steps to make Xcode aware of the translation:
|
||||
|
||||
1. In macos.xcworkspace, open the project editor for macos.xcodeproj. Using the project editor’s sidebar or tab bar dropdown, go to the “macos” project; under the Localizations section of the Info tab, click the + button to add your language to the project.
|
||||
1. In the sheet that appears, select all the .strings and .stringsdict files but no .xib file. (Most of the XIBs are part of the macosapp example application, which is not localized, while MLNAnnotationCallout.xib contains no localizable strings.) If your language lacks declension and pluralization, as in the case of Chinese, omit the .stringsdict files.
|
||||
1. In the Project navigator, expand each .stringsdict file in the project. An additional version for your localization should be listed; translate it. See Apple’s documentation on the [.stringsdict format](https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/StringsdictFileFormat/StringsdictFileFormat.html).
|
||||
1. In the Project navigator, select Demo App/Localizable.strings and then, in the File Inspector, check the box for your new localization.
|
||||
1. Repeat the steps above in ios.xcworkspace.
|
||||
|
||||
The .strings files should still be in the original English – that’s expected. Now you can pull your translations into this repository:
|
||||
|
||||
1. _(First time only.)_ Download the [`tx` command line tool](https://docs.transifex.com/client/installing-the-client) and [configure your .transifexrc](https://docs.transifex.com/client/client-configuration).
|
||||
1. Run `tx pull -a`.
|
||||
1. Convert any added .strings files from UTF-16 encoding to UTF-8 encoding to facilitate diffing and merging. You can convert the file encoding using Xcode’s File inspector or the following command (substituting _MYLANG_ for the locale code):
|
||||
|
||||
```
|
||||
find platform/{darwin,ios}/resources platform/macos/sdk -path '*/MYLANG.lproj/*.strings' -exec textutil -convert txt -extension strings -inputencoding UTF-16 -encoding UTF-8 {} -output {} \;
|
||||
```
|
||||
|
||||
### Adding a code example
|
||||
|
||||
To add an example code listing to the documentation for a class or class member:
|
||||
|
||||
1. Add a test method named in the form `testMLNClass` or `testMLNClass$method`
|
||||
to [MLNDocumentationExampleTests](test/MLNDocumentationExampleTests.swift).
|
||||
Wrap the code you’d like to appear in the documentation within
|
||||
`//#-example-code` and `//#-end-example-code` comments.
|
||||
1. If the header doesn’t already have an example code listing, add the path to
|
||||
the header to platform/darwin/scripts/update-examples.list.
|
||||
1. Insert the code listings into the headers:
|
||||
|
||||
```bash
|
||||
make darwin-update-examples
|
||||
```
|
||||
|
||||
[SourceKitten](https://github.com/jpsim/SourceKitten/) is required and will be installed automatically using Homebrew.
|
||||
|
||||
### Customizing compilation settings
|
||||
|
||||
You can provide an optional and custom [`xcconfig`](https://help.apple.com/xcode/mac/current/#/dev745c5c974) file named `platform/darwin/developer.xcconfig` to set custom build options. This file is ignored by git. These custom settings apply to all configurations (`Debug`, `Release`), but do **not** apply to the core `mbgl` files. This mechanism allows you to try different compiler settings (for example when testing an Xcode beta).
|
||||
|
||||
## Testing
|
||||
|
||||
`make macos-test` builds and runs unit tests of cross-platform code as well as the SDK.
|
||||
|
||||
To instead run the cross-platform tests in Xcode instead of on the command line:
|
||||
|
||||
1. Run `make xproj` to set up the workspace.
|
||||
1. Change the scheme to “mbgl-test” and press Command-R to run core unit tests.
|
||||
1. Change the scheme to “CI” and press Command-U to run SDK integration tests.
|
||||
|
||||
## Access tokens
|
||||
|
||||
The demo applications use Mapbox vector tiles, which require a Mapbox account and API access token. Obtain an access token on the [Mapbox account page](https://www.mapbox.com/studio/account/tokens/). You will be prompted for this access token the first time you launch the demo application.
|
||||
|
||||
## Using macosapp
|
||||
|
||||
Through the macOS maps SDK, the demo application supports a variety of standard gestures and keyboard shortcuts. For more details, open Mapbox GL Help from the Help menu.
|
||||
|
||||
You can also [integrate the Mapbox Maps SDK for macOS into your own Cocoa application](INSTALL.md).
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>method</key>
|
||||
<string>developer-id</string>
|
||||
<key>teamID</key>
|
||||
<string>GJZR2MEM28</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,104 +0,0 @@
|
||||
# Integrating a custom build of the Mapbox Maps SDK for macOS into your application
|
||||
|
||||
This document explains how to build a development version of the Mapbox Maps SDK for macOS from source and integrate it into your own Cocoa application. This process is for advanced developers who want to get a glimpse of the SDK’s development between releases. To use a production-ready version of the SDK, see the [Mapbox Maps SDK for macOS homepage](https://mapbox.github.io/mapbox-gl-native/macos/).
|
||||
|
||||
### Requirements
|
||||
|
||||
The Mapbox Maps SDK for macOS requires the macOS 10.11.0 SDK (or above) and Xcode 9.0 (or above). To use this SDK with Xcode 7.3.1, download and use a symbols build from the [releases](https://github.com/mapbox/mapbox-gl-native-ios/releases) page.
|
||||
|
||||
Before building, follow these steps to install prerequisites:
|
||||
|
||||
1. Install [Xcode](https://developer.apple.com/xcode/)
|
||||
1. Launch Xcode and install any updates
|
||||
1. Install [Homebrew](http://brew.sh)
|
||||
1. Install [Node.js](https://nodejs.org/), [CMake](https://cmake.org/), [ccache](https://ccache.samba.org), and [pkg-config](https://formulae.brew.sh/formula/pkg-config-wrapper#default), [glfw](https://formulae.brew.sh/formula/glfw):
|
||||
|
||||
```bash
|
||||
brew list node || brew install node
|
||||
brew list cmake || brew install cmake
|
||||
brew list ccache || brew install ccache
|
||||
brew list pkg-config || brew install pkg-config
|
||||
brew list glfw || brew install glfw
|
||||
|
||||
# To install the CMake documentation
|
||||
brew list cmake-docs || brew install cmake-docs
|
||||
```
|
||||
1. Install [xcpretty](https://github.com/supermarin/xcpretty) (optional, used for prettifying command line builds):
|
||||
```
|
||||
[sudo] gem install xcpretty
|
||||
```
|
||||
1. Install [jazzy](https://github.com/realm/jazzy) for generating API documentation:
|
||||
```
|
||||
[sudo] gem install jazzy
|
||||
```
|
||||
|
||||
### Building the SDK from source
|
||||
|
||||
To build the SDK from source:
|
||||
|
||||
1. Clone the git repository:
|
||||
```bash
|
||||
git clone https://github.com/maplibre/maplibre-native.git
|
||||
cd maplibre-native
|
||||
```
|
||||
Note that this repository uses Git submodules. They'll be automatically checked out when you first run a `make` command,
|
||||
but are not updated automatically. We recommended that you run `git submodule update` after pulling down new commits to
|
||||
this repository.
|
||||
1. Run:
|
||||
```
|
||||
make xpackage
|
||||
```
|
||||
This produces a `Mapbox.framework` in the `build/macos/pkg/` folder.
|
||||
|
||||
### Installation
|
||||
|
||||
1. Open the project editor, select your application target, then go to the General tab. Drag Mapbox.framework into the “Embedded Binaries” section. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish.
|
||||
|
||||
1. Some vector tiles servers require a API key. In the project editor, select the application target, then go to the Info tab. Under the “Custom macOS Application Target Properties”” section, set `MLNApiKey` to your api key.
|
||||
|
||||
## Usage
|
||||
|
||||
In a storyboard or XIB:
|
||||
|
||||
1. Add a view to your view controller or window. (Drag Custom View from the Object library to the View Controller scene on the Interface Builder canvas. In a XIB, drag it instead to the window on the canvas.)
|
||||
2. In the Identity inspector, set the view’s custom class to `MLNMapView`.
|
||||
3. MLNMapView needs to be layer-backed:
|
||||
* You can make the window layer-backed by selecting the window and checking Full Size Content View in the Attributes inspector. This allows the map view to underlap the title bar and toolbar.
|
||||
* Alternatively, if you don’t want the entire window to be layer-backed, you can make just the map view layer-backed by selecting it and checking its entry under the View Effects inspector’s Core Animation Layer section.
|
||||
4. Add a map feedback item to your Help menu. (Drag Menu Item from the Object library into Main Menu ‣ Help ‣ Menu.) Title it “Improve This Map” or similar, and connect it to the `giveFeedback:` action of First Responder.
|
||||
|
||||
If you need to manipulate the map view programmatically:
|
||||
|
||||
1. Switch to the Assistant Editor.
|
||||
1. Import the `Mapbox` module.
|
||||
1. Connect the map view to a new outlet in your view controller class. (Control-drag from the map view in Interface Builder to a valid location in your view controller implementation.) The resulting outlet declaration should look something like this:
|
||||
|
||||
```objc
|
||||
// ViewController.m
|
||||
@import Mapbox;
|
||||
|
||||
@interface ViewController : NSViewController
|
||||
|
||||
@property (strong) IBOutlet MLNMapView *mapView;
|
||||
|
||||
@end
|
||||
```
|
||||
|
||||
```swift
|
||||
// ViewController.swift
|
||||
import Mapbox
|
||||
|
||||
class ViewController: NSViewController {
|
||||
@IBOutlet var mapView: MLNMapView!
|
||||
}
|
||||
```
|
||||
|
||||
```applescript
|
||||
-- AppDelegate.applescript
|
||||
script AppDelegate
|
||||
property parent : class "NSObject"
|
||||
property theMapView : missing value
|
||||
end script
|
||||
```
|
||||
|
||||
For further instructions, consult the [macOS SDK documentation](https://mapbox.github.io/mapbox-gl-native/macos/) or run `make xdocument` to generate the documentation. The [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/)’s [API documentation](https://www.mapbox.com/ios-sdk/) and [online examples](https://www.mapbox.com/ios-sdk/examples/) apply to the Mapbox Maps SDK for macOS with few differences, mostly around unimplemented features like user location tracking.
|
||||
@@ -1,25 +1,34 @@
|
||||
# MapLibre Native for macOS
|
||||
|
||||
> **Note**
|
||||
> https://github.com/maplibre/maplibre-native/pull/995 introduced OpenGL ES 3.0 shaders which are not supported by macOS without workarounds. That means that while the [Metal backend implementation](https://github.com/maplibre/maplibre-native/blob/main/design-proposals/2022-11-29-metal-port.md) is underway, builds from the `main` branch will not work on macOS. Use the `opengl-2` branch in the meantime.
|
||||
[](https://github.com/maplibre/maplibre-native/actions/workflows/macos-ci.yml)
|
||||
|
||||
[](https://github.com/maplibre/maplibre-native/actions/workflows/macos-ci.yml) [](https://github.com/maplibre/maplibre-native/actions/workflows/macos-release.yml)
|
||||
Clone the repo:
|
||||
|
||||
Put interactive, scalable world maps into your native Cocoa application with MapLibre Native for macOS.
|
||||
```sh
|
||||
git clone --recurse-submodules git@github.com:maplibre/maplibre-native.git
|
||||
```
|
||||
|
||||
* High-performance OpenGL rendering and multitouch gestures keep your users happy.
|
||||
* A well-designed, fully documented API helps you stay productive.
|
||||
* Develop across [multiple platforms](../../README.md), including [iOS](../ios/README.md), using the same styles and similar APIs.
|
||||
Install needed tooling and dependencies with Homebrew. See [macos-ci.yml](https://github.com/maplibre/maplibre-native/blob/main/.github/workflows/macos-ci.yml) for the most up-to-date dependencies.
|
||||
|
||||

|
||||
Optionally configure Bazel:
|
||||
|
||||
MapLibre Native for macOS is compatible with macOS 10.10.0 and above for Cocoa applications developed in Objective-C, Swift, Interface Builder, or AppleScript. For hybrid applications, consider [MapLibre GL JS]([https://github.com/mapbox/mapbox-gl-js/](https://github.com/maplibre/maplibre-gl-js)).
|
||||
```sh
|
||||
cp platform/darwin/bazel/example_config.bzl platform/darwin/bazel/config.bzl
|
||||
```
|
||||
|
||||
## Contributing
|
||||
Create and open Xcode project:
|
||||
|
||||
* [Build the MapLibre Native for macOS from source](INSTALL.md)
|
||||
* [Contribute to MapLibre Native for macOS](CONTRIBUTING.md)
|
||||
* [MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/)
|
||||
* [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/)
|
||||
```sh
|
||||
bazel run //platform/macos:xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags="--//:renderer=metal
|
||||
xed platform/macos/MapLibre.xcodeproj
|
||||
```
|
||||
|
||||
The MapLibre Organization does not officially support the macOS to the same extent as iOS (see [project tiers](https://github.com/maplibre/maplibre/blob/main/PROJECT_TIERS.md)); however, bug reports and pull requests are certainly welcome.
|
||||
Build and run AppKit sample app directly from the command line:
|
||||
|
||||
```sh
|
||||
bazel run //platform/macos/app:macos_app --//:renderer=metal
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The MapLibre Organization does not officially support the macOS to the same extent as iOS (see [project tiers](https://github.com/maplibre/maplibre/blob/main/PROJECT_TIERS.md)). However, bug reports and pull requests are certainly welcome.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildLocationStyle</key>
|
||||
<string>CustomLocation</string>
|
||||
<key>CustomBuildIntermediatesPath</key>
|
||||
<string>../../build/macos</string>
|
||||
<key>CustomBuildLocationType</key>
|
||||
<string>RelativeToWorkspace</string>
|
||||
<key>CustomBuildProductsPath</key>
|
||||
<string>../../build/macos</string>
|
||||
<key>DerivedDataCustomLocation</key>
|
||||
<string>../../build/macos</string>
|
||||
<key>DerivedDataLocationStyle</key>
|
||||
<string>WorkspaceRelativePath</string>
|
||||
<key>IssueFilterStyle</key>
|
||||
<string>ShowActiveSchemeOnly</string>
|
||||
<key>LiveSourceIssuesEnabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,4 +1,4 @@
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <Mapbox.h>
|
||||
|
||||
extern NSString * const MLNApiKeyDefaultsKey;
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 993 B |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 993 B |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 35 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
platform/macos/app/BUILD.bazel
Normal file
@@ -0,0 +1,32 @@
|
||||
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
|
||||
|
||||
objc_library(
|
||||
name = "macos_app_lib",
|
||||
srcs = glob([
|
||||
"*.h",
|
||||
"*.m",
|
||||
]),
|
||||
enable_modules = True,
|
||||
deps = [
|
||||
"//platform:macos-objcpp",
|
||||
],
|
||||
)
|
||||
|
||||
macos_application(
|
||||
name = "macos_app",
|
||||
bundle_id = "org.maplibre.macosapp",
|
||||
infoplists = [
|
||||
"Info.plist",
|
||||
],
|
||||
minimum_os_version = "11.0",
|
||||
resources = glob([
|
||||
"*.lproj/**",
|
||||
"Assets.xcassets/**",
|
||||
]),
|
||||
visibility = [
|
||||
"@rules_xcodeproj//xcodeproj:generated",
|
||||
],
|
||||
deps = [
|
||||
":macos_app_lib",
|
||||
],
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <Mapbox.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#import "LocationCoordinate2DTransformer.h"
|
||||
#import "TimeIntervalTransformer.h"
|
||||
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <Mapbox.h>
|
||||
|
||||
static MLNCoordinateFormatter *DroppedPinCoordinateFormatter;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import "LocationCoordinate2DTransformer.h"
|
||||
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <Mapbox.h>
|
||||
|
||||
@implementation LocationCoordinate2DTransformer {
|
||||
MLNCoordinateFormatter *_coordinateFormatter;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <Mapbox.h>
|
||||
|
||||
@interface MLNStyle (MBXAdditions)
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#import "MapDocument.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "CustomStyleLayerExample.h"
|
||||
// #import "CustomStyleLayerExample.h"
|
||||
#import "DroppedPinAnnotation.h"
|
||||
#import "MLNMapsnapshotter.h"
|
||||
|
||||
#import "MLNStyle+MBXAdditions.h"
|
||||
#import "MLNVectorTileSource_Private.h"
|
||||
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <Mapbox.h>
|
||||
|
||||
static NSString * const MLNDroppedPinAnnotationImageIdentifier = @"dropped";
|
||||
|
||||
@@ -778,36 +778,36 @@ NSArray<id <MLNAnnotation>> *MBXFlattenedShapes(NSArray<id <MLNAnnotation>> *sha
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)insertCustomStyleLayer:(id)sender {
|
||||
[self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
|
||||
[self removeCustomStyleLayer:sender];
|
||||
}];
|
||||
// - (IBAction)insertCustomStyleLayer:(id)sender {
|
||||
// [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
|
||||
// [self removeCustomStyleLayer:sender];
|
||||
// }];
|
||||
|
||||
if (!self.undoManager.isUndoing) {
|
||||
[self.undoManager setActionName:@"Add Lime Green Layer"];
|
||||
}
|
||||
// if (!self.undoManager.isUndoing) {
|
||||
// [self.undoManager setActionName:@"Add Lime Green Layer"];
|
||||
// }
|
||||
|
||||
CustomStyleLayerExample *layer = [[CustomStyleLayerExample alloc] initWithIdentifier:@"mbx-custom"];
|
||||
MLNStyleLayer *houseNumberLayer = [self.mapView.style layerWithIdentifier:@"housenum-label"];
|
||||
if (houseNumberLayer) {
|
||||
[self.mapView.style insertLayer:layer belowLayer:houseNumberLayer];
|
||||
} else {
|
||||
[self.mapView.style addLayer:layer];
|
||||
}
|
||||
}
|
||||
// CustomStyleLayerExample *layer = [[CustomStyleLayerExample alloc] initWithIdentifier:@"mbx-custom"];
|
||||
// MLNStyleLayer *houseNumberLayer = [self.mapView.style layerWithIdentifier:@"housenum-label"];
|
||||
// if (houseNumberLayer) {
|
||||
// [self.mapView.style insertLayer:layer belowLayer:houseNumberLayer];
|
||||
// } else {
|
||||
// [self.mapView.style addLayer:layer];
|
||||
// }
|
||||
// }
|
||||
|
||||
- (IBAction)removeCustomStyleLayer:(id)sender {
|
||||
[self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
|
||||
[self insertCustomStyleLayer:sender];
|
||||
}];
|
||||
// - (IBAction)removeCustomStyleLayer:(id)sender {
|
||||
// [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
|
||||
// [self insertCustomStyleLayer:sender];
|
||||
// }];
|
||||
|
||||
if (!self.undoManager.isUndoing) {
|
||||
[self.undoManager setActionName:@"Delete Lime Green Layer"];
|
||||
}
|
||||
// if (!self.undoManager.isUndoing) {
|
||||
// [self.undoManager setActionName:@"Delete Lime Green Layer"];
|
||||
// }
|
||||
|
||||
MLNStyleLayer *layer = [self.mapView.style layerWithIdentifier:@"mbx-custom"];
|
||||
[self.mapView.style removeLayer:layer];
|
||||
}
|
||||
// MLNStyleLayer *layer = [self.mapView.style layerWithIdentifier:@"mbx-custom"];
|
||||
// [self.mapView.style removeLayer:layer];
|
||||
// }
|
||||
|
||||
- (IBAction)insertGraticuleLayer:(id)sender {
|
||||
[self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import "StyleLayerIconTransformer.h"
|
||||
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import <Mapbox.h>
|
||||
|
||||
@implementation StyleLayerIconTransformer
|
||||
|
||||
|
||||
@@ -3,15 +3,26 @@ MLN_MACOS_PUBLIC_OBJCPP_SOURCE = [
|
||||
"src/MLNMapView+IBAdditions.mm",
|
||||
"src/MLNMapView+Impl.mm",
|
||||
"src/MLNMapView.mm",
|
||||
"src/MLNOpenGLLayer.mm",
|
||||
"src/NSColor+MLNAdditions.mm",
|
||||
"src/NSImage+MLNAdditions.mm",
|
||||
]
|
||||
|
||||
MLN_MACOS_PUBLIC_OBJCPP_OPENGL_SOURCE = [
|
||||
"src/MLNMapView+OpenGL.mm",
|
||||
"src/MLNOpenGLLayer.mm",
|
||||
]
|
||||
|
||||
MLN_MACOS_PUBLIC_METAL_HEADERS = [
|
||||
"src/MLNMapView+Metal.h",
|
||||
]
|
||||
|
||||
MLN_MACOS_PUBLIC_OBJCPP_METAL_SOURCE = [
|
||||
"src/MLNMapView+OpenGL.mm",
|
||||
"src/MLNMapView+Metal.mm",
|
||||
]
|
||||
|
||||
MLN_MACOS_PUBLIC_OPENGL_HEADERS = [
|
||||
"src/MLNOpenGLLayer.h",
|
||||
"src/MLNMapView+OpenGL.h",
|
||||
]
|
||||
|
||||
MLN_MACOS_PUBLIC_OBJC_SOURCE = [
|
||||
@@ -22,18 +33,16 @@ MLN_MACOS_PUBLIC_OBJC_SOURCE = [
|
||||
|
||||
MLN_MACOS_PUBLIC_HEADERS = [
|
||||
"src/MLNAnnotationImage.h",
|
||||
"src/NSImage+MLNAdditions.h",
|
||||
"src/NSColor+MLNAdditions.h",
|
||||
"src/NSProcessInfo+MLNAdditions.h",
|
||||
"src/MLNCompassCell.h",
|
||||
"src/MLNAttributionButton.h",
|
||||
"src/MLNMapView+Impl.h",
|
||||
"src/MLNMapView+IBAdditions.h",
|
||||
"src/MLNMapView+OpenGL.h",
|
||||
"src/MLNMapViewDelegate.h",
|
||||
"src/MLNMapView.h",
|
||||
"src/Mapbox.h",
|
||||
"src/MLNOpenGLLayer.h",
|
||||
"src/NSImage+MLNAdditions.h",
|
||||
]
|
||||
|
||||
MLN_MACOS_PRIVATE_HEADERS = [
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
module: Mapbox
|
||||
author: Mapbox
|
||||
author_url: https://www.mapbox.com/
|
||||
github_url: https://github.com/mapbox/mapbox-gl-native-ios
|
||||
dash_url: https://mapbox.github.io/mapbox-gl-native/macos/docsets/Mapbox.xml
|
||||
copyright: '© 2014–2019 [Mapbox](https://www.mapbox.com/). See [license](https://github.com/mapbox/mapbox-gl-native-ios/blob/master/LICENSE.md) for more details.'
|
||||
|
||||
head: |
|
||||
<link rel='shortcut icon' href='https://www.mapbox.com/img/favicon.ico' type='image/x-icon' />
|
||||
|
||||
objc: Yes
|
||||
skip_undocumented: Yes
|
||||
hide_documentation_coverage: Yes
|
||||
umbrella_header: src/Mapbox.h
|
||||
framework_root: ../darwin/src
|
||||
|
||||
custom_categories:
|
||||
- name: Appendices
|
||||
children:
|
||||
- Working with GeoJSON Data
|
||||
- Predicates and Expressions
|
||||
- For Style Authors
|
||||
- Migrating to Expressions
|
||||
- Tile URL Templates
|
||||
- Customizing Fonts
|
||||
- Info.plist Keys
|
||||
- name: Maps
|
||||
children:
|
||||
- MLNSettings
|
||||
- MLNMapCamera
|
||||
- MLNMapView
|
||||
- MLNMapViewDelegate
|
||||
- MLNMapSnapshot
|
||||
- MLNMapSnapshotOptions
|
||||
- MLNMapSnapshotter
|
||||
- name: Shapes and Annotations
|
||||
children:
|
||||
- MLNAnnotation
|
||||
- MLNAnnotationImage
|
||||
- MLNOverlay
|
||||
- MLNShape
|
||||
- MLNMultiPoint
|
||||
- MLNPointAnnotation
|
||||
- MLNPointCollection
|
||||
- MLNPolygon
|
||||
- MLNPolyline
|
||||
- MLNMultiPolygon
|
||||
- MLNMultiPolyline
|
||||
- MLNShapeCollection
|
||||
- name: Styling the Map
|
||||
children:
|
||||
- MLNStyle
|
||||
- MLNLight
|
||||
- name: Content Primitives
|
||||
children:
|
||||
- MLNFeature
|
||||
- MLNPointFeature
|
||||
- MLNPolygonFeature
|
||||
- MLNPolylineFeature
|
||||
- MLNMultiPolygonFeature
|
||||
- MLNMultiPolylineFeature
|
||||
- MLNPointCollectionFeature
|
||||
- MLNShapeCollectionFeature
|
||||
- name: Content Sources
|
||||
children:
|
||||
- MLNSource
|
||||
- MLNShapeSource
|
||||
- MLNComputedShapeSource
|
||||
- MLNTileSource
|
||||
- MLNRasterTileSource
|
||||
- MLNRasterDEMSource
|
||||
- MLNVectorTileSource
|
||||
- MLNImageSource
|
||||
- name: Style Layers
|
||||
children:
|
||||
- MLNStyleLayer
|
||||
- MLNForegroundStyleLayer
|
||||
- MLNBackgroundStyleLayer
|
||||
- MLNRasterStyleLayer
|
||||
- MLNVectorStyleLayer
|
||||
- MLNCircleStyleLayer
|
||||
- MLNFillStyleLayer
|
||||
- MLNFillExtrusionStyleLayer
|
||||
- MLNHeatmapStyleLayer
|
||||
- MLNHillshadeStyleLayer
|
||||
- MLNLineStyleLayer
|
||||
- MLNSymbolStyleLayer
|
||||
- name: Offline Maps
|
||||
children:
|
||||
- MLNOfflineRegion
|
||||
- MLNOfflineStorage
|
||||
- MLNOfflinePack
|
||||
- MLNOfflinePackProgress
|
||||
- MLNOfflinePackState
|
||||
- MLNTilePyramidOfflineRegion
|
||||
- MLNShapeOfflineRegion
|
||||
- name: Geometry
|
||||
children:
|
||||
- MLNCoordinateBounds
|
||||
- MLNCoordinateBoundsEqualToCoordinateBounds
|
||||
- MLNCoordinateBoundsGetCoordinateSpan
|
||||
- MLNCoordinateBoundsIntersectsCoordinateBounds
|
||||
- MLNCoordinateBoundsIsEmpty
|
||||
- MLNCoordinateBoundsMake
|
||||
- MLNCoordinateBoundsOffset
|
||||
- MLNCoordinateInCoordinateBounds
|
||||
- MLNCoordinateSpan
|
||||
- MLNCoordinateSpanEqualToCoordinateSpan
|
||||
- MLNCoordinateSpanMake
|
||||
- MLNCoordinateSpanZero
|
||||
- MLNDegreesFromRadians
|
||||
- MLNRadiansFromDegrees
|
||||
- MLNStringFromCoordinateBounds
|
||||
- name: Formatters
|
||||
children:
|
||||
- MLNClockDirectionFormatter
|
||||
- MLNCompassDirectionFormatter
|
||||
- MLNCoordinateFormatter
|
||||
- MLNDistanceFormatter
|
||||
@@ -1 +0,0 @@
|
||||
#include "../darwin/darwin.xcconfig"
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:/Users/mxn/hub/mapbox-gl-native/platform/macos/macos.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3301CC30DB200DB3429"
|
||||
BuildableName = "test.xctest"
|
||||
BlueprintName = "test"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
language = "en"
|
||||
region = "US">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<TestPlans>
|
||||
<TestPlanReference
|
||||
reference = "container:test/CI.xctestplan"
|
||||
default = "YES">
|
||||
</TestPlanReference>
|
||||
</TestPlans>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3301CC30DB200DB3429"
|
||||
BuildableName = "test.xctest"
|
||||
BlueprintName = "test"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
<SkippedTests>
|
||||
<Test
|
||||
Identifier = "MLNMapSnapshotterTests/testLocalGlyphRendering">
|
||||
</Test>
|
||||
</SkippedTests>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</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 = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,116 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3271CC30DB200DB3429"
|
||||
BuildableName = "Mapbox.framework"
|
||||
BlueprintName = "dynamic"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3301CC30DB200DB3429"
|
||||
BuildableName = "test.xctest"
|
||||
BlueprintName = "test"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
language = "en"
|
||||
region = "US">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3271CC30DB200DB3429"
|
||||
BuildableName = "Mapbox.framework"
|
||||
BlueprintName = "dynamic"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3301CC30DB200DB3429"
|
||||
BuildableName = "test.xctest"
|
||||
BlueprintName = "test"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
<SkippedTests>
|
||||
<Test
|
||||
Identifier = "MLNMapSnapshotterTests/testLocalGlyphRendering">
|
||||
</Test>
|
||||
</SkippedTests>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</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 = "DAE6C3271CC30DB200DB3429"
|
||||
BuildableName = "Mapbox.framework"
|
||||
BlueprintName = "dynamic"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3271CC30DB200DB3429"
|
||||
BuildableName = "Mapbox.framework"
|
||||
BlueprintName = "dynamic"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,104 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
language = "en"
|
||||
region = "US">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DAE6C3301CC30DB200DB3429"
|
||||
BuildableName = "test.xctest"
|
||||
BlueprintName = "test"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
<SkippedTests>
|
||||
<Test
|
||||
Identifier = "MLNMapSnapshotterTests/testLocalGlyphRendering">
|
||||
</Test>
|
||||
</SkippedTests>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</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">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DA839E911CC2E3400062CAFB"
|
||||
BuildableName = "Mapbox GL.app"
|
||||
BlueprintName = "macosapp"
|
||||
ReferencedContainer = "container:macos.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "container:macos.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:../../build/macos/Mapbox GL Native.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:test/CI.xctestplan">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
uuid = "7469F368-D820-4EDA-9B01-3769323B9D32"
|
||||
type = "3"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
@@ -1,163 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -u
|
||||
|
||||
# dynamic environment variables:
|
||||
# VERSION_TAG={determined automatically}: Version tag in format macos-vX.X.X-pre.X
|
||||
# GITHUB_RELEASE=true: Upload to github
|
||||
# BINARY_DIRECTORY=build/macos/deploy: Directory in which to save test packages
|
||||
|
||||
# environment variables and dependencies:
|
||||
# - You must run "mbx auth ..." before running
|
||||
# - Set GITHUB_TOKEN to a GitHub API access token in your environment to use GITHUB_RELEASE
|
||||
# - "wget" is required for downloading the zip files from s3
|
||||
# - The "github-release" command is required to use GITHUB_RELEASE
|
||||
|
||||
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
|
||||
function finish { >&2 echo -en "\033[0m"; }
|
||||
trap finish EXIT
|
||||
|
||||
ENABLE_APP_PUBLISH=${ENABLE_APP_PUBLISH:-NO}
|
||||
|
||||
publish() {
|
||||
OPTRESET=1
|
||||
OPTIND=
|
||||
local arg
|
||||
local rule=
|
||||
local suffix=
|
||||
local app=
|
||||
while getopts 'r:s:a:' arg; do
|
||||
case ${arg} in
|
||||
r) rule=${OPTARG};;
|
||||
s) suffix=${OPTARG};;
|
||||
a) app=${OPTARG};;
|
||||
*) "Usage: [-r rule] [-s suffix] [-a app]"; return
|
||||
esac
|
||||
done
|
||||
|
||||
step "Building: make ${rule} ${suffix}"
|
||||
make ${rule}
|
||||
step "Publishing ${rule} with ${suffix}"
|
||||
local file_name=""
|
||||
if [ -z ${suffix} ]
|
||||
then
|
||||
file_name=mapbox-macos-sdk-${PUBLISH_VERSION}.zip
|
||||
else
|
||||
file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${suffix}.zip
|
||||
fi
|
||||
step "Compressing ${file_name}-> ${PWD}../deploy/${file_name}"
|
||||
cd build/macos/pkg
|
||||
rm -f ../deploy/${file_name}
|
||||
zip -yr ../deploy/${file_name} *
|
||||
cd -
|
||||
if [[ "${GITHUB_RELEASE}" == true ]]; then
|
||||
echo "Uploading ${file_name} to GitHub"
|
||||
github-release upload \
|
||||
--tag "macos-v${PUBLISH_VERSION}" \
|
||||
--name ${file_name} \
|
||||
--file "${BINARY_DIRECTORY}/${file_name}" > /dev/null
|
||||
fi
|
||||
if [ ${app} ]; then
|
||||
file_name="Mapbox GL.app.zip"
|
||||
step "Compressing ${file_name}…"
|
||||
cd build/macos/app
|
||||
rm -f "${file_name}"
|
||||
zip -yr "../deploy/${file_name}" 'Mapbox GL.app'
|
||||
cd -
|
||||
if [[ "${GITHUB_RELEASE}" == true ]]; then
|
||||
echo "Uploading ${file_name} to GitHub"
|
||||
github-release upload \
|
||||
--tag "macos-v${PUBLISH_VERSION}" \
|
||||
--name "${file_name}" \
|
||||
--file "${BINARY_DIRECTORY}/${file_name}" > /dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
export GITHUB_USER=maplibre
|
||||
export GITHUB_REPO=maplibre-native
|
||||
export BUILDTYPE=Release
|
||||
|
||||
|
||||
VERSION_TAG=${VERSION_TAG:-''}
|
||||
PUBLISH_VERSION=
|
||||
BINARY_DIRECTORY=${BINARY_DIRECTORY:-build/macos/deploy}
|
||||
GITHUB_RELEASE=${GITHUB_RELEASE:-true}
|
||||
PUBLISH_PRE_FLAG=''
|
||||
|
||||
if [[ ${GITHUB_RELEASE} = "true" ]]; then
|
||||
GITHUB_RELEASE=true # Assign bool, not just a string
|
||||
|
||||
if [[ -z `which github-release` ]]; then
|
||||
step "Installing github-release…"
|
||||
brew install github-release
|
||||
if [ -z `which github-release` ]; then
|
||||
echo "Unable to install github-release. See: https://github.com/aktau/github-release"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z ${VERSION_TAG} ]]; then
|
||||
step "Determining version number from most recent relevant git tag…"
|
||||
VERSION_TAG=$( git describe --tags --match=macos-v*.*.* --abbrev=0 )
|
||||
echo "Found tag: ${VERSION_TAG}"
|
||||
fi
|
||||
|
||||
if [[ $( echo ${VERSION_TAG} | grep --invert-match macos-v ) ]]; then
|
||||
echo "Error: ${VERSION_TAG} is not a valid macOS version tag"
|
||||
echo "VERSION_TAG should be in format: macos-vX.X.X-pre.X"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ github-release info --tag ${VERSION_TAG} | grep --quiet "draft: ✗" ]]; then
|
||||
echo "Error: ${VERSION_TAG} has already been published on GitHub"
|
||||
echo "See: https://github.com/${GITHUB_USER}/${GITHUB_REPO}/releases/tag/${VERSION_TAG}"
|
||||
if [[ "${GITHUB_RELEASE}" == true ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
PUBLISH_VERSION=$( echo ${VERSION_TAG} | sed 's/^macos-v//' )
|
||||
git checkout ${VERSION_TAG}
|
||||
|
||||
step "Deploying version ${PUBLISH_VERSION}…"
|
||||
|
||||
if [[ ${#} -eq 3 && $3 == "-g" ]]; then
|
||||
GITHUB_RELEASE=true
|
||||
fi
|
||||
|
||||
npm install --ignore-scripts
|
||||
mkdir -p ${BINARY_DIRECTORY}
|
||||
|
||||
step "Generating release notes…"
|
||||
RELEASE_NOTES=$( ./platform/macos/scripts/release-notes.js github )
|
||||
|
||||
if [[ -z "${RELEASE_NOTES}" ]]; then
|
||||
echo "Release notes cannot be empty."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_RELEASE}" == true ]]; then
|
||||
step "Create GitHub release…"
|
||||
if [[ $( echo ${PUBLISH_VERSION} | awk '/[0-9]-/' ) ]]; then
|
||||
PUBLISH_PRE_FLAG='--pre-release'
|
||||
fi
|
||||
github-release release \
|
||||
--tag "macos-v${PUBLISH_VERSION}" \
|
||||
--name "macos-v${PUBLISH_VERSION}" \
|
||||
--description "${RELEASE_NOTES}" \
|
||||
--draft ${PUBLISH_PRE_FLAG}
|
||||
fi
|
||||
|
||||
publish -r xpackage -s symbols
|
||||
|
||||
if [[ ${ENABLE_APP_PUBLISH} = "YES" ]]; then
|
||||
publish -r "xpackage SYMBOLS=NO" -a true
|
||||
else
|
||||
publish -r "xpackage SYMBOLS=NO"
|
||||
fi;
|
||||
|
||||
step "Finished deploying ${PUBLISH_VERSION} in $(($SECONDS / 60)) minutes and $(($SECONDS % 60)) seconds"
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -u
|
||||
|
||||
if [ -z `which jazzy` ]; then
|
||||
echo "Installing jazzy…"
|
||||
gem install jazzy
|
||||
if [ -z `which jazzy` ]; then
|
||||
echo "Unable to install jazzy. See https://github.com/mapbox/mapbox-gl-native-ios/blob/master/platform/macos/INSTALL.md"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
OUTPUT=${OUTPUT:-documentation}
|
||||
|
||||
BRANCH=$( git describe --tags --match=macos-v*.*.* --abbrev=0 )
|
||||
SHORT_VERSION=$( echo ${BRANCH} | sed 's/^macos-v//' )
|
||||
RELEASE_VERSION=$( echo ${SHORT_VERSION} | sed -e 's/^macos-v//' -e 's/-.*//' )
|
||||
|
||||
rm -rf /tmp/mbgl
|
||||
mkdir -p /tmp/mbgl/
|
||||
README=/tmp/mbgl/README.md
|
||||
if [[ ${STANDALONE:-} ]]; then
|
||||
cp platform/macos/docs/pod-README.md "${README}"
|
||||
perl -pi -e 's|https://raw.githubusercontent.com/mapbox/mapbox-gl-native-ios/master/platform/macos/docs/||' \
|
||||
"${README}"
|
||||
else
|
||||
cp platform/macos/docs/doc-README.md "${README}"
|
||||
fi
|
||||
# http://stackoverflow.com/a/4858011/4585461
|
||||
echo "## Changes in [version ${RELEASE_VERSION}](https://github.com/mapbox/mapbox-gl-native-ios/releases/tag/${BRANCH})" >> "${README}"
|
||||
sed -n -e '/^## /{' -e ':a' -e 'n' -e '/^## /q' -e 'p' -e 'ba' -e '}' platform/macos/CHANGELOG.md >> "${README}"
|
||||
|
||||
rm -rf ${OUTPUT}
|
||||
mkdir -p ${OUTPUT}
|
||||
|
||||
cp -r platform/darwin/docs/img "${OUTPUT}"
|
||||
cp -r platform/macos/docs/img "${OUTPUT}"
|
||||
|
||||
jazzy \
|
||||
--config platform/macos/jazzy.yml \
|
||||
--sdk macosx \
|
||||
--github-file-prefix https://github.com/mapbox/mapbox-gl-native-ios/tree/${BRANCH} \
|
||||
--module-version ${SHORT_VERSION} \
|
||||
--readme ${README} \
|
||||
--documentation="platform/{darwin,macos}/docs/guides/*.md" \
|
||||
--theme platform/darwin/docs/theme \
|
||||
--output ${OUTPUT} \
|
||||
--title "Maps SDK for macOS" \
|
||||
--module-version ${SHORT_VERSION}
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# Track individual architectures
|
||||
scripts/check_binary_size.js "build/macos/pkg/Mapbox.framework/Versions/Current/Mapbox" "macOS x86_64"
|
||||
@@ -1,127 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -u
|
||||
|
||||
NAME=Mapbox
|
||||
OUTPUT=build/macos/pkg
|
||||
APP_OUTPUT=build/macos/app
|
||||
DERIVED_DATA=build/macos
|
||||
ENABLE_APP_PUBLISH=${ENABLE_APP_PUBLISH:-NO}
|
||||
|
||||
BUILDTYPE=${BUILDTYPE:-Release}
|
||||
SYMBOLS=${SYMBOLS:-YES}
|
||||
PRODUCTS=${DERIVED_DATA}/${BUILDTYPE}
|
||||
|
||||
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
|
||||
function finish { >&2 echo -en "\033[0m"; }
|
||||
trap finish EXIT
|
||||
|
||||
rm -rf ${OUTPUT} ${APP_OUTPUT}
|
||||
|
||||
HASH=`git log | head -1 | awk '{ print $2 }' | cut -c 1-10` && true
|
||||
PROJ_VERSION=$(git rev-list --count HEAD)
|
||||
SEM_VERSION=$( git describe --tags --match=macos-v*.*.* --abbrev=0 | sed 's/^macos-v//' )
|
||||
SHORT_VERSION=${SEM_VERSION%-*}
|
||||
|
||||
CI_XCCONFIG=''
|
||||
if [[ ! -z "${CI:=}" ]]; then
|
||||
xcconfig='platform/darwin/ci.xcconfig'
|
||||
echo "CI environment, using ${xcconfig}"
|
||||
CI_XCCONFIG="-xcconfig ./${xcconfig}"
|
||||
fi
|
||||
|
||||
step "Building dynamic framework (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
|
||||
xcodebuild \
|
||||
CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \
|
||||
CURRENT_COMMIT_HASH=${HASH} \
|
||||
${CI_XCCONFIG} \
|
||||
-derivedDataPath ${DERIVED_DATA} \
|
||||
-archivePath "${APP_OUTPUT}/macosapp.xcarchive" \
|
||||
-workspace ./platform/macos/macos.xcworkspace \
|
||||
-scheme dynamic \
|
||||
-configuration ${BUILDTYPE} \
|
||||
-jobs ${JOBS} \
|
||||
build | xcpretty
|
||||
|
||||
step "Copying dynamic framework into place"
|
||||
mkdir -p "${OUTPUT}/${NAME}.framework"
|
||||
ditto ${PRODUCTS}/${NAME}.framework "${OUTPUT}/${NAME}.framework"
|
||||
if [[ -e ${PRODUCTS}/${NAME}.framework.dSYM ]]; then
|
||||
cp -r ${PRODUCTS}/${NAME}.framework.dSYM "${OUTPUT}"
|
||||
fi
|
||||
|
||||
step "Building and archiving Mapbox GL.app (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
|
||||
if [[ ${BUILDTYPE} == Release ]]; then
|
||||
mkdir -p ${APP_OUTPUT}
|
||||
xcodebuild \
|
||||
CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \
|
||||
CURRENT_COMMIT_HASH=${HASH} \
|
||||
${CI_XCCONFIG} \
|
||||
-derivedDataPath ${DERIVED_DATA} \
|
||||
-archivePath "${APP_OUTPUT}/macosapp.xcarchive" \
|
||||
-workspace ./platform/macos/macos.xcworkspace \
|
||||
-scheme macosapp \
|
||||
-configuration ${BUILDTYPE} \
|
||||
-jobs ${JOBS} \
|
||||
archive | xcpretty
|
||||
fi
|
||||
|
||||
if [[ ${SYMBOLS} = NO ]]; then
|
||||
step "Stripping symbols from binaries"
|
||||
strip -Sx "${OUTPUT}/${NAME}.framework/${NAME}"
|
||||
fi
|
||||
|
||||
function get_comparable_uuid {
|
||||
echo $(dwarfdump --uuid ${1} | sed -n 's/.*UUID:\([^\"]*\) .*/\1/p' | sort)
|
||||
}
|
||||
|
||||
function validate_dsym {
|
||||
step "Validating dSYM and framework UUIDs…"
|
||||
DSYM_UUID=$(get_comparable_uuid "${1}")
|
||||
FRAMEWORK_UUID=$(get_comparable_uuid "${2}")
|
||||
echo -e "${1}\n ${DSYM_UUID}\n${2}\n ${FRAMEWORK_UUID}"
|
||||
if [[ ${DSYM_UUID} != ${FRAMEWORK_UUID} ]]; then
|
||||
echo "Error: dSYM and framework UUIDs do not match."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ ${BUILDTYPE} == Release && ${ENABLE_APP_PUBLISH} = "YES" ]]; then
|
||||
validate_dsym \
|
||||
"${OUTPUT}/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" \
|
||||
"${OUTPUT}/${NAME}.framework/${NAME}"
|
||||
|
||||
step "Exporting Mapbox GL.app"
|
||||
xcodebuild \
|
||||
${CI_XCCONFIG} \
|
||||
-exportArchive \
|
||||
-archivePath "${APP_OUTPUT}/macosapp.xcarchive" \
|
||||
-exportPath "${APP_OUTPUT}" \
|
||||
-exportOptionsPlist platform/macos/ExportOptions.plist
|
||||
fi
|
||||
|
||||
function create_podspec {
|
||||
step "Creating local podspec…"
|
||||
[[ $SYMBOLS = YES ]] && POD_SUFFIX="-symbols" || POD_SUFFIX=""
|
||||
POD_SOURCE_PATH=' :path => ".",'
|
||||
POD_FRAMEWORKS=" m.vendored_frameworks = '"${NAME}".framework'"
|
||||
INPUT_PODSPEC=platform/macos/${NAME}-macOS-SDK${POD_SUFFIX}.podspec
|
||||
OUTPUT_PODSPEC=${OUTPUT}/${NAME}-macOS-SDK${POD_SUFFIX}.podspec
|
||||
sed "s/.*:http.*/${POD_SOURCE_PATH}/" ${INPUT_PODSPEC} > ${OUTPUT_PODSPEC}
|
||||
sed -i '' "s/.*vendored_frameworks.*/${POD_FRAMEWORKS}/" ${OUTPUT_PODSPEC}
|
||||
}
|
||||
|
||||
create_podspec
|
||||
|
||||
step "Copying library resources…"
|
||||
cp -pv LICENSE.md "${OUTPUT}"
|
||||
cp -pv platform/macos/docs/pod-README.md "${OUTPUT}/README.md"
|
||||
sed -n -e '/^## /,$p' platform/macos/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md"
|
||||
|
||||
step "Generating API documentation…"
|
||||
make xdocument OUTPUT="${OUTPUT}/documentation"
|
||||
|
||||
step "Checking that all public symbols are exported…"
|
||||
node platform/darwin/scripts/check-public-symbols.js macOS
|
||||
@@ -1,2 +0,0 @@
|
||||
<%-CHANGELOG-%>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# [MapLibre Maps SDK for macos]
|
||||
|
||||
The MapLibre Maps SDK for macos is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 9.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [MapLibre Style Spec](https://maplibre.org/maplibre-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL.
|
||||
|
||||
## Changes in version <%-CURRENTVERSION%>
|
||||
|
||||
<%-CURRENTCHANGELOG%>
|
||||
|
||||
## Recent changes
|
||||
|
||||
<% OTHERRELEASES.forEach(function(release) { %>
|
||||
### <%-release.version%>
|
||||
|
||||
<%-release.changelog%>
|
||||
<% }) -%>
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const execSync = require('child_process').execSync;
|
||||
const ejs = require('ejs');
|
||||
const _ = require('lodash');
|
||||
const semver = require('semver');
|
||||
|
||||
const changelogPath = 'platform/macos/CHANGELOG.md';
|
||||
const changelog = fs.readFileSync(changelogPath, 'utf8');
|
||||
|
||||
let outputMode = {};
|
||||
switch(process.argv[2]) {
|
||||
case "jazzy":
|
||||
outputMode.isJazzy = true; break;
|
||||
case "github":
|
||||
default:
|
||||
outputMode.isGitHub = true;
|
||||
}
|
||||
|
||||
/*
|
||||
Find current and immediately previous releases by parsing git tags.
|
||||
*/
|
||||
let currentVersion = execSync('git describe --tags --match=macos-v*.*.* --abbrev=0')
|
||||
.toString()
|
||||
.trim()
|
||||
.replace('macos-v', '');
|
||||
|
||||
let gitTags = execSync('git tag --list macos-v*.*.*')
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map(function (tag) {
|
||||
tag = tag.replace('macos-v', '').trim();
|
||||
return semver.clean(tag);
|
||||
});
|
||||
let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion);
|
||||
|
||||
/*
|
||||
Parse the raw changelog text and split it into individual releases.
|
||||
|
||||
This regular expression:
|
||||
- Matches lines starting with "## x.x.x".
|
||||
- Groups the version number.
|
||||
- Skips the (optional) release date.
|
||||
- Groups the changelog content.
|
||||
- Ends when another "## x.x.x" is found.
|
||||
*/
|
||||
const regex = /^## (\d+\.\d+\.\d+).*?\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms;
|
||||
|
||||
let releaseNotes = [];
|
||||
while (match = regex.exec(changelog)) {
|
||||
releaseNotes.push({
|
||||
'version': match[1],
|
||||
'changelog': match[2].trim(),
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
Match the current tag with the most appropriate release notes.
|
||||
*/
|
||||
const versionsInReleaseNotes = _.map(releaseNotes, 'version');
|
||||
const bestReleaseNotesForCurrentVersion = semver.minSatisfying(versionsInReleaseNotes, ">=" + currentVersion);
|
||||
const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForCurrentVersion });
|
||||
|
||||
if (!currentReleaseNotes) {
|
||||
console.error('Could not find a release section satisfying %s in %s — did you forget to rename the "main" section to %s?', currentVersion, changelogPath, currentVersion.split("-")[0]);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
Fill and print the release notes template.
|
||||
*/
|
||||
let templatedReleaseNotes;
|
||||
|
||||
if (outputMode.isGitHub) {
|
||||
templatedReleaseNotes = ejs.render(fs.readFileSync('platform/macos/scripts/release-notes-github.md.ejs', 'utf8'), {
|
||||
'CURRENTVERSION': currentVersion,
|
||||
'PREVIOUSVERSION': previousVersion,
|
||||
'CHANGELOG': currentReleaseNotes.changelog,
|
||||
'isPrerelease': semver.prerelease(currentVersion)
|
||||
});
|
||||
}
|
||||
|
||||
if (outputMode.isJazzy) {
|
||||
const minorReleaseSeries = semver.major(currentVersion) + "." + semver.minor(currentVersion) + ".0";
|
||||
const range = ">=" + minorReleaseSeries + " <" + currentVersion;
|
||||
const otherReleasesInSeries = _.filter(releaseNotes, function(release) {
|
||||
return semver.satisfies(release.version, range);
|
||||
});
|
||||
|
||||
otherReleasesInSeries.forEach(function(release) {
|
||||
// Bump section headings from h3 to h4.
|
||||
release.changelog = release.changelog.replace(/^### /gm, '#### ');
|
||||
});
|
||||
|
||||
templatedReleaseNotes = ejs.render(fs.readFileSync('platform/macos/scripts/release-notes-jazzy.md.ejs', 'utf8'), {
|
||||
'CURRENTVERSION': currentVersion,
|
||||
'CURRENTCHANGELOG': currentReleaseNotes.changelog,
|
||||
'OTHERRELEASES': otherReleasesInSeries
|
||||
});
|
||||
}
|
||||
|
||||
process.stdout.write(templatedReleaseNotes);
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script allows you to run commands from a graphical context
|
||||
# on macOS. This may be needed to run tests that depend on testmanagerd.
|
||||
# See:
|
||||
# https://stackoverflow.com/questions/67688130/run-macos-test-cases-on-the-jenkins-pipeline/71417206#71417206
|
||||
|
||||
# This script writes out a script that runs a command, then runs it with Terminal.app.
|
||||
# Next, it prints the output from the script and exits with the same
|
||||
# exit code as the command. See also this blog post:
|
||||
# https://aahlenst.dev/blog/accessing-the-macos-gui-in-automation-contexts/#continuous-integration-with-ssh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <command>"
|
||||
exit 1
|
||||
fi
|
||||
command="$1"
|
||||
|
||||
run_command_file="$(mktemp)"
|
||||
|
||||
output_file="$(mktemp)"
|
||||
exit_code_file="$(mktemp)"
|
||||
|
||||
cat << EOF > "$run_command_file"
|
||||
cd "$(pwd)"
|
||||
|
||||
$command 2>&1 | tee "$output_file"
|
||||
exit_code=$?
|
||||
echo $exit_code > "$exit_code_file"
|
||||
|
||||
osascript -e 'tell application "Terminal" to quit' &
|
||||
EOF
|
||||
|
||||
chmod +x "$run_command_file"
|
||||
open --wait-apps --new --fresh -a Terminal.app "$run_command_file"
|
||||
|
||||
cat "$output_file"
|
||||
|
||||
exit $(cat "$exit_code_file")
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -u
|
||||
|
||||
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
|
||||
function finish { >&2 echo -en "\033[0m"; }
|
||||
trap finish EXIT
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: v<semantic version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SEM_VERSION=$1
|
||||
SEM_VERSION=${SEM_VERSION/#macos-}
|
||||
SEM_VERSION=${SEM_VERSION/#v}
|
||||
SHORT_VERSION=${SEM_VERSION%-*}
|
||||
|
||||
step "Version ${SEM_VERSION}"
|
||||
|
||||
cd platform/macos/
|
||||
|
||||
step "Updating Xcode targets to version ${SHORT_VERSION}…"
|
||||
|
||||
xcrun agvtool bump -all
|
||||
xcrun agvtool new-marketing-version "${SHORT_VERSION}"
|
||||
|
||||
step "Updating CocoaPods podspecs to version ${SEM_VERSION}…"
|
||||
|
||||
find . -type f -name '*.podspec' -exec sed -i '' "s/^ *version *=.*$/ version = '${SEM_VERSION}'/" {} +
|
||||
@@ -9,7 +9,7 @@
|
||||
- (instancetype)initWithAttributionInfo:(MLNAttributionInfo *)info {
|
||||
if (self = [super initWithFrame:NSZeroRect]) {
|
||||
self.bordered = NO;
|
||||
self.bezelStyle = NSRegularSquareBezelStyle;
|
||||
self.bezelStyle = NSBezelStyleBadge;
|
||||
|
||||
// Extract any prefix consisting of intellectual property symbols.
|
||||
NSScanner *scanner = [NSScanner scannerWithString:info.title.string];
|
||||
|
||||
@@ -22,6 +22,9 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Called by the view delegate when it's time to render.
|
||||
void render();
|
||||
|
||||
// mbgl::MapObserver implementation
|
||||
void onCameraWillChange(mbgl::MapObserver::CameraChangeMode) override;
|
||||
void onCameraIsChanging() override;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import "MLNMapView+Impl.h"
|
||||
#import "MLNStyle_Private.h"
|
||||
#import <MLNStyle_Private.h>
|
||||
#import "NSBundle+MLNAdditions.h"
|
||||
|
||||
#if MLN_RENDER_BACKEND_METAL
|
||||
@@ -12,12 +12,20 @@
|
||||
#include <mbgl/style/style.hpp>
|
||||
|
||||
std::unique_ptr<MLNMapViewImpl> MLNMapViewImpl::Create(MLNMapView* nativeView) {
|
||||
#if MLN_RENDER_BACKEND_METAL
|
||||
return std::make_unique<MLNMapViewMetalImpl>(nativeView);
|
||||
#else // MLN_RENDER_BACKEND_OPENGL
|
||||
return std::make_unique<MLNMapViewOpenGLImpl>(nativeView);
|
||||
#endif
|
||||
}
|
||||
|
||||
MLNMapViewImpl::MLNMapViewImpl(MLNMapView* nativeView_) : mapView(nativeView_) {
|
||||
}
|
||||
|
||||
void MLNMapViewImpl::render() {
|
||||
[mapView renderSync];
|
||||
}
|
||||
|
||||
void MLNMapViewImpl::onCameraWillChange(mbgl::MapObserver::CameraChangeMode mode) {
|
||||
bool animated = mode == mbgl::MapObserver::CameraChangeMode::Animated;
|
||||
[mapView cameraWillChangeAnimated:animated];
|
||||
|
||||
46
platform/macos/src/MLNMapView+Metal.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#import "MLNMapView+Impl.h"
|
||||
#import "MLNMapView_Private.h"
|
||||
|
||||
#include <mbgl/gfx/renderable.hpp>
|
||||
#include <mbgl/mtl/renderer_backend.hpp>
|
||||
|
||||
@class MLNMapViewImplDelegate;
|
||||
|
||||
/// Adapter responsible for bridging calls from mbgl to MLNMapView and Cocoa.
|
||||
class MLNMapViewMetalImpl final : public MLNMapViewImpl,
|
||||
public mbgl::mtl::RendererBackend,
|
||||
public mbgl::gfx::Renderable {
|
||||
public:
|
||||
MLNMapViewMetalImpl(MLNMapView*);
|
||||
~MLNMapViewMetalImpl() override;
|
||||
|
||||
public:
|
||||
void restoreFramebufferBinding();
|
||||
|
||||
// Implementation of mbgl::gfx::RendererBackend
|
||||
public:
|
||||
mbgl::gfx::Renderable& getDefaultRenderable() override {
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
void activate() override;
|
||||
void deactivate() override;
|
||||
// End implementation of mbgl::gfx::RendererBackend
|
||||
|
||||
// Implementation of mbgl::gl::RendererBackend
|
||||
public:
|
||||
void updateAssumedState() override;
|
||||
// End implementation of mbgl::gl::Rendererbackend
|
||||
|
||||
// Implementation of MLNMapViewImpl
|
||||
public:
|
||||
mbgl::gfx::RendererBackend& getRendererBackend() override {
|
||||
return *this;
|
||||
}
|
||||
|
||||
mbgl::PremultipliedImage readStillImage() override;
|
||||
|
||||
private:
|
||||
bool presentsWithTransaction = false;
|
||||
};
|
||||
160
platform/macos/src/MLNMapView+Metal.mm
Normal file
@@ -0,0 +1,160 @@
|
||||
#import "MLNFoundation_Private.h"
|
||||
#import "MLNLoggingConfiguration_Private.h"
|
||||
#import "MLNMapView+Metal.h"
|
||||
|
||||
#import <mbgl/mtl/renderable_resource.hpp>
|
||||
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import <Metal/Metal.h>
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
|
||||
#import <Metal/Metal.hpp>
|
||||
|
||||
@interface MLNMapViewImplDelegate : NSObject <MTKViewDelegate>
|
||||
@end
|
||||
|
||||
@implementation MLNMapViewImplDelegate {
|
||||
MLNMapViewMetalImpl* _impl;
|
||||
}
|
||||
|
||||
- (instancetype)initWithImpl:(MLNMapViewMetalImpl*)impl {
|
||||
if (self = [super init]) {
|
||||
_impl = impl;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size {}
|
||||
|
||||
- (void)drawInMTKView:(MTKView *)view {
|
||||
_impl->render();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
class MLNMapViewMetalRenderableResource final : public mbgl::mtl::RenderableResource {
|
||||
public:
|
||||
MLNMapViewMetalRenderableResource(MLNMapViewMetalImpl& backend_)
|
||||
: backend(backend_),
|
||||
delegate([[MLNMapViewImplDelegate alloc] initWithImpl:&backend]) {
|
||||
}
|
||||
|
||||
void bind() override {
|
||||
if (!commandQueue) {
|
||||
commandQueue = [mtlView.device newCommandQueue];
|
||||
}
|
||||
|
||||
commandBuffer = [commandQueue commandBuffer];
|
||||
commandBufferPtr = NS::RetainPtr((__bridge MTL::CommandBuffer*)commandBuffer);
|
||||
}
|
||||
|
||||
const mbgl::mtl::RendererBackend& getBackend() const override { return backend; }
|
||||
|
||||
const mbgl::mtl::MTLCommandBufferPtr& getCommandBuffer() const override {
|
||||
return commandBufferPtr;
|
||||
}
|
||||
|
||||
virtual mbgl::mtl::MTLBlitPassDescriptorPtr getUploadPassDescriptor() const override {
|
||||
// Create from render pass descriptor?
|
||||
return NS::TransferPtr(MTL::BlitPassDescriptor::alloc()->init());
|
||||
}
|
||||
|
||||
const mbgl::mtl::MTLRenderPassDescriptorPtr& getRenderPassDescriptor() const override {
|
||||
if (!cachedRenderPassDescriptor) {
|
||||
auto* mtlDesc = mtlView.currentRenderPassDescriptor;
|
||||
cachedRenderPassDescriptor = NS::RetainPtr((__bridge MTL::RenderPassDescriptor*)mtlDesc);
|
||||
}
|
||||
return cachedRenderPassDescriptor;
|
||||
}
|
||||
|
||||
void swap() override {
|
||||
id<CAMetalDrawable> currentDrawable = [mtlView currentDrawable];
|
||||
[commandBuffer presentDrawable:currentDrawable];
|
||||
[commandBuffer commit];
|
||||
|
||||
// Un-comment for synchronous, which can help troubleshoot rendering problems,
|
||||
// particularly those related to resource tracking and multiple queued buffers.
|
||||
//[commandBuffer waitUntilCompleted];
|
||||
|
||||
commandBuffer = nil;
|
||||
commandBufferPtr.reset();
|
||||
|
||||
cachedRenderPassDescriptor.reset();
|
||||
}
|
||||
|
||||
mbgl::Size framebufferSize() {
|
||||
assert(mtlView);
|
||||
return { static_cast<uint32_t>(mtlView.drawableSize.width),
|
||||
static_cast<uint32_t>(mtlView.drawableSize.height) };
|
||||
}
|
||||
|
||||
private:
|
||||
MLNMapViewMetalImpl& backend;
|
||||
mbgl::mtl::MTLCommandBufferPtr commandBufferPtr;
|
||||
mutable mbgl::mtl::MTLRenderPassDescriptorPtr cachedRenderPassDescriptor;
|
||||
|
||||
public:
|
||||
MLNMapViewImplDelegate* delegate = nil;
|
||||
MTKView *mtlView = nil;
|
||||
id <MTLCommandBuffer> commandBuffer;
|
||||
id <MTLCommandQueue> commandQueue;
|
||||
|
||||
// We count how often the context was activated/deactivated so that we can truly deactivate it
|
||||
// after the activation count drops to 0.
|
||||
NSUInteger activationCount = 0;
|
||||
};
|
||||
|
||||
MLNMapViewMetalImpl::MLNMapViewMetalImpl(MLNMapView* nativeView_)
|
||||
: MLNMapViewImpl(nativeView_),
|
||||
mbgl::mtl::RendererBackend(mbgl::gfx::ContextMode::Unique),
|
||||
mbgl::gfx::Renderable({ 0, 0 }, std::make_unique<MLNMapViewMetalRenderableResource>(*this)) {
|
||||
|
||||
auto& resource = getResource<MLNMapViewMetalRenderableResource>();
|
||||
if (resource.mtlView) {
|
||||
return;
|
||||
}
|
||||
|
||||
id<MTLDevice> device = (__bridge id<MTLDevice>)resource.getBackend().getDevice().get();
|
||||
|
||||
resource.mtlView = [[MTKView alloc] initWithFrame:mapView.bounds device:device];
|
||||
resource.mtlView.delegate = resource.delegate;
|
||||
resource.mtlView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
||||
resource.mtlView.colorPixelFormat = MTLPixelFormatBGRA8Unorm;
|
||||
resource.mtlView.depthStencilPixelFormat = MTLPixelFormatDepth32Float_Stencil8;
|
||||
resource.mtlView.layer.opaque = mapView.opaque;
|
||||
resource.mtlView.enableSetNeedsDisplay = NO;
|
||||
CAMetalLayer* metalLayer = MLN_OBJC_DYNAMIC_CAST(resource.mtlView.layer, CAMetalLayer);
|
||||
metalLayer.presentsWithTransaction = presentsWithTransaction;
|
||||
|
||||
[mapView addSubview:resource.mtlView positioned:NSWindowBelow relativeTo:nil];
|
||||
}
|
||||
|
||||
MLNMapViewMetalImpl::~MLNMapViewMetalImpl() = default;
|
||||
|
||||
void MLNMapViewMetalImpl::activate() {
|
||||
auto& resource = getResource<MLNMapViewMetalRenderableResource>();
|
||||
if (resource.activationCount++) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void MLNMapViewMetalImpl::deactivate() {
|
||||
auto& resource = getResource<MLNMapViewMetalRenderableResource>();
|
||||
if (--resource.activationCount) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// This function is called before we start rendering, when iOS invokes our rendering method.
|
||||
/// iOS already sets the correct framebuffer and viewport for us, so we need to update the
|
||||
/// context state with the anticipated values.
|
||||
void MLNMapViewMetalImpl::updateAssumedState() {
|
||||
auto& resource = getResource<MLNMapViewMetalRenderableResource>();
|
||||
assumeFramebufferBinding(ImplicitFramebufferBinding);
|
||||
assumeViewport(0, 0, resource.framebufferSize());
|
||||
}
|
||||
|
||||
mbgl::PremultipliedImage MLNMapViewMetalImpl::readStillImage() {
|
||||
// return readFramebuffer(mapView.framebufferSize); // TODO: RendererBackend::readFramebuffer
|
||||
return {};
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import "MLNFoundation.h"
|
||||
#import "MLNTypes.h"
|
||||
|
||||
@@ -672,6 +672,11 @@ public:
|
||||
_mbglMap->setPrefetchZoomDelta(prefetchesTiles ? mbgl::util::DEFAULT_PREFETCH_ZOOM_DELTA : 0);
|
||||
}
|
||||
|
||||
- (BOOL)prefetchesTiles
|
||||
{
|
||||
return _mbglMap->getPrefetchZoomDelta() > 0 ? YES : NO;
|
||||
}
|
||||
|
||||
- (mbgl::Renderer *)renderer {
|
||||
return _rendererFrontend->getRenderer();
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"configurations" : [
|
||||
{
|
||||
"id" : "8091A03F-018D-4679-99F3-5E8DB029511E",
|
||||
"name" : "Configuration 1",
|
||||
"options" : {
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
"defaultOptions" : {
|
||||
"codeCoverage" : false,
|
||||
"language" : "en",
|
||||
"region" : "US",
|
||||
"targetForVariableExpansion" : {
|
||||
"containerPath" : "container:macos.xcodeproj",
|
||||
"identifier" : "DA839E911CC2E3400062CAFB",
|
||||
"name" : "macosapp"
|
||||
}
|
||||
},
|
||||
"testTargets" : [
|
||||
{
|
||||
"skippedTests" : [
|
||||
"MLNMapSnapshotterTests\/testLocalGlyphRendering",
|
||||
"MLNOfflineStorageTests"
|
||||
],
|
||||
"target" : {
|
||||
"containerPath" : "container:macos.xcodeproj",
|
||||
"identifier" : "DAE6C3301CC30DB200DB3429",
|
||||
"name" : "test"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 1
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage:
|
||||
# check_benchmark_results.sh <baseline> <results> <comparison report in txt> <comparison report in html>
|
||||
|
||||
# Benchmark comparison script uses a hard-coded 5% threshold by default, but it causes random failures
|
||||
# Increase the threshold to 15%
|
||||
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
sed -i '' s/"if res > 0.05"/"if res > 0.15"/ $PWD/vendor/benchmark/tools/gbench/report.py
|
||||
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
||||
sed -i s/"if res > 0.05"/"if res > 0.15"/ $PWD/vendor/benchmark/tools/gbench/report.py
|
||||
fi
|
||||
|
||||
# Run the bencmark comparison
|
||||
vendor/benchmark/tools/compare.py benchmarks $1 $2 > $3
|
||||
|
||||
# Find cases where the average is above threshold
|
||||
tests=`fgrep mean $3 | cut -c1-85 | grep 91m`
|
||||
|
||||
if [ -z "$tests" ]
|
||||
then
|
||||
echo "" >> $3
|
||||
echo "PASSED, all benchmarks within 15% threshold" >> $3
|
||||
|
||||
ansi2html < $3 > $4
|
||||
exit 0
|
||||
else
|
||||
test_names=`fgrep mean $3 | cut -c1-85 | grep 91m | cut -f1 -d' '`
|
||||
|
||||
echo "" >> $3
|
||||
echo "FAILED, following benchmarks are not within 15% threshold:" >> $3
|
||||
echo "" >> $3
|
||||
for t in $test_names;
|
||||
do
|
||||
echo $t >> $3
|
||||
done
|
||||
|
||||
ansi2html < $3 > $4
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,11 +0,0 @@
|
||||
// Do not edit -- generated by CMake
|
||||
|
||||
// mbgl-core
|
||||
mbgl_core_INCLUDE_DIRECTORIES = "$<JOIN:$<TARGET_PROPERTY:mbgl-core,INTERFACE_INCLUDE_DIRECTORIES>," ">"
|
||||
mbgl_core_LINK_LIBRARIES = "$<TARGET_PROPERTY:mbgl-core,XCODE_ATTRIBUTE_XCCONFIG_LINK_LIBRARIES>"
|
||||
|
||||
// mbgl-filesource
|
||||
mbgl_filesource_INCLUDE_DIRECTORIES = "$<JOIN:$<TARGET_PROPERTY:mbgl-filesource,INTERFACE_INCLUDE_DIRECTORIES>," ">"
|
||||
mbgl_filesource_LINK_LIBRARIES = "$<TARGET_PROPERTY:mbgl-filesource,XCODE_ATTRIBUTE_XCCONFIG_LINK_LIBRARIES>"
|
||||
|
||||
#include? "../../platform/darwin/developer.xcconfig"
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
exec "@C_LAUNCHER@" "${PATH%%/Contents/Developer/*}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" "$@"
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
exec "@C_LAUNCHER@" "$@"
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
exec "@CXX_LAUNCHER@" "${PATH%%/Contents/Developer/*}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" "$@"
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
exec "@CXX_LAUNCHER@" "$@"
|
||||
@@ -77,6 +77,7 @@ void Renderer::Impl::render(const RenderTree& renderTree,
|
||||
#if MLN_RENDER_BACKEND_METAL
|
||||
if constexpr (EnableMetalCapture) {
|
||||
const auto& mtlBackend = static_cast<mtl::RendererBackend&>(backend);
|
||||
|
||||
const auto& mtlDevice = mtlBackend.getDevice();
|
||||
|
||||
if (!commandCaptureScope) {
|
||||
|
||||
10
vendor/glfw.BUILD
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
cc_library(
|
||||
name = "glfw",
|
||||
hdrs = glob([
|
||||
"include/GLFW/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"include",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
6
vendor/libuv.BUILD
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
cc_library(
|
||||
name = "libuv",
|
||||
hdrs = glob(["include/**/*.h"]),
|
||||
includes = ["include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||