blob: cf983797dcd65aa5f5df6eb0549603f62feed2c6 (
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
|
project(ilasm)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-D_FEATURE_NO_HOST)
add_definitions(-D__ILASM__)
add_definitions(-DFEATURE_CORECLR)
include_directories(.)
include_directories(../ildasm/unixcoreclrloader)
if(CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-fPIE)
endif(CLR_CMAKE_PLATFORM_UNIX)
set(ILASM_SOURCES
assem.cpp
writer.cpp
writer_enc.cpp
method.cpp
asmman.cpp
main.cpp
assembler.cpp
prebuilt/asmparse.cpp
)
set(ILASM_HEADERS
asmenum.h
asmman.hpp
asmparse.h
asmtemplates.h
assembler.h
binstr.h
class.hpp
ilasmpch.h
method.hpp
nvpair.h
typar.hpp
)
if(WIN32)
list(APPEND ILASM_SOURCES ${ILASM_HEADERS})
set(ILASM_RESOURCES Native.rc)
add_definitions(-DFX_VER_INTERNALNAME_STR=ilasm.exe)
endif(WIN32)
if(CLR_CMAKE_PLATFORM_UNIX)
# Need generate a right form of asmparse.cpp to avoid the following options.
# Clang also produces a bad-codegen on this prebuilt file with optimization.
# https://github.com/dotnet/coreclr/issues/2305
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-Wno-register>")
add_compile_options(-Wno-array-bounds)
add_compile_options(-Wno-unused-label)
set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )
endif(CLR_CMAKE_PLATFORM_UNIX)
_add_executable(ilasm
${ILASM_SOURCES}
${ILASM_RESOURCES}
)
set_target_properties(ilasm PROPERTIES LINK_FLAGS -pie)
set(ILASM_LINK_LIBRARIES
utilcodestaticnohost
mscorpe
mdhotdata_full
corguids
)
if(CLR_CMAKE_PLATFORM_UNIX)
target_link_libraries(ilasm
${ILASM_LINK_LIBRARIES}
ceefgen
unixcoreclrloader
utilcodestaticnohost
mscorrc_debug
coreclrpal
palrt
)
# FreeBSD and NetBSD implement dlopen(3) in libc
if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
target_link_libraries(ilasm
dl
)
endif(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
else()
target_link_libraries(ilasm
${ILASM_LINK_LIBRARIES}
coreclr
ole32
oleaut32
shell32
)
endif(CLR_CMAKE_PLATFORM_UNIX)
install_clr(ilasm)
|