From 4da174e02af4116c077fe8d505f56d797d58c9a1 Mon Sep 17 00:00:00 2001 From: lateralusX Date: Fri, 8 Nov 2019 09:39:07 +0100 Subject: [PATCH] Fix Windows LLVM build using new repository structure. Commit migrated from https://github.com/mono/mono/commit/fad91a1c1e09df85040f8772d91eb6a5369303b4 --- src/mono/msvc/build-external-btls.bat | 1 + src/mono/msvc/build-external-llvm.bat | 10 +++++++++- src/mono/msvc/mono.external.targets | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mono/msvc/build-external-btls.bat b/src/mono/msvc/build-external-btls.bat index bd85f76..216134c 100755 --- a/src/mono/msvc/build-external-btls.bat +++ b/src/mono/msvc/build-external-btls.bat @@ -235,6 +235,7 @@ if "%GIT%" == "" ( ) :: Make sure boringssl submodule is up to date. +echo Updating submodule "%BTLS_DIR%" "%GIT%" submodule update --init -- "%BTLS_DIR%" if not ERRORLEVEL == 0 ( "%GIT%" submodule init -- "%BTLS_DIR%" diff --git a/src/mono/msvc/build-external-llvm.bat b/src/mono/msvc/build-external-llvm.bat index 04cdd1c..6976818 100755 --- a/src/mono/msvc/build-external-llvm.bat +++ b/src/mono/msvc/build-external-llvm.bat @@ -239,6 +239,7 @@ if "%GIT%" == "" ( ) :: Make sure llvm submodule is up to date. +echo Updating submodule "%LLVM_DIR%" "%GIT%" submodule update --init -- "%LLVM_DIR%" if not ERRORLEVEL == 0 ( "%GIT%" submodule init -- "%LLVM_DIR%" @@ -276,6 +277,13 @@ if not "%CMAKE_GENERATOR_ARCH%" == "" ( set CMAKE_GENERATOR_ARCH=-A %CMAKE_GENERATOR_ARCH% ) +:: Check if LLVM_DIR is just repro root or if we should build +:: a llvm subfolder within that repository. +set "LLVM_SOURCE_DIR=%LLVM_DIR%" +if exist "%LLVM_SOURCE_DIR%\llvm\CMakeLists.txt" ( + set "LLVM_SOURCE_DIR=%LLVM_DIR%\llvm" +) + :: Run cmake. "%CMAKE%" ^ -DCMAKE_INSTALL_PREFIX="%LLVM_INSTALL_DIR%" ^ @@ -293,7 +301,7 @@ if not "%CMAKE_GENERATOR_ARCH%" == "" ( %CMAKE_GENERATOR_ARGS% ^ -G "%CMAKE_GENERATOR%" ^ %CMAKE_GENERATOR_ARCH% ^ -"%LLVM_DIR%" +"%LLVM_SOURCE_DIR%" if not ERRORLEVEL == 0 ( goto ON_ERROR diff --git a/src/mono/msvc/mono.external.targets b/src/mono/msvc/mono.external.targets index b47e4ac..919eed6 100644 --- a/src/mono/msvc/mono.external.targets +++ b/src/mono/msvc/mono.external.targets @@ -112,7 +112,7 @@ <_LLVMSourceDir Condition="'$(_LLVMSourceDir)' == ''">$(MONO_INTERNAL_LLVM_SOURCE_DIR) - <_LLVMSourceDir Condition="'$(_LLVMSourceDir)' == ''">$(_MonoSourceDir)\external\llvm-project\llvm + <_LLVMSourceDir Condition="'$(_LLVMSourceDir)' == ''">$(_MonoSourceDir)\external\llvm-project <_LLVMBuildDir Condition="'$(_LLVMBuildDir)' == ''">$([System.IO.Path]::GetFullPath('$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\external\llvm-build\$(Configuration)')) <_LLVMInstallDir Condition="'$(_LLVMInstallDir)' == ''">$(_LLVMBuildDir)\install <_MonoLLVMConfig>$(_LLVMInstallDir)\bin\llvm-config.exe -- 2.7.4