Skip to content

[wasm][build] Disable networking targets from CMake build #4867

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)

option(BUILD_SHARED_LIBS "build shared libraries" ON)
option(HAS_LIBDISPATCH_API "has libdispatch API" ON)
option(BUILD_NETWORKING "build FoundationNetworking module" ON)
option(FOUNDATION_ENABLE_FOUNDATION_NETWORKING "build FoundationNetworking module" ON)
option(FOUNDATION_BUILD_TOOLS "build tools" ON)
option(NS_CURL_ASSUME_FEATURES_MISSING "Assume that optional libcurl features are missing rather than test the library's version, for build debugging" NO)

Expand Down Expand Up @@ -103,7 +103,7 @@ if(NOT BUILD_SHARED_LIBS)
install(TARGETS CoreFoundation CFXMLInterface
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)

if(BUILD_NETWORKING)
if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING)
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS
CFURLSessionInterface)
install(TARGETS CFURLSessionInterface
Expand Down
25 changes: 17 additions & 8 deletions CoreFoundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ endif()

if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
find_package(LibXml2 REQUIRED)
find_package(CURL CONFIG)
if(CURL_FOUND)
set(CURL_VERSION_STRING ${CURL_VERSION})
else()
find_package(CURL REQUIRED)

if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING)
find_package(CURL CONFIG)
if(CURL_FOUND)
set(CURL_VERSION_STRING ${CURL_VERSION})
else()
find_package(CURL REQUIRED)
endif()
endif()
endif()

Expand Down Expand Up @@ -438,7 +441,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
PRIVATE
CURL_STATICLIB)
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin AND FOUNDATION_ENABLE_FOUNDATION_NETWORKING)
target_link_libraries(CFURLSessionInterface PRIVATE
CURL::libcurl)
endif()
Expand Down Expand Up @@ -540,10 +543,16 @@ endif()

install(TARGETS
CoreFoundation
CFURLSessionInterface
CFXMLInterface
DESTINATION
"${CMAKE_INSTALL_FULL_LIBDIR}")
"${CMAKE_INSTALL_FULL_LIBDIR}/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")

if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING)
install(TARGETS
CFURLSessionInterface
DESTINATION
"${CMAKE_INSTALL_FULL_LIBDIR}/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that this might negatively impact Windows. Can you please test Windows as well?

endif()

# Needed to avoid double slash "//" when CMAKE_INSTALL_PREFIX set to "/" and DESTDIR used to relocate whole installation.
# Double slash raise CMake error "file called with network path DESTINATION //System/Library/Frameworks".
Expand Down
4 changes: 3 additions & 1 deletion Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
add_subdirectory(UUID)
add_subdirectory(Foundation)
add_subdirectory(FoundationNetworking)
if(FOUNDATION_ENABLE_FOUNDATION_NETWORKING)
add_subdirectory(FoundationNetworking)
endif()
add_subdirectory(FoundationXML)
if(FOUNDATION_BUILD_TOOLS)
add_subdirectory(Tools)
Expand Down