Minimal swift-package example

public enum CXXDataType: Int {
  case TYPE_R_16F = 2
  case TYPE_C_16F = 6
  case TYPE_R_16BF = 14
  case TYPE_C_16BF = 15
  case TYPE_R_32F = 0
  case TYPE_C_32F = 4
  case TYPE_R_64F = 1
  case TYPE_C_64F = 5
  case TYPE_R_4I = 16
  case TYPE_C_4I = 17
  case TYPE_R_4U = 18
  case TYPE_C_4U = 19
  case TYPE_R_8I = 3
  case TYPE_C_8I = 7
  case TYPE_R_8U = 8
  case TYPE_C_8U = 9
  case TYPE_R_16I = 20
  case TYPE_C_16I = 21
  case TYPE_R_16U = 22
  case TYPE_C_16U = 23
  case TYPE_R_32I = 10
  case TYPE_C_32I = 11
  case TYPE_R_32U = 12
  case TYPE_C_32U = 13
  case TYPE_R_64I = 24
  case TYPE_C_64I = 25
  case TYPE_R_64U = 26
  case TYPE_C_64U = 27
  case TYPE_R_8F_E4M3 = 28
  case TYPE_R_8F_E5M2 = 29
}
import Testing
@testable import cxxtest

@Test func example() async throws {
    let cxxtype = CXXDataType(rawValue: 0)
    #expect(cxxtype!.rawValue == 0)
}
 swiftSettings: [
    .interoperabilityMode(.Cxx),
] // for both .testTarget and .target
 cxxLanguageStandard: .cxx17

With cxx interop

swift test -c release
Building for production...
Build complete! (53.91s)
swift test
Building for debugging...
Build complete! (53.40s)

Without cxx interop

swift test -c release
Building for production...
Build complete!  (1.45s)
swift test
Building for debugging...
Build complete! (1.83s)
1 Like