authorgravatar for bratishkaerik@getgoogleoff.meEric Joldasov <bratishkaerik@getgoogleoff.me> 2023-01-10 13:20:40+06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-30 16:31:30-07:00
log339cae7fd0af5730673fcba7d97568af24b5aa4f
treedb25ab71853a1b5a38a63a56968554868d3d9598
parent91b4729962ddec96d1ee60d742326da828dae94a

cmake: install zig to 'build_dir/stage3' during building

This commit installs Zig to "build_dir/stage3" during building so that distros' can easily find binary and use it for testing/etc. This commit also splits "add_custom_target(stage3 ALL" and command that it invokes, so that it won't retry it during installation, as target will be considered not out-of-date. See also https://www.github.com/ziglang/zig/issues/14240#issuecomment-1374642063

2 files changed, 6 insertions(+), 5 deletions(-)

CMakeLists.txt+6-2
......@@ -860,8 +860,12 @@ set(ZIG_BUILD_ARGS
860860)
861861
862862add_custom_target(stage3 ALL
863 COMMAND zig2 build compile ${ZIG_BUILD_ARGS}
864 DEPENDS zig2
863 DEPENDS "${CMAKE_BINARY_DIR}/stage3/bin/zig"
864)
865
866add_custom_command(
867 OUTPUT "${CMAKE_BINARY_DIR}/stage3/bin/zig"
868 COMMAND zig2 build --prefix "${CMAKE_BINARY_DIR}/stage3" ${ZIG_BUILD_ARGS}
865869 COMMENT STATUS "Building stage3"
866870 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
867871)
build.zig-3
......@@ -179,9 +179,6 @@ pub fn build(b: *std.Build) !void {
179179 exe.entitlements = entitlements;
180180 b.installArtifact(exe);
181181
182 const compile_step = b.step("compile", "Build the self-hosted compiler");
183 compile_step.dependOn(&exe.step);
184
185182 test_step.dependOn(&exe.step);
186183
187184 exe.single_threaded = single_threaded;