build libuserland in cross compilation mode

Previously libuserland was being built for the native target,
which could depend on native CPU features such as AVX. The
CI infrastructure is intending to create binaries that are
widely compatible and do not make use of specific CPU features.

There could be something to gain from enabling native CPU features
sometimes, by introducing a new cmake configuration option, but
since it's planned to eventually ship self-hosted rather than stage1,
I don't think it really matters.

closes #2348
master
Andrew Kelley 2019-04-24 14:13:55 -04:00
parent e4a86d4653
commit ed41955522
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 2 additions and 0 deletions

View File

@ -6701,6 +6701,7 @@ add_custom_command(
DEPENDS
"${CMAKE_SOURCE_DIR}/src-self-hosted/stage1.zig"
"${CMAKE_SOURCE_DIR}/src-self-hosted/translate_c.zig"
"${CMAKE_SOURCE_DIR}/build.zig"
)
add_custom_target(userland_target DEPENDS "${LIBUSERLAND}")
add_executable(zig "${ZIG_MAIN_SRC}")

View File

@ -389,6 +389,7 @@ fn addLibUserlandStep(b: *Builder) void {
else
b.addStaticLibrary("userland", "src-self-hosted/stage1.zig");
artifact.disable_gen_h = true;
artifact.setTarget(builtin.arch, builtin.os, builtin.abi);
artifact.linkSystemLibrary("c");
const libuserland_step = b.step("libuserland", "Build the userland compiler library for use in stage1");
libuserland_step.dependOn(&artifact.step);