Skip to content

Commit 0595477

Browse files
authored
Add Android build configurations for Mono/Libraries (#33881)
* Add Android build configurations * Enable System.Globalization.Native on Android Dynamically load the libicu from the system. Android NDK doesn't ship with icu headers so for now define prototypes for all the functions we use ourselves. * Add temporary stub HashProvider that throws NIE on Android We still need to hook up the native System.Security.Native library. Unblocks Xamarin.Forms startup.
1 parent 5c8cad2 commit 0595477

30 files changed

+1040
-114
lines changed

eng/Subsets.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
<PropertyGroup>
6060
<DefaultSubsetCategories>libraries-installer-coreclr-mono</DefaultSubsetCategories>
61-
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'iOS'">libraries-mono</DefaultSubsetCategories>
61+
<DefaultSubsetCategories Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">libraries-mono</DefaultSubsetCategories>
6262
<DefaultInstallerSubsets>corehost-managed-depproj-pkgproj-bundle-installers-test</DefaultInstallerSubsets>
6363
<!-- TODO: Split into multiple sets. -->
6464
<DefaultLibrariesSubsets>all</DefaultLibrariesSubsets>
@@ -78,7 +78,7 @@
7878
</PropertyGroup>
7979

8080
<PropertyGroup>
81-
<RuntimeFlavor Condition="'$(TargetOS)' == 'iOS'">Mono</RuntimeFlavor>
81+
<RuntimeFlavor Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">Mono</RuntimeFlavor>
8282
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and $(_subsetCategory.Contains('mono')) and !$(_subsetCategory.Contains('coreclr'))">Mono</RuntimeFlavor>
8383
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">CoreCLR</RuntimeFlavor>
8484
</PropertyGroup>

eng/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ usage()
1919
echo "Common settings:"
2020
echo " --subset Build a subset, print available subsets with -subset help"
2121
echo " --subsetCategory Build a subsetCategory, print available subsetCategories with -subset help"
22-
echo " --os Build operating system: Windows_NT or Unix"
22+
echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, iOS or Android"
2323
echo " --arch Build platform: x86, x64, arm or arm64"
2424
echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)"
2525
echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked"

eng/codeOptimization.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
IBCMerge optimizations on Mac for now to unblock the offical build.
1010
See issue https://github.com/dotnet/runtime/issues/33303
1111
-->
12-
<IsEligibleForNgenOptimization Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS'">false</IsEligibleForNgenOptimization>
12+
<IsEligibleForNgenOptimization Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'Android'">false</IsEligibleForNgenOptimization>
1313
</PropertyGroup>
1414

1515
<Target Name="SetApplyNgenOptimization"

eng/native/configureplatform.cmake

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ set(PRERELEASE 1)
1111
# - for windows we use the passed in parameter to CMAKE to determine build arch
1212
#----------------------------------------
1313
set(CLR_CMAKE_HOST_OS ${CMAKE_SYSTEM_NAME})
14-
if(CLR_CMAKE_HOST_OS STREQUAL Linux OR CLR_CMAKE_HOST_OS STREQUAL Android)
14+
if(CLR_CMAKE_HOST_OS STREQUAL Linux)
1515
set(CLR_CMAKE_HOST_UNIX 1)
16-
if(CLR_CROSS_COMPONENTS_BUILD AND NOT CLR_CMAKE_HOST_OS STREQUAL Android)
16+
if(CLR_CROSS_COMPONENTS_BUILD)
1717
# CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
1818
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
1919
if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm" OR CLR_CMAKE_TARGET_ARCH STREQUAL "armel")
@@ -74,12 +74,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL Linux OR CLR_CMAKE_HOST_OS STREQUAL Android)
7474
set(CLR_CMAKE_HOST_OS ${CLR_CMAKE_LINUX_ID})
7575
endif()
7676
endif(DEFINED CLR_CMAKE_LINUX_ID)
77-
78-
if(CLR_CMAKE_HOST_OS STREQUAL Android)
79-
set(CLR_CMAKE_HOST_ANDROID 1)
80-
set(CLR_CMAKE_HOST_OS ${CLR_CMAKE_HOST_OS})
81-
endif()
82-
endif(CLR_CMAKE_HOST_OS STREQUAL Linux OR CLR_CMAKE_HOST_OS STREQUAL Android)
77+
endif(CLR_CMAKE_HOST_OS STREQUAL Linux)
8378

8479
if(CLR_CMAKE_HOST_OS STREQUAL Darwin)
8580
set(CLR_CMAKE_HOST_UNIX 1)
@@ -102,6 +97,23 @@ if(CLR_CMAKE_HOST_OS STREQUAL iOS)
10297
endif()
10398
endif(CLR_CMAKE_HOST_OS STREQUAL iOS)
10499

100+
if(CLR_CMAKE_HOST_OS STREQUAL Android)
101+
set(CLR_CMAKE_HOST_UNIX 1)
102+
set(CLR_CMAKE_HOST_LINUX 1)
103+
set(CLR_CMAKE_HOST_ANDROID 1)
104+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
105+
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
106+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a)
107+
set(CLR_CMAKE_HOST_UNIX_ARM 1)
108+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
109+
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
110+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
111+
set(CLR_CMAKE_HOST_UNIX_X86 1)
112+
else()
113+
clr_unknown_arch()
114+
endif()
115+
endif(CLR_CMAKE_HOST_OS STREQUAL Android)
116+
105117
if(CLR_CMAKE_HOST_OS STREQUAL FreeBSD)
106118
set(CLR_CMAKE_HOST_UNIX 1)
107119
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
@@ -315,6 +327,7 @@ else()
315327
endif()
316328

317329
if(NOT CLR_CMAKE_HOST_ARCH_WASM)
330+
if(NOT CLR_CMAKE_TARGET_ANDROID) # Android requires PIC and CMake handles this so we don't need the check
318331
# All code we build should be compiled as position independent
319332
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
320333
if("CXX" IN_LIST languages)
@@ -328,6 +341,5 @@ if(NOT CLR_CMAKE_HOST_ARCH_WASM)
328341
"PIE link options will not be passed to linker.")
329342
endif()
330343
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
344+
endif(NOT CLR_CMAKE_TARGET_ANDROID)
331345
endif(NOT CLR_CMAKE_HOST_ARCH_WASM)
332-
333-
set(CLR_CMAKE_CONFIGURE_PLATFORM_INCLUDED 1)

eng/native/configuretools.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ if(NOT WIN32)
4747
locate_toolchain_exec(ranlib CMAKE_RANLIB)
4848
endif()
4949

50-
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS)
50+
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
5151
locate_toolchain_exec(objdump CMAKE_OBJDUMP)
5252

53-
if(CMAKE_SYSTEM_NAME STREQUAL Android)
54-
set(TOOSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX})
53+
if(CLR_CMAKE_TARGET_ANDROID)
54+
set(TOOLSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX})
5555
elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR
5656
CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm))
5757
set(TOOLSET_PREFIX "${TOOLCHAIN}-")
@@ -60,5 +60,5 @@ if(NOT WIN32)
6060
endif()
6161

6262
locate_toolchain_exec(objcopy CMAKE_OBJCOPY)
63-
endif(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS)
63+
endif()
6464
endif()

eng/native/init-distro-rid.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ initDistroRidGlobal()
163163
distroRid="osx-$buildArch"
164164
elif [ "$targetOs" = "iOS" ]; then
165165
distroRid="ios-$buildArch"
166+
elif [ "$targetOs" = "Android" ]; then
167+
distroRid="android-$buildArch"
166168
elif [ "$targetOs" = "FreeBSD" ]; then
167169
distroRid="freebsd-$buildArch"
168170
fi

src/libraries/Directory.Build.props

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@
6363
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(HostArch)' == 'arm64'">arm64</ArchGroup>
6464
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(TargetOS)' == 'WebAssembly'">wasm</ArchGroup>
6565
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(TargetOS)' == 'iOS'">x64</ArchGroup>
66+
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(TargetOS)' == 'Android'">x64</ArchGroup>
6667
<ArchGroup Condition="'$(ArchGroup)' == ''">x64</ArchGroup>
6768

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

7375
<!-- Initialize BuildSettings from the individual properties if it wasn't already explicitly set -->
7476
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
@@ -95,6 +97,14 @@
9597
<PackageTargetRuntime>linux</PackageTargetRuntime>
9698
</PropertyGroup>
9799
</When>
100+
<When Condition="'$(TargetFrameworkSuffix)' == 'Android'">
101+
<PropertyGroup>
102+
<TargetsUnix>true</TargetsUnix>
103+
<TargetsLinux>true</TargetsLinux>
104+
<TargetsAndroid>true</TargetsAndroid>
105+
<PackageTargetRuntime>android</PackageTargetRuntime>
106+
</PropertyGroup>
107+
</When>
98108
<When Condition="'$(TargetFrameworkSuffix)' == 'OSX'">
99109
<PropertyGroup>
100110
<TargetsUnix>true</TargetsUnix>
@@ -186,6 +196,7 @@
186196
<_portableOS Condition="'$(_runtimeOSFamily)' == 'FreeBSD'">freebsd</_portableOS>
187197
<_portableOS Condition="'$(RuntimeOS)' == 'WebAssembly'">webassembly</_portableOS>
188198
<_portableOS Condition="'$(RuntimeOS)' == 'ios'">ios</_portableOS>
199+
<_portableOS Condition="'$(RuntimeOS)' == 'android'">android</_portableOS>
189200

190201
<_runtimeOS>$(RuntimeOS)</_runtimeOS>
191202
<_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">linux</_runtimeOS>
@@ -202,6 +213,11 @@
202213
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'webassembly' and '$(TargetOS)' != 'Windows_NT' and $(_buildingInOSX)">osx-x64</ToolRuntimeRID>
203214
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'webassembly' and '$(TargetOS)' != 'Windows_NT' and !$(_buildingInOSX)">linux-x64</ToolRuntimeRID>
204215

216+
<!-- There are no Android tools, so use the default ones -->
217+
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'android' and '$(TargetOS)' == 'Windows_NT'">win-x64</ToolRuntimeRID>
218+
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'android' and '$(TargetOS)' != 'Windows_NT' and $(_buildingInOSX)">osx-x64</ToolRuntimeRID>
219+
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'android' and '$(TargetOS)' != 'Windows_NT' and !$(_buildingInOSX)">linux-x64</ToolRuntimeRID>
220+
205221
<!-- There are no iOS tools and it can be built on OSX only, so use that -->
206222
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'ios'">osx-x64</ToolRuntimeRID>
207223

src/libraries/Native/Unix/CMakeLists.txt

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ endif ()
9191

9292
if(CLR_CMAKE_TARGET_ANDROID)
9393
add_definitions(-DTARGET_ANDROID)
94-
include_directories(SYSTEM "${CROSS_ROOTFS}/usr/include")
94+
if(CROSS_ROOTFS)
95+
include_directories(SYSTEM "${CROSS_ROOTFS}/usr/include")
96+
endif()
9597
endif()
9698

9799
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
@@ -195,18 +197,22 @@ endif()
195197

196198
add_subdirectory(System.Native)
197199

198-
if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
200+
if(CLR_CMAKE_TARGET_ARCH_WASM)
201+
# skip for now
202+
elseif(CLR_CMAKE_TARGET_IOS)
199203
add_subdirectory(System.Net.Security.Native)
200-
201-
if (NOT CLR_CMAKE_TARGET_IOS)
202-
# TODO: reenable for iOS
204+
#add_subdirectory(System.Globalization.Native) # TODO: reenable
205+
# System.Security.Cryptography.Native is intentionally disabled on iOS
206+
# it is only used for interacting with OpenSSL which isn't useful there
207+
elseif(CLR_CMAKE_TARGET_ANDROID AND NOT CROSS_ROOTFS)
203208
add_subdirectory(System.Globalization.Native)
204-
205-
# disable System.Security.Cryptography.Native build on iOS,
206-
# only used for interacting with OpenSSL which isn't useful there
209+
#add_subdirectory(System.Net.Security.Native) # TODO: reenable
210+
#add_subdirectory(System.Security.Cryptography.Native) # TODO: reenable
211+
else()
212+
add_subdirectory(System.Globalization.Native)
213+
add_subdirectory(System.Net.Security.Native)
207214
add_subdirectory(System.Security.Cryptography.Native)
208215
endif()
209-
endif()
210216

211217
if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS)
212218
add_subdirectory(System.Security.Cryptography.Native.Apple)

src/libraries/Native/Unix/Common/pal_config.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#cmakedefine01 HAVE_TIOCGWINSZ
3636
#cmakedefine01 HAVE_SCHED_GETAFFINITY
3737
#cmakedefine01 HAVE_SCHED_SETAFFINITY
38+
#cmakedefine01 HAVE_PTHREAD_SETCANCELSTATE
3839
#cmakedefine01 HAVE_ARC4RANDOM_BUF
3940
#cmakedefine01 KEVENT_HAS_VOID_UDATA
4041
#cmakedefine01 HAVE_FDS_BITS
@@ -100,7 +101,6 @@
100101
#cmakedefine01 HAVE_TCP_H_TCP_KEEPALIVE
101102
#cmakedefine01 HAVE_BUILTIN_MUL_OVERFLOW
102103
#cmakedefine01 HAVE_DISCONNECTX
103-
#cmakedefine01 HAVE_PTHREAD_SETCANCELSTATE
104104

105105
// Mac OS X has stat64, but it is deprecated since plain stat now
106106
// provides the same 64-bit aware struct when targeting OS X > 10.5

src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,39 @@ if(CLR_CMAKE_TARGET_UNIX)
1313
add_compile_options(-Wno-extra-semi-stmt)
1414
add_compile_options(-Wno-unknown-warning-option)
1515

16-
set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include")
16+
if (NOT CLR_CMAKE_TARGET_ANDROID)
17+
set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include")
1718

18-
find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
19-
if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
20-
message(FATAL_ERROR "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
21-
return()
22-
endif()
23-
24-
if(CLR_CMAKE_TARGET_OSX)
25-
find_library(ICUCORE icucore)
26-
if(ICUCORE STREQUAL ICUCORE-NOTFOUND)
27-
message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.")
28-
return()
29-
endif()
30-
add_definitions(-DOSX_ICU_LIBRARY_PATH=\"${ICUCORE}\")
31-
add_definitions(-DU_DISABLE_RENAMING)
32-
else()
33-
find_library(ICUUC icuuc)
34-
if(ICUUC STREQUAL ICUUC-NOTFOUND)
35-
message(FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)")
19+
find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
20+
if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
21+
message(FATAL_ERROR "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
3622
return()
3723
endif()
3824

39-
find_library(ICUI18N icui18n)
40-
if(ICUI18N STREQUAL ICUI18N-NOTFOUND)
41-
message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)")
42-
return()
25+
if(CLR_CMAKE_TARGET_OSX)
26+
find_library(ICUCORE icucore)
27+
if(ICUCORE STREQUAL ICUCORE-NOTFOUND)
28+
message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.")
29+
return()
30+
endif()
31+
add_definitions(-DOSX_ICU_LIBRARY_PATH=\"${ICUCORE}\")
32+
add_definitions(-DU_DISABLE_RENAMING)
33+
else()
34+
find_library(ICUUC icuuc)
35+
if(ICUUC STREQUAL ICUUC-NOTFOUND)
36+
message(FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)")
37+
return()
38+
endif()
39+
40+
find_library(ICUI18N icui18n)
41+
if(ICUI18N STREQUAL ICUI18N-NOTFOUND)
42+
message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)")
43+
return()
44+
endif()
4345
endif()
44-
endif()
4546

46-
include_directories(${UTYPES_H})
47+
include_directories(${UTYPES_H})
48+
endif()
4749
endif()
4850

4951
include(configure.cmake)
@@ -86,7 +88,7 @@ set_target_properties(System.Globalization.Native-Static PROPERTIES OUTPUT_NAME
8688

8789
install (TARGETS System.Globalization.Native-Static DESTINATION .)
8890

89-
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS)
91+
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_ANDROID)
9092
if (GEN_SHARED_LIB)
9193
add_custom_command(TARGET System.Globalization.Native POST_BUILD
9294
COMMENT "Verifying System.Globalization.Native.so dependencies"

src/libraries/Native/Unix/System.Globalization.Native/configure.cmake

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
include(CheckCSourceCompiles)
2-
include(CheckSymbolExists)
3-
41
if(CLR_CMAKE_TARGET_ANDROID)
5-
string(REPLACE ";" ":" ANDROID_RPATHS "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}:${CMAKE_SYSTEM_LIBRARY_PATH}")
6-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rpath ${ANDROID_RPATHS}")
7-
endif()
2+
set(HAVE_SET_MAX_VARIABLE 1)
3+
set(HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS 1)
4+
else()
5+
include(CheckCSourceCompiles)
6+
include(CheckSymbolExists)
87

9-
if (CLR_CMAKE_TARGET_UNIX)
10-
set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH})
8+
if (CLR_CMAKE_TARGET_UNIX)
9+
set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH})
1110

12-
CHECK_C_SOURCE_COMPILES("
13-
#include <unicode/udat.h>
14-
int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
15-
" HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
11+
CHECK_C_SOURCE_COMPILES("
12+
#include <unicode/udat.h>
13+
int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
14+
" HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
1615

17-
if(CLR_CMAKE_TARGET_OSX)
18-
set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE})
19-
else()
20-
set(CMAKE_REQUIRED_LIBRARIES ${ICUUC} ${ICUI18N})
21-
endif()
16+
if(CLR_CMAKE_TARGET_OSX)
17+
set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE})
18+
else()
19+
set(CMAKE_REQUIRED_LIBRARIES ${ICUUC} ${ICUI18N})
20+
endif()
2221

23-
check_symbol_exists(
24-
ucol_setMaxVariable
25-
"unicode/ucol.h"
26-
HAVE_SET_MAX_VARIABLE)
22+
check_symbol_exists(
23+
ucol_setMaxVariable
24+
"unicode/ucol.h"
25+
HAVE_SET_MAX_VARIABLE)
2726

28-
unset(CMAKE_REQUIRED_LIBRARIES)
29-
unset(CMAKE_REQUIRED_INCLUDES)
27+
unset(CMAKE_REQUIRED_LIBRARIES)
28+
unset(CMAKE_REQUIRED_INCLUDES)
29+
endif()
3030
endif()
3131

3232
configure_file(

0 commit comments

Comments
 (0)