-
-
Notifications
You must be signed in to change notification settings - Fork 849
Compiler Flags
Tetralux edited this page Dec 17, 2019
·
32 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, orin/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,.bcand object files. -
-collection:COLLECTION_NAME=PATH_TO_COLLECTION: Specifies collection directories. Can be specified multiple times. Can be imported withimport "COLLECTION_NAME". -
-define:NAME=VALUE: Defines a compile-time constant (likeNAME :: VALUEin your code) which can be used withwhenstatements. 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 bedllorexe.dllwill 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.pdbfile on Windows. -
-target=TARGET: For cross-compilation, where TARGET is of the formplatform_arch. Currently only working for nakst's essence -
-cross-lib-dir: -
-no-bounds-check: globally disable bounds checks. -
-vet: Log warnings for unused entities and variable shadowing -
-lld: Usebin/lld-link.exeto link instead ofmsvc-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)