https://github.com/oasisdigital/bazel-c-cpp-toolchain
https://github.com/oasisdigital/bazel-c-cpp-toolchain
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oasisdigital/bazel-c-cpp-toolchain
- Owner: OasisDigital
- License: other
- Created: 2022-03-22T20:39:38.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-14T16:27:16.000Z (almost 4 years ago)
- Last Synced: 2026-01-29T21:54:36.940Z (5 months ago)
- Language: Starlark
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Oasis Digital Bazel examples
We use these examples to teach Bazel, but you are welcome to study them
for your own purposes!
https://oasisdigital.com/class/bazel
## Cross-compile toolchain example
This is an example of cross-compiling with a custom toolchain.
It is not intended to be production-grade, but rather to be useful in explaining
how to set up toolchains.
## Tool installation
Ideally we'll build all the tools from source using Bazel, but to keep the focus
on toolchain setup, install them with your OS package manager instead.
```sh
sudo apt install cc65 stella
```
```sh
brew install cc65 stella
```
(Not working yet here:) On windows, download the cc65 precompiled binaries.
https://sourceforge.net/projects/cc65/files/cc65-snapshot-win32.zip
## Build
the old way: make
the new way: bazel build '...'
## Run
Run the make-generated binary:
```sh
stella game/hello
```
```sh
/usr/local/Cellar/stella/6.6/Stella.app/Contents/MacOS/Stella game/hello
```
Run the Bazel-generated binary:
```sh
stella bazel-out/darwin-fastbuild/bin/game/hello
```
```sh
/usr/local/Cellar/stella/6.6/Stella.app/Contents/MacOS/Stella bazel-out/darwin-fastbuild/bin/game/hello
```
## Future enhancement
Consider building the cc65 toolchain hermetically instead of relying
on an OS-level package.
https://github.com/cc65/cc65/archive/refs/heads/master.zip
Consider showing how to adopt an off-the-shelf embedded toolchain,
from this collection:
https://github.com/silvergasp/bazel-embedded
Consider demonstrating this LLVM toolchain:
https://github.com/grailbio/bazel-toolchain