Skip to content

Commit

Permalink
Bump NDK version to 27.0.12077973, replace ALooper_pollAll with `AL…
Browse files Browse the repository at this point in the history
…ooper_pollOnce` (#2663)
  • Loading branch information
louwers authored Aug 1, 2024
1 parent c9764a0 commit 88993b9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,13 @@ if (MLN_WITH_CLANG_TIDY)
set_target_properties(mbgl-core PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
endif()

set_source_files_properties(
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/utf.cpp
PROPERTIES
COMPILE_FLAGS
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wno-deprecated-declarations>
)

source_group(TREE ${PROJECT_SOURCE_DIR}/include FILES ${INCLUDE_FILES})
source_group(TREE ${PROJECT_SOURCE_DIR}/src FILES ${SRC_FILES})

Expand Down Expand Up @@ -1452,4 +1459,4 @@ endif()

add_subdirectory(${PROJECT_SOURCE_DIR}/test)
add_subdirectory(${PROJECT_SOURCE_DIR}/benchmark)
add_subdirectory(${PROJECT_SOURCE_DIR}/render-test)
add_subdirectory(${PROJECT_SOURCE_DIR}/render-test)
2 changes: 1 addition & 1 deletion platform/android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {
androidSdkVersions = [
ndkVersion : '25.1.8937393',
ndkVersion : '27.0.12077973',
cmakeVersion : '3.18.1+',
]
}
16 changes: 8 additions & 8 deletions platform/android/src/example_custom_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ void checkLinkStatus(GLuint program) {
if (isLinked == GL_FALSE) {
GLint maxLength = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);
GLchar infoLog[maxLength];
glGetProgramInfoLog(program, maxLength, &maxLength, &infoLog[0]);
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, &infoLog[0]);
throw Error(infoLog);
std::vector<GLchar> infoLog(maxLength);
glGetProgramInfoLog(program, maxLength, &maxLength, infoLog.data());
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, infoLog.data());
throw Error(std::string(infoLog.begin(), infoLog.end()));
}
}

Expand All @@ -107,10 +107,10 @@ void checkCompileStatus(GLuint shader) {
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);

// The maxLength includes the NULL character
GLchar errorLog[maxLength];
glGetShaderInfoLog(shader, maxLength, &maxLength, &errorLog[0]);
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, &errorLog[0]);
throw Error(errorLog);
std::vector<GLchar> errorLog(maxLength);
glGetShaderInfoLog(shader, maxLength, &maxLength, errorLog.data());
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, errorLog.data());
throw Error(std::string(errorLog.begin(), errorLog.end()));
}
}

Expand Down
5 changes: 4 additions & 1 deletion platform/android/src/run_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ void RunLoop::run() {
while (impl->running) {
process();
auto timeout = impl->processRunnables().count();
ALooper_pollAll(timeout, &outFd, &outEvents, reinterpret_cast<void**>(&outData));
auto result = ALooper_pollOnce(timeout, &outFd, &outEvents, reinterpret_cast<void**>(&outData));
if (result == ALOOPER_POLL_ERROR) {
throw std::runtime_error("ALooper_pollOnce returned an error");
}
}
}

Expand Down
13 changes: 12 additions & 1 deletion platform/default/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ cc_library(
],
)

cc_library(
name = "utf_conversion",
srcs = ["src/mbgl/util/utf.cpp"],
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
"-Wno-deprecated-declarations",
],
deps = [
"//:mbgl-core",
],
)

# From: platform/ios/core-files.json
# Mostly platform/default
cc_library(
Expand Down Expand Up @@ -53,7 +64,6 @@ cc_library(
"src/mbgl/util/monotonic_timer.cpp",
"src/mbgl/util/png_writer.cpp",
"src/mbgl/util/thread_local.cpp",
"src/mbgl/util/utf.cpp",
] + select({
"//:metal_renderer": ["src/mbgl/mtl/headless_backend.cpp"],
"//conditions:default": ["src/mbgl/gl/headless_backend.cpp"],
Expand Down Expand Up @@ -125,6 +135,7 @@ cc_library(
"//test:__pkg__",
],
deps = [
":utf_conversion",
"//:mbgl-core",
] + select({
"@platforms//os:ios": [
Expand Down
5 changes: 0 additions & 5 deletions platform/default/src/mbgl/util/utf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
namespace mbgl {
namespace util {

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

std::u16string convertUTF8ToUTF16(const std::string& str) {
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> conv;

Expand All @@ -21,7 +18,5 @@ std::string convertUTF16ToUTF8(const std::u16string& str) {
return conv.to_bytes(str);
}

#pragma GCC diagnostic pop

} // namespace util
} // namespace mbgl

0 comments on commit 88993b9

Please sign in to comment.