xref: /reactos/ntoskrnl/CMakeLists.txt (revision 1ac9e484)
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)
21set_property(TARGET ntoskrnl PROPERTY ENABLE_EXPORTS TRUE)
22set_target_properties(ntoskrnl PROPERTIES DEFINE_SYMBOL "")
23
24if(ARCH STREQUAL "i386")
25    set_entrypoint(ntoskrnl KiSystemStartup 4)
26else()
27    set_entrypoint(ntoskrnl KiSystemStartup)
28endif()
29set_subsystem(ntoskrnl native)
30
31if(MSVC)
32    set_image_base(ntoskrnl 0x00400000)
33    add_target_link_flags(ntoskrnl "/SECTION:.rsrc,!DP") #Accessed from bugcheck code
34else()
35    if(GDB)
36        set_image_base(ntoskrnl 0x00800000)
37    else()
38        set_image_base(ntoskrnl 0x80800000)
39    endif()
40endif()
41
42target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent)
43
44if(STACK_PROTECTOR)
45    target_link_libraries(ntoskrnl gcc_ssp)
46elseif(RUNTIME_CHECKS)
47    target_link_libraries(ntoskrnl runtmchk)
48endif()
49
50add_importlibs(ntoskrnl hal kdcom bootvid)
51add_pch(ntoskrnl ${REACTOS_SOURCE_DIR}/ntoskrnl/include/ntoskrnl.h NTOSKRNL_SOURCE)
52add_dependencies(ntoskrnl psdk bugcodes asm)
53add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
54
55if(BUILD_MP)
56    add_subdirectory(ntkrnlmp)
57endif()
58
59add_asm_files(ntdllsys_asm ntdll.S)
60add_library(ntdllsys ${ntdllsys_asm})
61set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
62add_dependencies(ntdllsys asm)