Compare commits
44 Commits
main
...
gtk4-swift
Author | SHA1 | Date |
---|---|---|
![]() |
b74dc77093 | |
![]() |
a2c87fffdc | |
![]() |
bb8a8b482c | |
![]() |
0d548b2770 | |
![]() |
d2a91269d7 | |
![]() |
18dfecfb72 | |
![]() |
4341d955fe | |
![]() |
9d36b9a3a2 | |
![]() |
280eb57fe2 | |
![]() |
434557d985 | |
![]() |
5c66a3b697 | |
![]() |
b88a5fa75e | |
![]() |
681ce7c762 | |
![]() |
f6358ff6a1 | |
![]() |
4556e6a1cb | |
![]() |
c8e02d8e82 | |
![]() |
1d79c033df | |
![]() |
e5dc13f81a | |
![]() |
04fae99989 | |
![]() |
b2748cf993 | |
![]() |
5b08198f7c | |
![]() |
be0061a24d | |
![]() |
4b10f39c7b | |
![]() |
840814bcab | |
![]() |
9207c22c1d | |
![]() |
0ccefaaf30 | |
![]() |
b735367bea | |
![]() |
8aa51ac16a | |
![]() |
cd0020c8e5 | |
![]() |
fe601105d9 | |
![]() |
9b6075b2b1 | |
![]() |
fe855f14d7 | |
![]() |
d7e6f6fa71 | |
![]() |
9b5706579c | |
![]() |
4b0f02c204 | |
![]() |
e142850e49 | |
![]() |
670e775bc6 | |
![]() |
73dc6e639c | |
![]() |
5da6aab77c | |
![]() |
0c4ddc932f | |
![]() |
46dc1273a8 | |
![]() |
f6271a136c | |
![]() |
7950d45d26 | |
![]() |
3f9ecf8e9f |
|
@ -0,0 +1,71 @@
|
|||
name: macOS 11
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
MACOS_BREW: ${{ 'gtk+3 pango glib glib-networking gobject-introspection pkg-config jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-big-sur-swift-latest:
|
||||
runs-on: macos-11.0
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '13.2.1'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: brew install $MACOS_BREW
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-big-sur
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -0,0 +1,68 @@
|
|||
name: Ubuntu 18.04
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
UBUNTU_APT: ${{ 'libgtk-3-dev gir1.2-gtk-3.0 gir1.2-gtksource-3.0 libpango1.0-dev gir1.2-pango-1.0 libgdk-pixbuf2.0-dev gir1.2-gdkpixbuf-2.0 libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev libxml2-dev jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# Ubuntu 18.04 tasks
|
||||
build-ubuntu-18_04-swift-latest:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Update package repository
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: sudo apt-get install $UBUNTU_APT
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-18.04-5.3
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -0,0 +1,71 @@
|
|||
name: macOS 10.15
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
MACOS_BREW: ${{ 'gtk+3 pango glib glib-networking gobject-introspection pkg-config jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-catalina-swift-latest:
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '12.4'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: brew install $MACOS_BREW
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-catalina
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -0,0 +1,68 @@
|
|||
name: Ubuntu 20.04
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
UBUNTU_APT: ${{ 'libgtk-3-dev gir1.2-gtk-3.0 gir1.2-gtksource-3.0 libpango1.0-dev gir1.2-pango-1.0 libgdk-pixbuf2.0-dev gir1.2-gdkpixbuf-2.0 libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev libxml2-dev jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# Ubuntu 20.04 tasks
|
||||
build-ubuntu-20_04-swift-latest:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Update package repository
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: sudo apt-get install $UBUNTU_APT
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-20.04-5.3
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -0,0 +1,79 @@
|
|||
name: macOS gtk4
|
||||
|
||||
# Dependencies of this package
|
||||
env:
|
||||
MACOS_BREW: ${{ 'gtk4 pango glib glib-networking gobject-introspection pkg-config jq' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- gtk4-development
|
||||
- gtk4
|
||||
pull_request:
|
||||
branches:
|
||||
- gtk4-development
|
||||
- gtk4
|
||||
|
||||
jobs:
|
||||
# macOS tasks
|
||||
build-mac-gtk4-swift-latest:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '13.2.1'
|
||||
|
||||
- name: Print Swift version to confirm
|
||||
run: swift --version
|
||||
|
||||
- name: Run brew update
|
||||
run: brew update
|
||||
|
||||
- name: Upgrade installed packages to current version
|
||||
run: brew upgrade
|
||||
continue-on-error: true
|
||||
|
||||
- name: Fetch dependencies for general repository
|
||||
run: brew install $MACOS_BREW
|
||||
if: ${{ success() || failure() }}
|
||||
|
||||
- name: Checkout SwiftGdk
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: SwiftGdk
|
||||
|
||||
- name: Build Swift Wrappers
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
./run-gir2swift.sh
|
||||
echo "GIR2SWIFT_PATH=${PWD}/checkouts/gir2swift/.build/release/gir2swift" >> $GITHUB_ENV
|
||||
cd ..
|
||||
|
||||
- name: Build SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift build -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Test SwiftGdk
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
|
||||
cd ..
|
||||
|
||||
- name: Remove unneeded files and archive artefacts
|
||||
run: |
|
||||
cd SwiftGdk
|
||||
swift package clean
|
||||
rm -rf .build/repositories
|
||||
cd ..
|
||||
|
||||
- name: 'Upload Artefact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-artefact-macos-gtk4
|
||||
path: |
|
||||
SwiftGdk/Sources/
|
||||
retention-days: 1
|
|
@ -4,6 +4,7 @@
|
|||
/docs
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
/.swiftpm
|
||||
*.tgz
|
||||
undocumented.json
|
||||
Package.resolved
|
||||
|
|
|
@ -48,3 +48,14 @@ s/public func flush/@available(*, deprecated) public func flush/
|
|||
s/public func setDoubleClickTime/@available(*, deprecated) public func setDoubleClickTime/
|
||||
s/_ptr.pointee.state = newValue.value/_ptr.pointee.state = newValue.rawValue/
|
||||
s/targets: GdkAtom/targets: UnsafePointer<GdkAtom?>/
|
||||
s/\(gdk_crossing_event.*\)crossing_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_button_event.*\)button_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_dnd_event.*\)dnd_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_focus_event.*\)focus_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_grab_broken_event.*\)grab_broken_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_key_event.*\)key_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_pad_event.*\)pad_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_scroll_event.*\)scroll_\(event_ptr\)/\1\2/
|
||||
s/\(gdk_touch.*_event.*\)touch.*_\(event_ptr\)/\1\2/
|
||||
s/\(init<DisplayT: DisplayProtocol>.\)toplevel \(display: DisplayT\)/\1\2/
|
||||
s/\(new<DisplayT: DisplayProtocol>.\)toplevel \(display: DisplayT\)/\1\2/
|
|
@ -1,4 +1,4 @@
|
|||
// swift-tools-version:5.2
|
||||
// swift-tools-version:5.3
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
@ -6,16 +6,21 @@ let package = Package(
|
|||
name: "Gdk",
|
||||
products: [ .library(name: "Gdk", targets: ["Gdk"]) ],
|
||||
dependencies: [
|
||||
.package(name: "GdkPixbuf", url: "https://github.com/rhx/SwiftGdkPixbuf.git", .branch("main")),
|
||||
.package(name: "PangoCairo", url: "https://github.com/rhx/SwiftPangoCairo.git", .branch("main")),
|
||||
.package(name: "gir2swift", url: "https://github.com/rhx/gir2swift.git", .branch("swif52")),
|
||||
.package(name: "GdkPixbuf", url: "https://github.com/rhx/SwiftGdkPixbuf.git", .branch("swif52")),
|
||||
.package(name: "PangoCairo", url: "https://github.com/rhx/SwiftPangoCairo.git", .branch("swif52")),
|
||||
],
|
||||
targets: [
|
||||
.systemLibrary(name: "CGdk", pkgConfig: "gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2.",
|
||||
.systemLibrary(name: "CGdk", pkgConfig: "gtk4",
|
||||
providers: [
|
||||
.brew(["gtk+3", "glib", "glib-networking", "gobject-introspection"]),
|
||||
.apt(["libgtk-3-dev", "libglib2.0-dev", "glib-networking", "gobject-introspection", "libgirepository1.0-dev"])
|
||||
.brew(["gtk4", "glib", "glib-networking", "gobject-introspection"]),
|
||||
.apt(["libgtk-4-dev", "libglib2.0-dev", "glib-networking", "gobject-introspection", "libgirepository1.0-dev"])
|
||||
]),
|
||||
.target(name: "Gdk", dependencies: ["CGdk", "GdkPixbuf", "PangoCairo"]),
|
||||
.target(
|
||||
name: "Gdk",
|
||||
dependencies: ["CGdk", "GdkPixbuf", "PangoCairo"],
|
||||
swiftSettings: [.unsafeFlags(["-Xfrontend", "-serialize-debugging-options"], .when(configuration: .debug))]
|
||||
),
|
||||
.testTarget(name: "GdkTests", dependencies: ["Gdk"]),
|
||||
]
|
||||
)
|
||||
|
|
106
README.md
106
README.md
|
@ -1,10 +1,38 @@
|
|||
# SwiftGdk
|
||||
|
||||
A Swift wrapper around gdk-3.x and gdk-4.x that is largely auto-generated from gobject-introspection.
|
||||
For up to date (auto-generated) reference documentation, see https://rhx.github.io/SwiftGdk/
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## What is new?
|
||||
|
||||
Experimental support for gtk 4 was added via the `gtk4` branch.
|
||||
This branch supports Swift 5.2, but is now unmaintained.
|
||||
The `main` and `development` branches will require newer versions of Swift.
|
||||
|
||||
Support for gtk 4 for Swift 5.2 is available via the `gtk4-swift52` branch.
|
||||
|
||||
Version 12 of gir2swift pulls in [PR#10](https://github.com/rhx/gir2swift/pull/10), addressing several issues:
|
||||
|
||||
- Improvements to the Build experience and LSP [rhx/SwiftGtk#34](https://github.com/rhx/SwiftGtk/issues/34)
|
||||
- Fix issues with LLDB [rhx/SwiftGtk#39](https://github.com/rhx/SwiftGtk/issues/39)
|
||||
- **Controversial:** Implicitly marks all declarations named "priv" as if they had attribute `private=1`
|
||||
- Prevents all "Private" records from generating unless generated in their instance record
|
||||
- `-a` option generates all records
|
||||
- Introduces CI
|
||||
- For Class metadata types no longer generates class wrappers. Ref structs now contain static method which returnes the GType of the class and instance of the Class metatype wrapped in the Ref struct.
|
||||
- Adds final class GWeak<T> where T could be any Ref struct of a type which supports ARC. This class is a property wrapper which contains weak reference to any instance of T. This is especially beneficial for capture lists.
|
||||
- Adds support for weak observation.
|
||||
- Constructors and factories of GObjectInitiallyUnowned classes now consume floating reference upon initialisation as advised by [the GObject documentation](https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html)
|
||||
|
||||
Partially implemented:
|
||||
- Typed signal generation. Issues shown in [rhx/SwiftGtk#35](https://github.com/rhx/SwiftGtk/issues/35) hat remain to be addressed are listed here: [mikolasstuchlik/gir2swift#2](https://github.com/mikolasstuchlik/gir2swift/pull/2).
|
||||
|
||||
### Other Notable changes
|
||||
|
||||
Version 11 introduces a new type system into `gir2swift`,
|
||||
to ensure it has a representation of the underlying types.
|
||||
|
@ -14,8 +42,6 @@ underlying types or pointers.
|
|||
This means that a lot of the changes will be source-breaking for code that
|
||||
was compiled against libraries built with earlier versions of `gir2swift`.
|
||||
|
||||
### Notable changes
|
||||
|
||||
* Requires Swift 5.2 or later (Swift 5.3 is required for the `gtk4` branch)
|
||||
* Uses the namespace referenced in the `gir` file
|
||||
* Wrapper code is now `@inlinable` to enable the compiler to optimise away most of the wrappers
|
||||
|
@ -29,21 +55,21 @@ was compiled against libraries built with earlier versions of `gir2swift`.
|
|||
|
||||
### Swift
|
||||
|
||||
To build, you need at least Swift 5.2 (Swift 5.3 is required for `gtk4`), download from https://swift.org/download/ -- if you are using macOS, make sure you have the command line tools installed as well). Test that your compiler works using `swift --version`, which should give you something like
|
||||
To build, you need at least Swift 5.2 (Swift 5.3 is required for `gtk4`; also some Linux distributions have issues and seem to **require at least Swift 5.5**), download from https://swift.org/download/ -- if you are using macOS, make sure you have the command line tools installed as well). Test that your compiler works using `swift --version`, which should give you something like
|
||||
|
||||
$ swift --version
|
||||
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
|
||||
Target: x86_64-apple-darwin20.3.0
|
||||
swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
|
||||
Target: x86_64-apple-macosx12.0
|
||||
|
||||
on macOS, or on Linux you should get something like:
|
||||
|
||||
$ swift --version
|
||||
Swift version 5.3.2 (swift-5.3.2-RELEASE)
|
||||
Swift version 5.5.2 (swift-5.5.2-RELEASE)
|
||||
Target: x86_64-unknown-linux-gnu
|
||||
|
||||
### Gtk 3.22 or higher
|
||||
|
||||
The Swift wrappers have been tested with glib-2.56, 2.58, 2.60, 2.62, 2.64 and 2.66, and gdk/gtk 3.22, 3.24 and 4.0. They should work with higher versions, but YMMV. Also make sure you have `gobject-introspection` and its `.gir` files installed.
|
||||
The Swift wrappers have been tested with glib-2.56, 2.58, 2.60, 2.62, 2.64, 2.66 and 2.68, and gdk/gtk 3.22, 3.24, 4.0, 4.2, 4.4, and 4.6. They should work with higher versions, but YMMV. Also make sure you have `gobject-introspection` and its `.gir` files installed.
|
||||
|
||||
#### Linux
|
||||
|
||||
|
@ -72,16 +98,44 @@ On Fedora 29, you can use the gtk that comes with the distribution. Just instal
|
|||
On macOS, you can install gdk and gtk using HomeBrew (for setup instructions, see http://brew.sh). Once you have a running HomeBrew installation, you can use it to install a native version of gtk:
|
||||
|
||||
brew update
|
||||
brew install gtk+3 glib glib-networking gobject-introspection pkg-config
|
||||
brew install gtk4 glib glib-networking gobject-introspection pkg-config
|
||||
|
||||
## Usage
|
||||
|
||||
Normally, you don't build this package directly (but for testing you can - see 'Building' below). Instead you need to embed SwiftGdk into your own project using the [Swift Package Manager](https://swift.org/package-manager/). After installing the prerequisites (see 'Prerequisites' below), add `SwiftGdk` as a dependency to your `Package.swift` file, e.g.:
|
||||
|
||||
```Swift
|
||||
// swift-tools-version:5.3
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(name: "MyPackage",
|
||||
dependencies: [
|
||||
.package(name: "gir2swift", url: "https://github.com/rhx/gir2swift.git", .branch("main")),
|
||||
.package(name: "Gdk", url: "https://github.com/rhx/SwiftGdk.git", .branch("gtk4")),
|
||||
],
|
||||
targets: [.target(name: "MyPackage", dependencies: ["Gdk"])]
|
||||
)
|
||||
```
|
||||
|
||||
For gtk3 replace `.branch("gtk4")` with `.branch("gtk3")`.
|
||||
|
||||
## Building
|
||||
Normally, you don't build this package directly, but you embed it into your own project (see 'Embedding' below). However, you can build and test this module separately to ensure that everything works. Make sure you have all the prerequisites installed (see above). After that, you can simply clone this repository and build the command line executable (be patient, this will download all the required dependencies and take a while to compile) using
|
||||
|
||||
Normally, you don't build this package directly, but you embed it into your own project (see 'Usage' above). However, you can build and test this module separately to ensure that everything works. Make sure you have all the prerequisites installed (see above). After that, you can simply clone this repository and build the command line executable (be patient, this will download all the required dependencies and take a while to compile) using
|
||||
|
||||
git clone https://github.com/rhx/SwiftGdk.git
|
||||
cd SwiftGdk
|
||||
./build.sh
|
||||
./test.sh
|
||||
./run-gir2swift.sh
|
||||
swift build
|
||||
swift test
|
||||
|
||||
Please note that on macOS, due to a bug currently in the Swift Package Manager,
|
||||
you need to pass in the build flags manually, i.e. instead of `swift build` and `swift test` you can run
|
||||
|
||||
swift build `./run-gir2swift.sh flags -noUpdate`
|
||||
swift test `./run-gir2swift.sh flags -noUpdate`
|
||||
|
||||
|
||||
### Xcode
|
||||
|
||||
|
@ -94,8 +148,8 @@ On macOS, you can build the project using Xcode instead. To do this, you need t
|
|||
After that, use the (usual) Build and Test buttons to build/test this package.
|
||||
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
You can find reference documentation inside the [docs](https://rhx.github.io/SwiftGdk/) folder.
|
||||
This was generated using the [jazzy](https://github.com/realm/jazzy) tool.
|
||||
If you want to generate your own documentation, matching your local installation,
|
||||
|
@ -103,20 +157,36 @@ you can use the `generate-documentation.sh` script in the repository.
|
|||
Unfortunately, at this stage [jazzy](https://github.com/realm/jazzy) only works on macOS (and crashes under Linux), so this will currently only work on a Mac.
|
||||
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Here are some common errors you might encounter and how to fix them.
|
||||
|
||||
### Old Swift toolchain or Xcode
|
||||
### Missing `.gir` Files
|
||||
If you get an error such as
|
||||
|
||||
$ ./build.sh
|
||||
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-package (No such file or directory)
|
||||
Girs located at
|
||||
Cannot open '/GLib-2.0.gir': No such file or directory
|
||||
|
||||
Make sure that you have the relevant `gobject-introspection` packages installed (as per the Pre-requisites section), including their `.gir` and `.pc` files.
|
||||
|
||||
### Old Swift toolchain or Xcode
|
||||
If, when you run `swift build`, you get a `Segmentation fault (core dumped)` or circular dependency error such as
|
||||
|
||||
warning: circular dependency detected while parsing pangocairo: harfbuzz -> freetype2 -> harfbuzz
|
||||
|
||||
this probably means that your Swift toolchain is too old. Make sure the latest toolchain is the one that is found when you run the Swift compiler (see above).
|
||||
this probably means that your Swift toolchain is too old, particularly on Linux (at the time of this writing, some Linux distributions require at least Swift 5.5). Make sure the latest toolchain is the one that is found when you run the Swift compiler (see above).
|
||||
|
||||
If you get an older version, make sure that the right version of the swift compiler is found first in your `PATH`. On macOS, use xcode-select to select and install the latest version, e.g.:
|
||||
|
||||
sudo xcode-select -s /Applications/Xcode.app
|
||||
xcode-select --install
|
||||
|
||||
### Known Issues
|
||||
|
||||
* When building, a lot of warnings appear. This is largely an issue with automatic `RawRepresentable` conformance in the Swift Standard library. As a workaround, you can turn this off by passing the `-Xswiftc -suppress-warnings` parameter when building.
|
||||
|
||||
* The current build system does not support directory paths with spaces (e.g. the `My Drive` directory used by Google Drive File Stream).
|
||||
|
||||
* BUILD_DIR is not supported in the current build system.
|
||||
|
||||
As a workaround, you can use the old build scripts, e.g. `./build.sh` (instead of `run-gir2swift.sh` and `swift build`) to build a package.
|
||||
|
|
|
@ -1,23 +1,41 @@
|
|||
struct _GdkAppLaunchContext {};
|
||||
struct _GdkAtom {};
|
||||
struct _GdkAxisUse {};
|
||||
struct _GdkButtonEvent {};
|
||||
struct _GdkByteOrder {};
|
||||
struct _GdkCairoContext {};
|
||||
struct _GdkClipboard {};
|
||||
struct _GdkContentDeserializer {};
|
||||
struct _GdkContentFormats {};
|
||||
struct _GdkContentFormatsBuilder {};
|
||||
struct _GdkContentSerializer {};
|
||||
struct _GdkCrossingEvent {};
|
||||
struct _GdkCrossingMode {};
|
||||
struct _GdkCursor {};
|
||||
struct _GdkCursorType {};
|
||||
struct _GdkDNDEvent {};
|
||||
struct _GdkDeleteEvent {};
|
||||
struct _GdkDevice {};
|
||||
struct _GdkDeviceManager {};
|
||||
struct _GdkDeviceType {};
|
||||
struct _GdkDisplay {};
|
||||
struct _GdkDisplayManager {};
|
||||
struct _GdkDrag {};
|
||||
struct _GdkDragAction {};
|
||||
struct _GdkDragContext {};
|
||||
struct _GdkDragProtocol {};
|
||||
struct _GdkDragSurface {};
|
||||
struct _GdkDragSurfaceInterface {};
|
||||
struct _GdkDrawContext {};
|
||||
struct _GdkDrop {};
|
||||
struct _GdkEvent {};
|
||||
struct _GdkEventFunc {};
|
||||
struct _GdkEventMask {};
|
||||
struct _GdkEventSequence {};
|
||||
struct _GdkFileList {};
|
||||
struct _GdkFilterFunc {};
|
||||
struct _GdkFilterReturn {};
|
||||
struct _GdkFocusEvent {};
|
||||
struct _GdkFrameClock {};
|
||||
struct _GdkFrameClockClass {};
|
||||
struct _GdkFrameClockPhase {};
|
||||
|
@ -26,28 +44,55 @@ struct _GdkFrameTimings {};
|
|||
struct _GdkFullscreenMode {};
|
||||
struct _GdkGLContext {};
|
||||
struct _GdkGLError {};
|
||||
struct _GdkGLTexture {};
|
||||
struct _GdkGLTextureClass {};
|
||||
struct _GdkGrabBrokenEvent {};
|
||||
struct _GdkGrabOwnership {};
|
||||
struct _GdkGrabStatus {};
|
||||
struct _GdkGravity {};
|
||||
struct _GdkInputMode {};
|
||||
struct _GdkInputSource {};
|
||||
struct _GdkKeyEvent {};
|
||||
struct _GdkKeymap {};
|
||||
struct _GdkMemoryTexture {};
|
||||
struct _GdkMemoryTextureClass {};
|
||||
struct _GdkModifierIntent {};
|
||||
struct _GdkModifierType {};
|
||||
struct _GdkMotionEvent {};
|
||||
struct _GdkNotifyType {};
|
||||
struct _GdkOwnerChange {};
|
||||
struct _GdkPadEvent {};
|
||||
struct _GdkPaintable {};
|
||||
struct _GdkPixbuf {};
|
||||
struct _GdkPopup {};
|
||||
struct _GdkPopupInterface {};
|
||||
struct _GdkPopupLayout {};
|
||||
struct _GdkPropMode {};
|
||||
struct _GdkPropertyState {};
|
||||
struct _GdkProximityEvent {};
|
||||
struct _GdkRectangle {};
|
||||
struct _GdkScreen {};
|
||||
struct _GdkScrollDirection {};
|
||||
struct _GdkScrollEvent {};
|
||||
struct _GdkSettingAction {};
|
||||
struct _GdkSnapshot {};
|
||||
struct _GdkSnapshotClass {};
|
||||
struct _GdkStatus {};
|
||||
struct _GdkSurface {};
|
||||
struct _GdkSurfaceClass {};
|
||||
struct _GdkTexture {};
|
||||
struct _GdkTextureClass {};
|
||||
struct _GdkToplevel {};
|
||||
struct _GdkToplevelInterface {};
|
||||
struct _GdkToplevelLayout {};
|
||||
struct _GdkToplevelSize {};
|
||||
struct _GdkTouchEvent {};
|
||||
struct _GdkTouchpadEvent {};
|
||||
struct _GdkTouchpadGesturePhase {};
|
||||
struct _GdkVisibilityState {};
|
||||
struct _GdkVisual {};
|
||||
struct _GdkVisualType {};
|
||||
struct _GdkVulkanContext {};
|
||||
struct _GdkWMDecoration {};
|
||||
struct _GdkWMFunction {};
|
||||
struct _GdkWindow {};
|
||||
|
@ -82,4 +127,9 @@ struct _GdkMonitorInterface {};
|
|||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
#undef GDK_ACTION_ALL
|
||||
#define GDK_ACTION_ALL 7
|
||||
|
||||
#undef GDK_MODIFIER_MASK
|
||||
#define GDK_MODIFIER_MASK 0x1C001F0F
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module CGdk [system] {
|
||||
header "gdk_bridging.h"
|
||||
|
||||
link "gdk-3"
|
||||
link "gtk-4"
|
||||
link "pangocairo-1.0"
|
||||
link "pangoft2-1.0"
|
||||
link "fontconfig"
|
||||
|
|
|
@ -3,24 +3,16 @@ import XCTest
|
|||
|
||||
class GdkTests: XCTestCase {
|
||||
|
||||
func testEvent() {
|
||||
let event = Event(type: .keyPress)
|
||||
XCTAssertEqual(event.type, event.event_ptr.pointee.type)
|
||||
XCTAssertEqual(event.type, EventType.keyPress)
|
||||
// FIXME: implement gdk-4 tests
|
||||
func testEmpty() {
|
||||
}
|
||||
|
||||
func testEventType() {
|
||||
let doubleButton = EventType.doubleButtonPress
|
||||
XCTAssertEqual(doubleButton, EventType._2buttonPress)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension GdkTests {
|
||||
static var allTests : [(String, (GdkTests) -> () throws -> Void)] {
|
||||
return [
|
||||
("testEvent", testEvent),
|
||||
("testEventType", testEventType),
|
||||
("testEmpty", testEmpty),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
13
config.sh
13
config.sh
|
@ -3,9 +3,10 @@
|
|||
# Configuration for the module to compile, the Swift toolchain, and
|
||||
# the compiler and linker flags to use.
|
||||
#
|
||||
VER=3.0
|
||||
major=4
|
||||
VER=$major.0
|
||||
GLIB_VER=2.0
|
||||
JAZZY_VER=3.24.22
|
||||
JAZZY_VER=$major.2.1
|
||||
Mod=Gdk
|
||||
Module=${Mod}-$VER
|
||||
module=`echo "${Module}" | tr '[:upper:]' '[:lower:]'`
|
||||
|
@ -14,13 +15,13 @@ if [ -z "$BUILD_DIR" ]; then
|
|||
if `pwd -P | grep -q Dropbox` ; then
|
||||
export BUILD_DIR="/tmp/.build-$Module"
|
||||
else
|
||||
export BUILD_DIR=`pwd`/.build
|
||||
export BUILD_DIR="$PWD/.build"
|
||||
fi
|
||||
fi
|
||||
export PATH="${GIR2SWIFT_PATH}:${BUILD_DIR}/gir2swift/.build/release:${BUILD_DIR}/gir2swift/.build/debug:${PATH}:/usr/local/opt/ruby/bin:`echo /usr/local/lib/ruby/gems/*/bin | tr ' ' '\n' | tail -n1`:${PATH}:`echo /var/lib/gems/*/gems/jazzy-*/bin/ | tr ' ' '\n' | tail -n1`:/usr/local/bin"
|
||||
export PATH="${GIR2SWIFT_PATH}:${BUILD_DIR}/checkouts/gir2swift/.build/release:${BUILD_DIR}/checkouts/gir2swift/.build/debug:${PATH}:$PWD/.build/checkouts/gir2swift/.build/release:$PWD/.build/checkouts/gir2swift/.build/debug:${PATH}:/usr/local/opt/ruby/bin:`echo /usr/local/lib/ruby/gems/*/bin | tr ' ' '\n' | tail -n1`:${PATH}:`echo /var/lib/gems/*/gems/jazzy-*/bin/ | tr ' ' '\n' | tail -n1`:/usr/local/bin"
|
||||
export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:${PKG_CONFIG_PATH}
|
||||
LINKFLAGS=`pkg-config --libs $module pangocairo pangoft2 pango gobject-$GLIB_VER gio-unix-$GLIB_VER glib-$GLIB_VER | tr ' ' '\n' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//' | tr '\n' ' ' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//g' -e 's/,/ -Xlinker /g' -e 's/ -pthread/ -lpthread/g' -e 's/-Xcc[ ]*-Xlinker/-Xlinker/g' -e 's/-Xlinker[ ]*-Xcc/-Xcc/g' -e 's/-Xlinker[ ]*--export-dynamic//g' -e 's/-Xlinker[ ]*-Xlinker/-Xlinker/g' -e 's/-Xcc *$//' -e 's/-Xlinker *$//'`
|
||||
CCFLAGS=`pkg-config --cflags $module pangocairo pangoft2 pango gobject-$GLIB_VER gio-unix-$GLIB_VER glib-$GLIB_VER | tr ' ' '\n' | sed 's/^/-Xcc /' | tr '\n' ' ' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//g' -e 's/,/ -Xlinker /g' -e 's/ -pthread/ -lpthread/g' -e 's/-Xcc[ ]*-Xlinker/-Xlinker/g' -e 's/-Xlinker[ ]*-Xcc/-Xcc/g' -e 's/-Xlinker[ ]*--export-dynamic//g' -e 's/-Xlinker[ ]*-Xlinker/-Xlinker/g' -e 's/-Xcc *$//' -e 's/-Xlinker *$//'`
|
||||
LINKFLAGS=`pkg-config --libs gtk$major pangocairo pangoft2 pango gobject-$GLIB_VER gio-unix-$GLIB_VER glib-$GLIB_VER | tr ' ' '\n' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//' | tr '\n' ' ' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//g' -e 's/,/ -Xlinker /g' -e 's/ -pthread/ -lpthread/g' -e 's/-Xcc[ ]*-Xlinker/-Xlinker/g' -e 's/-Xlinker[ ]*-Xcc/-Xcc/g' -e 's/-Xlinker[ ]*--export-dynamic//g' -e 's/-Xlinker[ ]*-Xlinker/-Xlinker/g' -e 's/-Xcc *$//' -e 's/-Xlinker *$//'`
|
||||
CCFLAGS=`pkg-config --cflags gtk$major pangocairo pangoft2 pango gobject-$GLIB_VER gio-unix-$GLIB_VER glib-$GLIB_VER | tr ' ' '\n' | sed 's/^/-Xcc /' | tr '\n' ' ' | sed -e 's/^/-Xlinker /' -e 's/-Wl,//g' -e 's/,/ -Xlinker /g' -e 's/ -pthread/ -lpthread/g' -e 's/-Xcc[ ]*-Xlinker/-Xlinker/g' -e 's/-Xlinker[ ]*-Xcc/-Xcc/g' -e 's/-Xlinker[ ]*--export-dynamic//g' -e 's/-Xlinker[ ]*-Xlinker/-Xlinker/g' -e 's/-Xcc *$//' -e 's/-Xlinker *$//'`
|
||||
TAC="tail -r"
|
||||
if which tac >/dev/null 2>&1 ; then
|
||||
TAC=tac
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
. ./config.sh
|
||||
[ -e Sources/${Mod}/${Module}.swift ] || ./generate-wrapper.sh
|
||||
if [ -z "$@" ]; then
|
||||
JAZZY_ARGS="--theme fullwidth --author René Hexel --author_url https://experts.griffith.edu.au/9237-rene-hexel --github_url https://github.com/rhx/Swift$Mod --github-file-prefix https://github.com/rhx/Swift$Mod/tree/generated --root-url http://rhx.github.io/Swift$Mod/ --output docs"
|
||||
JAZZY_ARGS="--theme fullwidth --author René Hexel --author_url https://experts.griffith.edu.au/9237-rene-hexel --github_url https://github.com/rhx/Swift$Mod --github-file-prefix https://github.com/rhx/Swift$Mod/tree/gtk4-generated --root-url http://rhx.github.io/Swift$Mod/ --output docs"
|
||||
fi
|
||||
[ -e "$BUILD_DIR/build.db" ] || ./build.sh
|
||||
rm -rf .docs.old
|
||||
|
|
|
@ -5,14 +5,19 @@
|
|||
#
|
||||
. ./config.sh
|
||||
./package.sh update
|
||||
if [ ! -x "${GIR2SWIFT_PATH}/gir2swift" ] &&
|
||||
! pushd "$BUILD_DIR/gir2swift" >/dev/null 2>&1 ; then
|
||||
mkdir -p "$BUILD_DIR"
|
||||
pushd "$BUILD_DIR" >/dev/null
|
||||
if [ ! -x "${GIR2SWIFT_PATH}/gir2swift" -a \
|
||||
! -e "$BUILD_DIR/checkouts/gir2swift" ] ; then
|
||||
mkdir -p "$BUILD_DIR/checkouts" 2>/dev/null
|
||||
pushd "$BUILD_DIR/checkouts" >/dev/null
|
||||
git clone https://github.com/rhx/gir2swift.git
|
||||
cd gir2swift && ./build.sh
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
export PATH=`pwd`/.build/debug:${PATH}
|
||||
if [ ! -x "${GIR2SWIFT_PATH}/gir2swift" ] &&
|
||||
! -e "$BUILD_DIR/checkouts/gir2swift/.build/release/gir2swift" >/dev/null 2>&1 ; then
|
||||
pushd "$BUILD_DIR/checkouts/gir2swift" >/dev/null
|
||||
./build.sh
|
||||
fi
|
||||
export PATH="$PWD/.build/release:${PATH}"
|
||||
popd >/dev/null 2>&1
|
||||
export PACKAGES="${BUILD_DIR}/checkouts"
|
||||
[ -e $PACKAGES ] || export PACKAGES=Packages
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
mkdir -p Sources/${Mod}
|
||||
GOBJECT_LIBDIR=`pkg-config --libs-only-L gobject-introspection-1.0 2>/dev/null | tr ' ' '\n' | grep gobject-introspection | tail -n1 | cut -c3-`
|
||||
GOBJECT_DIR=`dirname "${GOBJECT_LIBDIR}"`
|
||||
for prefix in $PREFIX GOBJECT_DIR /usr/local /usr ; do
|
||||
for prefix in $PREFIX /opt/homebrew /usr/local /usr $GOBJECT_DIR ; do
|
||||
gir_dir=${prefix}/share/gir-1.0
|
||||
gir=${gir_dir}/${Module}.gir
|
||||
if [ -e "${gir}" ] ; then
|
||||
|
@ -21,17 +21,4 @@ if [ ! -e "${GIR}" ] ; then
|
|||
echo "and can be found in /usr /usr/local or by pkg-config!"
|
||||
exit 1
|
||||
fi
|
||||
gir2swift -p ${GIR_DIR}/GLib-2.0.gir -p ${GIR_DIR}/GObject-2.0.gir -p ${GIR_DIR}/Pango-1.0.gir -p ${GIR_DIR}/cairo-1.0.gir -p ${GIR_DIR}/PangoCairo-1.0.gir -p ${GIR_DIR}/GdkPixbuf-2.0.gir "${GIR}" | sed -f ${Module}.sed | awk -f ${Module}.awk > Sources/${Mod}/${Module}.swift
|
||||
gir2swift -o Sources/${Mod} -m ${Module}.module -p ${GIR_DIR}/GLib-2.0.gir -p ${GIR_DIR}/GObject-2.0.gir -p ${GIR_DIR}/Pango-1.0.gir -p ${GIR_DIR}/cairo-1.0.gir -p ${GIR_DIR}/PangoCairo-1.0.gir -p ${GIR_DIR}/GdkPixbuf-2.0.gir "${GIR}"
|
||||
if which parallel >/dev/null ; then
|
||||
for src in Sources/${Mod}/*-*.swift ; do \
|
||||
echo "sed -f ${Module}.sed < ${src} |" \
|
||||
"awk -f ${Module}.awk > ${src}.out" \; \
|
||||
"mv ${src}.out ${src}" ; \
|
||||
done | parallel
|
||||
else
|
||||
for src in Sources/${Mod}/*-*.swift ; do
|
||||
sed -f ${Module}.sed < ${src} | awk -f ${Module}.awk > ${src}.out
|
||||
mv ${src}.out ${src}
|
||||
done
|
||||
fi
|
||||
gir2swift -o Sources/${Mod} -p ${GIR_DIR}/GLib-2.0.gir -p ${GIR_DIR}/GObject-2.0.gir -p ${GIR_DIR}/Pango-1.0.gir -p ${GIR_DIR}/cairo-1.0.gir -p ${GIR_DIR}/PangoCairo-1.0.gir -p ${GIR_DIR}/GdkPixbuf-2.0.gir "${GIR}"
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
GIR_NAME="Gdk-4.0"
|
||||
|
||||
function generate_arg-path_arg-g2s-exec_arg-gir-pre_arg-gir-path {
|
||||
local PACKAGE_PATH=$1
|
||||
local G2S_EXEC=$2
|
||||
local GIR_PRE=$3
|
||||
local GIR_PATH=$4
|
||||
|
||||
local CALLER=$PWD
|
||||
|
||||
cd $PACKAGE_PATH
|
||||
|
||||
local NAME=$(package_name)
|
||||
local GIR_PRE_ARGS=`for FILE in ${GIR_PRE}; do echo -n "-p ${GIR_PATH}/${FILE}.gir "; done`
|
||||
|
||||
bash -c "${G2S_EXEC} -o Sources/${NAME} ${GIR_PRE_ARGS} ${GIR_PATH}/${GIR_NAME}.gir"
|
||||
|
||||
cd $CALLER
|
||||
}
|
||||
|
||||
case $1 in
|
||||
gir-name) echo $GIR_NAME;;
|
||||
generate) echo $(generate_arg-path_arg-g2s-exec_arg-gir-pre_arg-gir-path "$2" "$3" "$4" "$5");;
|
||||
esac
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Swift package with fetched dependencies is required to run scipt in gir2swift package. Use option -noUpdate to prevent update.
|
||||
if ! [[ $@ == *'-noUpdate'* ]]
|
||||
then
|
||||
swift package update
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
## Returns flags needed for macOS compilation (experimental)
|
||||
flags) .build/checkouts/gir2swift/gir2swift-generation-driver.sh c-flags $PWD ;;
|
||||
## Removes all generaed files
|
||||
clean) .build/checkouts/gir2swift/gir2swift-generation-driver.sh remove-generated $PWD ;;
|
||||
## Defaults to generation
|
||||
*) .build/checkouts/gir2swift/gir2swift-generation-driver.sh generate $PWD ;;
|
||||
esac
|
Loading…
Reference in New Issue