Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mono: Turn on cmake build by default #42119

Merged
merged 6 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ endif()
# HOST OS CHECKS
######################################

message ("CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(-D_THREAD_SAFE)
set(HOST_DARWIN 1)
Expand Down Expand Up @@ -299,12 +301,22 @@ if(NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
endif()
endif()

# Unify naming
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
set(CMAKE_SYSTEM_PROCESSOR "arm")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
set(CMAKE_SYSTEM_PROCESSOR "x86")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(CMAKE_SYSTEM_PROCESSOR "arm64")
endif()

message ("CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(HOST_AMD64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
# i686 is used on android
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
set(HOST_X86 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(HOST_ARM64 1)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
set(HOST_ARM 1)
Expand All @@ -321,22 +333,31 @@ if(NOT TARGET_ARCH)
set(TARGET_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
endif()

# Unify naming
if(TARGET_ARCH STREQUAL "armv7l")
set(TARGET_ARCH "arm")
elseif(TARGET_ARCH STREQUAL "i686")
set(TARGET_ARCH "x86")
elseif(TARGET_ARCH STREQUAL "aarch64")
set(TARGET_ARCH "arm64")
endif()

message("TARGET_ARCH=${TARGET_ARCH}")

if(TARGET_ARCH STREQUAL "x86_64")
set(TARGET_AMD64 1)
set(MONO_ARCHITECTURE "\"amd64\"")
elseif(TARGET_ARCH STREQUAL "x86" OR TARGET_ARCH STREQUAL "i686")
elseif(TARGET_ARCH STREQUAL "x86")
set(TARGET_X86 1)
set(MONO_ARCHITECTURE "\"x86\"")
elseif(TARGET_ARCH STREQUAL "arm64" OR TARGET_ARCH STREQUAL "aarch64")
elseif(TARGET_ARCH STREQUAL "arm64")
set(TARGET_ARM64 1)
set(MONO_ARCHITECTURE "\"arm64\"")
elseif(TARGET_ARCH MATCHES "arm")
set(TARGET_ARM 1)
set(MONO_ARCHITECTURE "\"arm\"")
# FIXME:
if(TARGET_IOS OR TARGET_ANDROID)
add_definitions("-DARM_FPU_VFP=1")
endif()
add_definitions("-DARM_FPU_VFP=1")
elseif(TARGET_ARCH STREQUAL "wasm")
set(MONO_ARCHITECTURE "\"wasm\"")
else()
Expand All @@ -352,7 +373,7 @@ if(LLVM_PREFIX)
set(llvm_codegen_libs "x86codegen")
elseif(TARGET_ARCH STREQUAL "x86")
set(llvm_codegen_libs "x86codegen")
elseif(TARGET_ARCH STREQUAL "arm64" OR TARGET_ARCH STREQUAL "aarch64")
elseif(TARGET_ARCH STREQUAL "arm64")
set(llvm_codegen_libs "aarch64codegen")
elseif(TARGET_ARCH STREQUAL "arm")
set(llvm_codegen_libs "armcodegen")
Expand Down
13 changes: 10 additions & 3 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
-->

<PropertyGroup>
<MonoEnableCMake Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsOSX)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">true</MonoEnableCMake>
<!--<MonoEnableCMake Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsOSX)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">true</MonoEnableCMake>-->
<MonoEnableCMake Condition="'$(TargetsWindows)' != 'true'">true</MonoEnableCMake>
<MonoCrossDir Condition="'$(MonoCrossDir)' == '' and '$(ROOTFS_DIR)' != ''">$(ROOTFS_DIR)</MonoCrossDir>
<MonoEnableInterpreter Condition="'$(MonoEnableInterpreter)' == ''">false</MonoEnableInterpreter>
<ScriptExt Condition="'$(OS)' == 'Windows_NT'">.cmd</ScriptExt>
Expand Down Expand Up @@ -856,6 +857,10 @@
<Output TaskParameter="ExitCode" PropertyName="MonoNinjaFound"/>
</Exec>
<PropertyGroup>
<!--
<_MonoVerboseArg Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(MonoNinjaFound)' == '0'">-v</_MonoVerboseArg>
<_MonoVerboseArg Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(MonoNinjaFound)' != '0'">VERBOSE=1</_MonoVerboseArg>
-->
<MonoBuildTool Condition="'$(MonoNinjaFound)' == '0'">ninja</MonoBuildTool>
<MonoBuildTool Condition="'$(MonoNinjaFound)' != '0'">make -j$([System.Environment]::ProcessorCount)</MonoBuildTool>
</PropertyGroup>
Expand All @@ -881,6 +886,8 @@
<_MonoCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$(RepositoryEngineeringDir)/common/cross/toolchain.cmake" />
<_MonoBuildEnv Condition="'$(Platform)' == 'arm64'" Include="TARGET_BUILD_ARCH=arm64" />
<_MonoBuildEnv Condition="'$(Platform)' == 'arm'" Include="TARGET_BUILD_ARCH=arm" />
<_MonoBuildEnv Condition="'$(Platform)' == 'arm64'" Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/aarch64-linux-gnu/pkgconfig" />
<_MonoBuildEnv Condition="'$(Platform)' == 'arm'" Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/arm-linux-gnueabihf/pkgconfig" />
</ItemGroup>

<!-- OSX specific options -->
Expand Down Expand Up @@ -1015,8 +1022,8 @@
<Exec Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' == 'false'" Command="$(_MonoCCOption) $(_MonoCXXOption) @(_MonoBuildEnv, ' ') cmake @(_MonoCMakeArgs, ' ') $(MonoProjectRoot)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
<Exec Condition="'$(TargetsBrowser)' == 'true'" Command="bash -c 'source $(EMSDK_PATH)/emsdk_env.sh &amp;&amp; emcmake cmake @(_MonoCMakeArgs, ' ') $(MonoProjectRoot)'" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)" />
<!-- ninja/make -->
<Exec Condition="'$(TargetsBrowser)' != 'true'" Command="@(_MonoBuildEnv, ' ') $(MonoBuildTool) all install" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
<Exec Condition="'$(TargetsBrowser)' == 'true'" Command="bash -c 'source $(EMSDK_PATH)/emsdk_env.sh &amp;&amp; $(MonoBuildTool) all install'" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)" />
<Exec Condition="'$(TargetsBrowser)' != 'true'" Command="@(_MonoBuildEnv, ' ') $(MonoBuildTool) $(_MonoVerboseArg) all install" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
<Exec Condition="'$(TargetsBrowser)' == 'true'" Command="bash -c 'source $(EMSDK_PATH)/emsdk_env.sh &amp;&amp; $(MonoBuildTool) $(_MonoVerboseArg) all install'" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)" />
</Target>

<!-- Build AOT cross compiler (if available) -->
Expand Down