-
Notifications
You must be signed in to change notification settings - Fork 1.2k
FoundationNetworking: Split networking into its own module #2289
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
Changes from all commits
57c012c
b3a3d01
d697422
f9d93ec
db36644
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,6 +316,21 @@ add_framework(CoreFoundation | |
URL.subproj/CFURLComponents.c | ||
URL.subproj/CFURLComponents_URIParser.c | ||
URL.subproj/CFURLSessionInterface.c) | ||
|
||
add_framework(CFURLSessionInterface | ||
${FRAMEWORK_LIBRARY_TYPE} | ||
FRAMEWORK_DIRECTORY | ||
CoreFoundation_FRAMEWORK_DIRECTORY | ||
MODULE_MAP | ||
URL.subproj/module.modulemap | ||
PRIVATE_HEADERS | ||
URL.subproj/CFURLSessionInterface.h | ||
PUBLIC_HEADERS | ||
URL.subproj/CFURLSessionInterface.h | ||
SOURCES | ||
URL.subproj/CFURLSessionInterface.c) | ||
add_dependencies(CFURLSessionInterface CoreFoundation) | ||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL Windows) | ||
add_library(CoreFoundationResources OBJECT | ||
CoreFoundation.rc) | ||
|
@@ -337,38 +352,63 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android) | |
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-D_GNU_SOURCE) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-D_GNU_SOURCE) | ||
if(HAVE_SCHED_GETAFFINITY) | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-DHAVE_SCHED_GETAFFINITY) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-DHAVE_SCHED_GETAFFINITY) | ||
endif() | ||
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows) | ||
# NOTE(compnerd) we only support building with the dynamic CRT as using the | ||
# static CRT causes problems for users of the library. | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-D_DLL) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-D_DLL) | ||
if(BUILD_SHARED_LIBS) | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-D_WINDLL) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-D_WINDLL) | ||
endif() | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-DCURL_STATICLIB) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-DCURL_STATICLIB) | ||
endif() | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-DU_SHOW_DRAFT_API | ||
-DCF_BUILDING_CF) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-DU_SHOW_DRAFT_API | ||
-DCF_BUILDING_CF) | ||
if(CF_DEPLOYMENT_SWIFT) | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-DDEPLOYMENT_RUNTIME_SWIFT) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-DDEPLOYMENT_RUNTIME_SWIFT) | ||
else() | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
-DDEPLOYMENT_RUNTIME_C) | ||
target_compile_definitions(CFURLSessionInterface | ||
PRIVATE | ||
-DDEPLOYMENT_RUNTIME_C) | ||
endif() | ||
target_compile_definitions(CoreFoundation | ||
PRIVATE | ||
|
@@ -386,7 +426,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) | |
PRIVATE | ||
${LIBXML2_INCLUDE_DIR}) | ||
find_package(CURL REQUIRED) | ||
target_include_directories(CoreFoundation | ||
target_include_directories(CFURLSessionInterface | ||
PRIVATE | ||
${CURL_INCLUDE_DIRS}) | ||
find_package(ICU COMPONENTS uc i18n REQUIRED) | ||
|
@@ -398,27 +438,44 @@ target_include_directories(CoreFoundation | |
PRIVATE | ||
${CF_PATH_TO_LIBDISPATCH_SOURCE} | ||
${CF_PATH_TO_LIBDISPATCH_BUILD}/tests) | ||
target_include_directories(CFURLSessionInterface | ||
PRIVATE | ||
${CF_PATH_TO_LIBDISPATCH_SOURCE} | ||
${CF_PATH_TO_LIBDISPATCH_BUILD}/tests) | ||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
target_include_directories(CoreFoundation | ||
SYSTEM PRIVATE | ||
${CF_PATH_TO_LIBDISPATCH_SOURCE}/src/BlocksRuntime) | ||
target_include_directories(CFURLSessionInterface | ||
SYSTEM PRIVATE | ||
${CF_PATH_TO_LIBDISPATCH_SOURCE}/src/BlocksRuntime) | ||
endif() | ||
|
||
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC") | ||
target_compile_options(CoreFoundation | ||
PRIVATE | ||
$<$<COMPILE_LANGUAGE:C>:/FI${PROJECT_SOURCE_DIR}/Base.subproj/CoreFoundation_Prefix.h>) | ||
target_compile_options(CFURLSessionInterface | ||
PRIVATE | ||
$<$<COMPILE_LANGUAGE:C>:/FI${PROJECT_SOURCE_DIR}/Base.subproj/CoreFoundation_Prefix.h>) | ||
else() | ||
target_compile_options(CoreFoundation | ||
PRIVATE | ||
$<$<COMPILE_LANGUAGE:C>:-include;${PROJECT_SOURCE_DIR}/Base.subproj/CoreFoundation_Prefix.h>) | ||
target_compile_options(CFURLSessionInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
PRIVATE | ||
$<$<COMPILE_LANGUAGE:C>:-include;${PROJECT_SOURCE_DIR}/Base.subproj/CoreFoundation_Prefix.h>) | ||
endif() | ||
|
||
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC") | ||
target_compile_options(CoreFoundation | ||
PRIVATE | ||
-fblocks | ||
/EHsc) | ||
target_compile_options(CFURLSessionInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like these two should be a baseline for all CF code, and will keep them as-is. |
||
PRIVATE | ||
-fblocks | ||
/EHsc) | ||
else() | ||
target_compile_options(CoreFoundation | ||
PRIVATE | ||
|
@@ -427,16 +484,29 @@ else() | |
-fdollars-in-identifiers | ||
-fexceptions | ||
-fno-common) | ||
target_compile_options(CFURLSessionInterface | ||
PRIVATE | ||
-fblocks | ||
-fconstant-cfstrings | ||
-fdollars-in-identifiers | ||
-fexceptions | ||
-fno-common) | ||
endif() | ||
if(CF_DEPLOYMENT_SWIFT) | ||
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC") | ||
target_compile_options(CoreFoundation | ||
PRIVATE | ||
/clang:-fcf-runtime-abi=swift) | ||
target_compile_options(CFURLSessionInterface | ||
PRIVATE | ||
/clang:-fcf-runtime-abi=swift) | ||
else() | ||
target_compile_options(CoreFoundation | ||
PRIVATE | ||
-fcf-runtime-abi=swift) | ||
target_compile_options(CFURLSessionInterface | ||
PRIVATE | ||
-fcf-runtime-abi=swift) | ||
endif() | ||
endif() | ||
|
||
|
@@ -450,12 +520,24 @@ target_compile_options(CoreFoundation | |
-Wno-int-conversion | ||
-Wno-unused-function | ||
-Wno-microsoft-enum-forward-reference) | ||
target_compile_options(CFURLSessionInterface | ||
PRIVATE | ||
-Wno-shorten-64-to-32 | ||
-Wno-deprecated-declarations | ||
-Wno-unreachable-code | ||
-Wno-conditional-uninitialized | ||
-Wno-unused-variable | ||
-Wno-int-conversion | ||
-Wno-unused-function | ||
-Wno-microsoft-enum-forward-reference) | ||
|
||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
target_link_libraries(CoreFoundation | ||
PRIVATE | ||
${CURL_LIBRARIES} | ||
${LIBXML2_LIBRARIES}) | ||
target_link_libraries(CFURLSessionInterface | ||
PRIVATE | ||
${CURL_LIBRARIES}) | ||
endif() | ||
if(CMAKE_SYSTEM_NAME STREQUAL Android) | ||
target_link_libraries(CoreFoundation | ||
|
@@ -473,26 +555,42 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows) | |
Secur32 | ||
User32 | ||
mincore) | ||
target_link_libraries(CFURLSessionInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that you probably don't need to link against most of these libraries. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't test Windows builds at the moment; is it okay if I leave them in and you can remove them later? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds fine to me - unlike Unix, the semantics on Windows are that they will be dropped if unused anyways. |
||
PRIVATE | ||
AdvAPI32 | ||
Secur32 | ||
User32 | ||
mincore) | ||
endif() | ||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
target_link_libraries(CoreFoundation | ||
PRIVATE | ||
m) | ||
target_link_libraries(CFURLSessionInterface | ||
PRIVATE | ||
m) | ||
endif() | ||
target_link_libraries(CoreFoundation | ||
PRIVATE | ||
dispatch) | ||
target_link_libraries(CFURLSessionInterface | ||
PRIVATE | ||
dispatch) | ||
if(CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
target_link_libraries(CoreFoundation | ||
PRIVATE | ||
icucore) | ||
target_link_libraries(CFURLSessionInterface | ||
PRIVATE | ||
icucore) | ||
set_target_properties(CoreFoundation | ||
PROPERTIES LINK_FLAGS | ||
-Xlinker;-alias_list;-Xlinker;Base.subproj/DarwinSymbolAliases;-twolevel_namespace;-sectcreate;__UNICODE;__csbitmaps;CharacterSets/CFCharacterSetBitmaps.bitmap;-sectcreate;__UNICODE;__properties;CharacterSets/CFUniCharPropertyDatabase.data;-sectcreate;__UNICODE;__data;CharacterSets/CFUnicodeData-L.mapping;-segprot;__UNICODE;r;r) | ||
endif() | ||
|
||
install(TARGETS | ||
CoreFoundation | ||
CFURLSessionInterface | ||
DESTINATION | ||
"${CMAKE_INSTALL_FULL_LIBDIR}") | ||
install(DIRECTORY | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does CFURLSessionInterface use the CoreFoundation prefix header? (which seems like a PCH attempt)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keeping this, in case.