Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorlateralusX <lateralusx.github@gmail.com>2019-05-01 01:40:22 +0300
committerlateralusX <lateralusx.github@gmail.com>2019-05-03 16:14:21 +0300
commitf83d9f3575776a5c7edad336f21f5c70ce519bc4 (patch)
tree542e8bda3344cd2529943d862c38a2364719740f /llvm
parent231da41c789ccc8810452de516ffec0f9e5c34cf (diff)
Add LLVM SDK build/package support for Windows msvc build LLVM.
Diffstat (limited to 'llvm')
-rw-r--r--llvm/build_llvm_msbuild.bat94
-rw-r--r--llvm/build_llvm_msbuild.sh23
2 files changed, 117 insertions, 0 deletions
diff --git a/llvm/build_llvm_msbuild.bat b/llvm/build_llvm_msbuild.bat
new file mode 100644
index 00000000000..acca70734e3
--- /dev/null
+++ b/llvm/build_llvm_msbuild.bat
@@ -0,0 +1,94 @@
+:: Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
+
+:: Arguments:
+:: -------------------------------------------------------
+:: %1 Visual Studio target, build|clean, default build
+:: %2 Host CPU architecture, x86_64|i686, default x86_64
+:: %3 Visual Studio configuration, debug|release, default release
+:: %4 Mono MSVC source folder.
+:: %5 LLVM build directory.
+:: %6 LLVM install directory.
+:: %7 Additional arguments passed to msbuild, needs to be quoted if multiple.
+:: -------------------------------------------------------
+
+@echo off
+setlocal
+
+set BUILD_RESULT=1
+
+:: Get path for current running script.
+set RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH=%~dp0
+
+:: Configure all known build arguments.
+set VS_BUILD_ARGS=
+set VS_TARGET=build
+if /i "%~1" == "clean" (
+ set VS_TARGET="clean"
+)
+shift
+
+set VS_PLATFORM=x64
+if /i "%~1" == "i686" (
+ set VS_PLATFORM="Win32"
+)
+if /i "%~1" == "win32" (
+ set VS_PLATFORM="Win32"
+)
+shift
+
+set VS_CONFIGURATION=Release
+if /i "%~1" == "debug" (
+ set VS_CONFIGURATION="Debug"
+)
+shift
+
+set MONO_MSVC_SOURCE_DIR=%RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH%..\msvc\
+if not "%~1" == "" (
+ set MONO_MSVC_SOURCE_DIR=%~1
+)
+shift
+
+set MONO_LLVM_BUILD_DIR=
+if not "%~1" == "" (
+ set MONO_LLVM_BUILD_DIR=%~1
+)
+shift
+
+set MONO_LLVM_INSTALL_DIR=
+if not "%~1" == "" (
+ set MONO_LLVM_INSTALL_DIR=%~1
+)
+shift
+
+set "VS_ADDITIONAL_ARGUMENTS=/p:PlatformToolset=v140 /p:MONO_TARGET_GC=sgen"
+if not "%~1" == "" (
+ set VS_ADDITIONAL_ARGUMENTS=%~1
+)
+
+:: Setup Windows environment.
+call %MONO_MSVC_SOURCE_DIR%setup-windows-env.bat
+
+:: Setup VS msbuild environment.
+call %MONO_MSVC_SOURCE_DIR%setup-vs-msbuild-env.bat
+
+if not "%MONO_LLVM_BUILD_DIR%" == "" (
+ set VS_BUILD_ARGS=/p:_LLVMBuildDir="%MONO_LLVM_BUILD_DIR%"
+)
+
+if not "%MONO_LLVM_INSTALL_DIR%" == "" (
+ set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:_LLVMInstallDir="%MONO_LLVM_INSTALL_DIR%"
+)
+
+set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:MONO_ENABLE_LLVM=true /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% %VS_ADDITIONAL_ARGUMENTS% /t:%VS_TARGET%
+call msbuild.exe %VS_BUILD_ARGS% "%MONO_MSVC_SOURCE_DIR%build-external-llvm.vcxproj" && (
+ set BUILD_RESULT=0
+) || (
+ set BUILD_RESULT=1
+ if not %ERRORLEVEL% == 0 (
+ set BUILD_RESULT=%ERRORLEVEL%
+ )
+)
+
+exit /b %BUILD_RESULT%
+
+@echo on \ No newline at end of file
diff --git a/llvm/build_llvm_msbuild.sh b/llvm/build_llvm_msbuild.sh
new file mode 100644
index 00000000000..082d083370e
--- /dev/null
+++ b/llvm/build_llvm_msbuild.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
+
+# Arguments:
+# -------------------------------------------------------
+# $1 Visual Studio target, build|clean, default build
+# $2 Host CPU architecture, x86_64|i686, default x86_64
+# $3 Visual Studio configuration, debug|release, default release
+# $4 Mono MSVC source folder.
+# $5 LLVM build directory.
+# $6 LLVM install directory.
+# $7 Additional arguments passed to msbuild, needs to be quoted if multiple.
+# -------------------------------------------------------
+
+BUILD_LLVM_MSBUILD_SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd)
+
+BUILD_LLVM_MSBUILD_SCRIPT_PATH=$(cygpath -w "$BUILD_LLVM_MSBUILD_SCRIPT_PATH/build_llvm_msbuild.bat")
+MONO_MSVC_SOURCE_DIR=$(cygpath -w "$4")
+MONO_LLVM_BUILD_DIR=$(cygpath -w "$5")
+MONO_LLVM_INSTALL_DIR=$(cygpath -w "$6")
+
+"$WINDIR/System32/cmd.exe" /c "$BUILD_LLVM_MSBUILD_SCRIPT_PATH" "$1" "$2" "$3" "$MONO_MSVC_SOURCE_DIR" "$MONO_LLVM_BUILD_DIR" "$MONO_LLVM_INSTALL_DIR" "$7"