From 65acf35dcfa3784de7e522926469083068599550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 29 Feb 2016 18:23:24 +0100 Subject: [PATCH] [core] fix various compilation issues --- gyp/platform-linux.gypi | 1 + platform/default/http_request_curl.cpp | 4 ++-- platform/default/png_reader.cpp | 4 ++-- scripts/main.mk | 6 +++--- src/mbgl/util/thread.hpp | 10 +++++++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gyp/platform-linux.gypi b/gyp/platform-linux.gypi index 172e7349f..3d2c04299 100644 --- a/gyp/platform-linux.gypi +++ b/gyp/platform-linux.gypi @@ -32,6 +32,7 @@ 'variables': { 'cflags_cc': [ + '<@(opengl_cflags)', '<@(libpng_cflags)', '<@(libjpeg-turbo_cflags)', '<@(nunicode_cflags)', diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp index 58c574fee..fc57e4c13 100644 --- a/platform/default/http_request_curl.cpp +++ b/platform/default/http_request_curl.cpp @@ -525,11 +525,11 @@ void HTTPCURLRequest::handleResult(CURLcode code) { } else if (responseCode >= 500 && responseCode < 600) { response->error = std::make_unique(Error::Reason::Server, std::string{ "HTTP status code " } + - std::to_string(responseCode)); + util::toString(responseCode)); } else { response->error = std::make_unique(Error::Reason::Other, std::string{ "HTTP status code " } + - std::to_string(responseCode)); + util::toString(responseCode)); } } diff --git a/platform/default/png_reader.cpp b/platform/default/png_reader.cpp index 2b9bbbeb4..096596ee2 100644 --- a/platform/default/png_reader.cpp +++ b/platform/default/png_reader.cpp @@ -83,8 +83,8 @@ PremultipliedImage decodePNG(const uint8_t* data, size_t size) { png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); - unsigned width = 0; - unsigned height = 0; + png_uint_32 width = 0; + png_uint_32 height = 0; int bit_depth = 0; int color_type = 0; png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); diff --git a/scripts/main.mk b/scripts/main.mk index 889222719..d10fa39d5 100644 --- a/scripts/main.mk +++ b/scripts/main.mk @@ -147,20 +147,20 @@ Xcode/%: Xcode/__project__ Ninja/%: Ninja/__project__ @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/ninja/ninja-$(HOST) -C build/$(HOST_SLUG)/$(BUILDTYPE) $* + $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) $* Ninja/compdb: OUTPUT=build/$(HOST_SLUG)/$(BUILDTYPE)/compile_commands.json Ninja/compdb: Ninja/__project__ @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Writing to $(OUTPUT)$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/ninja/ninja-$(HOST) -C build/$(HOST_SLUG)/$(BUILDTYPE) \ + $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) \ -t compdb cc cc_s cxx objc objcxx > $(OUTPUT) #### Tidy ###################################################################### tidy: Ninja/compdb @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Generating header files...$(FORMAT_END)\n" - $(QUIET)$(ENV) deps/ninja/ninja-$(HOST) -C build/$(HOST_SLUG)/$(BUILDTYPE) version shaders + $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) version shaders @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Running tidy...$(FORMAT_END)\n" @./scripts/clang-tidy.sh diff --git a/src/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp index 33ca5aba6..dc388c922 100644 --- a/src/mbgl/util/thread.hpp +++ b/src/mbgl/util/thread.hpp @@ -11,6 +11,8 @@ #include #include +#include + namespace mbgl { namespace util { @@ -93,11 +95,13 @@ Thread::Thread(const ThreadContext& context, Args&&... args) { std::tuple params = std::forward_as_tuple(::std::forward(args)...); thread = std::thread([&] { - #if defined( __APPLE__) +#if defined(__APPLE__) pthread_setname_np(context.name.c_str()); - #elif defined(__linux__) +#elif defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 12) pthread_setname_np(pthread_self(), context.name.c_str()); - #endif +#endif +#endif if (context.priority == ThreadPriority::Low) { platform::makeThreadLowPriority();