-
Notifications
You must be signed in to change notification settings - Fork 103
/
platformdefinitions.cmake
99 lines (92 loc) · 3.07 KB
/
platformdefinitions.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#------------------------------------
# Definitions (for platform)
#-----------------------------------
if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
add_definitions(-D_AMD64_)
add_definitions(-D_WIN64)
add_definitions(-DAMD64)
add_definitions(-DBIT64=1) # CoreClr <= 3.x
add_definitions(-DHOST_64BIT=1) # CoreClr > 3.x
add_definitions(-DHOST_AMD64)
elseif (CLR_CMAKE_PLATFORM_ARCH_I386)
add_definitions(-D_X86_)
add_definitions(-DHOST_X86)
elseif (CLR_CMAKE_PLATFORM_ARCH_ARM)
add_definitions(-D_ARM_)
add_definitions(-DARM)
add_definitions(-DHOST_ARM)
elseif (CLR_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-D_ARM64_)
add_definitions(-DARM64)
add_definitions(-D_WIN64)
add_definitions(-DBIT64=1) # CoreClr <= 3.x
add_definitions(-DHOST_64BIT=1) # CoreClr > 3.x
add_definitions(-DHOST_ARM64)
elseif (CLR_CMAKE_PLATFORM_ARCH_RISCV64)
add_definitions(-D_RISCV64_)
add_definitions(-DRISCV64)
add_definitions(-D_WIN64)
add_definitions(-DBIT64=1) # CoreClr <= 3.x
add_definitions(-DHOST_64BIT=1) # CoreClr > 3.x
add_definitions(-DHOST_RISCV64)
else ()
clr_unknown_arch()
endif ()
if (CLR_CMAKE_PLATFORM_UNIX)
if(CLR_CMAKE_PLATFORM_LINUX)
if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
message("Detected Linux x86_64")
add_definitions(-DLINUX64)
elseif(CLR_CMAKE_PLATFORM_UNIX_ARM)
message("Detected Linux ARM")
add_definitions(-DLINUX32)
elseif(CLR_CMAKE_PLATFORM_UNIX_ARM64)
message("Detected Linux ARM64")
add_definitions(-DLINUX64)
elseif(CLR_CMAKE_PLATFORM_UNIX_X86)
message("Detected Linux i686")
add_definitions(-DLINUX32)
elseif(CLR_CMAKE_PLATFORM_UNIX_RISCV64)
message("Detected Linux RiscV64")
add_definitions(-DLINUX64)
else()
clr_unknown_arch()
endif()
endif(CLR_CMAKE_PLATFORM_LINUX)
endif(CLR_CMAKE_PLATFORM_UNIX)
if (CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DPLATFORM_UNIX=1)
if(CLR_CMAKE_PLATFORM_DARWIN)
if(CLR_CMAKE_PLATFORM_UNIX_ARM64)
message("Detected OSX ARM64")
else()
message("Detected OSX x86_64")
endif()
endif()
if(CLR_CMAKE_PLATFORM_FREEBSD)
message("Detected FreeBSD amd64")
endif(CLR_CMAKE_PLATFORM_FREEBSD)
if(CLR_CMAKE_PLATFORM_NETBSD)
message("Detected NetBSD amd64")
endif(CLR_CMAKE_PLATFORM_NETBSD)
endif(CLR_CMAKE_PLATFORM_UNIX)
if (WIN32)
# Define the CRT lib references that link into Desktop imports
set(STATIC_MT_CRT_LIB "libcmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
set(STATIC_MT_VCRT_LIB "libvcruntime$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
set(STATIC_MT_CPP_LIB "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
endif(WIN32)
# Architecture specific files folder name
if (CLR_CMAKE_TARGET_ARCH_AMD64)
set(ARCH_SOURCES_DIR amd64)
elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
set(ARCH_SOURCES_DIR arm64)
elseif (CLR_CMAKE_TARGET_ARCH_ARM)
set(ARCH_SOURCES_DIR arm)
elseif (CLR_CMAKE_TARGET_ARCH_I386)
set(ARCH_SOURCES_DIR i386)
elseif (CLR_CMAKE_TARGET_ARCH_RISCV64)
set(ARCH_SOURCES_DIR riscv64)
else ()
clr_unknown_arch()
endif ()