xref: /reactos/ntoskrnl/CMakeLists.txt (revision 84ccccab)
1
2PROJECT(NTOS)
3
4include(ntos.cmake)
5
6set(NTOSKRNL_SOURCE ${SOURCE})
7set(NTOSKRNL_ASM_SOURCE ${ASM_SOURCE})
8
9set(NTKRNLMP_SOURCE ${SOURCE})
10set(NTKRNLMP_ASM_SOURCE ${ASM_SOURCE})
11
12spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB)
13add_asm_files(ntoskrnl_asm ${NTOSKRNL_ASM_SOURCE})
14
15add_executable(ntoskrnl
16    ${ntoskrnl_asm}
17    ${NTOSKRNL_SOURCE}
18    guid.c
19    ntoskrnl.rc
20    ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
21
22if(ARCH STREQUAL "i386")
23    set_entrypoint(ntoskrnl KiSystemStartup 4)
24else()
25    set_entrypoint(ntoskrnl KiSystemStartup)
26endif()
27set_subsystem(ntoskrnl native)
28
29if(MSVC)
30    set_image_base(ntoskrnl 0x00400000)
31    add_target_link_flags(ntoskrnl "/SECTION:.rsrc,!DP") #Accessed from bugcheck code
32else()
33    if(GDB)
34        set_image_base(ntoskrnl 0x00800000)
35    else()
36        set_image_base(ntoskrnl 0x80800000)
37    endif()
38endif()
39
40target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent)
41
42if(STACK_PROTECTOR)
43    target_link_libraries(ntoskrnl gcc_ssp)
44elseif(RUNTIME_CHECKS)
45    target_link_libraries(ntoskrnl runtmchk)
46endif()
47
48add_importlibs(ntoskrnl hal kdcom bootvid)
49add_pch(ntoskrnl ${REACTOS_SOURCE_DIR}/ntoskrnl/include/ntoskrnl.h NTOSKRNL_SOURCE)
50add_dependencies(ntoskrnl psdk bugcodes asm)
51add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
52
53if(BUILD_MP)
54    add_subdirectory(ntkrnlmp)
55endif()
56
57add_asm_files(ntdllsys_asm ntdll.S)
58add_library(ntdllsys ${ntdllsys_asm})
59set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
60add_dependencies(ntdllsys asm)