Skip to content

Commit

Permalink
Add support for LLVM integrated build as part of Visual Studio solution
Browse files Browse the repository at this point in the history
build. LLVM build follows similar pattern as BTLS build and will be build
as part of regular Visual Studio build Mono runtime if LLVM has been enabled
through the autogen.sh, --enable-llvm or –with-llvm argument. It is also
supports msbuild properties MONO_ENABLE_LLVM, MONO_EXTERNAL_LLVM_CONFIG,
if Visual Studio Mono runtime has been built without using autogen.sh.
When just using –enable-llvm, LLVM build will try to build internal LLVM
branch under external/llvm or if override has been set in props file
(using MONO_INTERNAL_LLVM_SOURCE_DIR), an alternative LLVM source
directory path. If –with-llvm has been used pointing to an llvm-config.exe,
no internal LLVM will be build, but the external LLVM build will be used.
Needed LLVM executables (opt.exe, llc.exe) will be installed into regular
Visual Studio Mono runtime build output directory.

The internal Mono LLVM 6.0 release will build as part of changes to this
commit, but it has not yet been fixed to work as expected during runtime.
That work will be done in different commit. The Mono LLVM 3.6 branch will
however work as expected for Windows x64 and can be setup and used using
–with-llvm argument or build as part of Visual Studio build Mono runtime
by enabling msbuild properties, MONO_ENABLE_LLVM and
MONO_INTERNAL_LLVM_SOURCE_DIR.
  • Loading branch information
lateralusX committed Nov 12, 2018
1 parent f038e7c commit 269d02c
Show file tree
Hide file tree
Showing 14 changed files with 918 additions and 98 deletions.
16 changes: 3 additions & 13 deletions msvc/build-external-btls.vcxproj
Expand Up @@ -145,25 +145,15 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="mono.external.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<PropertyGroup>
<_BtlsCFlags Condition="'$(MONO_PREPROCESSOR_DEFINITIONS)' != ''">$(MONO_PREPROCESSOR_DEFINITIONS.Replace(";"," "))</_BtlsCFlags>
<_BtlsCFlags>$(_BtlsCFlags.Trim())</_BtlsCFlags>
<_BtlsCFlags Condition="'$(_BtlsCFlags)' != ''">-D$(_BtlsCFlags.Replace(" "," -D"))</_BtlsCFlags>
<_BtlsBuildDir>$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\external\btls-build-shared\$(Configuration)</_BtlsBuildDir>
<_BtlsBuildCommand>build-external-btls.bat &quot;$(MONO_DIR)&quot; &quot;$(_BtlsBuildDir)&quot; &quot;$(OutDir)&quot; &quot;$(_BtlsCFlags)&quot; &quot;$(Platform)&quot; &quot;$(Configuration)&quot;</_BtlsBuildCommand>
<_BtlsCheckCommand>findstr /i /r /c:&quot;.*#define.*HAVE_BTLS.*1&quot; $(MONO_DIR)/cygconfig.h >nul 2>&amp;1</_BtlsCheckCommand>
</PropertyGroup>
<Target Name="_CheckEnableBtls" Condition="'$(MONO_ENABLE_BTLS)' == ''">
<Exec Command="$(_BtlsCheckCommand)" IgnoreExitCode="true" EchoOff="true">
<Output TaskParameter="ExitCode" PropertyName="_CheckEnableBtlsExitCode"/>
</Exec>
<PropertyGroup>
<MONO_ENABLE_BTLS Condition="'$(_CheckEnableBtlsExitCode)' == '0'">true</MONO_ENABLE_BTLS>
<MONO_ENABLE_BTLS Condition="'$(_CheckEnableBtlsExitCode)' == '1'">false</MONO_ENABLE_BTLS>
</PropertyGroup>
</Target>
<Target Name="_AfterBuildExternalBtls" Condition="'$(MONO_ENABLE_BTLS)' == 'true'">
<Exec Command="$(_BtlsBuildCommand) &quot;Build&quot; &quot;$(MSBuildBinPath)\&quot;">
<Output TaskParameter="ExitCode" PropertyName="_BuildExternalBtlsExitCode" />
Expand All @@ -174,6 +164,6 @@
<Output TaskParameter="ExitCode" PropertyName="_CleanExternalBtlsExitCode" />
</Exec>
</Target>
<Target Name="AfterBuild" DependsOnTargets="_CheckEnableBtls;_AfterBuildExternalBtls" />
<Target Name="AfterClean" DependsOnTargets="_CheckEnableBtls;_AfterCleanExternalBtls" />
<Target Name="AfterBuild" DependsOnTargets="_ConfigureExternalMonoBTLSBuildEnvironment;_AfterBuildExternalBtls" />
<Target Name="AfterClean" DependsOnTargets="_ConfigureExternalMonoBTLSBuildEnvironment;_AfterCleanExternalBtls" />
</Project>

0 comments on commit 269d02c

Please sign in to comment.