AK+Meta: Make AK / ObjC interop MacOS only
This is entirely unused but still could be useful in the AppKit port. Originally this was meant for Swift interop which is why it had support for other platforms, but now it's causing issues on systems like FreeBSD, so lets just gate it behind the only platform it's useful for. We also assume that Objective C blocks and Arc are supported for the AppKit port to build so no need to check for that in CMake.
This commit is contained in:
parent
d58ac35e0b
commit
542f3e5cca
4 changed files with 4 additions and 44 deletions
|
|
@ -263,11 +263,11 @@
|
|||
# define LSAN_IGNORE_OBJECT(base)
|
||||
#endif
|
||||
|
||||
#if __has_feature(blocks)
|
||||
#if __has_feature(blocks) && defined(AK_OS_MACOS)
|
||||
# define AK_HAS_BLOCKS
|
||||
#endif
|
||||
|
||||
#if __has_feature(objc_arc)
|
||||
#if __has_feature(objc_arc) && defined(AK_OS_MACOS)
|
||||
# define AK_HAS_OBJC_ARC
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
# Finds the BlocksRuntime library
|
||||
# On Apple platforms, this does not exist and is folded into other System libraries
|
||||
|
||||
find_library(BLOCKS_RUNTIME NAMES BlocksRuntime)
|
||||
if (BLOCKS_RUNTIME)
|
||||
if (NOT TARGET BlocksRuntime::BlocksRuntime)
|
||||
add_library(BlocksRuntime::BlocksRuntime IMPORTED UNKNOWN)
|
||||
message(STATUS "Found BlocksRuntime: ${BLOCKS_RUNTIME}")
|
||||
cmake_path(GET BLOCKS_RUNTIME PARENT_PATH _BLOCKS_RUNTIME_DIR)
|
||||
set_target_properties(BlocksRuntime::BlocksRuntime PROPERTIES
|
||||
IMPORTED_LOCATION "${BLOCKS_RUNTIME}"
|
||||
INTERFACE_LINK_DIRECTORIES "${_BLOCKS_RUNTIME_DIR}"
|
||||
INTERFACE_COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:C,CXX>:-fblocks>"
|
||||
)
|
||||
endif()
|
||||
set(BlocksRuntime_FOUND TRUE)
|
||||
endif()
|
||||
|
|
@ -52,24 +52,4 @@ if (ENABLE_FUZZERS_LIBFUZZER)
|
|||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "Type of target to use for try_compile()" FORCE)
|
||||
endif()
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(BLOCKS_REQUIRED_LIBRARIES "")
|
||||
if (NOT APPLE)
|
||||
find_package(BlocksRuntime)
|
||||
if (BlocksRuntime_FOUND)
|
||||
set(BLOCKS_REQUIRED_LIBRARIES BlocksRuntime::BlocksRuntime)
|
||||
set(CMAKE_REQUIRED_LIBRARIES BlocksRuntime::BlocksRuntime)
|
||||
endif()
|
||||
endif()
|
||||
check_cxx_source_compiles([=[
|
||||
int main() { __block int x = 0; auto b = ^{++x;}; b(); }
|
||||
]=] CXX_COMPILER_SUPPORTS_BLOCKS)
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "-fobjc-arc")
|
||||
check_cxx_source_compiles([=[
|
||||
int main() { auto b = ^{}; auto __weak w = b; w(); }
|
||||
]=] CXX_COMPILER_SUPPORTS_OBJC_ARC)
|
||||
unset(CMAKE_REQUIRED_FLAGS)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/lagom_install_options.cmake)
|
||||
|
|
|
|||
|
|
@ -103,14 +103,11 @@ if (WIN32)
|
|||
target_link_libraries(TestUFixedBigInt PRIVATE clang_rt.builtins-x86_64.lib)
|
||||
endif()
|
||||
|
||||
if (CXX_COMPILER_SUPPORTS_BLOCKS)
|
||||
if (APPLE)
|
||||
ladybird_test(TestFunctionObjC.mm AK NAME TestFunctionObjC)
|
||||
target_link_libraries(TestFunctionObjC PRIVATE ${BLOCKS_REQUIRED_LIBRARIES})
|
||||
endif()
|
||||
if (CXX_COMPILER_SUPPORTS_OBJC_ARC)
|
||||
|
||||
ladybird_test(TestFunctionObjC.mm AK NAME TestFunctionObjCArc)
|
||||
target_compile_options(TestFunctionObjCArc PRIVATE -fobjc-arc)
|
||||
target_link_libraries(TestFunctionObjCArc PRIVATE ${BLOCKS_REQUIRED_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(TestString PRIVATE LibUnicode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue