xref: /reactos/dll/ntdll/CMakeLists.txt (revision b707be90)
1
2add_subdirectory(nt_0600)
3
4spec2def(ntdll.dll def/ntdll.spec ADD_IMPORTLIB)
5
6# Embed RTC libs
7if (STACK_PROTECTOR)
8    target_sources(libntdll PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>)
9endif()
10
11add_definitions(
12    -D__NTDLL__
13    -D_NTOSKRNL_
14    -DCRTDLL)
15
16include_directories(
17    BEFORE include
18    ${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys)
19
20add_library(rtl_um OBJECT
21    rtl/libsupp.c
22    rtl/uilist.c
23    rtl/version.c)
24target_link_libraries(rtl_um apisets ${PSEH_LIB})
25add_dependencies(rtl_um psdk)
26
27# On NT6+ this is used by advapi32
28add_library(etwtrace etw/trace.c)
29target_link_libraries(etwtrace ${PSEH_LIB})
30add_dependencies(etwtrace psdk)
31
32list(APPEND SOURCE
33    dbg/dbgui.c
34    ldr/ldrapi.c
35    ldr/ldrinit.c
36    ldr/ldrpe.c
37    ldr/ldrutils.c
38    ldr/verifier.c)
39
40if(ARCH STREQUAL "i386")
41    list(APPEND ASM_SOURCE dispatch/i386/dispatch.S)
42elseif(ARCH STREQUAL "amd64")
43    list(APPEND ASM_SOURCE dispatch/amd64/dispatch.S)
44elseif(ARCH STREQUAL "arm")
45    list(APPEND ASM_SOURCE dispatch/arm/stubs_asm.s)
46else()
47    list(APPEND SOURCE dispatch/dispatch.c)
48endif()
49
50add_asm_files(ntdll_asm ${ASM_SOURCE})
51
52list(APPEND PCH_SKIP_SOURCE
53    ${CMAKE_CURRENT_BINARY_DIR}/ntdll_stubs.c)
54
55add_library(ntdll MODULE
56    ${SOURCE}
57    ${ntdll_asm}
58    ${PCH_SKIP_SOURCE}
59    def/ntdll.rc
60    ${CMAKE_CURRENT_BINARY_DIR}/ntdll.def)
61
62set_module_type(ntdll win32dll ENTRYPOINT 0)
63#############################################
64## HACK FOR MSVC COMPILATION WITH win32dll ##
65set_subsystem(ntdll console)
66################# END  HACK #################
67
68target_link_libraries(ntdll etwtrace csrlib rtl rtl_um rtl_vista ntdllsys libcntpr uuid ${PSEH_LIB})
69if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600)
70    target_link_libraries(ntdll cryptlib)
71endif()
72
73if (STACK_PROTECTOR)
74    target_sources(ntdll PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>)
75endif()
76
77add_pch(ntdll include/ntdll.h "${PCH_SKIP_SOURCE}")
78add_dependencies(ntdll ntstatus asm)
79add_cd_file(TARGET ntdll DESTINATION reactos/system32 NO_CAB FOR all)
80
81# Newer VS versions link to _ftol2 / _ftoul2_legacy
82if(MSVC AND ARCH STREQUAL "i386")
83    target_link_libraries(libntdll ftol2)
84endif()
85