1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/cmd/v/internal/help/build-c.txt

60 lines
2.4 KiB
Plaintext

Usage: v [build flags] ['build'] <file.v|directory>
This command compiles the given target, along with their dependencies, into an executable.
This help topic explores C-backend specific build flags.
For help regarding building an executable, see `v help build`.
These build flags are enabled on `build` and `run` as long as the backend is set to `c`:
-arch <architecture>
Change the architecture that V will tell the C compiler to build.
List of supported architectures: `x86` and `x64` (default).
-cc <compiler>, -compiler <compiler>
Change the C compiler V invokes to the specified compiler.
The C compiler is required to support C99.
Officially supported/tested C compilers include: `clang`, `gcc`, `tcc`, `mingw-w64` and `msvc`.
-cf <flag>, -cflags <flag>
Pass the provided flag as is to the C compiler.
Can be specified multiple times to provide multiple flags.
Use quotes to wrap the flag argument if it contains spaces.
-cg, -cdebug
Enable debug mode while preserving C line numbers in the compiled executable.
This allows issues regarding C compilation to be located more easily.
-compress
Strip the compiled executable to compress it.
-csource <keep|drop>
Specify how V deals with the intermediate C source code.
* `keep` - The C source code will be kept as generated by V.
* `drop` (default) - The C source code will be deleted after compiling the executable.
-freestanding
Build the executable without dependency on libc.
Supported only on `linux` targets currently.
-live
Build the executable with live capabilities (`[live]`).
-manual-free
Enable manually freeing on all V code. This will cause memory leaks in vlib.
Currently enabled until a stable auto-free system is in place.
-os <os>, -target-os <os>
Change the target OS that V tries to compile for.
By default, the target OS is the host system.
When OS is `cross`, V will attempt to output cross-platform C code.
List of OS supported by V: `linux`, `windows`, `mac`, `freebsd`, `openbsd`, `netbsd`,
`dragonfly`, `solaris`, `android` and `haiku`.
-sanitize
Pass flags related to sanitization to the C compiler.
-shared
Tell V to compile a shared object instead of an executable.
The resulting file extension will be `.dll` on Windows and `.so` on Unix systems