make storage lib separate so we can build without storage libs

This commit is contained in:
Konstantin Käfer
2015-01-23 16:31:48 +01:00
parent fbe30e04c4
commit 272fa8935e
26 changed files with 451 additions and 247 deletions

7
.gitmodules vendored
View File

@@ -1,5 +1,5 @@
[submodule "ios/mapbox-gl-cocoa"]
path = ios/mapbox-gl-cocoa
[submodule "ios"]
path = ios
url = https://github.com/mapbox/mapbox-gl-cocoa.git
[submodule "test/suite"]
@@ -13,3 +13,6 @@
[submodule "styles"]
path = styles
url = https://github.com/mapbox/mapbox-gl-styles.git
[submodule "app/ios"]
path = app/ios
url = https://github.com/mapbox/mapbox-gl-cocoa.git

View File

@@ -39,8 +39,8 @@ install: build/mbgl/Makefile
#### Build scripts #############################################################
.PHONY: build/mbgl/Makefile
build/mbgl/Makefile: mapboxgl.gyp config.gypi
deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) -Dinstall_prefix=$(PREFIX) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
build/mbgl/Makefile: mbgl.gyp config.gypi
deps/run_gyp mbgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) -Dinstall_prefix=$(PREFIX) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
.PHONY: build/test/Makefile
build/test/Makefile: test/test.gyp config.gypi

1
app/ios Submodule

Submodule app/ios added at 2e5bfbdcd5

View File

@@ -44,10 +44,10 @@
],
'include_dirs': [ '../src' ],
'dependencies': [
'../mapboxgl.gyp:mbgl-standalone',
'../mapboxgl.gyp:mbgl-headless',
'../mapboxgl.gyp:mbgl-<(platform)',
'../mapboxgl.gyp:copy_certificate_bundle',
'../mbgl.gyp:<(core_library)',
'../mbgl.gyp:<(headless_library)',
'../mbgl.gyp:<(platform_library)',
'../mbgl.gyp:copy_certificate_bundle',
],
},
],

View File

