From ed419555229a6d93eb7b08950620f86641f44d92 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 24 Apr 2019 14:13:55 -0400 Subject: [PATCH] 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 --- CMakeLists.txt | 1 + build.zig | 1 + 2 files changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f6ee5a852f1c46c5200e00c35b2fb096fa2995c..41aa75def2db7d1fca67ce668e8bbb1e2597776e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/build.zig b/build.zig index 733f2e68d27587d8a03f1a46c0b9381bf8415032..d9456e0d287bcae33b62e694ae74f012663574e2 100644 --- a/build.zig +++ b/build.zig @@ -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); -- 2.54.0