mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
stage1: add cmake flag for enabling logging
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 ```
This commit is contained in:
parent
5e40560367
commit
ba8ac46e1f
@ -89,6 +89,7 @@ set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries
|
||||
set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")
|
||||
set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")
|
||||
set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1")
|
||||
set(ZIG_ENABLE_LOGGING off CACHE BOOL "enable logging")
|
||||
|
||||
if("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
|
||||
set(ZIG_USE_LLVM_CONFIG ON CACHE BOOL "use llvm-config to find LLVM libraries")
|
||||
@ -607,6 +608,12 @@ else()
|
||||
set(ZIG_OMIT_STAGE2_BOOL "false")
|
||||
endif()
|
||||
|
||||
if(ZIG_ENABLE_LOGGING)
|
||||
set(ZIG_ENABLE_LOGGING_BOOL "true")
|
||||
else()
|
||||
set(ZIG_ENABLE_LOGGING_BOOL "false")
|
||||
endif()
|
||||
|
||||
configure_file (
|
||||
"${CMAKE_SOURCE_DIR}/src/stage1/config.h.in"
|
||||
"${ZIG_CONFIG_H_OUT}"
|
||||
|
@ -1,7 +1,7 @@
|
||||
pub const have_llvm = true;
|
||||
pub const version: [:0]const u8 = "@ZIG_VERSION@";
|
||||
pub const semver = try @import("std").SemanticVersion.parse(version);
|
||||
pub const enable_logging: bool = false;
|
||||
pub const enable_logging: bool = @ZIG_ENABLE_LOGGING_BOOL@;
|
||||
pub const enable_tracy = false;
|
||||
pub const is_stage1 = true;
|
||||
pub const skip_non_native = false;
|
||||
|
Loading…
Reference in New Issue
Block a user