Skip to content
gingerBill edited this page Jul 22, 2020 · 31 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=OUTPUT_FILE_OR_PATH: Explicitly specify the output file name or path. Cannot use backslashes or Windows-style drive names; must be /in/this/form, ./in/this/form, or in/this/form. The destination directory must already exist.
  • -resource: Specify a resource (.rc) file (Windows)
  • -opt:LEVEL: Specify the optimization level. Valid numbers are 0 through 3.
  • -show-timings: Print detailed timings after the compilation stage.
  • -thread-count:COUNT: Specify number of threads available.
  • -keep-temp-files: Do not delete temporary files after compilation. Namely .ll, .bc and object files.
  • -collection:COLLECTION_NAME=PATH_TO_COLLECTION: Specifies collection directories. Can be specified multiple times. Can be imported with import "COLLECTION_NAME".
  • -define:NAME=VALUE: Defines a compile-time constant, as if by ::, which can be used like a normal constant can, such as with when statements. You can use #defined(NAME) as the condition to check if it was passed, or declared by source code.
  • -build-mode:MODE: Specifies build mode. Can be dll or exe. dll will produce a shared object file in linux.
  • -debug: Compile in debug mode. Windows has better support than Linux at the moment, but neverless, does work somewhat on Linux. Produces a .pdb file on Windows.
  • -target:TARGET: For cross-compilation, where TARGET is of the form platform_arch.
  • -cross-lib-dir:
  • -no-bounds-check: globally disable bounds checks.
  • -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)
  • -subsystem:SUBSYSTEM: Pick the subsystem used for the application. Can be console or windows. (Windows)
  • -extra-linker-flags:FLAGS: Pass flags through to the linker. Surround multiple flags "with quotes".
Clone this wiki locally