Skip to content

Commit b27f6f3

Browse files
committed
Add modulemap for static compilation
When compiling statically, we have to link against DispatchStubs in addition to the other dependencies, so we are defining a separate modulemap for that.
1 parent feb4421 commit b27f6f3

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

dispatch/CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ install(FILES
1616
DESTINATION
1717
"${INSTALL_DISPATCH_HEADERS_DIR}")
1818
if(ENABLE_SWIFT)
19-
get_filename_component(MODULE_MAP module.modulemap REALPATH)
19+
set(base_dir "${CMAKE_CURRENT_SOURCE_DIR}")
20+
if(NOT BUILD_SHARED_LIBS)
21+
set(base_dir "${CMAKE_CURRENT_SOURCE_DIR}/generic_static")
22+
endif()
23+
24+
get_filename_component(
25+
MODULE_MAP
26+
module.modulemap
27+
REALPATH
28+
BASE_DIR "${base_dir}")
29+
2030
install(FILES
2131
${MODULE_MAP}
2232
DESTINATION
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module Dispatch {
2+
requires blocks
3+
export *
4+
link "dispatch"
5+
link "BlocksRuntime"
6+
link "DispatchStubs"
7+
}
8+
9+
module DispatchIntrospection [system] [extern_c] {
10+
header "introspection.h"
11+
export *
12+
}
13+
14+
module CDispatch [system] [extern_c] {
15+
umbrella header "dispatch.h"
16+
export *
17+
requires blocks
18+
link "dispatch"
19+
}

0 commit comments

Comments
 (0)