Quoting Setting Up Mixed-Language Swift and C++ Projects from swift.org:
The
-emit-clang-header-path
Swift frontend flag can be used to emit a generated header when exposing Swift APIs to C++ when building Swift code in a build system that doesn’t provide automatic support for generating a header file with exposed APIs.The following Swift compiler invocation emits a generated header file for the
SwiftModule
module that consists of two source files,a.swift
andb.swift
:swiftc -frontend -typecheck \ /sources/a.swift /sources/b.swift -module-name SwiftModule \ -cxx-interoperability-mode=default \ -emit-clang-header-path SwiftModule-Swift.h
I haven’t tried this.