Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WASM] Add WASI specific modulemap for linked libraries #159

Merged
merged 2 commits into from Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 18 additions & 4 deletions CMakeLists.txt
Expand Up @@ -88,16 +88,30 @@ if(NOT BUILD_SHARED_LIBS)
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
endif()
endif()

set(swift_lib_dir "lib/swift")
if(NOT BUILD_SHARED_LIBS)
set(swift_lib_dir "lib/swift_static")
endif()

# TODO(compnerd) install as a Framework as that is how swift actually is built
install(DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/CoreFoundation.framework/Headers/
DESTINATION
lib/swift/CoreFoundation
FILES_MATCHING PATTERN "*.h")
install(FILES
CoreFoundation/Base.subproj/module.map
DESTINATION
lib/swift/CoreFoundation)
if(CMAKE_SYSTEM_NAME STREQUAL WASI)
install(FILES
CoreFoundation/Base.subproj/$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:static/>wasm32-unknown-wasi.modulemap
DESTINATION
${swift_lib_dir}/CoreFoundation
Copy link
Member

Choose a reason for hiding this comment

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

Please keep to use lib/swift dir because we already have some build script that assumes it is located under lib/swift.

RENAME module.map)
else()
install(FILES
CoreFoundation/Base.subproj/$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:static/>module.map
DESTINATION
${swift_lib_dir}/CoreFoundation)
endif()
install(DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/CFURLSessionInterface.framework/Headers/
DESTINATION
Expand Down
10 changes: 10 additions & 0 deletions CoreFoundation/Base.subproj/static/wasm32-unknown-wasi.modulemap
@@ -0,0 +1,10 @@
module CoreFoundation [extern_c] [system] {
umbrella header "CoreFoundation.h"
explicit module CFPlugInCOM { header "CFPlugInCOM.h" }

link "CoreFoundation"
link "uuid"

link "BlocksRuntime"
link "icui18n"
}