| author | |
| committer | |
| log | 913b4a3f19955296a892ffe4f148f8c097a7732a |
| tree | 564c5ac6d5f2014c3f7df862f30eb78ec20b2c42 |
| parent | 096d3efae5fcaa5640f4acb2f9be2d7f93f7fdb2 |
| parent | 1122d9d212f2147e12675eb86565d63d2b0949a5 |
| signature | Signed by PGP key 4AEE18F83AFDEB23 |
CI: make Windows build from source like every other system3 files changed, 65 insertions(+), 39 deletions(-)
build.zig+24-7| ... | ... | @@ -280,6 +280,13 @@ pub fn build(b: *Builder) !void { |
| 280 | 280 | try addStaticLlvmOptionsToExe(exe); |
| 281 | 281 | try addStaticLlvmOptionsToExe(test_cases); |
| 282 | 282 | } |
| 283 | if (target.isWindows()) { | |
| 284 | inline for (.{ exe, test_cases }) |artifact| { | |
| 285 | artifact.linkSystemLibrary("version"); | |
| 286 | artifact.linkSystemLibrary("uuid"); | |
| 287 | artifact.linkSystemLibrary("ole32"); | |
| 288 | } | |
| 289 | } | |
| 283 | 290 | } |
| 284 | 291 | |
| 285 | 292 | const semver = try std.SemanticVersion.parse(version); |
| ... | ... | @@ -537,7 +544,11 @@ fn addCmakeCfgOptionsToExe( |
| 537 | 544 | exe.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{ |
| 538 | 545 | cfg.cmake_binary_dir, |
| 539 | 546 | "zigcpp", |
| 540 | b.fmt("{s}{s}{s}", .{ exe.target.libPrefix(), "zigcpp", exe.target.staticLibSuffix() }), | |
| 547 | b.fmt("{s}{s}{s}", .{ | |
| 548 | cfg.cmake_static_library_prefix, | |
| 549 | "zigcpp", | |
| 550 | cfg.cmake_static_library_suffix, | |
| 551 | }), | |
| 541 | 552 | }) catch unreachable); |
| 542 | 553 | assert(cfg.lld_include_dir.len != 0); |
| 543 | 554 | exe.addIncludePath(cfg.lld_include_dir); |
| ... | ... | @@ -610,12 +621,6 @@ fn addStaticLlvmOptionsToExe(exe: *std.build.LibExeObjStep) !void { |
| 610 | 621 | |
| 611 | 622 | // This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries. |
| 612 | 623 | exe.linkSystemLibrary("c++"); |
| 613 | ||
| 614 | if (exe.target.getOs().tag == .windows) { | |
| 615 | exe.linkSystemLibrary("version"); | |
| 616 | exe.linkSystemLibrary("uuid"); | |
| 617 | exe.linkSystemLibrary("ole32"); | |
| 618 | } | |
| 619 | 624 | } |
| 620 | 625 | |
| 621 | 626 | fn addCxxKnownPath( |
| ... | ... | @@ -669,6 +674,8 @@ const CMakeConfig = struct { |
| 669 | 674 | llvm_linkage: std.build.LibExeObjStep.Linkage, |
| 670 | 675 | cmake_binary_dir: []const u8, |
| 671 | 676 | cmake_prefix_path: []const u8, |
| 677 | cmake_static_library_prefix: []const u8, | |
| 678 | cmake_static_library_suffix: []const u8, | |
| 672 | 679 | cxx_compiler: []const u8, |
| 673 | 680 | lld_include_dir: []const u8, |
| 674 | 681 | lld_libraries: []const u8, |
| ... | ... | @@ -732,6 +739,8 @@ fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig { |
| 732 | 739 | .llvm_linkage = undefined, |
| 733 | 740 | .cmake_binary_dir = undefined, |
| 734 | 741 | .cmake_prefix_path = undefined, |
| 742 | .cmake_static_library_prefix = undefined, | |
| 743 | .cmake_static_library_suffix = undefined, | |
| 735 | 744 | .cxx_compiler = undefined, |
| 736 | 745 | .lld_include_dir = undefined, |
| 737 | 746 | .lld_libraries = undefined, |
| ... | ... | @@ -751,6 +760,14 @@ fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig { |
| 751 | 760 | .prefix = "#define ZIG_CMAKE_PREFIX_PATH ", |
| 752 | 761 | .field = "cmake_prefix_path", |
| 753 | 762 | }, |
| 763 | .{ | |
| 764 | .prefix = "#define ZIG_CMAKE_STATIC_LIBRARY_PREFIX ", | |
| 765 | .field = "cmake_static_library_prefix", | |
| 766 | }, | |
| 767 | .{ | |
| 768 | .prefix = "#define ZIG_CMAKE_STATIC_LIBRARY_SUFFIX ", | |
| 769 | .field = "cmake_static_library_suffix", | |
| 770 | }, | |
| 754 | 771 | .{ |
| 755 | 772 | .prefix = "#define ZIG_CXX_COMPILER ", |
| 756 | 773 | .field = "cxx_compiler", |
ci/x86_64-windows.ps1+35-28| ... | ... | @@ -1,20 +1,18 @@ |
| 1 | 1 | $TARGET = "$($Env:ARCH)-windows-gnu" |
| 2 | 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e" |
| 3 | $MCPU = "baseline" | |
| 3 | 4 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" |
| 5 | $PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | |
| 6 | $ZIG = "$PREFIX_PATH\bin\zig.exe" | |
| 7 | $ZIG_LIB_DIR = "$(Get-Location)\lib" | |
| 4 | 8 | |
| 5 | 9 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" |
| 6 | ||
| 7 | 10 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" |
| 8 | 11 | |
| 9 | 12 | Write-Output "Extracting..." |
| 10 | ||
| 11 | 13 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; |
| 12 | 14 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") |
| 13 | 15 | |
| 14 | Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib" | |
| 15 | Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release" | |
| 16 | Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | |
| 17 | ||
| 18 | 16 | function CheckLastExitCode { |
| 19 | 17 | if (!$?) { |
| 20 | 18 | exit 1 |
| ... | ... | @@ -31,32 +29,41 @@ if ((git rev-parse --is-shallow-repository) -eq "true") { |
| 31 | 29 | git fetch --unshallow # `git describe` won't work on a shallow repo |
| 32 | 30 | } |
| 33 | 31 | |
| 34 | Write-Output "Building Zig..." | |
| 32 | Write-Output "Building from source..." | |
| 33 | Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore | |
| 34 | New-Item -Path 'build-release' -ItemType Directory | |
| 35 | Set-Location -Path 'build-release' | |
| 35 | 36 | |
| 36 | & "$ZIGPREFIXPATH\bin\zig.exe" build ` | |
| 37 | --prefix "$ZIGINSTALLDIR" ` | |
| 38 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 39 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 40 | -Dstatic-llvm ` | |
| 41 | -Drelease ` | |
| 42 | -Duse-zig-libcxx ` | |
| 43 | -Dtarget="$TARGET" | |
| 37 | # CMake gives a syntax error when file paths with backward slashes are used. | |
| 38 | # Here, we use forward slashes only to work around this. | |
| 39 | & cmake .. ` | |
| 40 | -GNinja ` | |
| 41 | -DCMAKE_INSTALL_PREFIX="stage3-release" ` | |
| 42 | -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" ` | |
| 43 | -DCMAKE_BUILD_TYPE=Release ` | |
| 44 | -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" ` | |
| 45 | -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" ` | |
| 46 | -DZIG_TARGET_TRIPLE="$TARGET" ` | |
| 47 | -DZIG_TARGET_MCPU="$MCPU" ` | |
| 48 | -DZIG_STATIC=ON | |
| 44 | 49 | CheckLastExitCode |
| 45 | 50 | |
| 46 | Write-Output " zig build test docs..." | |
| 47 | ||
| 48 | & "$ZIGINSTALLDIR\bin\zig.exe" build test docs ` | |
| 49 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 50 | -Dstatic-llvm ` | |
| 51 | -Dskip-non-native ` | |
| 52 | -Denable-symlinks-windows | |
| 51 | ninja install | |
| 53 | 52 | CheckLastExitCode |
| 54 | 53 | |
| 55 | # Produce the experimental std lib documentation. | |
| 56 | Write-Output "zig test std/std.zig..." | |
| 54 | Write-Output "Main test suite..." | |
| 55 | & "stage3-release\bin\zig.exe" build test docs ` | |
| 56 | --zig-lib-dir "$ZIG_LIB_DIR" ` | |
| 57 | --search-prefix "$PREFIX_PATH" ` | |
| 58 | -Dstatic-llvm ` | |
| 59 | -Dskip-non-native ` | |
| 60 | -Denable-symlinks-windows | |
| 61 | CheckLastExitCode | |
| 57 | 62 | |
| 58 | & "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" ` | |
| 59 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 60 | -femit-docs ` | |
| 61 | -fno-emit-bin | |
| 63 | Write-Output "Testing Autodocs..." | |
| 64 | & "stage3-release\bin\zig.exe" test "..\lib\std\std.zig" ` | |
| 65 | --zig-lib-dir "$ZIG_LIB_DIR" ` | |
| 66 | -femit-docs ` | |
| 67 | -fno-emit-bin | |
| 62 | 68 | CheckLastExitCode |
| 69 |
stage1/config.h.in+6-4| ... | ... | @@ -15,16 +15,18 @@ |
| 15 | 15 | #define ZIG_VERSION_STRING "@ZIG_VERSION@" |
| 16 | 16 | |
| 17 | 17 | // Used by build.zig for communicating build information to self hosted build. |
| 18 | #define ZIG_CLANG_LIBRARIES "@CLANG_LIBRARIES@" | |
| 18 | 19 | #define ZIG_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@" |
| 19 | #define ZIG_LLVM_LINK_MODE "@LLVM_LINK_MODE@" | |
| 20 | 20 | #define ZIG_CMAKE_PREFIX_PATH "@ZIG_CMAKE_PREFIX_PATH@" |
| 21 | #define ZIG_CMAKE_STATIC_LIBRARY_PREFIX "@CMAKE_STATIC_LIBRARY_PREFIX@" | |
| 22 | #define ZIG_CMAKE_STATIC_LIBRARY_SUFFIX "@CMAKE_STATIC_LIBRARY_SUFFIX@" | |
| 21 | 23 | #define ZIG_CXX_COMPILER "@CMAKE_CXX_COMPILER@" |
| 24 | #define ZIG_DIA_GUIDS_LIB "@ZIG_DIA_GUIDS_LIB_ESCAPED@" | |
| 22 | 25 | #define ZIG_LLD_INCLUDE_PATH "@LLD_INCLUDE_DIRS@" |
| 23 | 26 | #define ZIG_LLD_LIBRARIES "@LLD_LIBRARIES@" |
| 24 | #define ZIG_CLANG_LIBRARIES "@CLANG_LIBRARIES@" | |
| 25 | 27 | #define ZIG_LLVM_INCLUDE_PATH "@LLVM_INCLUDE_DIRS@" |
| 26 | #define ZIG_LLVM_LIB_PATH "@LLVM_LIBDIRS@" | |
| 27 | 28 | #define ZIG_LLVM_LIBRARIES "@LLVM_LIBRARIES@" |
| 28 | #define ZIG_DIA_GUIDS_LIB "@ZIG_DIA_GUIDS_LIB_ESCAPED@" | |
| 29 | #define ZIG_LLVM_LIB_PATH "@LLVM_LIBDIRS@" | |
| 30 | #define ZIG_LLVM_LINK_MODE "@LLVM_LINK_MODE@" | |
| 29 | 31 | |
| 30 | 32 | #endif |