Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/colbyhall/objective-zig-gen
Obejctive-C to Zig bindgen.
https://github.com/colbyhall/objective-zig-gen
bindgen macos objective-c zig
Last synced: about 2 months ago
JSON representation
Obejctive-C to Zig bindgen.
- Host: GitHub
- URL: https://github.com/colbyhall/objective-zig-gen
- Owner: colbyhall
- License: mit
- Created: 2024-09-05T00:45:18.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-16T03:04:02.000Z (3 months ago)
- Last Synced: 2024-10-17T15:14:56.031Z (3 months ago)
- Topics: bindgen, macos, objective-c, zig
- Language: Zig
- Homepage:
- Size: 180 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zig Objective-C Generator (objective-zig-gen)
![License](https://img.shields.io/badge/license-MIT-blue.svg)
`objective-zig-gen` is a work-in-progress tool for generating Objective-C bindings from Zig. This project aims to streamline the process of integrating Objective-C code with Zig, providing developers with a seamless way to interact with Objective-C APIs from Zig projects. You can find generated bindings in [objective-zig](https://github.com/colbyhall/objective-zig).
## Goals
- **Objective-C Bindings Generation**: Automatically generate Zig bindings for Objective-C code, enabling smooth integration between Zig and Objective-C.
- **Type Mapping**: Handles basic type conversions between Zig and Objective-C.
- **Command Line Interface**: Easy-to-use CLI for generating bindings directly from Objective-C header files.
- **Comptime Zig to Objective C ABI**: Allow users to write Objective-C compatible Zig so there is no need to write any Objective-C.## Getting Started
### Prerequisites
- [Zig](https://ziglang.org/) (0.13.0)
- llvm installed through homebrew for libclang (We currently have a naive way to find libclang which is why homebrew is required)
- A working Objective-C toolchain (Xcode on macOS)### Installation
Since this project is under active development, it's recommended to clone the repository and build from source:
```bash
git clone https://github.com/colbyhall/zigobjcgen.git
cd zigobjcgen
zig build
```### Usage
The program works off of a manifest file that list out xtool sdk frameworks, their dependencies, and other information for formatting the types.
```bash
objective-zig-gen
```
Here is an example manifest file```json
[
{
"name": "Security",
"output_file": "security"
},
{
"name": "CoreFoundation",
"output_file": "cf","remove_prefix": "CF"
},
{
"name": "CoreServices",
"output_file": "cs","dependencies": [
"CoreFoundation"
]
},
{
"name": "Foundation",
"output_file": "ns","remove_prefix": "NS",
"dependencies": [
"CoreServices",
"CoreFoundation",
"Security"
]
}
]
```## Roadmap
- [ ] **In Progress** | Complete type mapping for all Objective-C types. (Protocols, Interfaces, Blocks)
- [ ] Zig interface for writing Objective-C ABI compatible Zig.
- [ ] Comprehensive test and benchmarking.## Contributing
Contributions are welcome! Feel free to open issues or submit pull requests if you want to help improve the project.## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.## Acknowledgements
- Thanks to the Zig community for their ongoing support and inspiration
- Inspiration for this project comes from the ened to bridge the gap between Zig and the Objective-C ecosystem.
- Mach and [mach-objc](https://github.com/hexops/mach-objc) for giving me the initial inspiration, resources, and some runtime code bindings.---
**Note**: This project is actively being developed and is not ready for production use. Expect frequent changes and updates.