File tree Expand file tree Collapse file tree 5 files changed +31
-7
lines changed Expand file tree Collapse file tree 5 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,21 @@ if(NOT SwiftFoundation_MODULE_TRIPLE)
9292 mark_as_advanced (SwiftFoundation_MODULE_TRIPLE)
9393endif ()
9494
95- # System dependencies (fail fast if dependencies are missing)
95+ # System dependencies
96+ find_package (dispatch CONFIG)
97+ if (NOT dispatch_FOUND)
98+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" )
99+ set (DISPATCH_INCLUDE_PATH "/usr/lib/swift" CACHE STRING "A path to where you can find libdispatch headers" )
100+ message ("-- dispatch_DIR not found, using dispatch from SDK at ${DISPATCH_INCLUDE_PATH} " )
101+ list (APPEND _Foundation_common_build_flags
102+ "-I${DISPATCH_INCLUDE_PATH} "
103+ "-I${DISPATCH_INCLUDE_PATH} /Block" )
104+ else ()
105+ message (FATAL_ERROR "-- dispatch_DIR is required on this platform" )
106+ endif ()
107+ endif ()
96108find_package (LibXml2 REQUIRED)
97109find_package (CURL REQUIRED)
98- find_package (dispatch CONFIG REQUIRED)
99110
100111# Common build flags (_CFURLSessionInterface, _CFXMLInterface, CoreFoundation)
101112list (APPEND _Foundation_common_build_flags
@@ -148,8 +159,7 @@ list(APPEND _Foundation_swift_build_flags
148159
149160if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android" )
150161 list (APPEND _Foundation_common_build_flags
151- "-D_GNU_SOURCE"
152- "-I/usr/lib/swift" ) # dispatch
162+ "-D_GNU_SOURCE" )
153163endif ()
154164
155165include (GNUInstallDirs)
Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ target_include_directories(CoreFoundation
105105 PRIVATE
106106 internalInclude)
107107
108+ target_compile_options (CoreFoundation INTERFACE
109+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /include/module.modulemap>" )
110+
108111target_compile_options (CoreFoundation PRIVATE
109112 "SHELL:$<$<COMPILE_LANGUAGE:C>:${_Foundation_common_build_flags} >" )
110113
Original file line number Diff line number Diff line change @@ -166,11 +166,14 @@ endif()
166166
167167set_target_properties (Foundation PROPERTIES
168168 INSTALL_RPATH "$ORIGIN"
169- BUILD_RPATH "$<TARGET_FILE_DIR:swiftDispatch>"
170169 INSTALL_REMOVE_ENVIRONMENT_RPATH ON )
171170
172- target_link_libraries (Foundation PUBLIC
173- swiftDispatch)
171+ if (dispatch_FOUND)
172+ set_target_properties (Foundation PROPERTIES
173+ BUILD_RPATH "$<TARGET_FILE_DIR:swiftDispatch>" )
174+ target_link_libraries (Foundation PUBLIC
175+ swiftDispatch)
176+ endif ()
174177
175178if (LINKER_SUPPORTS_BUILD_ID)
176179 target_link_options (Foundation PRIVATE "LINKER:--build-id=sha1" )
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ target_include_directories(_CFURLSessionInterface
2323
2424target_precompile_headers(_CFURLSessionInterface PRIVATE ${CMAKE_SOURCE_DIR} /Sources /CoreFoundation/internalInclude/CoreFoundation_Prefix.h)
2525
26+ target_compile_options (_CFURLSessionInterface INTERFACE
27+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /../CoreFoundation/include/module.modulemap>"
28+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /include/module.modulemap>" )
29+
2630target_compile_options (_CFURLSessionInterface PRIVATE
2731 "SHELL:$<$<COMPILE_LANGUAGE:C>:${_Foundation_common_build_flags} >" )
2832
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ target_include_directories(_CFXMLInterface
2222 ../CoreFoundation/internalInclude
2323 /usr/include /libxml2/)
2424
25+ target_compile_options (_CFXMLInterface INTERFACE
26+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /../CoreFoundation/include/module.modulemap>"
27+ "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR} /include/module.modulemap>" )
28+
2529target_compile_options (_CFXMLInterface PRIVATE
2630 "SHELL:$<$<COMPILE_LANGUAGE:C>:${_Foundation_common_build_flags} >" )
2731
You can’t perform that action at this time.
0 commit comments