Merge pull request #7112 from rahku/appdomain
[platform/upstream/coreclr.git] / src / ilasm / CMakeLists.txt
1 project(ilasm)
2
3 add_definitions(-DUNICODE)
4 add_definitions(-D_UNICODE)
5 add_definitions(-D_FEATURE_NO_HOST)
6 add_definitions(-D__ILASM__)
7
8 add_definitions(-DFEATURE_CORECLR)
9
10 include_directories(.)
11 include_directories(../ildasm/unixcoreclrloader)
12
13 if(CLR_CMAKE_PLATFORM_UNIX)
14   add_compile_options(-fPIE)
15 endif(CLR_CMAKE_PLATFORM_UNIX)
16
17 set(ILASM_SOURCES
18   assem.cpp
19   writer.cpp
20   writer_enc.cpp
21   method.cpp
22   asmman.cpp
23   main.cpp
24   assembler.cpp
25   prebuilt/asmparse.cpp
26 )
27 if(WIN32)
28   set(ILASM_RESOURCES Native.rc)
29   add_definitions(-DFX_VER_INTERNALNAME_STR=ilasm.exe)
30 endif(WIN32)
31
32
33 if(CLR_CMAKE_PLATFORM_UNIX)
34   # Need generate a right form of asmparse.cpp to avoid the following options.
35   # Clang also produces a bad-codegen on this prebuilt file with optimization.
36   # https://github.com/dotnet/coreclr/issues/2305
37   add_compile_options(-Wno-delete-non-virtual-dtor)
38   add_compile_options(-Wno-deprecated-register)
39   add_compile_options(-Wno-array-bounds)
40   add_compile_options(-Wno-unused-label)
41   set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )
42 endif(CLR_CMAKE_PLATFORM_UNIX)
43
44 _add_executable(ilasm
45   ${ILASM_SOURCES}
46   ${ILASM_RESOURCES}
47 )
48
49 set(ILASM_LINK_LIBRARIES
50   utilcodestaticnohost
51   mscorpe
52   mdhotdata_full
53   corguids
54 )
55
56 if(CLR_CMAKE_PLATFORM_UNIX)
57   target_link_libraries(ilasm
58     ${ILASM_LINK_LIBRARIES}
59     ceefgen
60     unixcoreclrloader
61     utilcodestaticnohost
62     mscorrc_debug
63     coreclrpal
64     palrt
65   )
66
67   # FreeBSD and NetBSD implement dlopen(3) in libc
68   if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
69     target_link_libraries(ilasm
70       dl
71     )
72   endif(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
73 else()
74   target_link_libraries(ilasm
75     ${ILASM_LINK_LIBRARIES}
76     coreclr
77     ole32
78     oleaut32
79     shell32
80   )
81 endif(CLR_CMAKE_PLATFORM_UNIX)
82
83 install_clr(ilasm)
84