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 15list(APPEND PCH_SKIP_SOURCE 16 guid.c) 17 18add_executable(ntoskrnl 19 ${ntoskrnl_asm} 20 ${NTOSKRNL_SOURCE} 21 ${PCH_SKIP_SOURCE} 22 ntoskrnl.rc 23 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def) 24set_property(TARGET ntoskrnl PROPERTY ENABLE_EXPORTS TRUE) 25set_target_properties(ntoskrnl PROPERTIES DEFINE_SYMBOL "") 26 27source_group(TREE ${REACTOS_SOURCE_DIR}/ntoskrnl PREFIX "Source Files" FILES ${NTOSKRNL_SOURCE}) 28 29if(ARCH STREQUAL "i386") 30 set_entrypoint(ntoskrnl KiSystemStartup 4) 31else() 32 set_entrypoint(ntoskrnl KiSystemStartup) 33endif() 34set_subsystem(ntoskrnl native) 35 36if(MSVC) 37 set_image_base(ntoskrnl 0x00400000) 38 add_target_link_flags(ntoskrnl "/SECTION:.rsrc,!DP") #Accessed from bugcheck code 39 add_target_link_flags(ntoskrnl "/SECTION:INIT,D") 40else() 41 if(GDB) 42 set_image_base(ntoskrnl 0x00800000) 43 else() 44 set_image_base(ntoskrnl 0x80800000) 45 endif() 46 add_linker_script(ntoskrnl ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds) 47endif() 48 49target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} arbiter cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent) 50 51if(STACK_PROTECTOR) 52 target_link_libraries(ntoskrnl gcc_ssp) 53elseif(RUNTIME_CHECKS) 54 target_link_libraries(ntoskrnl runtmchk) 55endif() 56 57add_importlibs(ntoskrnl hal kdcom bootvid) 58add_pch(ntoskrnl ${REACTOS_SOURCE_DIR}/ntoskrnl/include/ntoskrnl.h "${PCH_SKIP_SOURCE}") 59add_dependencies(ntoskrnl psdk bugcodes asm) 60add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all) 61 62if(BUILD_MP) 63 add_subdirectory(ntkrnlmp) 64endif() 65 66add_asm_files(ntdllsys_asm ntdll.S) 67add_library(ntdllsys ${ntdllsys_asm}) 68set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C") 69add_dependencies(ntdllsys asm) 70