LibCore+Meta: Un-break Swift build on Linux

LibCore's list of ignored header files for Swift was missing the Apple
only files on non-Apple platforms. Additionally, any generic glue code
cannot use -fobjc-arc, so we need to rely on -fblocks only.
This commit is contained in:
Andrew Kaster 2025-03-17 17:46:42 -06:00 committed by Andrew Kaster
parent 01ac48b36f
commit 89ecc75ed8
3 changed files with 13 additions and 8 deletions

View File

@ -122,12 +122,20 @@ if (ENABLE_SWIFT)
else()
list(APPEND SWIFT_EXCLUDE_HEADERS "EventLoopImplementationWindows.h")
endif()
if (NOT APPLE)
list(APPEND SWIFT_EXCLUDE_HEADERS
IOSurface.h
MachPort.h
MachMessageTypes.h
ProcessStatisticsMach.h
)
endif()
generate_clang_module_map(LibCore EXCLUDE_FILES ${SWIFT_EXCLUDE_HEADERS})
target_sources(LibCore PRIVATE
EventSwift.mm
EventLoopExecutor.swift)
set_source_files_properties(EventSwift.mm PRIVATE PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(EventSwift.mm PRIVATE PROPERTIES COMPILE_FLAGS -fblocks)
target_link_libraries(LibCore PRIVATE AK)
add_swift_target_properties(LibCore LAGOM_LIBRARIES AK)
endif()

View File

@ -7,16 +7,10 @@
#include <LibCore/EventLoop.h>
#include <LibCore/EventSwift.h>
#if !__has_feature(objc_arc)
# error "This file requires ARC"
#endif
namespace Core {
void deferred_invoke_block(EventLoop& event_loop, void (^invokee)(void))
{
event_loop.deferred_invoke([invokee = move(invokee)] {
invokee();
});
event_loop.deferred_invoke(invokee);
}
}

View File

@ -104,6 +104,9 @@ function(_setup_swift_paths)
NO_DEFAULT_PATH)
add_link_options("$<$<LINK_LANGUAGE:Swift>:${SWIFT_SWIFTRT_FILE}>")
endif()
# FIXME: Re-enable SIL verification after https://github.com/swiftlang/swift/issues/80065 is fixed
add_compile_options("SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -sil-verify-none>")
endfunction()
_setup_swift_paths()