Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libuv run loop for macOS (CMake) #3059

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/mbgl/util/run_loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RunLoop : public Scheduler, private util::noncopyable {
void updateTime();

/// Platform integration callback for platforms that do not have full
/// run loop integration or don't want to block at the Mapbox GL Native
/// run loop integration or don't want to block at the MapLibre Native
/// loop. It will be called from any thread and is up to the platform
/// to, after receiving the callback, call RunLoop::runOnce() from the
/// same thread as the Map object lives.
Expand Down
34 changes: 13 additions & 21 deletions platform/macos/macos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,19 @@ endif()
set_target_properties(mbgl-core PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH[variant=Debug] "YES")

set_target_properties(mbgl-core PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
find_package(PkgConfig REQUIRED)

if(MLN_WITH_OPENGL)
find_package(OpenGL REQUIRED)
pkg_search_module(LIBUV libuv REQUIRED)

target_compile_definitions(
mbgl-core
PUBLIC GL_SILENCE_DEPRECATION
)
target_sources(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/gl/headless_backend.cpp
${PROJECT_SOURCE_DIR}/platform/darwin/src/gl_functions.cpp ${PROJECT_SOURCE_DIR}/platform/darwin/src/headless_backend_cgl.mm
)
target_link_libraries(
mbgl-core
PRIVATE OpenGL::GL
)
if (NOT LIBUV_FOUND)
message(FATAL_ERROR "libuv not found! Install it via Homebrew: brew install libuv")
endif()

if(MLN_WITH_METAL)
find_package(OpenGL REQUIRED)
if(MLN_WITH_OPENGL)
message(FATAL_ERROR "OpenGL ES it not supported for macOS")
endif()

if(MLN_WITH_METAL)
target_sources(
mbgl-core
PRIVATE
Expand Down Expand Up @@ -63,7 +53,7 @@ endif()
target_sources(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/platform/darwin/src/async_task.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/async_task.cpp
${PROJECT_SOURCE_DIR}/platform/darwin/src/collator.mm
${PROJECT_SOURCE_DIR}/platform/darwin/src/http_file_source.mm
${PROJECT_SOURCE_DIR}/platform/darwin/src/image.mm
Expand All @@ -72,9 +62,9 @@ target_sources(
${PROJECT_SOURCE_DIR}/platform/darwin/src/native_apple_interface.m
${PROJECT_SOURCE_DIR}/platform/darwin/src/nsthread.mm
${PROJECT_SOURCE_DIR}/platform/darwin/src/number_format.mm
${PROJECT_SOURCE_DIR}/platform/darwin/src/run_loop.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/run_loop.cpp
${PROJECT_SOURCE_DIR}/platform/darwin/src/string_nsstring.mm
${PROJECT_SOURCE_DIR}/platform/darwin/src/timer.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/timer.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/gfx/headless_backend.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/gfx/headless_frontend.cpp
${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/layermanager/layer_manager.cpp
Expand Down Expand Up @@ -114,6 +104,7 @@ target_include_directories(
mbgl-core
PRIVATE
${PROJECT_SOURCE_DIR}/platform/darwin/include ${PROJECT_SOURCE_DIR}/platform/darwin/src ${PROJECT_SOURCE_DIR}/platform/macos/src
${LIBUV_INCLUDE_DIRS}
)

include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
Expand All @@ -128,6 +119,7 @@ target_link_libraries(
mbgl-vendor-icu
sqlite3
z
${LIBUV_LINK_LIBRARIES}
)

add_subdirectory(${PROJECT_SOURCE_DIR}/bin)
Expand Down
Loading