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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14456] Provide a way to exclude specific headers under include from the module map #4440

Open
abertelrud opened this issue Apr 7, 2021 · 3 comments
Assignees

Comments

@abertelrud
Copy link
Contributor

Previous ID SR-14456
Radar rdar://problem/76455246
Original Reporter @abertelrud
Type Improvement
Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels Improvement
Assignee @abertelrud
Priority Medium

md5: 2843d28fab96433cad396861be17a332

Issue Description:

SwiftPM allows a Clang-based target to provide a "public headers directory" which defaults to a directory named "include" if it exists in the target directory, but which can be customized in the package manifest.

Some cross-platform source bases have "private" directories under the "include" directories. There is currently no way to exclude such headers from the module map, so any errors in such headers affect the ability to build the module map, and any private headers are vended to clients.

The reason that the fix for this isn't always as simple as just moving the headers is that a relatively common pattern of including C source bases in packages that wrap them with Swift APIs is to use Git submodules to bring in unmodified repositories as target source directories.

So there should be some way to control what gets included from the target's public-headers directory.

There is an `exclude` parameter that could in theory be used, but it doesn't currently apply to the generated module map. That would be one avenue to address this.

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
@HFabi
Copy link

HFabi commented Oct 19, 2022

Currently, I am facing the same issue. I am trying to wrap a git submodule (to reduce further maintenance when the original c library changes), but I am forced to delete header files that should not be included in swift (e.g. tests). Has anyone found a suitable workaround yet?

@SpectralDragon
Copy link

SpectralDragon commented Mar 10, 2023

Currently I have the same issue when importing https://github.com/KhronosGroup/SPIRV-Cross. I am trying to exclude include directory in Package.swift, but SPM still looks into this folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants