Skip to content
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
2 changes: 1 addition & 1 deletion eng/Configurations.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<PropertyGroup>
<__TargetOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">OSX</__TargetOS>
<__TargetOS Condition="'$(__TargetOS)' == '' and $([MSBuild]::IsOSPlatform('OSX'))">OSX</__TargetOS>
<__TargetOS Condition="'$(__TargetOS)' == '' and $([MSBuild]::IsOSPlatform('FREEBSD'))">FreeBSD</__TargetOS>
<__TargetOS Condition="'$(__TargetOS)' == '' and $([MSBuild]::IsOSPlatform('NETBSD'))">NetBSD</__TargetOS>
<__TargetOS Condition="'$(__TargetOS)' == '' and $([MSBuild]::IsOSUnixLike())">Linux</__TargetOS>
Expand Down
7 changes: 7 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

<PropertyGroup>
<DefaultSubsetCategories>libraries-installer-coreclr-mono</DefaultSubsetCategories>
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'iOS'">libraries-mono</DefaultSubsetCategories>
<DefaultInstallerSubsets>corehost-managed-depproj-pkgproj-bundle-installers-test</DefaultInstallerSubsets>
<!-- TODO: Split into multiple sets. -->
<DefaultLibrariesSubsets>all</DefaultLibrariesSubsets>
Expand All @@ -76,6 +77,12 @@
<_subset>-$(_subset)-</_subset>
</PropertyGroup>

<PropertyGroup>
<RuntimeFlavor Condition="'$(TargetOS)' == 'iOS'">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and $(_subsetCategory.Contains('mono')) and !$(_subsetCategory.Contains('coreclr'))">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">CoreCLR</RuntimeFlavor>
</PropertyGroup>

<ItemGroup>
<!-- Global -->
<SubsetName Include="RegenerateReadmeTable" Category="" OnDemand="true" Description="Regenerates the table of asset links in the README.md file." />
Expand Down
13 changes: 12 additions & 1 deletion eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ usage()
echo ""
echo "Common Options:"
echo ""
echo "BuildArch can be: -arm, -armel, -arm64, -armel, x64, x86, -wasm"
echo "BuildArch can be: -arm, -armel, -arm64, x64, x86, -wasm"
echo "BuildType can be: -debug, -checked, -release"
echo "-os: target OS (defaults to running OS)"
echo "-bindir: output directory (defaults to $__ProjectRoot/artifacts)"
echo "-ci: indicates if this is a CI build."
echo "-clang: optional argument to build using clang in PATH (default)."
Expand Down Expand Up @@ -355,6 +356,16 @@ while :; do
__BuildArch=wasm
;;

os|-os)
if [[ -n "$2" ]]; then
__TargetOS="$2"
shift
else
echo "ERROR: 'os' requires a non-empty option argument"
exit 1
fi
;;

*)
handle_arguments "$1" "$2"
if [[ "$__ShiftArgs" == 1 ]]; then
Expand Down
21 changes: 21 additions & 0 deletions eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ if(CLR_CMAKE_HOST_OS STREQUAL Darwin)
set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> <INCLUDES> -o <OBJECT> -c <SOURCE>")
endif(CLR_CMAKE_HOST_OS STREQUAL Darwin)

if(CLR_CMAKE_HOST_OS STREQUAL iOS)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_IOS 1)
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "armv7")
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
else()
clr_unknown_arch()
endif()
endif(CLR_CMAKE_HOST_OS STREQUAL iOS)

if(CLR_CMAKE_HOST_OS STREQUAL FreeBSD)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
Expand Down Expand Up @@ -230,6 +244,11 @@ if(CLR_CMAKE_TARGET_OS STREQUAL Darwin)
set(CLR_CMAKE_TARGET_DARWIN 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL Darwin)

if(CLR_CMAKE_TARGET_OS STREQUAL iOS)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_IOS 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL iOS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect iOS to set CLR_CMAKE_TARGET_DARWIN too. Not sure whether it would make the rest of the diff with if conditions smaller or larger though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please, at least on cmake side, we are consistent with Darwin naming. It's only the code and RIDs where the (obsolete) osx name is used. 😁

Copy link
Member Author

@akoeplinger akoeplinger Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a conscious decision because CLR_CMAKE_TARGET_DARWIN really means macOS in the rest of the build scripts. We could rename it to CLR_CMAKE_TARGET_OSX?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do the renaming in a follow-up PR.


if(CLR_CMAKE_TARGET_OS STREQUAL FreeBSD)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_FREEBSD 1)
Expand Down Expand Up @@ -302,3 +321,5 @@ if(NOT CLR_CMAKE_HOST_ARCH_WASM)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif(NOT CLR_CMAKE_HOST_ARCH_WASM)

set(CLR_CMAKE_CONFIGURE_PLATFORM_INCLUDED 1)
6 changes: 5 additions & 1 deletion eng/native/configuretools.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if(NOT CLR_CMAKE_CONFIGURE_PLATFORM_INCLUDED)
message(FATAL_ERROR "configuretools.cmake needs to be included after configureplatform.cmake")
endif()

# Get the version of the compiler that is in the file name for tool location.
set (CLR_CMAKE_COMPILER_FILE_NAME_VERSION "")
if (CMAKE_C_COMPILER MATCHES "-?[0-9]+(\.[0-9]+)?$")
Expand Down Expand Up @@ -45,7 +49,7 @@ if(NOT WIN32)
locate_toolchain_exec(ranlib CMAKE_RANLIB)
endif()

if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(NOT CLR_CMAKE_TARGET_DARWIN AND NOT CLR_CMAKE_TARGET_IOS)
locate_toolchain_exec(objdump CMAKE_OBJDUMP)

if(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR
Expand Down
2 changes: 2 additions & 0 deletions eng/native/init-distro-rid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ initDistroRidGlobal()
distroRid="linux-$buildArch"
elif [ "$targetOs" = "OSX" ]; then
distroRid="osx-$buildArch"
elif [ "$targetOs" = "iOS" ]; then
distroRid="ios-$buildArch"
elif [ "$targetOs" = "FreeBSD" ]; then
distroRid="freebsd-$buildArch"
fi
Expand Down
2 changes: 1 addition & 1 deletion eng/native/naming.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<SymbolFileExtension>.pdb</SymbolFileExtension>
</PropertyGroup>
</When>
<When Condition=" '$(_runtimeOSFamily)' == 'osx' OR $(RuntimeIdentifier.StartsWith('osx')) ">
<When Condition=" '$(_runtimeOSFamily)' == 'osx' or $(RuntimeIdentifier.StartsWith('osx')) or '$(_runtimeOSFamily)' == 'ios' or $(RuntimeIdentifier.StartsWith('ios'))">
<PropertyGroup>
<LibraryFilePrefix Condition=" '$(SkipLibraryPrefixFromUnix)' == '' ">lib</LibraryFilePrefix>
<LibraryFileExtension>.dylib</LibraryFileExtension>
Expand Down
2 changes: 1 addition & 1 deletion src/installer/corehost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.14.2)

project(corehost)

include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake)
include(${CLR_ENG_NATIVE_DIR}/configureplatform.cmake)
include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake)
include(../settings.cmake)
include(../functions.cmake)
add_subdirectory(cli)
17 changes: 15 additions & 2 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(HostArch)' == 'arm'">arm</ArchGroup>
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(HostArch)' == 'arm64'">arm64</ArchGroup>
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(TargetOS)' == 'WebAssembly'">wasm</ArchGroup>
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(TargetOS)' == 'iOS'">x64</ArchGroup>
<ArchGroup Condition="'$(ArchGroup)' == ''">x64</ArchGroup>

<!-- RuntimeOS is calculated based on the build system OS, however if building for WebAssembly we need to let
the build system to use webassembly as the RuntimeOS for produced package RIDs. -->
<!-- RuntimeOS is calculated based on the build system OS, however if building for WebAssembly or iOS we need to let
the build system to use webassembly/ios as the RuntimeOS for produced package RIDs. -->
<RuntimeOS Condition="'$(TargetOS)' == 'WebAssembly'">$(TargetOS.ToLowerInvariant())</RuntimeOS>
<RuntimeOS Condition="'$(TargetOS)' == 'iOS'">$(TargetOS.ToLowerInvariant())</RuntimeOS>

<!-- Initialize BuildSettings from the individual properties if it wasn't already explicitly set -->
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
Expand Down Expand Up @@ -79,6 +81,13 @@
<PackageTargetRuntime>osx</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'iOS'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsiOS>true</TargetsiOS>
<PackageTargetRuntime>ios</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'FreeBSD'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
Expand Down Expand Up @@ -155,6 +164,7 @@
<_portableOS Condition="'$(_runtimeOSFamily)' == 'osx'">osx</_portableOS>
<_portableOS Condition="'$(_runtimeOSFamily)' == 'FreeBSD'">freebsd</_portableOS>
<_portableOS Condition="'$(RuntimeOS)' == 'WebAssembly'">webassembly</_portableOS>
<_portableOS Condition="'$(RuntimeOS)' == 'ios'">ios</_portableOS>

<_runtimeOS>$(RuntimeOS)</_runtimeOS>
<_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">linux</_runtimeOS>
Expand All @@ -171,6 +181,9 @@
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'webassembly' and '$(TargetOS)' != 'Windows_NT' and $(_buildingInOSX)">osx-x64</ToolRuntimeRID>
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'webassembly' and '$(TargetOS)' != 'Windows_NT' and !$(_buildingInOSX)">linux-x64</ToolRuntimeRID>

<!-- There are no iOS tools and it can be built on OSX only, so use that -->
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'ios'">osx-x64</ToolRuntimeRID>

<!-- support cross-targeting by choosing a RID to restore when running on a different machine that what we're build for -->
<_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl'">linux</_portableOS>

Expand Down
18 changes: 16 additions & 2 deletions src/libraries/Native/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ project(CoreFX C)

include(${CLR_ENG_NATIVE_DIR}/configureplatform.cmake)

if(CLR_CMAKE_TARGET_IOS)
cmake_minimum_required(VERSION 3.14.5)
endif()

if(NOT CLR_CMAKE_TARGET_ARCH_WASM)
cmake_policy(SET CMP0083 NEW)
endif(NOT CLR_CMAKE_TARGET_ARCH_WASM)
Expand Down Expand Up @@ -118,7 +122,7 @@ else ()
endif ()

if(CLR_CMAKE_TARGET_ARCH_WASM)
elseif (CLR_CMAKE_TARGET_DARWIN)
elseif (CLR_CMAKE_TARGET_DARWIN OR CLR_CMAKE_TARGET_IOS)
add_definitions(-D__APPLE_USE_RFC_3542)

# We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
Expand Down Expand Up @@ -156,6 +160,8 @@ if(CLR_CMAKE_TARGET_UNIX)
if (STRIP STREQUAL "STRIP-NOTFOUND")
message(FATAL_ERROR "strip not found")
endif()
elseif (CLR_CMAKE_TARGET_IOS)
# No object stripping for iOS
elseif (CLR_CMAKE_TARGET_ARCH_WASM)
# No object stripping for WASM
else (CLR_CMAKE_TARGET_DARWIN)
Expand Down Expand Up @@ -194,8 +200,10 @@ include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake)
add_subdirectory(System.IO.Compression.Native)

if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
if (NOT CLR_CMAKE_TARGET_IOS) # TODO: reenable
add_subdirectory(System.IO.Ports.Native)
endif()
endif()

if(CMAKE_C_COMPILER_ID STREQUAL Clang)
add_compile_options(-Weverything)
Expand All @@ -204,11 +212,17 @@ endif()
add_subdirectory(System.Native)

if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
if (NOT CLR_CMAKE_TARGET_IOS) # TODO: reenable
add_subdirectory(System.Globalization.Native)
add_subdirectory(System.Net.Security.Native)
endif()
if (NOT CLR_CMAKE_TARGET_IOS)
# disable System.Security.Cryptography.Native build on iOS,
# only used for interacting with OpenSSL which isn't useful there
add_subdirectory(System.Security.Cryptography.Native)
endif()
endif()

if(CLR_CMAKE_TARGET_DARWIN)
if(CLR_CMAKE_TARGET_DARWIN OR CLR_CMAKE_TARGET_IOS)
add_subdirectory(System.Security.Cryptography.Native.Apple)
endif()
6 changes: 5 additions & 1 deletion src/libraries/Native/Unix/Common/pal_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@
#cmakedefine01 HAVE_TCSANOW
#cmakedefine01 HAVE_IN_PKTINFO
#cmakedefine01 HAVE_IP_MREQN
#cmakedefine01 HAVE_TCP_VAR_H
#cmakedefine01 HAVE_NETINET_TCP_VAR_H
#cmakedefine01 HAVE_NETINET_UDP_VAR_H
#cmakedefine01 HAVE_NETINET_IP_VAR_H
#cmakedefine01 HAVE_NETINET_ICMP_VAR_H
#cmakedefine01 HAVE_IOS_NET_ROUTE_H
#cmakedefine01 HAVE_RT_MSGHDR
#cmakedefine01 HAVE_RT_MSGHDR2
#cmakedefine01 HAVE_IF_MSGHDR2
Expand Down
Loading