- Clone this repository
git clone https://github.com/amnykon/SUI
- Install SDL2 via Homebrew
brew install sdl2 sdl2_gfx sdl2_ttf sdl2_image
- Run the
codegenerate
script
cd SUI
./codegenerate.sh
- Open
module.modulemap
in your preferred text editor
vim .build/checkouts/CSDL2.swift.git-84403830401767267/module.modulemap
-
Replace all headers with:
/usr/local/include/
-
Open
Package.swift
in your preferred text editor
vim .build/checkouts/CSDL2.swift.git-84403830401767267/Package.swift
- Add
pkgconfig: "sdl2"
betweenname
andtargets
let package = Package(
name: "CSDL2",
pkgConfig: "sdl2",
targets: [],
dependencies: []
)
- Open
sdl2.pc
in your preferred text editor
vim /usr/local/lib/pkgconfig/sdl2.pc
-
On line 15 remove:
-D_THREAD_SAFE
-
Run the
codegenerate
script
./codegenerate.sh
- Build
swift build
swift test
.build/debug/SdlSuiDemo