@@ -1,19 +1,47 @@
{
'variables': {
'install_prefix%': '',
'standalone_product_dir':'<!@(pwd)/build'
'standalone_product_dir':'<!@(pwd)/build',
'core_library%': 'mbgl-core',
'headless_library%': 'mbgl-headless',
},
'conditions': [
['platform == "osx"', {
'variables': {
'platform_library%': 'mbgl-osx',
'storage_library%': 'mbgl-storage-cocoa',
},
}],
['platform == "ios"', {
'variables': {
'platform_library%': 'mbgl-ios',
'storage_library%': 'mbgl-storage-cocoa',
},
}],
['platform == "linux"', {
'variables': {
'platform_library%': 'mbgl-linux',
'storage_library%': 'mbgl-storage-curl',
},
}],
['platform == "android"', {
'variables': {
'platform_library%': 'mbgl-android',
'storage_library%': 'mbgl-storage-curl',
},
}],
],
'target_defaults': {
'default_configuration': 'Release',
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET':'10.9',
'MACOSX_DEPLOYMENT_TARGET': '10.9',
'CLANG_CXX_LIBRARY': 'libc++',
'CLANG_CXX_LANGUAGE_STANDARD':'c++11',
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI':'YES',
'GCC_ENABLE_CPP_RTTI': 'YES',
'OTHER_CPLUSPLUSFLAGS': [
'-Werror',
'-Wall',
@@ -38,6 +66,7 @@
['OS=="mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-fPIC' ],
'SKIP_INSTALL': 'YES',
},
}, {
'cflags_cc': [ '-fPIC' ],
@@ -46,14 +75,10 @@
'xcode_settings': {
'SDKROOT': 'iphoneos',
'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos',
'CLANG_CXX_LIBRARY': 'libc++',
'CLANG_CXX_LANGUAGE_STANDARD':'c++11',
'IPHONEOS_DEPLOYMENT_TARGET':'7.0',
'IPHONEOS_DEPLOYMENT_TARGET': '7.0',
'TARGETED_DEVICE_FAMILY': '1,2',
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'CLANG_ENABLE_OBJC_ARC': 'NO',
'CODE_SIGN_IDENTITY': 'iPhone Developer',
'SKIP_INSTALL': 'YES'
},
'configurations': {
'Release': {

View File

@@ -6,16 +6,18 @@
'type': 'none',
'hard_dependency': 1,
'dependencies': [
'mbgl-core',
'<(core_library)',
'<(headless_library)',
'<(platform_library)',
'<(storage_library)',
'mbgl-standalone',
'mbgl-headless',
'mbgl-<(platform)',
],
'copies': [
{ 'files': [ '<(standalone_product_dir)/libmbgl.a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '<(PRODUCT_DIR)/libmbgl-core.a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '<(PRODUCT_DIR)/libmbgl-headless.a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '<(PRODUCT_DIR)/libmbgl-<(platform).a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '<(PRODUCT_DIR)/lib<(platform_library).a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '<(PRODUCT_DIR)/lib<(storage_library).a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' },
],
'variables': {

View File

@@ -9,18 +9,9 @@
'shaders',
'version',
],
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
'<@(sqlite3_cflags)',
'<@(zlib_cflags)',
'-I<(boost_root)/include',
],
'cflags': [
'<@(uv_cflags)','-fPIC'
],
},
'sources': [
'<!@(find src -name "*.hpp")',
'<!@(find src -name "*.cpp")',
'<!@(find src -name "*.c")',
'<!@(find src -name "*.h")',
@@ -29,25 +20,60 @@
'<!@(find src -name "*.glsl")',
'bin/style.json'
],
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
'-I<(boost_root)/include',
],
'cflags': [
'<@(uv_cflags)',
'-fPIC'
],
'ldflags': [
'<@(uv_ldflags)',
],
'libraries': [
'<@(uv_static_libs)',
],
},
'include_dirs': [
'../include',
'../src',
],
'conditions': [
['OS == "mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
'OTHER_CFLAGS': [ '<@(cflags)' ],
'SKIP_INSTALL': 'YES'
},
}, {
'cflags_cc': [ '<@(cflags_cc)' ],
'cflags': [ '<@(cflags)' ],
}]
]
],
'link_settings': {
'libraries': [ '<@(libraries)' ],
'conditions': [
['OS == "mac"', {
'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] }
}, {
'ldflags': [ '<@(ldflags)' ],
}]
],
},
'direct_dependent_settings': {
'include_dirs': [
'../include',
],
},
},
{
'target_name': 'mbgl-standalone',
{ 'target_name': 'mbgl-standalone',
'type': 'none',
'hard_dependency': 1,
'dependencies': [

View File

@@ -8,9 +8,6 @@
'cflags_cc': [
'<@(uv_cflags)',
],
'cflags': [
'<@(uv_cflags)',
],
},
'include_dirs': [
'../include',
@@ -19,11 +16,9 @@
['OS == "mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
'OTHER_CFLAGS': [ '<@(cflags)' ],
}
}, {
'cflags_cc': [ '<@(cflags_cc)' ],
'cflags': [ '<@(cflags)' ],
}]
],
'sources': [

View File

@@ -8,34 +8,47 @@
'dependencies': [
'version',
],
'sources': [
'../platform/darwin/log_nslog.mm',
'../platform/darwin/string_nsstring.mm',
'../platform/darwin/http_request_cocoa.mm',
'../platform/darwin/application_root.mm',
'../platform/darwin/image.mm',
'../platform/default/asset_request_libuv.cpp',
],
'include_dirs': [
'../include',
'../src',
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
'-I<(boost_root)/include',
],
'libraries': [
'<@(uv_static_libs)',
],
'ldflags': [
'-framework ImageIO',
'-framework MobileCoreServices',
],
},
'include_dirs': [
'../include',
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
},
'link_settings': {
'libraries': [ '<@(libraries)' ],
'xcode_settings': {
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
},
},
'direct_dependent_settings': {
'include_dirs': [
'../include',
],
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework ImageIO',
'-framework MobileCoreServices',
],
},
},
},
],

View File

@@ -8,27 +8,7 @@
'dependencies': [
'version',
],
'variables': {
'cflags_cc': [
'<@(png_cflags)',
'<@(jpeg_cflags)',
'<@(uv_cflags)',
'<@(curl_cflags)',
'<@(nu_cflags)',
'-I<(boost_root)/include',
],
'cflags': [
'<@(uv_cflags)',
'<@(nu_cflags)',
],
'ldflags': [
'<@(png_ldflags)',
'<@(jpeg_ldflags)',
'<@(uv_ldflags)',
'<@(curl_ldflags)',
'<@(nu_ldflags)',
],
},
'sources': [
'../platform/default/log_stderr.cpp',
'../platform/default/string_stdlib.cpp',
@@ -40,42 +20,61 @@
'../platform/default/png_reader.cpp',
'../platform/default/jpeg_reader.cpp',
],
'variables': {
'cflags_cc': [
'<@(png_cflags)',
'<@(jpeg_cflags)',
'<@(uv_cflags)',
'<@(nu_cflags)',
'-I<(boost_root)/include',
],
'ldflags': [
'<@(png_ldflags)',
'<@(jpeg_ldflags)',
'<@(uv_ldflags)',
'<@(curl_ldflags)',
'<@(nu_ldflags)',
],
'libraries': [
'<@(png_static_libs)',
'<@(jpeg_static_libs)',
'<@(uv_static_libs)',
'<@(nu_static_libs)',
],
},
'include_dirs': [
'../include',
'../src',
],
'link_settings': {
'libraries': [
'<@(png_static_libs)',
'<@(jpeg_static_libs)',
'<@(nu_static_libs)'
],
},
'conditions': [
['OS == "mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
'OTHER_CFLAGS': [ '<@(cflags)' ],
}
}, {
'cflags_cc': [ '<@(cflags_cc)' ],
'cflags': [ '<@(cflags)' ],
}]
],
'direct_dependent_settings': {
'include_dirs': [
'../include',
],
'link_settings': {
'libraries': [ '<@(libraries)' ],
'conditions': [
['OS == "mac"', {
'xcode_settings': {
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
}
'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] }
}, {
'ldflags': [ '<@(ldflags)' ],
}]
],
},
'direct_dependent_settings': {
'include_dirs': [
'../include',
],
},
},
],
}

View File

@@ -8,35 +8,49 @@
'dependencies': [
'version',
],
'sources': [
'../platform/darwin/log_nslog.mm',
'../platform/darwin/string_nsstring.mm',
'../platform/darwin/http_request_cocoa.mm',
'../platform/darwin/application_root.mm',
'../platform/darwin/image.mm',
'../platform/default/asset_request_libuv.cpp',
],
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
'-I<(boost_root)/include',
],
'libraries': [
'<@(uv_static_libs)',
],
'ldflags': [
'-framework Foundation',
'-framework ImageIO',
'-framework CoreServices',
],
},
'include_dirs': [
'../include',
'../src',
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
'<@(uv_cflags)',
'-I<(boost_root)/include',
],
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
},
'link_settings': {
'libraries': [ '<@(libraries)' ],
'xcode_settings': {
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
},
},
'direct_dependent_settings': {
'include_dirs': [
'../include',
],
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework Foundation',
'-framework ImageIO',
'-framework CoreServices',
],
},
},
},
],

View File

@@ -1,20 +0,0 @@
{
'conditions': [
['platform == "osx"', {
'includes': ['mbgl-osx.gypi'],
'variables': { 'platform_library': 'mbgl-osx' },
}],
['platform == "ios"', {
'includes': ['mbgl-ios.gypi'],
'variables': { 'platform_library': 'mbgl-ios' },
}],
['platform == "linux"', {
'includes': ['mbgl-linux.gypi'],
'variables': { 'platform_library': 'mbgl-linux' },
}],
['platform == "android"', {
'includes': ['mbgl-android.gypi'],
'variables': { 'platform_library': 'mbgl-android' },
}],
],
}

View File

