Skip to content

Compiler Flags

vassvik edited this page Jan 17, 2019 · 5 revisions

Running the odin executable without any arguments (or faulty input) will print the following help description:

odin is a tool for managing Odin source code
Usage:
        odin command [arguments]
Commands:
        build     compile .odin file as executable
        run       compile and run .odin file
        docs      generate documentation for a .odin file
        version   print version

As of right now, docs is disabled and reserved for generating docs in the future.

In addition, there are several hidden compiler flags. Most flags are on the form -foo=bar.

  • -out: Explicitly specify the output file path.
  • -resource: Specify a resource (.rc) file (Windows)
  • -opt: Specify the optimization level. Valid numbers are 0 through 3.
  • -show-timings: Print detailed timings after the compilation stage.
  • -thread-count: Specify number of threads available.
  • -keep-temp-files: Do not delete temporary files after compilation. Namely .ll, .bc and object files.
  • -collection: Specifies collection directories. Can be specified multiple times. In the form -collection=foo=/path/to/foo.
  • -build-mode: Specifies build mode. Can be dll or exe. dll will produce a shared object file in linux.
  • -debug: Compile in debug mode. Windows only at the moment most likely. Produces a .pdb file, or equivalent.
  • -cross-compile: For cross-compilation. Currently only working for nakst's essence
  • -cross-lib-dir:
  • -no-bounds-check: make #no_bounds_check global.
  • -vet: Log warnings for unused entities and variable shadowing
  • -lld: Use bin/lld-link.exe to link instead of msvc-link.exe (Requires the Windows SDK for system libs in the LIB env variable.)
  • -no-crt: Do not link to the CRT. (Warning: Static linked libraries that rely on the CRT will become unusable)
You can’t perform that action at this time.