blob: e2fcacc2f3363da097661311239a1570724fa86b (
plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
cmake_minimum_required(VERSION 2.8.12)
project(CoreRT)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(NOT WIN32)
set(CMAKE_C_FLAGS "-std=c11")
set(CMAKE_CXX_FLAGS "-std=c++11")
endif()
set(CMAKE_SHARED_LIBRARY_PREFIX "")
function(clr_unknown_arch)
if (WIN32)
message(FATAL_ERROR "Only AMD64 and I386 are supported")
else()
message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported")
endif()
endfunction()
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
add_definitions(-DBIT64=1)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
add_definitions(-DBIT32=1)
# Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang
# we have to set the triple by adding a compiler argument
add_compile_options(-target armv7-linux-gnueabihf)
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
endif ()
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_PLATFORM_UNIX 1)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM64 1)
else()
clr_unknown_arch()
endif()
set(CLR_CMAKE_PLATFORM_LINUX 1)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CLR_CMAKE_PLATFORM_UNIX 1)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
set(CLR_CMAKE_PLATFORM_DARWIN 1)
set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> -o <OBJECT> -c <SOURCE>")
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
if (CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DPLATFORM_UNIX=1)
# All warnings that are not explicitly disabled are reported as errors
add_compile_options(-Wall)
add_compile_options(-Werror)
add_compile_options(-Wno-format-nonliteral)
add_compile_options(-Wno-missing-prototypes)
add_compile_options(-Wno-disabled-macro-expansion)
add_compile_options(-Wno-c++98-compat)
add_compile_options(-Wno-c++98-compat-pedantic)
add_compile_options(-Wno-null-conversion)
add_compile_options(-Wno-invalid-offsetof)
add_compile_options(-Wno-null-arithmetic)
# Disable strict warning on unused functions.
add_compile_options(-Wno-unused-function)
# The -fms-extensions enable the stuff like __if_exists, __declspec(uuid()), etc.
add_compile_options(-fms-extensions )
add_compile_options(-fPIC)
endif(CLR_CMAKE_PLATFORM_UNIX)
if(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM)
set(CLR_CMAKE_PLATFORM_ARCH_ARM 1)
elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM64)
set(CLR_CMAKE_PLATFORM_ARCH_ARM64 1)
elseif(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
elseif(WIN32)
if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
set(IS_64BIT_BUILD 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
set(IS_64BIT_BUILD 0)
else()
clr_unknown_arch()
endif()
endif()
# Set the passed in RetSources variable to the list of sources with added current source directory
# to form absolute paths.
# The parameters after the RetSources are the input files.
function(convert_to_absolute_path RetSources)
set(Sources ${ARGN})
foreach(Source IN LISTS Sources)
list(APPEND AbsolutePathSources ${CMAKE_CURRENT_SOURCE_DIR}/${Source})
endforeach()
set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE)
endfunction(convert_to_absolute_path)
if(WIN32)
add_definitions(-DWIN32)
add_compile_options($<$<CONFIG:Debug>:-DDEBUG>)
else(WIN32)
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
add_compile_options(-g -O0)
add_definitions(-DDEBUG)
add_definitions(-D_DEBUG)
elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
add_compile_options (-O3)
add_definitions(-DNDEBUG)
else ()
message(FATAL_ERROR "Unknown build type. Set CMAKE_BUILD_TYPE to DEBUG or RELEASE.")
endif ()
endif (WIN32)
include(configure.cmake)
if(WIN32)
add_subdirectory(gc)
endif()
add_subdirectory(Runtime)
add_subdirectory(Bootstrap)
|