Skip to content

Commit 2ed1111

Browse files
authored
Merge pull request #3040 from apple/revert-3038-maxd/cf-wasi-unavailable
2 parents e10529d + d0b3bc6 commit 2ed1111

File tree

1 file changed

+47
-84
lines changed

1 file changed

+47
-84
lines changed

CoreFoundation/CMakeLists.txt

+47-84
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,17 @@ endif()
2020

2121
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
2222

23-
24-
if(HAS_LIBDISPATCH_API)
25-
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
26-
set(THREADS_PREFER_PTHREAD_FLAG OFF)
27-
find_package(Threads REQUIRED)
28-
endif()
23+
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
24+
set(THREADS_PREFER_PTHREAD_FLAG OFF)
25+
find_package(Threads REQUIRED)
2926

3027
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
3128
find_package(LibXml2 REQUIRED)
32-
33-
if(BUILD_NETWORKING)
34-
find_package(CURL CONFIG)
35-
if(CURL_FOUND)
36-
set(CURL_VERSION_STRING ${CURL_VERSION})
37-
else()
38-
find_package(CURL REQUIRED)
39-
endif()
29+
find_package(CURL CONFIG)
30+
if(CURL_FOUND)
31+
set(CURL_VERSION_STRING ${CURL_VERSION})
32+
else()
33+
find_package(CURL REQUIRED)
4034
endif()
4135
find_package(ICU COMPONENTS uc i18n REQUIRED)
4236
endif()
@@ -121,38 +115,6 @@ else()
121115
set(FRAMEWORK_LIBRARY_TYPE STATIC)
122116
endif()
123117

