Skip to content

Commit 3c79dbb

Browse files
authored
build release compilers for Windows (checkedc#495)
This fixes the build automation scripts for Windows to actually build release versions of clang. We were relying on CMAKE_BUILD_TYPE, which is disregarded when cmake generates a build system for Visual Studio. The fix is to pass the build type in as an additional parameter to the msbuild invocations instead. This addresses issue checkedc#494, where the installed compiler required a debug version of the Windows CRT that isn't usually installed on Windows systems. Testing: - Build x86/x64 compiler installers.
1 parent 2e60ca6 commit 3c79dbb

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

automation/Windows/build-package.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cd %LLVM_OBJ_DIR%
1111
if "%BUILD_PACKAGE%" == "No" (goto succeeded)
1212

1313
echo.Building installation package for clang
14-
"%MSBUILD_BIN%" PACKAGE.vcxproj /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
14+
"%MSBUILD_BIN%" PACKAGE.vcxproj /p:Configuration=%BUILDCONFIGURATION% /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
1515
if ERRORLEVEL 1 (goto cmdfailed)
1616

1717
rem Put the installer executable in its own subdirectory. The VSTS build

automation/Windows/run-cmake.bat

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if "%TEST_TARGET_ARCH%"=="AMD64" (
1010

1111
if "%BUILD_PACKAGE%"=="Yes" (
1212
if "%BUILDCONFIGURATION%"=="Release" (
13-
set EXTRA_FLAGS="DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DLLVM_USE_CRT_RELEASE=MT"
13+
set EXTRA_FLAGS="-DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DLLVM_USE_CRT_RELEASE=MT"
1414
) else (
1515
set EXTRA_FLAGS=
1616
)
@@ -21,7 +21,9 @@ if "%BUILD_PACKAGE%"=="Yes" (
2121
set OLD_DIR=%CD%
2222

2323
cd %LLVM_OBJ_DIR%
24-
cmake %CMAKE_GENERATOR% -T "host=x64" %EXTRA_FLAGS% -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DCMAKE_BUILD_TYPE=%BUILDCONFIGURATION% %BUILD_SOURCESDIRECTORY%\llvm
24+
rem This generates a build system that supports multiple configurations. Don't try setting CMAKE_BUILD_TYPE here
25+
rem because it is ignored.
26+
cmake %CMAKE_GENERATOR% -T "host=x64" %EXTRA_FLAGS% -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON %BUILD_SOURCESDIRECTORY%\llvm
2527
if ERRORLEVEL 1 (goto cmdfailed)
2628

2729
:succeeded

automation/Windows/test-clang.bat

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ cd %LLVM_OBJ_DIR%
1212
if "%SKIP_CHECKEDC_TESTS%"=="Yes" (
1313
rem
1414
) else (
15-
"%MSBUILD_BIN%" projects\checkedc-wrapper\check-checkedc.vcxproj /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
15+
"%MSBUILD_BIN%" projects\checkedc-wrapper\check-checkedc.vcxproj /p:Configuration=%BUILDCONFIGURATION% /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
1616
if ERRORLEVEL 1 (goto cmdfailed)
1717
)
1818

1919
if "%TEST_SUITE%"=="CheckedC" (
2020
rem
2121
) else if "%TEST_SUITE%"=="CheckedC_clang" (
22-
"%MSBUILD_BIN%" tools\clang\test\check-clang.vcxproj /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
22+
"%MSBUILD_BIN%" tools\clang\test\check-clang.vcxproj /p:Configuration=%BUILDCONFIGURATION% /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
2323
if ERRORLEVEL 1 (goto cmdfailed)
2424
) else if "%TEST_SUITE%"=="CheckedC_LLVM" (
25-
"%MSBUILD_BIN%" check-all.vcxproj /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
25+
"%MSBUILD_BIN%" check-all.vcxproj /p:Configuration=%BUILDCONFIGURATION% /v:%MSBUILD_VERBOSITY% /maxcpucount:%MSBUILD_CPU_COUNT% /p:CL_MPCount=%CL_CPU_COUNT%
2626
if ERRORLEVEL 1 (goto cmdfailed)
2727
)
2828

0 commit comments

Comments
 (0)