xref: /reactos/dll/win32/dbghelp/CMakeLists.txt (revision 9393fc32)
1
2if(NOT CMAKE_CROSSCOMPILING)
3    add_definitions(-DDBGHELP_STATIC_LIB)
4
5    include_directories(
6        ${REACTOS_SOURCE_DIR}/tools)
7
8    list(APPEND SOURCE
9        compat.c
10        dbghelp.c
11        dwarf.c
12        inflate.c
13        module.c
14        pe_module.c
15        source.c
16        stabs.c
17        storage.c
18        symbol.c
19        type.c)
20
21    if(ARCH STREQUAL "i386")
22        list(APPEND SOURCE cpu_i386.c)
23    endif()
24
25    add_library(dbghelphost ${SOURCE})
26    target_link_libraries(dbghelphost PRIVATE host_includes)
27else()
28    add_definitions(
29        -D__WINESRC__
30        -D_WINE
31        -DHAVE_ALLOCA_H
32        -D_IMAGEHLP_SOURCE_)
33
34    if(ARCH STREQUAL "amd64")
35        add_definitions(-DUNW_FLAG_NHANDLER=0 -DUNW_FLAG_EHANDLER=1 -DUNW_FLAG_UHANDLER=2 -DUNW_FLAG_CHAININFO=3)
36    endif()
37
38    include_directories(
39        BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
40
41    spec2def(dbghelp.dll dbghelp.spec ADD_IMPORTLIB)
42
43    list(APPEND SOURCE
44        coff.c
45        cpu_arm.c
46        cpu_arm64.c
47        cpu_i386.c
48        cpu_x86_64.c
49        dbghelp.c
50        dwarf.c
51#       elf_module.c
52        image.c
53#       macho_module.c
54        inflate.c
55        minidump.c
56        module.c
57        msc.c
58        path.c
59        pe_module.c
60        rosstubs.c
61        rsym.c
62        source.c
63        stabs.c
64        stack.c
65        storage.c
66        symbol.c
67        type.c
68        precomp.h)
69
70    add_library(dbghelp MODULE
71        ${SOURCE}
72        version.rc
73        ${CMAKE_CURRENT_BINARY_DIR}/dbghelp_stubs.c
74        ${CMAKE_CURRENT_BINARY_DIR}/dbghelp.def)
75
76    set_module_type(dbghelp win32dll)
77    target_link_libraries(dbghelp wine ${PSEH_LIB} oldnames)
78    add_delay_importlibs(dbghelp version)
79    add_importlibs(dbghelp psapi msvcrt kernel32 ntdll)
80    add_pch(dbghelp precomp.h SOURCE)
81    add_cd_file(TARGET dbghelp DESTINATION reactos/system32 FOR all)
82
83    if(MSVC)
84        # Disable warning C4146: unary minus operator applied to unsigned type, result still unsigned
85        # Disable warning C4477 (printf format warnings)
86        target_compile_options(dbghelp PRIVATE /wd4146 /wd4477)
87    endif()
88endif()
89