124-
set(CF_WASI_UNAVAILABLE_SOURCES)
125-
126-
if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI)
127-
list(APPEND CF_WASI_UNAVAILABLE_SOURCES
128-
# PlugIn
129-
PlugIn.subproj/CFBundle_Binary.c
130-
PlugIn.subproj/CFBundle.c
131-
PlugIn.subproj/CFBundle_DebugStrings.c
132-
PlugIn.subproj/CFBundle_Executable.c
133-
PlugIn.subproj/CFBundle_Grok.c
134-
PlugIn.subproj/CFBundle_InfoPlist.c
135-
PlugIn.subproj/CFBundle_Locale.c
136-
PlugIn.subproj/CFBundle_Main.c
137-
PlugIn.subproj/CFBundle_ResourceFork.c
138-
PlugIn.subproj/CFBundle_Resources.c
139-
PlugIn.subproj/CFBundle_SplitFileName.c
140-
PlugIn.subproj/CFBundle_Strings.c
141-
PlugIn.subproj/CFBundle_Tables.c
142-
PlugIn.subproj/CFPlugIn.c
143-
# Preferences
144-
Preferences.subproj/CFApplicationPreferences.c
145-
Preferences.subproj/CFPreferences.c
146-
Preferences.subproj/CFXMLPreferencesDomain.c
147-
# RunLoop
148-
RunLoop.subproj/CFRunLoop.c
149-
RunLoop.subproj/CFSocket.c
150-
# Stream
151-
Stream.subproj/CFConcreteStreams.c
152-
Stream.subproj/CFSocketStream.c
153-
Stream.subproj/CFStream.c)
154-
endif()
155-
156118
add_framework(CoreFoundation
157119
${FRAMEWORK_LIBRARY_TYPE}
158120
FRAMEWORK_DIRECTORY
@@ -240,6 +202,7 @@ add_framework(CoreFoundation
240202
Locale.subproj/CFDateInterval.h
241203
Locale.subproj/CFLocaleInternal.h
242204
PlugIn.subproj/CFBundlePriv.h
205+
Stream.subproj/CFStreamPriv.h
243206
String.subproj/CFCharacterSetPriv.h
244207
String.subproj/CFRegularExpression.h
245208
String.subproj/CFRunArray.h
@@ -294,7 +257,6 @@ add_framework(CoreFoundation
294257
RunLoop.subproj/CFRunLoop.h
295258
RunLoop.subproj/CFSocket.h
296259
# Stream
297-
Stream.subproj/CFStreamPriv.h
298260
Stream.subproj/CFStream.h
299261
# String
300262
String.subproj/CFAttributedString.h
@@ -350,11 +312,36 @@ add_framework(CoreFoundation
350312
Parsing.subproj/CFBinaryPList.c
351313
Parsing.subproj/CFOldStylePList.c
352314
Parsing.subproj/CFPropertyList.c
315+
# PlugIn
316+
PlugIn.subproj/CFBundle_Binary.c
317+
PlugIn.subproj/CFBundle.c
318+
PlugIn.subproj/CFBundle_DebugStrings.c
319+
PlugIn.subproj/CFBundle_Executable.c
320+
PlugIn.subproj/CFBundle_Grok.c
321+
PlugIn.subproj/CFBundle_InfoPlist.c
322+
PlugIn.subproj/CFBundle_Locale.c
323+
PlugIn.subproj/CFBundle_Main.c
324+
PlugIn.subproj/CFBundle_ResourceFork.c
325+
PlugIn.subproj/CFBundle_Resources.c
326+
PlugIn.subproj/CFBundle_SplitFileName.c
327+
PlugIn.subproj/CFBundle_Strings.c
328+
PlugIn.subproj/CFBundle_Tables.c
329+
PlugIn.subproj/CFPlugIn.c
330+
# Preferences
331+
Preferences.subproj/CFApplicationPreferences.c
332+
Preferences.subproj/CFPreferences.c
333+
Preferences.subproj/CFXMLPreferencesDomain.c
353334
# RunLoop
354335
# TODO(compnerd) make this empty on non-Mach targets
355336
# RunLoop.subproj/CFMachPort.c
356337
# RunLoop.subproj/CFMachPort_Lifetime.c
357338
# RunLoop.subproj/CFMessagePort.c
339+
RunLoop.subproj/CFRunLoop.c
340+
RunLoop.subproj/CFSocket.c
341+
# Stream
342+
Stream.subproj/CFConcreteStreams.c
343+
Stream.subproj/CFSocketStream.c
344+
Stream.subproj/CFStream.c
358345
# String
359346
String.subproj/CFAttributedString.c
360347
String.subproj/CFBurstTrie.c
@@ -382,9 +369,7 @@ add_framework(CoreFoundation
382369
URL.subproj/CFURLAccess.c
383370
URL.subproj/CFURL.c
384371
URL.subproj/CFURLComponents.c
385-
URL.subproj/CFURLComponents_URIParser.c
386-
387-
${CF_WASI_UNAVAILABLE_SOURCES})
372+
URL.subproj/CFURLComponents_URIParser.c)
388373
target_compile_definitions(CoreFoundation
389374
PRIVATE
390375
$<$<COMPILE_LANGUAGE:ASM>:CF_CHARACTERSET_BITMAP="CharacterSets/CFCharacterSetBitmaps.bitmap">
@@ -394,27 +379,11 @@ target_compile_definitions(CoreFoundation
394379
target_include_directories(CoreFoundation
395380
PRIVATE
396381
${PROJECT_SOURCE_DIR})
397-
398382
target_link_libraries(CoreFoundation PRIVATE
383+
Threads::Threads
399384
${CMAKE_DL_LIBS}
400-
BlocksRuntime)
401-
402-
if(HAS_LIBDISPATCH_API)
403-
target_link_libraries(CoreFoundation PRIVATE
404-
Threads::Threads
405-
dispatch)
406-
endif()
407-
408-
if(NOT BUILD_SHARED_LIBS)
409-
set_property(TARGET CoreFoundation PROPERTY STATIC_LIBRARY_OPTIONS
410-
$<TARGET_OBJECTS:BlocksRuntime>)
411-
endif()
412-
413-
if(CMAKE_SYSTEM_NAME STREQUAL WASI)
414-
# Enable emulated mman and constant CFSTRINGS
415-
target_compile_definitions(CoreFoundation PRIVATE _WASI_EMULATED_MMAN __CONSTANT_CFSTRINGS__)
416-
endif()
417-
385+
BlocksRuntime
386+
dispatch)
418387
if(CMAKE_SYSTEM_NAME STREQUAL Android)
419388
target_link_libraries(CoreFoundation PRIVATE
420389
log)
@@ -453,7 +422,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
453422
PRIVATE
454423
CURL_STATICLIB)
455424
endif()
456-
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin AND BUILD_NETWORKING)
425+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
457426
target_link_libraries(CFURLSessionInterface PRIVATE
458427
CURL::libcurl)
459428
endif()
@@ -471,8 +440,6 @@ add_framework(CFXMLInterface
471440
SOURCES
472441
Parsing.subproj/CFXMLInterface.c)
473442
add_dependencies(CFXMLInterface CoreFoundation)
474-
target_link_libraries(CFXMLInterface PRIVATE BlocksRuntime)
475-
476443
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
477444
target_link_libraries(CFXMLInterface PRIVATE
478445
LibXml2::LibXml2)
@@ -527,19 +494,15 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Dar
527494
PRIVATE
528495
m)
529496
endif()
530-
531-
if(HAS_LIBDISPATCH_API)
532-
target_link_libraries(CoreFoundation
533-
PRIVATE
534-
dispatch)
535-
target_link_libraries(CFURLSessionInterface
536-
PRIVATE
537-
dispatch)
538-
target_link_libraries(CFXMLInterface
539-
PRIVATE
497+
target_link_libraries(CoreFoundation
498+
PRIVATE
499+
dispatch)
500+
target_link_libraries(CFURLSessionInterface
501+
PRIVATE
502+
dispatch)
503+
target_link_libraries(CFXMLInterface
504+
PRIVATE
540505
dispatch)
541-
endif()
542-
543506
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
544507
target_link_libraries(CoreFoundation
545508
PRIVATE

0 commit comments

Comments
 (0)