Merge pull request #516 from mapbox/standalone
[Work in Progress] Standalone libmgl.a
This commit is contained in:
17
Makefile
17
Makefile
@@ -9,7 +9,7 @@ endif
|
||||
PLATFORM ?= linux
|
||||
|
||||
|
||||
all: mbgl
|
||||
all: mbgl-core mbgl-platform mbgl-headless
|
||||
|
||||
config.gypi: configure
|
||||
./configure
|
||||
@@ -18,9 +18,17 @@ config-ios.gypi: configure
|
||||
MASON_PLATFORM=ios ./configure config-ios.gypi
|
||||
|
||||
# Builds the regular library
|
||||
mbgl: config.gypi mapboxgl.gyp
|
||||
mbgl-core: config.gypi mapboxgl.gyp
|
||||
deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
|
||||
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl
|
||||
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-core
|
||||
|
||||
mbgl-platform: config.gypi mapboxgl.gyp
|
||||
deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
|
||||
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-$(PLATFORM)
|
||||
|
||||
mbgl-headless: config.gypi mapboxgl.gyp
|
||||
deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
|
||||
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-headless
|
||||
|
||||
install: config.gypi mapboxgl.gyp
|
||||
deps/run_gyp mapboxgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) -Dinstall_prefix=$(PREFIX) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
|
||||
@@ -104,10 +112,11 @@ lproj: config.gypi linux/mapboxgl-app.gyp clear_xcode_cache
|
||||
clean: clear_xcode_cache
|
||||
-find ./deps/gyp -name "*.pyc" -exec rm {} \;
|
||||
-rm -rf ./build/
|
||||
-rm -rf ./macosx/build/
|
||||
-rm -rf ./config.gypi ./config-ios.gypi
|
||||
|
||||
distclean: clean
|
||||
-rm -rf ./mason_packages
|
||||
|
||||
.PHONY: mbgl install test linux clear_xcode_cache build/test/Makefile clean distclean
|
||||
.PHONY: mbgl-core install test linux clear_xcode_cache build/test/Makefile clean distclean
|
||||
# DO NOT DELETE
|
||||
|
||||
22
configure
vendored
22
configure
vendored
@@ -69,7 +69,7 @@ PYTHON=`which python || abort 'Cannot find python'`
|
||||
>&2 echo -en "\033[0m";
|
||||
|
||||
function quote_flags {
|
||||
${PYTHON} -c "import sys, re; print re.split('(?<!-framework)\s+', ' '.join(sys.argv[1:]))" "$@"
|
||||
${PYTHON} -c "import sys, re; print filter(None, re.split('(?<!-framework)\s+', ' '.join(sys.argv[1:])))" "$@"
|
||||
}
|
||||
|
||||
LN=$'\n'
|
||||
@@ -96,38 +96,46 @@ fi
|
||||
|
||||
if [ ! -z ${LIBCURL_VERSION} ]; then
|
||||
mason install libcurl ${LIBCURL_VERSION}
|
||||
CONFIG+=" 'curl_static_libs': $(quote_flags $(mason static_libs libcurl ${LIBCURL_VERSION})),"$LN
|
||||
CONFIG+=" 'curl_cflags': $(quote_flags $(mason cflags libcurl ${LIBCURL_VERSION})),"$LN
|
||||
CONFIG+=" 'curl_libraries': $(quote_flags $(mason ldflags libcurl ${LIBCURL_VERSION})),"$LN
|
||||
CONFIG+=" 'curl_ldflags': $(quote_flags $(mason ldflags libcurl ${LIBCURL_VERSION})),"$LN
|
||||
else
|
||||
CONFIG+=" 'curl_static_libs': [],"$LN
|
||||
fi
|
||||
|
||||
if [ ! -z ${GLFW_VERSION} ]; then
|
||||
mason install glfw ${GLFW_VERSION}
|
||||
CONFIG+=" 'glfw3_static_libs': $(quote_flags $(mason static_libs glfw ${GLFW_VERSION})),"$LN
|
||||
CONFIG+=" 'glfw3_cflags': $(quote_flags $(mason cflags glfw ${GLFW_VERSION})),"$LN
|
||||
CONFIG+=" 'glfw3_libraries': $(quote_flags $(mason ldflags glfw ${GLFW_VERSION})),"$LN
|
||||
CONFIG+=" 'glfw3_ldflags': $(quote_flags $(mason ldflags glfw ${GLFW_VERSION})),"$LN
|
||||
fi
|
||||
|
||||
if [ ! -z ${LIBPNG_VERSION} ]; then
|
||||
mason install libpng ${LIBPNG_VERSION}
|
||||
CONFIG+=" 'png_static_libs': $(quote_flags $(mason static_libs libpng ${LIBPNG_VERSION})),"$LN
|
||||
CONFIG+=" 'png_cflags': $(quote_flags $(mason cflags libpng ${LIBPNG_VERSION})),"$LN
|
||||
CONFIG+=" 'png_libraries': $(quote_flags $(mason ldflags libpng ${LIBPNG_VERSION})),"$LN
|
||||
CONFIG+=" 'png_ldflags': $(quote_flags $(mason ldflags libpng ${LIBPNG_VERSION})),"$LN
|
||||
fi
|
||||
|
||||
if [ ! -z ${SQLITE_VERSION} ]; then
|
||||
mason install sqlite ${SQLITE_VERSION}
|
||||
CONFIG+=" 'sqlite3_static_libs': $(quote_flags $(mason static_libs sqlite ${SQLITE_VERSION})),"$LN
|
||||
CONFIG+=" 'sqlite3_cflags': $(quote_flags $(mason cflags sqlite ${SQLITE_VERSION})),"$LN
|
||||
CONFIG+=" 'sqlite3_libraries': $(quote_flags $(mason ldflags sqlite ${SQLITE_VERSION})),"$LN
|
||||
CONFIG+=" 'sqlite3_ldflags': $(quote_flags $(mason ldflags sqlite ${SQLITE_VERSION})),"$LN
|
||||
fi
|
||||
|
||||
if [ ! -z ${LIBUV_VERSION} ]; then
|
||||
mason install libuv ${LIBUV_VERSION}
|
||||
CONFIG+=" 'uv_static_libs': $(quote_flags $(mason static_libs libuv ${LIBUV_VERSION})),"$LN
|
||||
CONFIG+=" 'uv_cflags': $(quote_flags $(mason cflags libuv ${LIBUV_VERSION})),"$LN
|
||||
CONFIG+=" 'uv_libraries': $(quote_flags $(mason ldflags libuv ${LIBUV_VERSION})),"$LN
|
||||
CONFIG+=" 'uv_ldflags': $(quote_flags $(mason ldflags libuv ${LIBUV_VERSION})),"$LN
|
||||
fi
|
||||
|
||||
if [ ! -z ${ZLIB_VERSION} ]; then
|
||||
mason install zlib ${ZLIB_VERSION}
|
||||
CONFIG+=" 'zlib_static_libs': $(quote_flags $(mason static_libs zlib ${ZLIB_VERSION})),"$LN
|
||||
CONFIG+=" 'zlib_cflags': $(quote_flags $(mason cflags zlib ${ZLIB_VERSION})),"$LN
|
||||
CONFIG+=" 'zlib_libraries': $(quote_flags $(mason ldflags zlib ${ZLIB_VERSION})),"$LN
|
||||
CONFIG+=" 'zlib_ldflags': $(quote_flags $(mason ldflags zlib ${ZLIB_VERSION})),"$LN
|
||||
fi
|
||||
|
||||
CONFIG+=" }
|
||||
|
||||
2
deps/gyp/pylib/gyp/generator/make.py
vendored
2
deps/gyp/pylib/gyp/generator/make.py
vendored
@@ -141,7 +141,7 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
|
||||
# special "figure out circular dependencies" flags around the entire
|
||||
# input list during linking.
|
||||
quiet_cmd_link = LINK($(TOOLSET)) $@
|
||||
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
|
||||
cmd_link = $(LINK.$(TOOLSET)) -Wl,--start-group $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) -Wl,--end-group $(LIBS)
|
||||
|
||||
# We support two kinds of shared objects (.so):
|
||||
# 1) shared_library, which is just bundling together many dependent libraries
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
'variables': {
|
||||
'install_prefix%': '',
|
||||
'standalone_product_dir':'<!@(pwd)/../build'
|
||||
},
|
||||
'target_defaults': {
|
||||
'default_configuration': 'Release',
|
||||
@@ -24,6 +25,19 @@
|
||||
],
|
||||
}],
|
||||
],
|
||||
'target_conditions': [
|
||||
['_type == "static_library"', {
|
||||
'conditions': [
|
||||
['OS=="mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '-fPIC' ],
|
||||
},
|
||||
}, {
|
||||
'cflags_cc': [ '-fPIC' ],
|
||||
}]
|
||||
],
|
||||
}],
|
||||
],
|
||||
'cflags_cc': [ '-std=c++11', '-Werror', '-Wall', '-Wextra', '-Wshadow', '-frtti', '-fexceptions' ],
|
||||
'configurations': {
|
||||
'Debug': {
|
||||
|
||||
@@ -6,16 +6,35 @@
|
||||
'type': 'none',
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'mbgl',
|
||||
'mbgl-core',
|
||||
'mbgl-standalone',
|
||||
'mbgl-headless',
|
||||
'mbgl-<(platform)',
|
||||
],
|
||||
'copies': [
|
||||
{ 'files': [ '<(PRODUCT_DIR)/libmbgl.a' ], 'destination': '<(install_prefix)/lib' },
|
||||
{ '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': [ '../include/mbgl' ], 'destination': '<(install_prefix)/include' }
|
||||
],
|
||||
'actions': [
|
||||
{ 'action_name': 'mbgl-config',
|
||||
'inputs': [
|
||||
'../utils/mbgl-config/mbgl-config.template.sh',
|
||||
'../utils/mbgl-config/build.sh',
|
||||
],
|
||||
'outputs': [
|
||||
'<(install_prefix)/bin/mbgl-config',
|
||||
],
|
||||
'action': [
|
||||
'./utils/mbgl-config/build.sh',
|
||||
'<(install_prefix)',
|
||||
'<(platform)',
|
||||
'<@(png_ldflags)'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
}],
|
||||
|
||||
93
gyp/mbgl-core.gypi
Normal file
93
gyp/mbgl-core.gypi
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
'targets': [
|
||||
{ 'target_name': 'mbgl-core',
|
||||
'product_name': 'mbgl-core',
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'shaders',
|
||||
],
|
||||
'variables': {
|
||||
'cflags_cc': [
|
||||
'<@(png_cflags)',
|
||||
'<@(uv_cflags)',
|
||||
'<@(sqlite3_cflags)',
|
||||
'<@(zlib_cflags)',
|
||||
'-I<(boost_root)/include',
|
||||
],
|
||||
'cflags': [
|
||||
'<@(uv_cflags)',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'<!@(find src -name "*.cpp")',
|
||||
'<!@(test -f "config/constants_local.cpp" && echo "config/constants_local.cpp" || echo "config/constants.cpp")',
|
||||
'<!@(find src -name "*.c")',
|
||||
'<!@(find src -name "*.h")',
|
||||
'<!@(find include -name "*.hpp")',
|
||||
'<!@(find include -name "*.h")',
|
||||
'<!@(find src -name "*.glsl")',
|
||||
'bin/style.json'
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
|
||||
'OTHER_CFLAGS': [ '<@(cflags)' ],
|
||||
},
|
||||
}, {
|
||||
'cflags_cc': [ '<@(cflags_cc)' ],
|
||||
'cflags': [ '<@(cflags)' ],
|
||||
}]
|
||||
]
|
||||
},
|
||||
{
|
||||
'target_name': 'mbgl-standalone',
|
||||
'type': 'none',
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'mbgl-core'
|
||||
],
|
||||
'variables': {
|
||||
'core_lib':'<(PRODUCT_DIR)/libmbgl-core.a',
|
||||
'standalone_lib':'<(standalone_product_dir)/libmbgl.a'
|
||||
},
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [ '<(standalone_lib)' ],
|
||||
}
|
||||
}, {
|
||||
'ldflags': [ '<(standalone_lib)' ],
|
||||
}]
|
||||
],
|
||||
},
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'build standalone core lib',
|
||||
'inputs': [
|
||||
'<(core_lib)'
|
||||
],
|
||||
'outputs': [
|
||||
'<(standalone_lib)'
|
||||
],
|
||||
'action': [
|
||||
'./gyp/merge_static_libs.py',
|
||||
'<(standalone_lib)',
|
||||
'<@(uv_static_libs)',
|
||||
'<@(curl_static_libs)',
|
||||
'<(core_lib)'
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -12,5 +12,5 @@
|
||||
'../platform/default/headless_display.cpp',
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
|
||||
'CLANG_ENABLE_OBJC_ARC': 'YES',
|
||||
'CODE_SIGN_IDENTITY': 'iPhone Developer',
|
||||
'PUBLIC_HEADERS_FOLDER_PATH': 'include',
|
||||
},
|
||||
'configurations': {
|
||||
'Release': {
|
||||
@@ -30,29 +29,22 @@
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'sources': [
|
||||
'../platform/ios/cache_database_library.mm',
|
||||
'../platform/darwin/log_nslog.mm',
|
||||
'../platform/darwin/string_nsstring.mm',
|
||||
'../platform/darwin/http_request_baton_cocoa.mm',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': [
|
||||
'<@(uv_cflags)',
|
||||
],
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(uv_cflags)' ],
|
||||
},
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(uv_libraries)',
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -5,28 +5,38 @@
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'include_dirs': [
|
||||
'../include'
|
||||
],
|
||||
'variables': {
|
||||
'cflags_cc': [
|
||||
'<@(uv_cflags)',
|
||||
'<@(curl_cflags)',
|
||||
],
|
||||
'cflags': [
|
||||
'<@(uv_cflags)',
|
||||
],
|
||||
'ldflags': [
|
||||
'<@(uv_ldflags)',
|
||||
'<@(curl_ldflags)',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'../platform/default/cache_database_tmp.cpp',
|
||||
'../platform/default/log_stderr.cpp',
|
||||
'../platform/default/string_stdlib.cpp',
|
||||
'../platform/default/http_request_baton_curl.cpp',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': [
|
||||
'<@(uv_cflags)',
|
||||
'<@(curl_cflags)',
|
||||
],
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
|
||||
'OTHER_CFLAGS': [ '<@(cflags)' ],
|
||||
}
|
||||
}, {
|
||||
'cflags': [
|
||||
'<@(uv_cflags)',
|
||||
'<@(curl_cflags)',
|
||||
],
|
||||
'ldflags': [ '<@(ldflags)' ],
|
||||
'cflags_cc': [ '<@(cflags_cc)' ],
|
||||
'cflags': [ '<@(cflags)' ],
|
||||
}]
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
@@ -36,20 +46,13 @@
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(uv_libraries)',
|
||||
'<@(curl_libraries)',
|
||||
]
|
||||
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
|
||||
}
|
||||
}, {
|
||||
'libraries': [
|
||||
'<@(uv_libraries)',
|
||||
'<@(curl_libraries)',
|
||||
'-lboost_regex',
|
||||
]
|
||||
'ldflags': [ '<@(ldflags)' ],
|
||||
}]
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
@@ -5,29 +5,22 @@
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'sources': [
|
||||
'../platform/osx/cache_database_application_support.mm',
|
||||
'../platform/darwin/log_nslog.mm',
|
||||
'../platform/darwin/string_nsstring.mm',
|
||||
'../platform/darwin/http_request_baton_cocoa.mm',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': [
|
||||
'<@(uv_cflags)',
|
||||
],
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(uv_cflags)' ],
|
||||
},
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(uv_libraries)',
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
{
|
||||
'targets': [
|
||||
{ 'target_name': 'mbgl',
|
||||
'product_name': 'mbgl',
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'shaders',
|
||||
],
|
||||
'sources': [
|
||||
'<!@(find src -name "*.cpp")',
|
||||
'<!@(test -f "config/constants_local.cpp" && echo "config/constants_local.cpp" || echo "config/constants.cpp")',
|
||||
'<!@(find src -name "*.c")',
|
||||
'<!@(find src -name "*.h")',
|
||||
'<!@(find include -name "*.hpp")',
|
||||
'<!@(find include -name "*.h")',
|
||||
'<!@(find src -name "*.glsl")',
|
||||
'bin/style.json'
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include'
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'PUBLIC_HEADERS_FOLDER_PATH': 'include',
|
||||
'OTHER_CPLUSPLUSFLAGS': [
|
||||
'<@(png_cflags)',
|
||||
'<@(uv_cflags)',
|
||||
'<@(sqlite3_cflags)',
|
||||
'<@(zlib_cflags)',
|
||||
'-I<(boost_root)/include',
|
||||
],
|
||||
'OTHER_CFLAGS': [
|
||||
'<@(uv_cflags)',
|
||||
],
|
||||
},
|
||||
}, {
|
||||
'cflags': [
|
||||
'<@(png_cflags)',
|
||||
'<@(uv_cflags)',
|
||||
'<@(sqlite3_cflags)',
|
||||
'<@(zlib_cflags)',
|
||||
'-I<(boost_root)/include',
|
||||
],
|
||||
}]
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(png_libraries)',
|
||||
'<@(uv_libraries)',
|
||||
'<@(sqlite3_libraries)',
|
||||
'<@(zlib_libraries)',
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'libraries': [
|
||||
'<@(png_libraries)',
|
||||
'<@(uv_libraries)',
|
||||
'<@(sqlite3_libraries)',
|
||||
'<@(zlib_libraries)',
|
||||
]
|
||||
}]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
66
gyp/merge_static_libs.py
Executable file
66
gyp/merge_static_libs.py
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def _Usage():
|
||||
print 'Usage: merge_static_libs OUTPUT_LIB INPUT_LIB [INPUT_LIB]*'
|
||||
sys.exit(1)
|
||||
|
||||
def MergeLibs(in_libs, out_lib):
|
||||
""" Merges multiple static libraries into one.
|
||||
|
||||
in_libs: list of paths to static libraries to be merged
|
||||
out_lib: path to the static library which will be created from in_libs
|
||||
"""
|
||||
if os.name == 'posix':
|
||||
tempdir = tempfile.mkdtemp()
|
||||
abs_in_libs = []
|
||||
for in_lib in in_libs:
|
||||
abs_in_libs.append(os.path.abspath(in_lib))
|
||||
curdir = os.getcwd()
|
||||
os.chdir(tempdir)
|
||||
objects = []
|
||||
ar = os.environ.get('AR', 'ar')
|
||||
for in_lib in abs_in_libs:
|
||||
proc = subprocess.Popen([ar, '-t', in_lib], stdout=subprocess.PIPE)
|
||||
proc.wait()
|
||||
obj_str = proc.communicate()[0]
|
||||
current_objects = obj_str.rstrip().split('\n')
|
||||
proc = subprocess.Popen([ar, '-x', in_lib], stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
proc.wait()
|
||||
if proc.poll() == 0:
|
||||
# The static library is non-thin, and we extracted objects
|
||||
for object in current_objects:
|
||||
objects.append(os.path.abspath(object))
|
||||
elif 'thin archive' in proc.communicate()[0]:
|
||||
# The static library is thin, so it contains the paths to its objects
|
||||
for object in current_objects:
|
||||
objects.append(object)
|
||||
else:
|
||||
raise Exception('Failed to extract objects from %s.' % in_lib)
|
||||
os.chdir(curdir)
|
||||
if not subprocess.call([ar, '-crs', out_lib] + objects) == 0:
|
||||
raise Exception('Failed to add object files to %s' % out_lib)
|
||||
shutil.rmtree(tempdir)
|
||||
elif os.name == 'nt':
|
||||
subprocess.call(['lib', '/OUT:%s' % out_lib] + in_libs)
|
||||
else:
|
||||
raise Exception('Error: Your platform is not supported')
|
||||
|
||||
def Main():
|
||||
if len(sys.argv) < 3:
|
||||
_Usage()
|
||||
out_lib = sys.argv[1]
|
||||
in_libs = sys.argv[2:]
|
||||
MergeLibs(in_libs, out_lib)
|
||||
|
||||
if '__main__' == __name__:
|
||||
sys.exit(Main())
|
||||
40
include/mbgl/util/stopwatch.hpp
Normal file
40
include/mbgl/util/stopwatch.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef MBGL_UTIL_STOPWATCH
|
||||
#define MBGL_UTIL_STOPWATCH
|
||||
|
||||
#include <mbgl/platform/event.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
|
||||
#ifndef DISABLE_STOPWATCH
|
||||
class stopwatch {
|
||||
public:
|
||||
stopwatch(Event event = Event::General);
|
||||
stopwatch(EventSeverity severity, Event event = Event::General);
|
||||
stopwatch(const std::string &name, Event event = Event::General);
|
||||
stopwatch(const std::string &name, EventSeverity severity, Event event = Event::General);
|
||||
void report(const std::string &name);
|
||||
~stopwatch();
|
||||
|
||||
private:
|
||||
const std::string name;
|
||||
EventSeverity severity = EventSeverity::Debug;
|
||||
Event event = Event::General;
|
||||
uint64_t start;
|
||||
};
|
||||
#else
|
||||
class stopwatch {
|
||||
inline stopwatch(Event event = Event::General);
|
||||
inline stopwatch(EventSeverity severity, Event event = Event::General);
|
||||
inline stopwatch(const std::string &name, Event event = Event::General);
|
||||
inline stopwatch(const std::string &name, EventSeverity severity, Event event = Event::General);
|
||||
inline void report(const std::string &name) {}
|
||||
inline ~stopwatch() {}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef MBGL_UTIL_TIMER
|
||||
#define MBGL_UTIL_TIMER
|
||||
|
||||
#include <mbgl/platform/event.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
|
||||
#ifndef DISABLE_TIMER
|
||||
class timer {
|
||||
public:
|
||||
timer(Event event = Event::General);
|
||||
timer(EventSeverity severity, Event event = Event::General);
|
||||
timer(const std::string &name, Event event = Event::General);
|
||||
timer(const std::string &name, EventSeverity severity, Event event = Event::General);
|
||||
void report(const std::string &name);
|
||||
~timer();
|
||||
|
||||
private:
|
||||
const std::string name;
|
||||
EventSeverity severity = EventSeverity::Debug;
|
||||
Event event = Event::General;
|
||||
uint64_t start;
|
||||
};
|
||||
#else
|
||||
class timer {
|
||||
inline timer(Event event = Event::General);
|
||||
inline timer(EventSeverity severity, Event event = Event::General);
|
||||
inline timer(const std::string &name, Event event = Event::General);
|
||||
inline timer(const std::string &name, EventSeverity severity, Event event = Event::General);
|
||||
inline void report(const std::string &name) {}
|
||||
inline ~timer() {}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Submodule ios/mapbox-gl-cocoa updated: bba56f27fa...80fd792b99
@@ -13,38 +13,30 @@
|
||||
'../platform/default/glfw_view.cpp',
|
||||
'../platform/default/log_stderr.cpp',
|
||||
],
|
||||
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS':[
|
||||
'<@(glfw3_cflags)',
|
||||
],
|
||||
},
|
||||
'cflags_cc': [
|
||||
'<@(glfw3_cflags)',
|
||||
'-I<(boost_root)/include',
|
||||
],
|
||||
'libraries': [
|
||||
'<@(png_ldflags)',
|
||||
'<@(sqlite3_ldflags)',
|
||||
'<@(glfw3_static_libs)',
|
||||
'<@(glfw3_ldflags)',
|
||||
'<@(curl_ldflags)',
|
||||
'<@(zlib_ldflags)',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"',
|
||||
|
||||
# Mac OS X
|
||||
{
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS':[
|
||||
'<@(glfw3_cflags)',
|
||||
],
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(glfw3_libraries)',
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
# Non-Mac OS X
|
||||
{
|
||||
'cflags': [
|
||||
'<@(glfw3_cflags)',
|
||||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'<@(glfw3_libraries)',
|
||||
'-L<(boost_root)/lib',
|
||||
'-lboost_regex',
|
||||
],
|
||||
},
|
||||
}],
|
||||
['OS == "linux"', {
|
||||
'libraries':[ '-L<(boost_root)/lib','-lboost_regex' ]
|
||||
}]
|
||||
],
|
||||
'dependencies': [
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
'../mapboxgl.gyp:mbgl-linux',
|
||||
'../mapboxgl.gyp:copy_styles',
|
||||
'../mapboxgl.gyp:copy_certificate_bundle',
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
'<@(glfw3_cflags)'
|
||||
],
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(glfw3_libraries)',
|
||||
'<@(glfw3_ldflags)',
|
||||
'-framework SystemConfiguration',
|
||||
],
|
||||
'SDKROOT': 'macosx',
|
||||
@@ -35,9 +35,27 @@
|
||||
'MACOSX_DEPLOYMENT_TARGET':'10.9',
|
||||
'CLANG_ENABLE_OBJC_ARC': 'YES'
|
||||
},
|
||||
'variables' : {
|
||||
'ldflags': [
|
||||
'<@(sqlite3_ldflags)',
|
||||
'<@(glfw3_static_libs)',
|
||||
'<@(glfw3_ldflags)',
|
||||
'<@(curl_ldflags)',
|
||||
'<@(png_ldflags)'
|
||||
]
|
||||
},
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
|
||||
}
|
||||
}, {
|
||||
'ldflags': [ '<@(ldflags)' ],
|
||||
}]
|
||||
],
|
||||
'dependencies': [
|
||||
'../mapboxgl.gyp:bundle_styles',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
'../mapboxgl.gyp:mbgl-osx',
|
||||
]
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'./gyp/styles.gypi',
|
||||
'./gyp/fixtures.gypi',
|
||||
'./gyp/certificates.gypi',
|
||||
'./gyp/mbgl.gypi',
|
||||
'./gyp/mbgl-core.gypi',
|
||||
'./gyp/mbgl-platform.gypi',
|
||||
'./gyp/mbgl-headless.gypi',
|
||||
'./gyp/install.gypi',
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <mbgl/map/source.hpp>
|
||||
|
||||
#if defined(DEBUG)
|
||||
#include <mbgl/util/timer.hpp>
|
||||
#include <mbgl/util/stopwatch.hpp>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
@@ -40,7 +40,7 @@ bool Painter::needsAnimation() const {
|
||||
|
||||
void Painter::setup() {
|
||||
#if defined(DEBUG)
|
||||
util::timer timer("painter setup");
|
||||
util::stopwatch stopwatch("painter setup");
|
||||
#endif
|
||||
setupShaders();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
#include <mbgl/platform/gl.hpp>
|
||||
#include <mbgl/util/timer.hpp>
|
||||
#include <mbgl/util/stopwatch.hpp>
|
||||
#include <mbgl/platform/log.hpp>
|
||||
|
||||
#include <cstring>
|
||||
@@ -12,7 +12,7 @@ Shader::Shader(const char *name_, const GLchar *vertSource, const GLchar *fragSo
|
||||
: name(name_),
|
||||
valid(false),
|
||||
program(0) {
|
||||
util::timer timer("shader compilation", Event::Shader);
|
||||
util::stopwatch stopwatch("shader compilation", Event::Shader);
|
||||
|
||||
GLuint vertShader;
|
||||
if (!compileShader(&vertShader, GL_VERTEX_SHADER, vertSource)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef DISABLE_TIMER
|
||||
#include <mbgl/util/timer.hpp>
|
||||
#ifndef DISABLE_STOPWATCH
|
||||
#include <mbgl/util/stopwatch.hpp>
|
||||
#include <mbgl/util/time.hpp>
|
||||
#include <mbgl/platform/log.hpp>
|
||||
|
||||
@@ -8,26 +8,26 @@
|
||||
|
||||
using namespace mbgl::util;
|
||||
|
||||
timer::timer(Event event_)
|
||||
stopwatch::stopwatch(Event event_)
|
||||
: event(event_), start(now()) {}
|
||||
|
||||
timer::timer(EventSeverity severity_, Event event_)
|
||||
stopwatch::stopwatch(EventSeverity severity_, Event event_)
|
||||
: severity(severity_), event(event_), start(now()) {}
|
||||
|
||||
timer::timer(const std::string &name_, Event event_)
|
||||
stopwatch::stopwatch(const std::string &name_, Event event_)
|
||||
: name(name_), event(event_), start(now()) {}
|
||||
|
||||
timer::timer(const std::string &name_, EventSeverity severity_, Event event_)
|
||||
stopwatch::stopwatch(const std::string &name_, EventSeverity severity_, Event event_)
|
||||
: name(name_), severity(severity_), event(event_), start(now()) {}
|
||||
|
||||
void timer::report(const std::string &name_) {
|
||||
void stopwatch::report(const std::string &name_) {
|
||||
timestamp duration = now() - start;
|
||||
|
||||
Log::Record(severity, event, name_ + ": " + std::to_string((double)(duration) / 1_millisecond) + "ms");
|
||||
start += duration;
|
||||
}
|
||||
|
||||
timer::~timer() {
|
||||
stopwatch::~stopwatch() {
|
||||
if (name.size()) {
|
||||
report(name);
|
||||
}
|
||||
@@ -3,6 +3,20 @@
|
||||
'../gyp/common.gypi',
|
||||
'../gyp/mbgl-platform.gypi',
|
||||
],
|
||||
'target_defaults': {
|
||||
"libraries": [
|
||||
'<@(uv_ldflags)',
|
||||
'<@(curl_static_libs)',
|
||||
'<@(png_ldflags)',
|
||||
'<@(sqlite3_ldflags)',
|
||||
'<@(zlib_ldflags)'
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "linux"', {
|
||||
'libraries':[ '-L<(boost_root)/lib','-lboost_regex' ]
|
||||
}]
|
||||
],
|
||||
},
|
||||
'targets': [
|
||||
{ 'target_name': 'rotation_range',
|
||||
'product_name': 'test_rotation_range',
|
||||
@@ -13,7 +27,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
]
|
||||
},
|
||||
{ 'target_name': 'clip_ids',
|
||||
@@ -25,7 +39,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
]
|
||||
},
|
||||
{ 'target_name': 'enums',
|
||||
@@ -37,7 +51,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
]
|
||||
},
|
||||
{ 'target_name': 'style_parser',
|
||||
@@ -51,7 +65,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
'../mapboxgl.gyp:copy_fixtures',
|
||||
]
|
||||
},
|
||||
@@ -64,7 +78,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
]
|
||||
},
|
||||
{ 'target_name': 'comparisons',
|
||||
@@ -76,7 +90,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
]
|
||||
},
|
||||
{ 'target_name': 'tile',
|
||||
@@ -88,7 +102,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
]
|
||||
},
|
||||
{ 'target_name': 'functions',
|
||||
@@ -100,7 +114,7 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
]
|
||||
},
|
||||
{ 'target_name': 'headless',
|
||||
@@ -111,8 +125,6 @@
|
||||
'./headless.cpp',
|
||||
'./fixtures/fixture_request.cpp',
|
||||
'./fixtures/fixture_log.cpp',
|
||||
'../platform/default/headless_view.cpp',
|
||||
'../platform/default/headless_display.cpp',
|
||||
],
|
||||
'conditions': [
|
||||
# add libuv include path and OpenGL libs
|
||||
@@ -120,17 +132,18 @@
|
||||
{
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': ['<@(uv_cflags)'],
|
||||
'OTHER_LDFLAGS': ['<@(glfw3_libraries)'],
|
||||
'OTHER_LDFLAGS': ['<@(glfw3_ldflags)'],
|
||||
},
|
||||
},
|
||||
{
|
||||
'cflags': ['<@(uv_cflags)'],
|
||||
'libraries': ['<@(glfw3_libraries)'],
|
||||
'libraries': ['<@(glfw3_ldflags)'],
|
||||
}],
|
||||
],
|
||||
'dependencies': [
|
||||
'../deps/gtest/gtest.gyp:gtest',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
'../mapboxgl.gyp:mbgl-standalone',
|
||||
'../mapboxgl.gyp:mbgl-headless',
|
||||
'<(platform_library)',
|
||||
],
|
||||
},
|
||||
|
||||
20
utils/mbgl-config/build.sh
Executable file
20
utils/mbgl-config/build.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
PREFIX=$1
|
||||
PLATFORM=$2
|
||||
shift
|
||||
shift
|
||||
|
||||
VARIABLES="#!/bin/bash
|
||||
|
||||
## variables
|
||||
|
||||
CONFIG_MBGL_PREFIX=$PREFIX
|
||||
CONFIG_MBGL_PLATFORM=$PLATFORM
|
||||
CONFIG_MBGL_LDFLAGS=\"$@\"
|
||||
"
|
||||
|
||||
echo "$VARIABLES" | cat - utils/mbgl-config/mbgl-config.template.sh \
|
||||
> $PREFIX/bin/mbgl-config
|
||||
|
||||
chmod 755 $PREFIX/bin/mbgl-config
|
||||
61
utils/mbgl-config/mbgl-config.template.sh
Normal file
61
utils/mbgl-config/mbgl-config.template.sh
Normal file
@@ -0,0 +1,61 @@
|
||||
## program below
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage:
|
||||
mbgl-config [OPTION...]
|
||||
|
||||
Help Options:
|
||||
-h, --help Show help options
|
||||
|
||||
Application Options:
|
||||
--prefix output prefix where mbgl is installed
|
||||
--libs output -L flags
|
||||
--includedir output include directory path
|
||||
EOF
|
||||
|
||||
exit $1
|
||||
}
|
||||
|
||||
echoerr() { echo "$@" 1>&2; }
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
|
||||
--help)
|
||||
usage 0
|
||||
;;
|
||||
|
||||
-h)
|
||||
usage 0
|
||||
;;
|
||||
|
||||
--prefix)
|
||||
echo ${CONFIG_MBGL_PREFIX}
|
||||
;;
|
||||
|
||||
--libs)
|
||||
echo -L${CONFIG_MBGL_PREFIX}/lib -lmbgl -lmbgl-${CONFIG_MBGL_PLATFORM} -lmbgl-headless ${CONFIG_MBGL_LDFLAGS}
|
||||
;;
|
||||
|
||||
--includedir)
|
||||
echo ${CONFIG_MBGL_PREFIX}/include
|
||||
;;
|
||||
|
||||
*)
|
||||
# push to stderr any invalid options
|
||||
echo "unknown option $1" 1>&2;
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user