Update README.md

This commit is contained in:
apio 2022-08-25 20:19:42 +02:00
parent 318e8a2154
commit f9e360ce70

View File

@ -77,6 +77,7 @@ let @main in {
More documentation is available at [Documentation](docs/Documentation.md).
## Building
First, install the required packages. (ninja is optional, you can use any build system you want)
Debian/Ubuntu:
@ -92,7 +93,7 @@ In that case, symlink ninja-build to ninja (`ln -s /usr/bin/ninja /usr/bin/ninja
First-time setup:
```
./sapphire.sh generate <build system, such as Ninja or Unix Makefiles> <build type: Debug or Release>
./sapphire.sh generate <build system, such as Ninja or Unix Makefiles (you can view all possible options with `cmake --help`)> <build type: Debug or Release (or MinSizeRel/RelWithDebInfo)>
```
To change build type/build system, just run `./sapphire.sh clean` followed by the generate command above.
@ -104,18 +105,22 @@ Building:
Installing (probably will have to be run as administrator/root):
```
./sapphire.sh install <destination, default depends on platform, on linux it's often /usr/local>
./sapphire.sh install <destination, default depends on platform, on Linux it's often /usr/local>
```
This will install the compiler at `<destination>/bin/sapphirec`.
## Running
The compiler is built at `build/sapphirec`.
For now, it can only generate object files/LLVM IR, so you'll have to link manually.
A few example commands:
```
$ build/sapphirec --version # prints the compiler version
$ build/sapphirec --help # shows usage
$ build/sapphirec main.sp # compiles a file
$ build/sapphirec main.sp -o main # compiles a file with output filename
$ build/sapphirec main.sp -o main --msystem darwin # compiles a file for macOS
$ build/sapphirec main.sp -o main.o # compiles a file with output filename
$ build/sapphirec main.sp -o main.o --msystem darwin # compiles a file for macOS
$ build/sapphirec main.sp -o main.o && gcc main.o -o main && ./main # compiles, links and runs
$ build/sapphirec main.sp -o main.ll --emit-llvm # display the generated cross-platform LLVM intermediate representation
```