Cross platform swift package for the imgui library.
To run an imgui example, first install SwiftBundler, and run the following (currently only the glfw+metal backend on macOS, more coming soon...)
git clone https://github.com/the-swift-collective/imgui.git
cd imgui
swift bundler run
should launch 'GLFWMetalApp.app'.
dependencies: [
.package(url: "https://github.com/the-swift-collective/imgui.git", branch: "main"),
]
// swift-tools-version: 5.10
import PackageDescription
let package = Package(
name: "MyPackage",
products: [
.library(
name: "MyLibrary",
targets: ["MyLibrary"]
),
],
dependencies: [
.package(url: "https://github.com/the-swift-collective/imgui.git", branch: "main")
],
targets: [
.target(
name: "MyLibrary",
dependencies: [
/* add the imgui product as a library dependency. */
.product(name: "ImGui", package: "imgui"),
],
cxxSettings: [
/* for windows, add the following until swift updates its embedded clang. */
.define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])),
.define("_ALLOW_KEYWORD_MACROS", to: "1", .when(platforms: [.windows])),
.define("static_assert(_conditional, ...)", to: "", .when(platforms: [.windows])),
],
swiftSettings: [
/* enable swift/c++ interop. */
.interoperabilityMode(.Cxx),
]
),
],
/* use cxx17 language standard. */
cxxLanguageStandard: .cxx17
)