Monorepo with mixed C & swift

I have the following package I am working on:

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
import Foundation

let package = Package(
    name: "LVGLSwift",
    products: [
        .library(name: "LVGLSwift", targets: ["LVGLSwift"]),
        .executable(name: "LVGLDemo", targets: ["LVGLDemo"])
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
            name: "LVGLDemo",
            dependencies: [.target(name: "LVGLSwift")]
            name: "LVGLSwift",
            dependencies: [],
            exclude: ["lvgl/Kconfig",
            cSettings: [.headerSearchPath("LVGLSwift")]
            name: "LVGLSwiftTests",
            dependencies: ["LVGLSwift"],
            exclude: ["*.py",

This LVGLSwift is a C library (ignore the name for now). I am trying to import it into my swift application target but it won't let me. Some reason the auto compete gives me the test target. Does this need a module map setup? I want to be able to debug both the C and swift sources in one as one target in Xcode. I don't want to build an Xcode project because this needs to eventually move over to Linux

I have this figured out. I needed to add a module map with an umbrella header. Now this works amazingly.

1 Like

Where did you add the module.modulemap file?

Terms of Service

Privacy Policy

Cookie Policy