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...@@ -860,8 +860,12 @@ set(ZIG_BUILD_ARGS
860)860)
861861
862add_custom_target(stage3 ALL862add_custom_target(stage3 ALL
863 COMMAND zig2 build compile ${ZIG_BUILD_ARGS}863 DEPENDS "${CMAKE_BINARY_DIR}/stage3/bin/zig"
864 DEPENDS zig2864)
865
866add_custom_command(
867 OUTPUT "${CMAKE_BINARY_DIR}/stage3/bin/zig"
868 COMMAND zig2 build --prefix "${CMAKE_BINARY_DIR}/stage3" ${ZIG_BUILD_ARGS}
865 COMMENT STATUS "Building stage3"869 COMMENT STATUS "Building stage3"
866 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"870 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
867)871)
build.zig-3
...@@ -179,9 +179,6 @@ pub fn build(b: *std.Build) !void {...@@ -179,9 +179,6 @@ pub fn build(b: *std.Build) !void {
179 exe.entitlements = entitlements;179 exe.entitlements = entitlements;
180 b.installArtifact(exe);180 b.installArtifact(exe);
181181
182 const compile_step = b.step("compile", "Build the self-hosted compiler");
183 compile_step.dependOn(&exe.step);
184
185 test_step.dependOn(&exe.step);182 test_step.dependOn(&exe.step);
186183
187 exe.single_threaded = single_threaded;184 exe.single_threaded = single_threaded;