Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully static stage1 compiler on windows #3467

Merged
merged 4 commits into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ if(NOT CMAKE_INSTALL_PREFIX)
"Directory to install zig to" FORCE)
endif()

set(CMAKE_USER_MAKE_RULES_OVERRIDE
${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)

project(zig C CXX)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})


set(ZIG_VERSION_MAJOR 0)
set(ZIG_VERSION_MINOR 5)
set(ZIG_VERSION_PATCH 0)
Expand Down
4 changes: 2 additions & 2 deletions ci/azure/windows_install
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ set -e
pacman -Su --needed --noconfirm
pacman -S --needed --noconfirm wget p7zip python3-pip
pip install s3cmd
wget -nv "https://ziglang.org/deps/llvm%2bclang-9.0.0-win64-msvc-release.tar.xz"
tar xf llvm+clang-9.0.0-win64-msvc-release.tar.xz
wget -nv "https://ziglang.org/deps/llvm%2bclang-9.0.0-win64-msvc-mt.tar.xz"
tar xf llvm+clang-9.0.0-win64-msvc-mt.tar.xz
7 changes: 3 additions & 4 deletions ci/azure/windows_script.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ SET "MSYSTEM=%PREVMSYSTEM%"

SET "ZIGBUILDDIR=%SRCROOT%\build"
SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist"
SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang-9.0.0-win64-msvc-release"
SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang-9.0.0-win64-msvc-mt"

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64

mkdir %ZIGBUILDDIR%
cd %ZIGBUILDDIR%
REM Here we use MinSizeRel instead of Release to work around https://github.com/ziglang/zig/issues/3024
cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=MinSizeRel || exit /b
msbuild /maxcpucount /p:Configuration=MinSizeRel INSTALL.vcxproj || exit /b
cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b
msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b

"%ZIGINSTALLDIR%\bin\zig.exe" build test || exit /b

Expand Down
13 changes: 13 additions & 0 deletions cmake/c_flag_overrides.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(MSVC)
set(CMAKE_C_FLAGS_DEBUG_INIT
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")

set(CMAKE_C_FLAGS_MINSIZEREL_INIT
"/MT /O1 /Ob1 /D NDEBUG")

set(CMAKE_C_FLAGS_RELEASE_INIT
"/MT /O2 /Ob1 /D NDEBUG")

set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT
"/MT /Zi /O2 /Ob1 /D NDEBUG")
endif()
13 changes: 13 additions & 0 deletions cmake/cxx_flag_overrides.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG_INIT
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")

set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT
"/MT /O1 /Ob1 /D NDEBUG")

set(CMAKE_CXX_FLAGS_RELEASE_INIT
"/MT /O2 /Ob1 /D NDEBUG")

set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT
"/MT /Zi /O2 /Ob1 /D NDEBUG")
endif()