@@ -0,0 +1,62 @@
{
'targets': [
{ 'target_name': 'mbgl-storage-cocoa',
'product_name': 'mbgl-storage-cocoa',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'sources': [
'../platform/default/default_file_source.cpp',
'../platform/default/sqlite_cache.cpp',
'../platform/darwin/http_request_cocoa.mm',
'../platform/default/asset_request_libuv.cpp',
'../platform/default/sqlite3.hpp',
'../platform/default/sqlite3.cpp',
'../platform/default/compression.hpp',
'../platform/default/compression.cpp',
],
'include_dirs': [
'../include',
],
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
'<@(sqlite3_cflags)',
'-I<(boost_root)/include',
],
'ldflags': [
'-framework Foundation', # For NSURLRequest
'<@(uv_ldflags)',
'<@(sqlite3_ldflags)',
'<@(zlib_ldflags)',
],
'libraries': [
'<@(uv_static_libs)',
'<@(sqlite3_static_libs)',
'<@(zlib_static_libs)',
],
},
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
'CLANG_ENABLE_OBJC_ARC': 'NO',
},
'link_settings': {
'libraries': [ '<@(libraries)' ],
'xcode_settings': {
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
},
},
'direct_dependent_settings': {
'include_dirs': [
'../include',
],
},
},
],
}

View File

@@ -0,0 +1,68 @@
{
'targets': [
{ 'target_name': 'mbgl-storage-curl',
'product_name': 'mbgl-storage-curl',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'sources': [
'../platform/default/default_file_source.cpp',
'../platform/default/sqlite_cache.cpp',
'../platform/default/http_request_curl.cpp',
'../platform/default/asset_request_libuv.cpp',
'../platform/default/sqlite3.hpp',
'../platform/default/sqlite3.cpp',
'../platform/default/compression.hpp',
'../platform/default/compression.cpp',
],
'include_dirs': [
'../include',
],
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
'<@(sqlite3_cflags)',
'-I<(boost_root)/include',
],
'ldflags': [
'<@(uv_ldflags)',
'<@(sqlite3_ldflags)',
'<@(zlib_ldflags)',
],
'libraries': [
'<@(uv_static_libs)',
'<@(sqlite3_static_libs)',
'<@(zlib_static_libs)',
],
},
'conditions': [
['OS == "mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
},
}, {
'cflags_cc': [ '<@(cflags_cc)' ],
}],
],
'link_settings': {
'libraries': [ '<@(libraries)' ],
'conditions': [
['OS == "mac"', {
'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] }
}, {
'ldflags': [ '<@(ldflags)' ],
}]
],
},
'direct_dependent_settings': {
'include_dirs': [ '../include' ],
},
},
],
}

View File

