Merge pull request #11262 from pgavlin/NoCompatJit
[platform/upstream/coreclr.git] / src / CMakeLists.txt
1 include_directories("inc")
2 include_directories("strongname/inc")
3 include_directories("inc/winrt")
4 include_directories("debug/inc")
5 include_directories("debug/inc/${ARCH_SOURCES_DIR}")
6 include_directories("debug/inc/dump")
7 include_directories("md/inc")
8 include_directories("classlibnative/bcltype")
9 include_directories("classlibnative/cryptography")
10 include_directories("classlibnative/inc")
11 include_directories("${GENERATED_INCLUDE_DIR}")
12
13 # The Following Logic is used to wire up Build dependencies for Generated files in Event Logging 
14 # ClrEtwAll.man                  - Event Schema
15 # ClrEtwAllMeta.lst              - MetaData list [provided to ensure Windows Desktop is not broken]
16 # genXplatEventing.py            - has the core logic for parsing Event Schema
17 # genWinEtw.py                   - Uses genXplatEventing to generate Windows Specific ETW Files
18 # clretwallmain.h and etmdummy.h - Provides the Event Logging Functionality to the VM
19 # clrxplatevents.h               - Used by clretwallmain.h on Non Windows platform
20 # ClrEtwAll.h                    - Used by clretwallmain.h on  Windows 
21 # ClrEtwAll.rc                   - Used by src/dlls/clretwrc/clretrw.rc on Windows
22
23 set (ScriptGeneratedEventFiles
24       ${GENERATED_INCLUDE_DIR}/clretwallmain.h
25       ${GENERATED_INCLUDE_DIR}/etmdummy.h
26 )
27 set (GeneratedEventFiles)
28
29 if(WIN32)
30     set (GenEventFilesScript "${CLR_DIR}/src/scripts/genWinEtw.py")
31     set (GenEventArgs --eventheader "${GENERATED_INCLUDE_DIR}/ClrEtwAll.h" --macroheader "${GENERATED_INCLUDE_DIR}/clretwallmain.h")
32
33     list (APPEND ScriptGeneratedEventFiles
34           ${GENERATED_INCLUDE_DIR}/ClrEtwAll.h
35     )
36
37     list (APPEND GeneratedEventFiles
38          ${GENERATED_INCLUDE_DIR}/ClrEtwAll.rc
39     )
40
41     add_custom_command(
42       COMMENT "Generating ETW resource Files"
43       COMMAND ${MC} -h ${GENERATED_INCLUDE_DIR} -r ${GENERATED_INCLUDE_DIR} -b -co -um -p FireEtw "${VM_DIR}/ClrEtwAll.man"
44       OUTPUT ${GENERATED_INCLUDE_DIR}/ClrEtwAll.h
45       DEPENDS "${VM_DIR}/ClrEtwAll.man"
46     )
47 else()
48     set (GenEventFilesScript "${CLR_DIR}/src/scripts/genXplatEventing.py")
49     set (GenEventArgs   --inc  "${GENERATED_INCLUDE_DIR}")
50
51     list (APPEND ScriptGeneratedEventFiles
52           ${GENERATED_INCLUDE_DIR}/clrxplatevents.h
53     )
54 endif(WIN32)
55
56 add_custom_command(
57   COMMENT "Generating Eventing Files"
58   COMMAND ${PYTHON} -B -Wall -Werror ${GenEventFilesScript} ${GenEventArgs} --man "${VM_DIR}/ClrEtwAll.man" --exc "${VM_DIR}/ClrEtwAllMeta.lst" --dummy "${GENERATED_INCLUDE_DIR}/etmdummy.h"
59   OUTPUT ${ScriptGeneratedEventFiles}
60   DEPENDS ${GenEventFilesScript} "${VM_DIR}/ClrEtwAll.man" "${VM_DIR}/ClrEtwAllMeta.lst" "${CLR_DIR}/src/scripts/genXplatEventing.py"
61 )
62
63 list (APPEND GeneratedEventFiles
64       ${ScriptGeneratedEventFiles}
65 )
66
67 add_custom_target(
68   GeneratedEventingFiles
69   DEPENDS ${GeneratedEventFiles}
70 )
71
72 function(add_library_clr)
73     if(NOT WIN32)
74       add_library(${ARGV} ${VERSION_FILE_PATH})
75     else()
76       add_library(${ARGV})
77     endif(NOT WIN32)
78     add_dependencies(${ARGV0} GeneratedEventingFiles)
79     list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX)  
80     if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1)  
81      set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1)  
82     endif()  
83 endfunction()
84
85 function(add_executable_clr)
86     if(NOT WIN32)
87       add_executable(${ARGV} ${VERSION_FILE_PATH})
88     else()
89       add_executable(${ARGV})
90     endif(NOT WIN32)
91     add_dependencies(${ARGV0} GeneratedEventingFiles)
92     list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX)  
93     if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1)  
94      set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1)  
95     endif()  
96 endfunction()
97
98 if(CLR_CMAKE_PLATFORM_UNIX)
99   if(CLR_CMAKE_PLATFORM_LINUX)
100     if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
101       add_subdirectory(debug/createdump)
102     endif(CLR_CMAKE_PLATFORM_UNIX_AMD64)
103   endif(CLR_CMAKE_PLATFORM_LINUX)
104
105   add_subdirectory(ToolBox/SOS/Strike)
106
107   # Include the dummy c++ include files
108   include_directories("pal/inc/rt/cpp")
109
110   # This prevents inclusion of standard C compiler headers
111   add_compile_options(-nostdinc)
112
113   set (NATIVE_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nativeresources)
114   include_directories(${NATIVE_RESOURCE_DIR})
115   set (RC_TO_CPP ${NATIVE_RESOURCE_DIR}/rctocpp.awk)
116   set (PROCESS_RC ${NATIVE_RESOURCE_DIR}/processrc.awk)
117   set (RESOURCE_STRING_HEADER_DIR ${NATIVE_RESOURCE_DIR})
118
119   # Create a command to create a C++ source file containing an array of
120   # NativeStringResource structs which represent the information from a
121   # given Windows .rc file. The target C++ file path is returned in the
122   # variable specified by the TARGET_FILE parameter.
123   function(build_resources SOURCE TARGET_NAME TARGET_FILE)
124
125     get_compile_definitions(PREPROCESS_DEFINITIONS)
126     get_include_directories(INCLUDE_DIRECTORIES)
127
128     set(PREPROCESSED_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.rc.i)
129     set(RESOURCE_ENTRY_ARRAY_CPP ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.cpp)
130
131     add_custom_command(
132       OUTPUT ${RESOURCE_ENTRY_ARRAY_CPP}
133       # Preprocess the windows .rc file
134       COMMAND ${CMAKE_CXX_COMPILER} -E -P ${PREPROCESS_DEFINITIONS} ${INCLUDE_DIRECTORIES} -o ${PREPROCESSED_SOURCE} -x c ${SOURCE}
135       # Convert the preprocessed .rc file to a C++ file which will be used to make a static lib.
136       COMMAND ${AWK} -v name=${TARGET_NAME} -f ${RC_TO_CPP} -f ${PROCESS_RC} ${PREPROCESSED_SOURCE} >${RESOURCE_ENTRY_ARRAY_CPP}
137             DEPENDS ${SOURCE} ${RC_TO_CPP} ${PROCESS_RC}
138     )
139
140     include_directories(${RESOURCE_STRING_HEADER_DIR})
141     set(${TARGET_FILE} ${RESOURCE_ENTRY_ARRAY_CPP} PARENT_SCOPE)
142
143   endfunction()
144
145   add_subdirectory(nativeresources)
146 endif(CLR_CMAKE_PLATFORM_UNIX)
147
148 add_subdirectory(utilcode)
149 add_subdirectory(gcinfo)
150 add_subdirectory(coreclr)
151 add_subdirectory(jit)
152 add_subdirectory(gc)
153 add_subdirectory(vm)
154 add_subdirectory(md)
155 add_subdirectory(debug)
156 add_subdirectory(inc)
157 add_subdirectory(strongname)
158 add_subdirectory(binder)
159 add_subdirectory(classlibnative)
160 add_subdirectory(dlls)
161 add_subdirectory(ToolBox)
162 add_subdirectory(tools)
163 add_subdirectory(unwinder)
164 add_subdirectory(ildasm)
165 add_subdirectory(ilasm)
166
167 if(WIN32)
168   add_subdirectory(ipcman)
169 endif(WIN32)
170
171 if(CLR_CMAKE_PLATFORM_UNIX)
172     add_subdirectory(palrt)
173 endif(CLR_CMAKE_PLATFORM_UNIX)