Skip to content

Commit 0d7bc89

Browse files
committed
[mono-runtimes] Add and use $(HostCc), $(HostCxx)
`clang` isn't the C compiler everywhere, and `clang++` isn't the C++ everywhere. For example, Ubuntu provides `clang-3.5`. Allow the host-native C and C++ compilers to be specified/overridden via the new $(HostCc) and $(HostCxx) MSBuild properties.
1 parent 1ecd075 commit 0d7bc89

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

Configuration.Override.props.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
<!-- The Xamarin.Android $(TargetFrameworkVersion) value that corresponds to $(AndroidApiLevel) -->
77
<AndroidFrameworkVersion>v6.0</AndroidFrameworkVersion>
88

9+
<!-- C and C++ compilers to emit host-native binaries -->
10+
<HostCc>clang</HostCc>
11+
<HostCxx>clang++</HostCxx>
12+
913
<!-- These must be FULL PATHS -->
1014
<AndroidToolchainCacheDirectory>$(HOME)\android-archives</AndroidToolchainCacheDirectory>
1115
<AndroidToolchainDirectory>$(HOME)\android-toolchain</AndroidToolchainDirectory>

Configuration.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<HostOS Condition=" '$(HostOS)' == '' And '$(OS)' == 'Windows_NT' ">Windows</HostOS>
66
<HostOS Condition=" '$(HostOS)' == '' And '$(OS)' == 'Unix' And Exists ('/Applications') ">Darwin</HostOS>
77
<HostOS Condition=" '$(HostOS)' == '' And '$(OS)' == 'Unix' ">Linux</HostOS>
8+
<HostCc Condition=" '$(HostCc)' == '' ">clang</HostCc>
9+
<HostCxx Condition=" '$(HostCc)' == '' ">clang++</HostCxx>
810
<ManagedRuntime Condition=" '$(ManagedRuntime)' == '' And '$(OS)' != 'Windows_NT' ">mono</ManagedRuntime>
911
<HOME Condition=" '$(HOME)' == '' ">$(HOMEDRIVE)$(HOMEPATH)</HOME>
1012
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">23</AndroidApiLevel>

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Overridable MSBuild properties include:
3333
* `$(AndroidToolchainDirectory)`: The directory to install the downloaded
3434
Android NDK and SDK files. This value defaults to
3535
`$(HOME)\android-toolchain`.
36+
* `$(HostCc)`, `$(HostCxx)`: The C and C++ compilers to use to generate
37+
host-native binaries.
3638

3739
# Build Requirements
3840

build-tools/mono-runtimes/mono-runtimes.projitems

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
<_MonoRuntime Include="host">
2323
<Ar>ar</Ar>
2424
<As>as</As>
25-
<Cc>clang</Cc>
25+
<Cc>$(HostCc)</Cc>
2626
<CFlags>$(_CommonCFlags) -mmacosx-version-min=10.9</CFlags>
27-
<Cxx>clang++</Cxx>
27+
<Cxx>$(HostCxx)</Cxx>
2828
<CxxCpp>cpp</CxxCpp>
2929
<CxxFlags></CxxFlags>
3030
<Ld>ld</Ld>

0 commit comments

Comments
 (0)