diff options
author | lateralusX <lateralusx.github@gmail.com> | 2018-11-12 18:26:17 +0300 |
---|---|---|
committer | lateralusX <lateralusx.github@gmail.com> | 2018-11-12 18:28:23 +0300 |
commit | 9728edf5cccd482fc2e39129cb3d5c8821ab1641 (patch) | |
tree | 88a76afaa095aa16b827fe29018e7e29d8bface2 | |
parent | 269d02cf5b3c906954bbba944fc9d5918fa1ad75 (diff) |
Align LLVM/BTLS Visual Studio external builds.
-rw-r--r-- | msvc/build-external-btls.bat | 77 | ||||
-rw-r--r-- | msvc/build-external-btls.vcxproj | 2 | ||||
-rw-r--r-- | msvc/build-external-llvm.bat | 4 | ||||
-rw-r--r-- | msvc/mono.external.targets | 4 | ||||
-rw-r--r-- | msvc/mono.props | 8 |
5 files changed, 49 insertions, 46 deletions
diff --git a/msvc/build-external-btls.bat b/msvc/build-external-btls.bat index 6b647fc7f14..042cdcac924 100644 --- a/msvc/build-external-btls.bat +++ b/msvc/build-external-btls.bat @@ -4,14 +4,15 @@ :: When executed from withing Visual Studio build environment current
:: build environment will be inherited by script.
::
-:: %1 Mono source root directory.
-:: %2 Mono build root directory.
-:: %3 Mono distribution root directory.
-:: %4 VS CFLAGS.
-:: %5 VS platform (Win32/x64)
-:: %6 VS configuration (Debug/Release)
-:: %7 VS target
-:: %8 MsBuild bin path, if used.
+:: %1 Mono BTLS source root directory.
+:: %2 BTLS source root directory.
+:: %3 BTLS build root directory.
+:: %4 Mono distribution root directory.
+:: %5 VS CFLAGS.
+:: %6 VS platform (Win32/x64)
+:: %7 VS configuration (Debug/Release)
+:: %8 VS target
+:: %9 MsBuild bin path, if used.
:: --------------------------------------------------
@echo off
@@ -28,14 +29,15 @@ set NINJA_BIN_NAME=ninja.exe set PERL_BIN_NAME=perl.exe
set YASM_BIN_NAME=yasm.exe
-set MONO_DIR=%~1
-set MONO_BUILD_DIR=%~2
-set MONO_DIST_DIR=%~3
-set VS_CFLAGS=%~4
-set VS_PLATFORM=%~5
-set VS_CONFIGURATION=%~6
-set VS_TARGET=%~7
-set MSBUILD_BIN_PATH=%~8
+set MONO_BTLS_DIR=%~1
+set BTLS_DIR=%~2
+set BTLS_BUILD_DIR=%~3
+set MONO_DIST_DIR=%~4
+set VS_CFLAGS=%~5
+set VS_PLATFORM=%~6
+set VS_CONFIGURATION=%~7
+set VS_TARGET=%~8
+set MSBUILD_BIN_PATH=%~9
:: Setup toolchain.
:: set GIT=
@@ -43,13 +45,18 @@ set MSBUILD_BIN_PATH=%~8 :: set NINJA=
set MSBUILD=%MSBUILD_BIN_PATH%msbuild.exe
-if "%MONO_DIR%" == "" (
- echo Missing mono source directory argument.
+if "%MONO_BTLS_DIR%" == "" (
+ echo Missing mono BTLS source directory argument.
goto ECHO_USAGE
)
-if "%MONO_BUILD_DIR%" == "" (
- echo Missing mono build directory argument.
+if "%BTLS_DIR%" == "" (
+ echo Missing BTLS source directory argument.
+ goto ECHO_USAGE
+)
+
+if "%BTLS_BUILD_DIR%" == "" (
+ echo Missing BTLS build directory argument.
goto ECHO_USAGE
)
@@ -75,20 +82,13 @@ if "%VS_TARGET%" == "" ( set VS_TARGET=Build
)
-if not exist %MONO_DIR% (
- echo Could not find "%MONO_DIR%".
- goto ON_ERROR
-)
-
-set BTLS_ROOT_PATH=%MONO_DIR%\external\boringssl
-if not exist %BTLS_ROOT_PATH% (
- echo Could not find "%BTLS_ROOT_PATH%".
+if not exist "%MONO_BTLS_DIR%" (
+ echo Could not find "%MONO_BTLS_DIR%".
goto ON_ERROR
)
-set MONO_BTLS_ROOT_PATH=%MONO_DIR%\mono\btls
-if not exist %MONO_BTLS_ROOT_PATH% (
- echo Could not find "%MONO_BTLS_ROOT_PATH%".
+if not exist "%BTLS_DIR%" (
+ echo Could not find "%BTLS_DIR%".
goto ON_ERROR
)
@@ -99,7 +99,6 @@ if /i "%VS_PLATFORM%" == "win32" ( )
set BTLS_NO_ASM_SUPPORT=1
-set BTLS_BUILD_DIR=%MONO_BUILD_DIR%
:: Check if executed from VS2015/VS2017 build environment.
if "%VisualStudioVersion%" == "14.0" (
@@ -181,7 +180,7 @@ if "%GIT%" == "" ( :: Make sure boringssl submodule is up to date.
pushd
-cd %MONO_BTLS_ROOT_PATH%
+cd "%BTLS_DIR%"
echo Updating boringssl submodule.
"%GIT%" submodule update --init
if not ERRORLEVEL == 0 (
@@ -210,15 +209,15 @@ if /i "%CMAKE_GENERATOR%" == "ninja" ( :: Run cmake.
"%CMAKE%" ^
--D BTLS_ROOT:PATH="%BTLS_ROOT_PATH%" ^
--D SRC_DIR:PATH="%MONO_BTLS_ROOT_PATH%" ^
+-D BTLS_ROOT:PATH="%BTLS_DIR%" ^
+-D SRC_DIR:PATH="%MONO_BTLS_DIR%" ^
-D BTLS_CFLAGS="%BTLS_CFLAGS%" ^
-D OPENSSL_NO_ASM=%BTLS_NO_ASM_SUPPORT% ^
-D BTLS_ARCH="%BTLS_ARCH%" ^
-D BUILD_SHARED_LIBS=1 ^
%BTLS_BUILD_TYPE% ^
-G "%CMAKE_GENERATOR%" ^
-"%MONO_BTLS_ROOT_PATH%"
+"%MONO_BTLS_DIR%"
if not ERRORLEVEL == 0 (
goto ON_ERROR
@@ -231,7 +230,7 @@ if /i "%CMAKE_GENERATOR%" == "ninja" ( )
) else (
:: Build BTLS using msbuild build system.
- call "%MSBUILD%" mono-btls.sln /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% /t:%VS_TARGET% || (
+ call "%MSBUILD%" mono-btls.sln /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% /t:%VS_TARGET% /m:4 || (
goto ON_ERROR
)
)
@@ -244,7 +243,7 @@ if not exist "%BTLS_BUILD_OUTPUT_DIR%\libmono-btls-shared.dll" ( )
:: Make sure build output folder exists.
-if not exist %MONO_DIST_DIR% (
+if not exist "%MONO_DIST_DIR%" (
echo Could not find "%MONO_DIST_DIR%", creating folder for build output.
mkdir "%MONO_DIST_DIR%"
)
@@ -279,7 +278,7 @@ set BUILD_RESULT=0 goto ON_EXIT
:ECHO_USAGE:
- ECHO Usage: build-btls.bat [mono_src_dir] [mono_build_dir] [mono_dist_dir] [vs_cflags] [vs_plaform] [vs_configuration].
+ ECHO Usage: build-btls.bat [mono_btls_src_dir] [btls_src_dir] [btls_build_dir] [mono_dist_dir] [vs_cflags] [vs_plaform] [vs_configuration].
:ON_ERROR
echo Failed to build BTLS.
diff --git a/msvc/build-external-btls.vcxproj b/msvc/build-external-btls.vcxproj index bbb2357067d..b3eddb01ed3 100644 --- a/msvc/build-external-btls.vcxproj +++ b/msvc/build-external-btls.vcxproj @@ -152,7 +152,7 @@ <_BtlsCFlags Condition="'$(MONO_PREPROCESSOR_DEFINITIONS)' != ''">$(MONO_PREPROCESSOR_DEFINITIONS.Replace(";"," "))</_BtlsCFlags>
<_BtlsCFlags>$(_BtlsCFlags.Trim())</_BtlsCFlags>
<_BtlsCFlags Condition="'$(_BtlsCFlags)' != ''">-D$(_BtlsCFlags.Replace(" "," -D"))</_BtlsCFlags>
- <_BtlsBuildCommand>build-external-btls.bat "$(MONO_DIR)" "$(_BtlsBuildDir)" "$(OutDir)" "$(_BtlsCFlags)" "$(Platform)" "$(Configuration)"</_BtlsBuildCommand>
+ <_BtlsBuildCommand>build-external-btls.bat "$(_MonoBtlsSourceDir)" "$(_BtlsSourceDir)" "$(_BtlsBuildDir)" "$(_MonoOutputDir)" "$(_BtlsCFlags)" "$(Platform)" "$(Configuration)"</_BtlsBuildCommand>
</PropertyGroup>
<Target Name="_AfterBuildExternalBtls" Condition="'$(MONO_ENABLE_BTLS)' == 'true'">
<Exec Command="$(_BtlsBuildCommand) "Build" "$(MSBuildBinPath)\"">
diff --git a/msvc/build-external-llvm.bat b/msvc/build-external-llvm.bat index 508bc0a1810..70d9ff52ff3 100644 --- a/msvc/build-external-llvm.bat +++ b/msvc/build-external-llvm.bat @@ -81,7 +81,7 @@ if "%VS_TARGET%" == "" ( set VS_TARGET=Build
)
-if not exist %LLVM_DIR% (
+if not exist "%LLVM_DIR%" (
echo Could not find "%LLVM_DIR%".
goto ON_ERROR
)
@@ -172,7 +172,7 @@ if "%GIT%" == "" ( :: Make sure llvm submodule is up to date.
pushd
-cd %LLVM_DIR%
+cd "%LLVM_DIR%"
echo Updating llvm submodule.
"%GIT%" submodule update --init
if not ERRORLEVEL == 0 (
diff --git a/msvc/mono.external.targets b/msvc/mono.external.targets index 9551a71e9b0..5e2a3eed2bd 100644 --- a/msvc/mono.external.targets +++ b/msvc/mono.external.targets @@ -103,13 +103,15 @@ </PropertyGroup> <PropertyGroup> - <_LLVMSourceDir>$(MONO_INTERNAL_LLVM_SOURCE_DIR)</_LLVMSourceDir> + <_LLVMSourceDir Condition="'$(_LLVMSourceDir)' == ''">$(MONO_INTERNAL_LLVM_SOURCE_DIR)</_LLVMSourceDir> <_LLVMSourceDir Condition="'$(_LLVMSourceDir)' == ''">$(_MonoSourceDir)\external\llvm</_LLVMSourceDir> <_LLVMBuildDir>$([System.IO.Path]::GetFullPath('$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\external\llvm-build\$(Configuration)'))</_LLVMBuildDir> <_LLVMInstallDir>$(_LLVMBuildDir)\install</_LLVMInstallDir> </PropertyGroup> <PropertyGroup> + <_BtlsSourceDir Condition="'$(_BtlsSourceDir)' == ''">$(_MonoSourceDir)\external\boringssl</_BtlsSourceDir> + <_MonoBtlsSourceDir>$(_MonoSourceDir)\mono\btls</_MonoBtlsSourceDir> <_BtlsBuildDir>$([System.IO.Path]::GetFullPath('$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\external\btls-build-shared\$(Configuration)'))</_BtlsBuildDir> </PropertyGroup> diff --git a/msvc/mono.props b/msvc/mono.props index 2de8f1851c4..26ae7abcde1 100644 --- a/msvc/mono.props +++ b/msvc/mono.props @@ -23,6 +23,8 @@ <MONO_EXTERNAL_LLVM_CONFIG></MONO_EXTERNAL_LLVM_CONFIG> <!-- When true, ported mono projects will build using C++ instead of C compiler. When false, all project will be build using the default compiler. --> <MONO_COMPILE_AS_CPP>false</MONO_COMPILE_AS_CPP> + <!-- When true, mono binaries will link and include BTLS. When false, mono binaries will not link and include BTLS. --> + <MONO_ENABLE_BTLS>false</MONO_ENABLE_BTLS> </PropertyGroup> <PropertyGroup Label="MonoDirectories"> <MonoSourceLocation Condition="'$(MonoSourceLocation)' == '' ">..</MonoSourceLocation> @@ -81,9 +83,6 @@ <BuildMacro Include="MONO_INSTALL_DIR_PREFIX"> <Value>$(MONO_INSTALL_DIR_PREFIX)</Value> </BuildMacro> - <BuildMacro Include="MONO_LLVM_INSTALL_DIR_PREFIX"> - <Value>$(MONO_LLVM_INSTALL_DIR_PREFIX)</Value> - </BuildMacro> <BuildMacro Include="MONO_TARGET_GC"> <Value>$(MONO_TARGET_GC)</Value> </BuildMacro> @@ -108,6 +107,9 @@ <BuildMacro Include="MONO_COMPILE_AS_CPP"> <Value>$(MONO_COMPILE_AS_CPP)</Value> </BuildMacro> + <BuildMacro Include="MONO_ENABLE_BTLS"> + <Value>$(MONO_ENABLE_BTLS)</Value> + </BuildMacro> </ItemGroup> <PropertyGroup Label="MonoDefaultPreprocessorDefinitions"> <MONO_PREPROCESSOR_DEFINITIONS>__default_codegen__;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;GC_NOT_DLL;WIN32_THREADS;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;_UNICODE;UNICODE;FD_SETSIZE=1024;NVALGRIND;$(MONO_ADDITIONAL_PREPROCESSOR_DEFINITIONS)</MONO_PREPROCESSOR_DEFINITIONS> |