gyp fixes
This commit is contained in:
12
Makefile
12
Makefile
@@ -22,10 +22,22 @@ mbgl: 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
|
||||
|
||||
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
|
||||
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) install
|
||||
|
||||
config: 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-config
|
||||
|
||||
##### Test cases ###############################################################
|
||||
|
||||
build/test/Makefile: src common config.gypi test/test.gyp
|
||||
|
||||
20
configure
vendored
20
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,44 @@ 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
|
||||
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+=" }
|
||||
|
||||
@@ -11,5 +11,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': {
|
||||
@@ -29,28 +28,27 @@
|
||||
'product_name': 'mbgl-ios',
|
||||
'type': 'static_library',
|
||||
'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)' ],
|
||||
},
|
||||
'libraries': [
|
||||
'<@(uv_static_libs)',
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(uv_libraries)',
|
||||
],
|
||||
'OTHER_LDFLAGS': [ '<@(uv_ldflags)' ],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -4,28 +4,36 @@
|
||||
'product_name': 'mbgl-linux',
|
||||
'type': 'static_library',
|
||||
'hard_dependency': 1,
|
||||
'include_dirs': [
|
||||
'../include'
|
||||
],
|
||||
'variables': {
|
||||
'cflags_cc': [
|
||||
'<@(uv_cflags)',
|
||||
'<@(curl_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',
|
||||
],
|
||||
'libraries': [
|
||||
'<@(uv_static_libs)',
|
||||
'<@(curl_static_libs)',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_CPLUSPLUSFLAGS': [
|
||||
'<@(uv_cflags)',
|
||||
'<@(curl_cflags)',
|
||||
],
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
|
||||
}
|
||||
}, {
|
||||
'cflags': [
|
||||
'<@(uv_cflags)',
|
||||
'<@(curl_cflags)',
|
||||
],
|
||||
'ldflags': [ '<@(ldflags)' ],
|
||||
}]
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
@@ -35,20 +43,13 @@
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(uv_libraries)',
|
||||
'<@(curl_libraries)',
|
||||
]
|
||||
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
|
||||
}
|
||||
}, {
|
||||
'libraries': [
|
||||
'<@(uv_libraries)',
|
||||
'<@(curl_libraries)',
|
||||
'-lboost_regex',
|
||||
]
|
||||
'ldflags': [ '<@(ldflags)' ],
|
||||
}]
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
@@ -4,28 +4,27 @@
|
||||
'product_name': 'mbgl-osx',
|
||||
'type': 'static_library',
|
||||
'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)' ],
|
||||
},
|
||||
'libraries': [
|
||||
'<@(uv_static_libs)',
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(uv_libraries)',
|
||||
],
|
||||
'OTHER_LDFLAGS': [ '<@(uv_ldflags)' ],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -7,6 +7,24 @@
|
||||
'dependencies': [
|
||||
'shaders',
|
||||
],
|
||||
'variables': {
|
||||
'cflags_cc': [
|
||||
'<@(png_cflags)',
|
||||
'<@(uv_cflags)',
|
||||
'<@(sqlite3_cflags)',
|
||||
'<@(zlib_cflags)',
|
||||
'-I<(boost_root)/include',
|
||||
],
|
||||
'cflags': [
|
||||
'<@(uv_cflags)',
|
||||
],
|
||||
'ldflags': [
|
||||
'<@(png_ldflags)',
|
||||
'<@(uv_ldflags)',
|
||||
'<@(sqlite3_ldflags)',
|
||||
'<@(zlib_ldflags)',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'<!@(find src -name "*.cpp")',
|
||||
'<!@(test -f "config/constants_local.cpp" && echo "config/constants_local.cpp" || echo "config/constants.cpp")',
|
||||
@@ -18,31 +36,25 @@
|
||||
'bin/style.json'
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include'
|
||||
'../include',
|
||||
],
|
||||
'libraries': [
|
||||
'<@(png_static_libs)',
|
||||
'<@(uv_static_libs)',
|
||||
'<@(sqlite3_static_libs)',
|
||||
'<@(zlib_static_libs)',
|
||||
],
|
||||
'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)',
|
||||
],
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
|
||||
'OTHER_CFLAGS': [ '<@(cflags)' ],
|
||||
# Makefile builds don't respect 'libraries' on OS X.
|
||||
'OTHER_LDFLAGS': [ '>@(_libraries)' ],
|
||||
},
|
||||
}, {
|
||||
'cflags': [
|
||||
'<@(png_cflags)',
|
||||
'<@(uv_cflags)',
|
||||
'<@(sqlite3_cflags)',
|
||||
'<@(zlib_cflags)',
|
||||
'-I<(boost_root)/include',
|
||||
],
|
||||
'cflags_cc': [ '<@(cflags_cc)' ],
|
||||
'cflags': [ '<@(cflags)' ],
|
||||
}]
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
@@ -52,20 +64,10 @@
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(png_libraries)',
|
||||
'<@(uv_libraries)',
|
||||
'<@(sqlite3_libraries)',
|
||||
'<@(zlib_libraries)',
|
||||
]
|
||||
'OTHER_LDFLAGS': [ '<@(ldflags)' ]
|
||||
}
|
||||
}, {
|
||||
'libraries': [
|
||||
'<@(png_libraries)',
|
||||
'<@(uv_libraries)',
|
||||
'<@(sqlite3_libraries)',
|
||||
'<@(zlib_libraries)',
|
||||
]
|
||||
'ldflags': [ '<@(ldflags)' ]
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
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
|
||||
@@ -13,7 +13,9 @@
|
||||
'../platform/default/glfw_view.cpp',
|
||||
'../platform/default/log_stderr.cpp',
|
||||
],
|
||||
|
||||
'libraries': [
|
||||
'<@(glfw3_static_libs)',
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "mac"',
|
||||
|
||||
@@ -24,23 +26,22 @@
|
||||
'<@(glfw3_cflags)',
|
||||
],
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(glfw3_libraries)',
|
||||
'<@(glfw3_ldflags)',
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
# Non-Mac OS X
|
||||
{
|
||||
'cflags': [
|
||||
'cflags_cc': [
|
||||
'<@(glfw3_cflags)',
|
||||
'-I<(boost_root)/include',
|
||||
],
|
||||
'ldflags': [
|
||||
'<@(glfw3_ldflags)',
|
||||
'-L<(boost_root)/lib',
|
||||
'-lboost_regex',
|
||||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'<@(glfw3_libraries)',
|
||||
'-L<(boost_root)/lib',
|
||||
'-lboost_regex',
|
||||
],
|
||||
},
|
||||
}],
|
||||
],
|
||||
'dependencies': [
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
'<@(glfw3_cflags)'
|
||||
],
|
||||
'OTHER_LDFLAGS': [
|
||||
'<@(glfw3_libraries)',
|
||||
'<@(glfw3_ldflags)',
|
||||
'-framework SystemConfiguration',
|
||||
],
|
||||
'SDKROOT': 'macosx',
|
||||
@@ -35,6 +35,9 @@
|
||||
'MACOSX_DEPLOYMENT_TARGET':'10.9',
|
||||
'CLANG_ENABLE_OBJC_ARC': 'YES'
|
||||
},
|
||||
'libraries': [
|
||||
'<@(glfw3_static_libs)',
|
||||
],
|
||||
'dependencies': [
|
||||
'../mapboxgl.gyp:bundle_styles',
|
||||
'../mapboxgl.gyp:mbgl',
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <mbgl/geometry/sprite_atlas.hpp>
|
||||
|
||||
#if defined(DEBUG)
|
||||
#include <mbgl/util/timer.hpp>
|
||||
#include <mbgl/util/stopwatch.hpp>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
@@ -35,7 +35,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);
|
||||
}
|
||||
@@ -111,8 +111,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 +118,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-headless',
|
||||
'<(platform_library)',
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user