Comments (3)
This issue was discussed on Discord with @kabiroberai .
First message: https://discord.com/channels/791751777598570606/791751778092711941/872087233811853312
Last message: https://discord.com/channels/791751777598570606/791751778092711941/872404886833229824
Summary
Kabir suggested using SourceKit
via https://github.com/jpsim/SourceKitten. SourceKitten is a commonly used tool. Kabir managed to create an example on using SwiftGLib:
# macOS
$ sourcekitten module-info --module CGLib -- -I"${PWD}/Sources" $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0)) -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
# linux
$ sourcekitten module-info --module CGLib -- -I"${PWD}/Sources" $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0))
The output is ~800K lines long JSON, which contains embedded XML strings. It will take some time until I get familiar with the data structure.
The SourceKitten does not require the package to be built, but it needs path to the libsourcekitdInProc.so
on Linux and the SDK on macOS.
from gir2swift.
#Linux
sourcekitten module-info --module Swift -- ""
sourcekitten module-info --module Foundation -- ""
sourcekitten module-info --module Glibc -- ""
sourcekitten module-info --module CGLib -- -I"$PWD"/Sources $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0))
#macOS
sourcekitten module-info --module Swift -- -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
sourcekitten module-info --module Foundation -- -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
sourcekitten module-info --module Darwin -- -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
sourcekitten module-info --module CGLib -- -I"${PWD}/Sources" $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0)) -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
from gir2swift.
For anyone interested, a MR mikolasstuchlik/g2swift#1 has been merged into my PoC repository g2swift
. It implements a call to SourceKit and parses it's output.
This demonstrates how responses from SourceKit could be parsed. In future, I'll try to get a useful information about the environment.
from gir2swift.
Related Issues (13)
- Compilation failure with Swift 4 HOT 2
- Advice needed: on the way to remove postprocessing HOT 1
- Automate swiftObject integration for classes
- Expanding the `.yaml` manifest capabilities HOT 2
- Raspberry Pi 4 CI for the project HOT 1
- Use element-type for lists/hash tables HOT 2
- Module.module/Module.preamble not working
- Includes error HOT 3
- Generated files not building with Swift 5.2 HOT 1
- Use dlopen(), dlsym() and dlclose() to launch functions. HOT 1
- gir2swift creates duplicate labels for some (template) methods
- Redundant protocol conformance warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gir2swift.