Skip to content

Commit

Permalink
Merge pull request #41 from mapbox/mbgl-core-upgrade
Browse files Browse the repository at this point in the history
Upgrade gl-native dependency (aka mbgl-core)
  • Loading branch information
springmeyer authored Apr 8, 2020
2 parents a93765a + 8f83ce8 commit b0d8eb4
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 126 deletions.
4 changes: 2 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Checks: '*,-fuchsia-default-arguments'
WarningsAsErrors: '*'
Checks: '*,-fuchsia*,-llvm-header-guard,-google-readability-todo,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers'
WarningsAsErrors: '*,-modernize-avoid-c-arrays,-hicpp-avoid-c-arrays,-cppcoreguidelines-avoid-c-arrays'
HeaderFilterRegex: '\/src\/'
AnalyzeTemporaryDtors: false
CheckOptions:
Expand Down
47 changes: 3 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ language: node_js
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libstdc++-4.9-dev' ]
packages: [ 'libstdc++-5-dev' ]

install:
- node -v
Expand Down Expand Up @@ -38,10 +38,6 @@ matrix:
- os: linux
env: BUILDTYPE=release TOOLSET=cfi CXXFLAGS="-fsanitize=cfi -fvisibility=hidden" LDFLAGS="-fsanitize=cfi"
node_js: 10
# linux publishable node v11/release
- os: linux
env: BUILDTYPE=release
node_js: 11
# linux publishable node v10/release
- os: linux
env: BUILDTYPE=release
Expand All @@ -50,67 +46,30 @@ matrix:
- os: linux
env: BUILDTYPE=debug
node_js: 10
# linux publishable node v8/release
- os: linux
env: BUILDTYPE=release
node_js: 8
# linux publishable node v8/debug
- os: linux
env: BUILDTYPE=debug
node_js: 8
# linux publishable node v6/release
- os: linux
env: BUILDTYPE=release
node_js: 6
# linux publishable node v6/debug
- os: linux
env: BUILDTYPE=debug
node_js: 6
# osx publishable node v10/release
- os: osx
osx_image: xcode9.3
env: BUILDTYPE=release
node_js: 11
# osx publishable node v10/release
- os: osx
osx_image: xcode9.3
osx_image: xcode11.3
env: BUILDTYPE=release
node_js: 10
# osx publishable node v8/release
- os: osx
osx_image: xcode9.3
env: BUILDTYPE=release
node_js: 8
# osx publishable node v6/release
- os: osx
osx_image: xcode9.3
env: BUILDTYPE=release
node_js: 6
# osx publishable node v6/debug
- os: osx
osx_image: xcode9.3
env: BUILDTYPE=debug
node_js: 6
# linux sanitizer build node v6/debug
- os: linux
env: BUILDTYPE=debug TOOLSET=asan
node_js: 10
sudo: required
# Overrides `install` to set up custom asan flags
install:
- sed -ie 's/20f880e/20f880e-asan/g' mason-versions.ini
- make sanitize
# Overrides `before_script` (tests are already run in `make sanitize`)
before_script:
- true
# osx sanitizer build node v6/debug
- os: osx
osx_image: xcode11.3
env: BUILDTYPE=debug TOOLSET=asan
node_js: 10
sudo: required
# Overrides `install` to set up custom asan flags
install:
- sed -ie 's/20f880e/20f880e-asan/g' mason-versions.ini
- make sanitize
# Overrides `before_script` (tests are already run in `make sanitize`)
before_script:
Expand Down
51 changes: 28 additions & 23 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,26 @@
# cflags (linux) and xcode (mac)
'system_includes': [
"-isystem <(module_root_dir)/<!(node -e \"require('nan')\")",
"-isystem <(module_root_dir)/mason_packages/.link/include/",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/src",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/platform"
"-isystem <(module_root_dir)/mason_packages/.link/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/variant/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/optional",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/geometry.hpp/include",
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/mapbox-base/deps/geojson.hpp/include",
'-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/wagyu/include',
"-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/nunicode/include",
'-isystem <(module_root_dir)/mason_packages/.link/include/mbgl/vendor/boost/include',
"-isystem <(module_root_dir)/mason_packages/.link/src",
"-isystem <(module_root_dir)/mason_packages/.link/platform",
],
# Flags we pass to the compiler to ensure the compiler
# warns us about potentially buggy or dangerous code
'compiler_checks': [
'-Wall',
'-Wextra',
'-Weffc++',
# disabled since this now breaks on gl-native's platform/default/src/mbgl/layermanager/layer_manager.cpp
# which we cannot easily change here
#'-Weffc++',
'-Wconversion',
'-pedantic-errors',
'-Wconversion',
Expand All @@ -38,7 +47,9 @@
'-Wno-error=unused-variable',
'-Wno-error=unused-value',
'-DRAPIDJSON_HAS_STDSTRING=1',
'-Wno-deprecated-declarations'
'-Wno-deprecated-declarations',
'-Wno-float-equal',
'-Wno-float-conversion'
]
},
'targets': [
Expand Down Expand Up @@ -73,7 +84,17 @@
'sources': [
'./src/vtshaver.cpp',
'./src/shave.cpp',
'./src/filters.cpp'
'./src/filters.cpp',
'./mason_packages/.link/src/mbgl/tile/geometry_tile_data.cpp',
'./mason_packages/.link/platform/default/src/mbgl/layermanager/layer_manager.cpp',
# mbgl::LayerManager::annotationsEnabled
'./mason_packages/.link/platform/default/src/mbgl/layermanager/layer_manager.cpp',
# mbgl::util::impl::ThreadLocalBase::~ThreadLocalBase()
'./mason_packages/.link/platform/default/src/mbgl/util/thread_local.cpp',
# mbgl::platform::Collator::resolvedLocale() const
'./mason_packages/.link/platform/default/src/mbgl/i18n/collator.cpp',
# mbgl::util::convertUTF8ToUTF16(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
'./mason_packages/.link/platform/default/src/mbgl/util/utf.cpp'
],
"libraries": [
# static linking (combining): Take a lib and smoosh it into the thing you're building.
Expand All @@ -82,9 +103,6 @@
# But Dynamic lib is loaded at runtime. (.node is a type of dynamic lib cause it's loaded into node at runtime)
"<(module_root_dir)/mason_packages/.link/lib/libmbgl-core.a"
],
'ldflags': [
'-Wl,-z,now'
],
'conditions': [
['error_on_warnings == "true"', {
'cflags_cc' : [ '-Werror' ],
Expand All @@ -94,18 +112,6 @@
}
}]
],
"conditions": [
[ "OS=='linux'", {
"libraries": [
"<(module_root_dir)/mason_packages/.link/lib/libnu.a",
"<(module_root_dir)/mason_packages/.link/lib/libpng.a",
"<(module_root_dir)/mason_packages/.link/lib/libjpeg.a",
"<(module_root_dir)/mason_packages/.link/lib/libwebp.a",
"<(module_root_dir)/mason_packages/.link/lib/libsqlite3.a",
"<(module_root_dir)/mason_packages/.link/lib/libicuuc.a"
]
}]
],
# Add to cpp glossary (or other doc in cpp repo) different types of binaries (.node, .a, static, dynamic (.so on linux and .dylib on osx))
# talk from cppcon by person from Apple, exploration of every builds systems in c++ are awful since theyre system-specific
'cflags': [
Expand All @@ -114,7 +120,6 @@
],
'xcode_settings': {
'OTHER_LDFLAGS':[
'-Wl,-bind_at_load',
'-framework Foundation'
],
'OTHER_CPLUSPLUSFLAGS': [
Expand Down
4 changes: 2 additions & 2 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
'NDEBUG'
],
'cflags': [
'-flto'
'-flto', '-fvisibility=hidden'
],
'ldflags': [
'-flto',
Expand All @@ -50,7 +50,7 @@
'-O2'
],
'OTHER_LDFLAGS':[ '-flto' ],
'OTHER_CPLUSPLUSFLAGS': [ '-flto' ],
'OTHER_CPLUSPLUSFLAGS': [ '-flto', '-fvisibility=hidden' ],
'GCC_OPTIMIZATION_LEVEL': '3',
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
'DEAD_CODE_STRIPPING': 'YES',
Expand Down
26 changes: 7 additions & 19 deletions mason-versions.ini
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
[headers]
protozero=1.6.3
rapidjson=1.1.0
geojson=0.4.2
geometry=0.9.2
vtzero=1.0.0
variant=1.1.4
vtzero=1.0.3
protozero=1.6.8
gzip-hpp=0.1.0
vector-tile=1.0.1
wagyu=0.4.3
[compiled]
clang++=6.0.1
clang-tidy=6.0.1
clang-format=6.0.1
llvm-cov=6.0.1
clang++=10.0.0
clang-tidy=10.0.0
clang-format=10.0.0
llvm-cov=10.0.0
binutils=2.31
mbgl-core=20f880e
nunicode=1.8
libpng=1.6.25
sqlite=3.14.2
libjpeg-turbo=1.5.0
webp=0.5.1
icu=58.1-min-size
mbgl-core=1.6.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapbox/vtshaver",
"version": "0.2.1",
"version": "0.2.1-mbglupgrade.1",
"description": "Creates style-optimized vector tiles",
"main": "./lib/index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_compile_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def generate():
for line in sys.stdin.readlines():
if TOKEN_DENOTING_COMPILED_FILE in line:
match = matcher.match(line)
if match:
if match and 'src/mbgl' not in match.group(2):
compile_commands.append({
"directory": build_dir,
"command": line.strip(),
Expand Down
2 changes: 1 addition & 1 deletion src/filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <utility>

// Single constructor used for any new instance of it.
Nan::Persistent<v8::FunctionTemplate>& Filters::constructor() {
auto Filters::constructor() -> Nan::Persistent<v8::FunctionTemplate>& {
static Nan::Persistent<v8::FunctionTemplate> init;
return init;
} // LCOV_EXCL_LINE
Expand Down
6 changes: 3 additions & 3 deletions src/filters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Filters : public Nan::ObjectWrap {
using filter_properties_types = enum { all,
list };
using filter_properties_type = std::pair<filter_properties_types, std::vector<std::string>>;
using filter_key_type = std::string; // TODO: convert to data_view
using filter_key_type = std::string; // TODO(danespringmeyer): convert to data_view
using zoom_type = double;
using filter_values_type = std::tuple<filter_value_type, filter_properties_type, zoom_type, zoom_type>;
using filters_type = std::map<filter_key_type, filter_values_type>;
Expand All @@ -25,14 +25,14 @@ class Filters : public Nan::ObjectWrap {
static NAN_METHOD(New); // Filters instance is stored here
static NAN_METHOD(layers);

static Nan::Persistent<v8::FunctionTemplate>& constructor();
static auto constructor() -> Nan::Persistent<v8::FunctionTemplate>&;

void add_filter(filter_key_type&& key, filter_value_type&& filter, filter_properties_type&& properties, zoom_type minzoom, zoom_type maxzoom) {
// add a new key/value pair, with the value equaling a tuple 'filter_values_type' defined above
filters.emplace(key, std::make_tuple(std::move(filter), std::move(properties), minzoom, maxzoom));
}

filters_type const& get_filters() const {
auto get_filters() const -> filters_type const& {
return filters;
}

Expand Down
Loading

0 comments on commit b0d8eb4

Please sign in to comment.