summaryrefslogtreecommitdiff
path: root/src/ildasm/exe/CMakeLists.txt
blob: 8a57044ce6fa4faa8a4210f726df1414f61d8b10 (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
project(ildasm)

add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-D_FEATURE_NO_HOST)
add_definitions(-D__ILDASM__)

add_definitions(-DFEATURE_CORECLR)

include_directories(..)

if(CLR_CMAKE_PLATFORM_UNIX)
    add_compile_options(-fPIE)
    include_directories(../unixcoreclrloader)
    build_resources(${CMAKE_CURRENT_SOURCE_DIR}/../dasm.rc dasm_rc TARGET_CPP_FILE)

    set(ILDASM_RESOURCES
        ${TARGET_CPP_FILE}
    )
endif(CLR_CMAKE_PLATFORM_UNIX)

set(ILDASM_SOURCES
    ../ceeload.cpp
    ../dasm.cpp
    ../dasm_formattype.cpp
    ../dasm_mi.cpp
    ../dasm_pr.cpp
    ../dasm_sz.cpp
    ../dis.cpp
    ../dman.cpp
    ../dres.cpp
    ../gui.cpp
    ../ildasmpch.cpp
    ../windasm.cpp
)

add_executable(ildasm
    ${ILDASM_SOURCES}
    ${ILDASM_RESOURCES}
)

set(ILDASM_LINK_LIBRARIES
    utilcodestaticnohost
    mdhotdata_full
    corguids
)

if(CLR_CMAKE_PLATFORM_UNIX)
    target_link_libraries(ildasm
        ${ILDASM_LINK_LIBRARIES}
        unixcoreclrloader
        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(ildasm
            dl
        )
    endif(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
else()
    target_link_libraries(ildasm
        ${ILDASM_LINK_LIBRARIES}
        coreclr
        msvcrt
        ole32
        oleaut32
        shell32
    )

    # We will generate PDB only for the debug configuration
    install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/ildasm.pdb DESTINATION PDB)

endif(CLR_CMAKE_PLATFORM_UNIX)

install (TARGETS ildasm DESTINATION .)