Fix Apple platform target link surface

This commit is contained in:
2026-06-17 15:16:01 +02:00
parent 624f1bb99d
commit 0249ecab28
3 changed files with 37 additions and 2 deletions

View File

@@ -277,6 +277,27 @@ target_link_libraries(pp_platform_apple
pp_project_options
PRIVATE
pp_project_warnings)
if(TARGET pp_renderer_gl)
target_link_libraries(pp_platform_apple PUBLIC pp_renderer_gl)
endif()
if(APPLE)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_link_libraries(pp_platform_apple
PUBLIC
"-framework Foundation"
"-framework AVFoundation"
"-framework UIKit"
"-framework GLKit"
"-framework OpenGLES")
else()
target_link_libraries(pp_platform_apple
PUBLIC
"-framework Foundation"
"-framework AVFoundation"
"-framework AppKit"
"-framework OpenGL")
endif()
endif()
add_library(pp_platform_linux STATIC
${PP_PLATFORM_LINUX_SOURCES})

View File

@@ -24,6 +24,15 @@ namespace pp::platform::apple {
namespace {
void log_apple_platform_message(const char* format, ...)
{
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
fputc('\n', stderr);
va_end(args);
}
[[nodiscard]] std::vector<std::string> apple_image_file_types()
{
static constexpr std::array<std::string_view, 5> kFileTypes = {
@@ -300,7 +309,9 @@ void ApplePlatformServices::log_stacktrace()
{
#if defined(__OSX__)
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
LOG("callstack:\n%s", [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
log_apple_platform_message(
"callstack:\n%s",
[callstack cStringUsingEncoding:NSUTF8StringEncoding]);
#endif
}
@@ -378,7 +389,9 @@ void ApplePlatformServices::apply_render_platform_hints()
.enable = pp::legacy::ui_gl::enable_opengl_state,
});
if (!status.ok())
LOG("OpenGL legacy render platform hints failed: %s", status.message);
log_apple_platform_message(
"OpenGL legacy render platform hints failed: %s",
status.message);
#endif
}

View File

@@ -1,3 +1,4 @@
#include "pch.h"
#include "platform_apple/apple_platform_services.h"
#include "platform_legacy/legacy_platform_state.h"