@@ -3,55 +3,50 @@
'../gyp/common.gypi',
],
'targets': [
{
'target_name': 'linuxapp',
{ 'target_name': 'linuxapp',
'product_name': 'mapbox-gl',
'type': 'executable',
'dependencies': [
'../mbgl.gyp:<(core_library)',
'../mbgl.gyp:<(platform_library)',
'../mbgl.gyp:<(storage_library)',
'../mbgl.gyp:bundle_styles',
'../mbgl.gyp:copy_certificate_bundle',
],
'sources': [
'./main.cpp',
'main.cpp',
'../platform/default/settings_json.cpp',
'../platform/default/glfw_view.cpp',
'../platform/default/log_stderr.cpp',
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS':[
'variables' : {
'cxxflags': [
'<@(glfw3_cflags)',
'<@(png_cflags)',
'<@(jpeg_cflags)',
],
},
'cflags_cc': [
'<@(glfw3_cflags)',
'<@(png_cflags)',
'<@(jpeg_cflags)',
'-I<(boost_root)/include',
],
'variables': {
'ldflags': [
'<@(png_ldflags)',
'<@(sqlite3_static_libs)',
'<@(sqlite3_ldflags)',
'<@(glfw3_static_libs)',
'<@(glfw3_ldflags)',
'<@(curl_ldflags)',
'<@(zlib_ldflags)',
],
'libraries': [
'<@(glfw3_static_libs)',
],
},
'libraries': [ '<@(libraries)' ],
'conditions': [
['OS == "mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cxxflags)' ],
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
}
}, {
'libraries': [ '<@(ldflags)' ],
'cxxflags': [ '<@(cxxflags)' ],
'ldflags': [ '<@(ldflags)' ],
}]
],
'dependencies': [
'../mapboxgl.gyp:mbgl-standalone',
'../mapboxgl.gyp:mbgl-linux',
'../mapboxgl.gyp:bundle_styles',
'../mapboxgl.gyp:copy_certificate_bundle',
],
'copies': [{
'files': [ '../styles/styles' ],
'destination': '<(PRODUCT_DIR)'

View File

@@ -3,10 +3,22 @@
'../gyp/common.gypi',
],
'targets': [
{
'target_name': 'osxapp',
{ 'target_name': 'osxapp',
'product_name': 'Mapbox GL',
'type': 'executable',
'product_extension': 'app',
'mac_bundle': 1,
'mac_bundle_resources': [
'Icon.icns',
],
'dependencies': [
'../mbgl.gyp:bundle_styles',
'../mbgl.gyp:<(core_library)',
'../mbgl.gyp:<(platform_library)',
'../mbgl.gyp:<(storage_library)',
],
'sources': [
'./main.mm',
'../platform/darwin/settings_nsuserdefaults.hpp',
@@ -15,54 +27,34 @@
'../platform/default/glfw_view.hpp',
'../platform/default/glfw_view.cpp',
],
'product_extension': 'app',
'mac_bundle': 1,
'mac_bundle_resources': [
'Icon.icns',
'variables' : {
'cxxflags': [
'<@(glfw3_cflags)',
],
'ldflags': [
'-framework SystemConfiguration', # For NSUserDefaults and Reachability
'<@(glfw3_ldflags)',
],
'libraries': [
'<@(glfw3_static_libs)',
],
},
'libraries': [
'<@(libraries)',
],
'xcode_settings': {
'SDKROOT': 'macosx',
'SUPPORTED_PLATFORMS':'macosx',
'OTHER_CPLUSPLUSFLAGS': [
'<@(glfw3_cflags)'
],
'OTHER_LDFLAGS': [
'<@(glfw3_ldflags)',
'-framework SystemConfiguration',
],
'OTHER_CPLUSPLUSFLAGS': [ '<@(cxxflags)' ],
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
'SDKROOT': 'macosx',
'INFOPLIST_FILE': 'Info.plist',
'MACOSX_DEPLOYMENT_TARGET':'10.9',
'MACOSX_DEPLOYMENT_TARGET': '10.9',
'CLANG_ENABLE_OBJC_ARC': 'YES'
},
'variables' : {
'ldflags': [
'<@(uv_ldflags)',
'<@(uv_static_libs)',
'<@(sqlite3_static_libs)',
'<@(sqlite3_ldflags)',
'<@(glfw3_static_libs)',
'<@(glfw3_ldflags)',
'<@(zlib_ldflags)',
]
},
'conditions': [
['OS == "mac"', {
'xcode_settings': {
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
}
}, {
'ldflags': [ '<@(ldflags)' ],
}]
],
'include_dirs': [
'../src'
],
'dependencies': [
'../mapboxgl.gyp:bundle_styles',
'../mapboxgl.gyp:mbgl-core',
'../mapboxgl.gyp:mbgl-osx',
]
}
]
}

View File

@@ -1,13 +0,0 @@
{
'includes': [
'./gyp/common.gypi',
'./gyp/shaders.gypi',
'./gyp/version.gypi',
'./gyp/styles.gypi',
'./gyp/certificates.gypi',
'./gyp/mbgl-core.gypi',
'./gyp/mbgl-platform.gypi',
'./gyp/mbgl-headless.gypi',
'./gyp/install.gypi',
],
}

38
mbgl.gyp Normal file
View File

@@ -0,0 +1,38 @@
{
'includes': [
'./gyp/common.gypi',
'./gyp/shaders.gypi',
'./gyp/version.gypi',
'./gyp/styles.gypi',
'./gyp/certificates.gypi',
'./gyp/mbgl-core.gypi',
'./gyp/mbgl-headless.gypi',
'./gyp/mbgl-storage-curl.gypi',
'./gyp/install.gypi',
],
'conditions': [
['platform == "osx"', {
'includes': [
'./gyp/mbgl-osx.gypi',
'./gyp/mbgl-storage-cocoa.gypi'
],
}],
['platform == "ios"', {
'includes': [
'./gyp/mbgl-ios.gypi',
'./gyp/mbgl-storage-cocoa.gypi'
],
}],
['platform == "linux"', {
'includes': [
'./gyp/mbgl-linux.gypi'
],
}],
['platform == "android"', {
'includes': [
'./gyp/mbgl-android.gypi'
],
}],
],
}

View File

@@ -1,10 +1,25 @@
#include <mbgl/util/compression.hpp>
#include "compression.hpp"
#include <zlib.h>
#include <cstring>
#include <stdexcept>
// Check zlib library version.
const static bool zlibVersionCheck = []() {
const char *const version = zlibVersion();
if (version[0] != ZLIB_VERSION[0]) {
char message[96];
snprintf(message, 96, "zlib version mismatch: headers report %s, but library reports %s",
ZLIB_VERSION, version);
throw std::runtime_error(message);
}
return true;
}();
namespace mbgl {
namespace util {

View File

@@ -1,8 +1,28 @@
#include <mbgl/util/sqlite3.hpp>
#include "sqlite3.hpp"
#include <sqlite3.h>
#include <cassert>
// Check sqlite3 library version.
const static bool sqliteVersionCheck = []() {
if (sqlite3_libversion_number() != SQLITE_VERSION_NUMBER) {
char message[96];
snprintf(message, 96,
"sqlite3 libversion mismatch: headers report %d, but library reports %d",
SQLITE_VERSION_NUMBER, sqlite3_libversion_number());
throw std::runtime_error(message);
}
if (strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) != 0) {
char message[256];
snprintf(message, 256,
"sqlite3 sourceid mismatch: headers report \"%s\", but library reports \"%s\"",
SQLITE_SOURCE_ID, sqlite3_sourceid());
throw std::runtime_error(message);
}
return true;
}();
namespace mapbox {
namespace sqlite {

View File

@@ -7,8 +7,8 @@
#include <mbgl/util/variant.hpp>
#include <mbgl/platform/log.hpp>
#include "../util/sqlite3.hpp"
#include "../util/compression.hpp"
#include "sqlite3.hpp"
#include "compression.hpp"
#include <uv.h>

View File

@@ -54,38 +54,6 @@ const static bool uvVersionCheck = []() {
return true;
}();
#include <zlib.h>
// Check zlib library version.
const static bool zlibVersionCheck = []() {
const char *const version = zlibVersion();
if (version[0] != ZLIB_VERSION[0]) {
throw std::runtime_error(mbgl::util::sprintf<96>(
"zlib version mismatch: headers report %s, but library reports %s", ZLIB_VERSION, version));
}
return true;
}();
#include <sqlite3.h>
// Check sqlite3 library version.
const static bool sqliteVersionCheck = []() {
if (sqlite3_libversion_number() != SQLITE_VERSION_NUMBER) {
throw std::runtime_error(mbgl::util::sprintf<96>(
"sqlite3 libversion mismatch: headers report %d, but library reports %d",
SQLITE_VERSION_NUMBER, sqlite3_libversion_number()));
}
if (strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) != 0) {
throw std::runtime_error(mbgl::util::sprintf<256>(
"sqlite3 sourceid mismatch: headers report \"%s\", but library reports \"%s\"",
SQLITE_SOURCE_ID, sqlite3_sourceid()));
}
return true;
}();
using namespace mbgl;
Map::Map(View& view_, FileSource& fileSource_)

View File

@@ -20,9 +20,10 @@
'include_dirs': [ '../include', '../src' ],
'dependencies': [
'symlink_TEST_DATA',
'../mapboxgl.gyp:mbgl-core',
'../mapboxgl.gyp:mbgl-<(platform)',
'../mapboxgl.gyp:mbgl-headless',
'../mbgl.gyp:<(core_library)',
'../mbgl.gyp:<(platform_library)',
'../mbgl.gyp:<(storage_library)',
'../mbgl.gyp:<(headless_library)',
'../deps/gtest/gtest.gyp:gtest'
],
'sources': [