2011-05-16 13:12:07 +00:00
|
|
|
|
2012-06-12 22:28:46 +00:00
|
|
|
PROJECT(NTOS)
|
|
|
|
|
2014-02-10 17:12:41 +00:00
|
|
|
include(ntos.cmake)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2014-02-10 17:12:41 +00:00
|
|
|
set(NTOSKRNL_SOURCE ${SOURCE})
|
|
|
|
set(NTOSKRNL_ASM_SOURCE ${ASM_SOURCE})
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2014-02-10 17:12:41 +00:00
|
|
|
set(NTKRNLMP_SOURCE ${SOURCE})
|
|
|
|
set(NTKRNLMP_ASM_SOURCE ${ASM_SOURCE})
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2014-02-10 17:12:41 +00:00
|
|
|
spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB)
|
2020-12-31 16:56:39 +00:00
|
|
|
|
|
|
|
# Embed RTC libs
|
|
|
|
if (STACK_PROTECTOR)
|
|
|
|
target_sources(libntoskrnl PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>)
|
|
|
|
endif()
|
|
|
|
|
2014-02-10 17:12:41 +00:00
|
|
|
add_asm_files(ntoskrnl_asm ${NTOSKRNL_ASM_SOURCE})
|
2013-01-08 20:33:08 +00:00
|
|
|
|
2020-11-09 08:41:48 +00:00
|
|
|
if (GCC AND CLANG)
|
|
|
|
# Clang optimises strcmp calls to memcmp.
|
2020-12-31 16:56:39 +00:00
|
|
|
target_sources(libntoskrnl PRIVATE $<TARGET_OBJECTS:memcmp>)
|
2020-11-09 08:41:48 +00:00
|
|
|
endif()
|
|
|
|
|
2020-05-09 21:37:40 +00:00
|
|
|
list(APPEND PCH_SKIP_SOURCE
|
|
|
|
guid.c)
|
|
|
|
|
2012-04-13 21:35:00 +00:00
|
|
|
add_executable(ntoskrnl
|
2013-01-08 20:33:08 +00:00
|
|
|
${ntoskrnl_asm}
|
2014-02-10 17:12:41 +00:00
|
|
|
${NTOSKRNL_SOURCE}
|
2020-05-09 21:37:40 +00:00
|
|
|
${PCH_SKIP_SOURCE}
|
2014-02-10 17:12:41 +00:00
|
|
|
ntoskrnl.rc
|
2012-04-13 21:35:00 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
|
2019-02-03 11:57:20 +00:00
|
|
|
set_property(TARGET ntoskrnl PROPERTY ENABLE_EXPORTS TRUE)
|
2019-04-06 11:22:50 +00:00
|
|
|
set_target_properties(ntoskrnl PROPERTIES DEFINE_SYMBOL "")
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2020-05-27 20:28:00 +00:00
|
|
|
source_group(TREE ${REACTOS_SOURCE_DIR}/ntoskrnl PREFIX "Source Files" FILES ${NTOSKRNL_SOURCE})
|
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2012-12-22 10:47:06 +00:00
|
|
|
set_entrypoint(ntoskrnl KiSystemStartup 4)
|
2011-06-06 19:08:39 +00:00
|
|
|
else()
|
2012-12-22 10:47:06 +00:00
|
|
|
set_entrypoint(ntoskrnl KiSystemStartup)
|
2011-06-06 19:08:39 +00:00
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
set_subsystem(ntoskrnl native)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
set_image_base(ntoskrnl 0x00400000)
|
2015-09-03 09:29:26 +00:00
|
|
|
add_target_link_flags(ntoskrnl "/SECTION:.rsrc,!DP") #Accessed from bugcheck code
|
2020-10-06 19:36:45 +00:00
|
|
|
add_target_link_flags(ntoskrnl "/SECTION:INIT,ERWD")
|
2011-05-16 13:12:07 +00:00
|
|
|
else()
|
2020-11-09 16:01:07 +00:00
|
|
|
if(GDB AND NOT CLANG)
|
2020-10-21 10:32:54 +00:00
|
|
|
# Completely disable optimizations when debugging the kernel
|
2020-11-09 16:01:07 +00:00
|
|
|
# Not for CLang, which fails as following in _SEH2_EXCEPT macro:
|
|
|
|
# error: inline assembly requires more registers than available
|
2020-10-21 10:32:54 +00:00
|
|
|
target_compile_options(ntoskrnl PRIVATE -O0)
|
2014-10-11 13:43:02 +00:00
|
|
|
set_image_base(ntoskrnl 0x00800000)
|
|
|
|
else()
|
|
|
|
set_image_base(ntoskrnl 0x80800000)
|
|
|
|
endif()
|
2020-05-13 15:08:25 +00:00
|
|
|
add_linker_script(ntoskrnl ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
2020-03-26 14:45:59 +00:00
|
|
|
target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} arbiter cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2014-10-04 20:26:14 +00:00
|
|
|
if(STACK_PROTECTOR)
|
2020-12-31 16:56:39 +00:00
|
|
|
target_sources(ntoskrnl PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>)
|
2014-10-18 14:22:09 +00:00
|
|
|
elseif(RUNTIME_CHECKS)
|
|
|
|
target_link_libraries(ntoskrnl runtmchk)
|
2014-10-04 20:26:14 +00:00
|
|
|
endif()
|
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
add_importlibs(ntoskrnl hal kdcom bootvid)
|
2020-05-09 21:37:40 +00:00
|
|
|
add_pch(ntoskrnl ${REACTOS_SOURCE_DIR}/ntoskrnl/include/ntoskrnl.h "${PCH_SKIP_SOURCE}")
|
2011-05-16 13:12:07 +00:00
|
|
|
add_dependencies(ntoskrnl psdk bugcodes asm)
|
|
|
|
add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
|
2012-03-07 21:21:27 +00:00
|
|
|
|
2012-04-13 16:16:39 +00:00
|
|
|
if(BUILD_MP)
|
2014-02-10 17:12:41 +00:00
|
|
|
add_subdirectory(ntkrnlmp)
|
2012-04-13 16:16:39 +00:00
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2013-01-08 20:33:08 +00:00
|
|
|
add_asm_files(ntdllsys_asm ntdll.S)
|
|
|
|
add_library(ntdllsys ${ntdllsys_asm})
|
|
|
|
set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
|
2020-05-27 20:28:00 +00:00
|
|
|
add_dependencies(ntdllsys asm)
|