Import C library without git

Is there a way to include the C library in a Swift project without creating a git repository? It seems that the only way explained in the package manager documentation. Running a git repo just to include some of the C headers that are already on my computer seems cumbersome.

I tried using the module.map file in the module, as with any clean Swift module, and the C module imports in order, but does not contain any characters.

This is what my project looks like:

 Project ├── Package.swift └── Sources ├── Project │  └── main.swift ├── The_C_module_i_want │  ├── module.modulemap │  └── Package.swift (empty, else it won't compile) └── Some_Swift_module └── taylor.swift 

The top level of Package.swift looks like

 import PackageDescription let package = Package(name: "Project", targets : [ Target(name: "Project", dependencies: ["Some_Swift_module", "The_C_module_i_want"]), Target(name: "Some_Swift_module"), Target(name: "The_C_module_i_want") ] ) 

and the module map is as follows:

 module The_C_module_i_want { header "/usr/local/include/The_C_library/the_c_library.h" export * link ... link ... ... } 
+5
source share

Source: https://habr.com/ru/post/1260304/


All Articles