| author | |
| committer | |
| log | ba8ac46e1f75212c823568a2e121097bd0bafc5b |
| tree | ecbe81f2a06c725b90b972db20b3b4300e603cce |
| parent | 5e40560367bb2e591c5275d211d661e1aa1eef03 |
Now that we ship our own linker for MachO by default in both stage1
and stage2, we need a way to enable logs for verbose debugging.
This commit adds `ZIG_ENABLE_LOGGING` cmake option which is equivalent
to stage2's `-Dlog` flag.
To enable it when building stage1 with cmake, add:
```
cmake .. -DZIG_ENABLE_LOGGING=on
```2 files changed, 8 insertions(+), 1 deletions(-)
CMakeLists.txt+7| ... | ... | @@ -89,6 +89,7 @@ set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries |
| 89 | 89 | set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary") |
| 90 | 90 | set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread") |
| 91 | 91 | set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1") |
| 92 | set(ZIG_ENABLE_LOGGING off CACHE BOOL "enable logging") | |
| 92 | 93 | |
| 93 | 94 | if("${ZIG_TARGET_TRIPLE}" STREQUAL "native") |
| 94 | 95 | set(ZIG_USE_LLVM_CONFIG ON CACHE BOOL "use llvm-config to find LLVM libraries") |
| ... | ... | @@ -607,6 +608,12 @@ else() |
| 607 | 608 | set(ZIG_OMIT_STAGE2_BOOL "false") |
| 608 | 609 | endif() |
| 609 | 610 | |
| 611 | if(ZIG_ENABLE_LOGGING) | |
| 612 | set(ZIG_ENABLE_LOGGING_BOOL "true") | |
| 613 | else() | |
| 614 | set(ZIG_ENABLE_LOGGING_BOOL "false") | |
| 615 | endif() | |
| 616 | ||
| 610 | 617 | configure_file ( |
| 611 | 618 | "${CMAKE_SOURCE_DIR}/src/stage1/config.h.in" |
| 612 | 619 | "${ZIG_CONFIG_H_OUT}" |
src/config.zig.in+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | pub const have_llvm = true; |
| 2 | 2 | pub const version: [:0]const u8 = "@ZIG_VERSION@"; |
| 3 | 3 | pub const semver = try @import("std").SemanticVersion.parse(version); |
| 4 | pub const enable_logging: bool = false; | |
| 4 | pub const enable_logging: bool = @ZIG_ENABLE_LOGGING_BOOL@; | |
| 5 | 5 | pub const enable_tracy = false; |
| 6 | 6 | pub const is_stage1 = true; |
| 7 | 7 | pub const skip_non_native = false; |