diff --git a/Makefile b/Makefile index 2431f7be7..9a6faf985 100644 --- a/Makefile +++ b/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 diff --git a/configure b/configure index ef289ac5d..43a665f29 100755 --- a/configure +++ b/configure @@ -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('(?@(_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)' ] }] ] } diff --git a/include/mbgl/util/stopwatch.hpp b/include/mbgl/util/stopwatch.hpp new file mode 100644 index 000000000..663bbb6fc --- /dev/null +++ b/include/mbgl/util/stopwatch.hpp @@ -0,0 +1,40 @@ +#ifndef MBGL_UTIL_STOPWATCH +#define MBGL_UTIL_STOPWATCH + +#include + +#include + +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 diff --git a/include/mbgl/util/timer.hpp b/include/mbgl/util/timer.hpp deleted file mode 100644 index 8171c2f5d..000000000 --- a/include/mbgl/util/timer.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef MBGL_UTIL_TIMER -#define MBGL_UTIL_TIMER - -#include - -#include - -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 diff --git a/linux/mapboxgl-app.gyp b/linux/mapboxgl-app.gyp index ee38b4b26..92175d1c0 100644 --- a/linux/mapboxgl-app.gyp +++ b/linux/mapboxgl-app.gyp @@ -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': [ diff --git a/macosx/mapboxgl-app.gyp b/macosx/mapboxgl-app.gyp index fe8d9f7ae..b6881c1a5 100644 --- a/macosx/mapboxgl-app.gyp +++ b/macosx/mapboxgl-app.gyp @@ -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', diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index 38c2176ae..228783b3c 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -11,7 +11,7 @@ #include #if defined(DEBUG) -#include +#include #endif #include @@ -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(); diff --git a/src/shader/shader.cpp b/src/shader/shader.cpp index d9f63cae1..84cb55eac 100644 --- a/src/shader/shader.cpp +++ b/src/shader/shader.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -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)) { diff --git a/src/util/timer.cpp b/src/util/stopwatch.cpp similarity index 60% rename from src/util/timer.cpp rename to src/util/stopwatch.cpp index 5c4af51da..c9b8756e3 100644 --- a/src/util/timer.cpp +++ b/src/util/stopwatch.cpp @@ -1,5 +1,5 @@ -#ifndef DISABLE_TIMER -#include +#ifndef DISABLE_STOPWATCH +#include #include #include @@ -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); } diff --git a/test/test.gyp b/test/test.gyp index daf74b3e9..a01d1b32b 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -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)', ], },