Skip to content

Commit

Permalink
add prefix dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
li-feng-sc committed Jul 31, 2024
1 parent 683c39f commit c271198
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/source/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ object Main {
var swiftxxBaseLibModule: String = "DjinniSupportCxx"
var swiftxxClassIdentStyleOptional: Option[IdentConverter] = None
var swiftxxFileIdentStyleOptional: Option[IdentConverter] = None
var swiftxxIncludeCppPrefix: String = ""
var swiftxxBaseLibIncludePrefix: String = ""
var inFileListPath: Option[File] = None
var outFileListPath: Option[File] = None
var skipGeneration: Boolean = false
Expand Down Expand Up @@ -304,6 +306,10 @@ object Main {
.text("Swift module name (default: \"Module\").")
opt[File]("swiftxx-out").valueName("<out-folder>").foreach(x => swiftxxOutFolder = Some(x))
.text("The output folder for private Swift/C++ interop files (Generator disabled if unspecified).")
opt[String]("swiftxx-include-cpp-prefix").valueName("<prefix>").foreach(swiftxxIncludeCppPrefix = _)
.text("The prefix for #includes of the main header files from Swift C++ files.")
opt[String]("swiftxx-base-lib-include-prefix").valueName("...").foreach(x => swiftxxBaseLibIncludePrefix = x)
.text("The Swift C++ base library's include path, relative to the Swift C++ classes.")
note("")
opt[File]("yaml-out").valueName("<out-folder>").foreach(x => yamlOutFolder = Some(x))
.text("The output folder for YAML files (Generator disabled if unspecified).")
Expand Down Expand Up @@ -519,6 +525,8 @@ object Main {
swiftxxBaseLibModule,
swiftxxClassIdentStyle,
swiftxxFileIdentStyle,
swiftxxIncludeCppPrefix,
swiftxxBaseLibIncludePrefix,
outFileListWriter,
skipGeneration,
yamlOutFolder,
Expand Down
4 changes: 2 additions & 2 deletions src/source/SwiftxxGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class SwiftxxGenerator(spec: Spec) extends Generator(spec) {
class SwiftRefs(name: String) {
var swiftHpp = mutable.TreeSet[String]()
var swiftCpp = mutable.TreeSet[String]()
swiftHpp.add("#include " + q(spec.cppFileIdentStyle(name) + "." + spec.cppHeaderExt))
swiftHpp.add("#include " + q("djinni_support.hpp"))
swiftHpp.add("#include " + q(spec.swiftxxIncludeCppPrefix + spec.cppFileIdentStyle(name) + "." + spec.cppHeaderExt))
swiftHpp.add("#include " + q(spec.swiftxxBaseLibIncludePrefix + "djinni_support.hpp"))
spec.cppNnHeader match {
case Some(nnHdr) => swiftHpp.add("#include " + nnHdr)
case _ =>
Expand Down
2 changes: 2 additions & 0 deletions src/source/generator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ package object generatorTools {
swiftxxBaseLibModule: String,
swiftxxClassIdentStyle: IdentConverter,
swiftxxFileIdentStyle: IdentConverter,
swiftxxIncludeCppPrefix: String,
swiftxxBaseLibIncludePrefix: String,
outFileListWriter: Option[Writer],
skipGeneration: Boolean,
yamlOutFolder: Option[File],
Expand Down

0 comments on commit c271198

Please sign in to comment.