-spec2def(ntoskrnl.exe ntoskrnl.spec)
+PROJECT(NTOS)
+
+spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB)
include_directories(
${REACTOS_SOURCE_DIR}
-D_IN_KERNEL_
-DNTDDI_VERSION=0x05020400)
-set_rc_compiler()
-
-set(NEWCC FALSE)
+if(NOT DEFINED NEWCC)
+ set(NEWCC FALSE)
+endif()
if(NEWCC)
add_definitions(-DNEWCC)
cache/lazyrite.c
cache/logsup.c
cache/mdlsup.c
- cache/pinsup.c
- cache/section/data.c
- cache/section/fault.c
- cache/section/reqtools.c
- cache/section/sptab.c
- cache/section/swapout.c)
+ cache/pinsup.c)
else()
list(APPEND SOURCE
cc/cacheman.c
list(APPEND SOURCE
cache/section/io.c
+ cache/section/data.c
+ cache/section/fault.c
+ cache/section/reqtools.c
+ cache/section/sptab.c
+ cache/section/swapout.c
config/cmalloc.c
config/cmapi.c
config/cmboot.c
ex/event.c
ex/evtpair.c
ex/exintrin.c
- ex/fastinterlck.c
ex/fmutex.c
ex/handle.c
ex/harderr.c
ex/hdlsterm.c
ex/init.c
+ ex/interlocked.c
ex/keyedevt.c
ex/locale.c
ex/lookas.c
ex/work.c
ex/xipdisp.c
ex/zone.c
- ex/zw.S
fsrtl/dbcsname.c
fsrtl/fastio.c
fsrtl/faulttol.c
fsrtl/fsfilter.c
fsrtl/fsrtlpc.c
fsrtl/largemcb.c
+ fsrtl/mcb.c
fsrtl/name.c
fsrtl/notify.c
fsrtl/oplock.c
fstub/disksup.c
fstub/fstubex.c
fstub/halstub.c
- fstub/translate.c
+ fstub/translate.c
inbv/inbv.c
inbv/inbvport.c
io/iomgr/adapter.c
mm/ARM3/pool.c
mm/ARM3/procsup.c
mm/ARM3/section.c
+ mm/ARM3/special.c
mm/ARM3/sysldr.c
mm/ARM3/syspte.c
mm/ARM3/vadnode.c
mm/ARM3/virtual.c
mm/ARM3/zeropage.c
- mm/anonmem.c
mm/balance.c
mm/freelist.c
mm/marea.c
mm/mmfault.c
mm/mminit.c
mm/pagefile.c
- mm/pageop.c
mm/region.c
mm/rmap.c
mm/section.c
se/token.c
vf/driver.c
wmi/wmi.c
- ntoskrnl.rc
- ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
+ ntoskrnl.rc)
-if(ARCH MATCHES i386)
- list(APPEND SOURCE
- config/i386/cmhardwr.c
- ex/i386/interlck_asm.S
+list(APPEND ASM_SOURCE ex/zw.S)
+
+if(ARCH STREQUAL "i386")
+ list(APPEND ASM_SOURCE
ex/i386/fastinterlck_asm.S
ex/i386/ioport.S
- ke/freeldr.c
+ ke/i386/ctxswitch.S
+ ke/i386/trap.s
+ ke/i386/usercall_asm.S
+ rtl/i386/stack.S)
+ list(APPEND SOURCE
+ config/i386/cmhardwr.c
ke/i386/abios.c
ke/i386/cpu.c
ke/i386/context.c
- ke/i386/ctxswitch.S
ke/i386/exp.c
ke/i386/irqobj.c
ke/i386/kiinit.c
ke/i386/mtrr.c
ke/i386/patpge.c
ke/i386/thrdini.c
- ke/i386/trap.s
ke/i386/traphdlr.c
- ke/i386/usercall_asm.S
ke/i386/usercall.c
ke/i386/v86vdm.c
mm/i386/page.c
mm/ARM3/i386/init.c
ps/i386/psctx.c
ps/i386/psldt.c
- rtl/i386/stack.S
vdm/vdmmain.c
vdm/vdmexec.c)
-elseif(ARCH MATCHES amd64)
+elseif(ARCH STREQUAL "amd64")
+ list(APPEND ASM_SOURCE
+ ke/amd64/boot.S
+ ke/amd64/ctxswitch.S
+ ke/amd64/trap.S)
list(APPEND SOURCE
config/i386/cmhardwr.c
- ex/amd64/fastinterlck.c
- ke/amd64/boot.S
ke/amd64/context.c
ke/amd64/cpu.c
- ke/amd64/ctxswitch.S
ke/amd64/except.c
ke/amd64/interrupt.c
ke/amd64/irql.c
ke/amd64/kiinit.c
+ ke/amd64/krnlinit.c
ke/amd64/spinlock.c
ke/amd64/stubs.c
ke/amd64/thrdini.c
- ke/amd64/trap.S
mm/amd64/init.c
mm/amd64/page.c
ps/amd64/psctx.c)
-elseif(ARCH MATCHES arm)
+elseif(ARCH STREQUAL "arm")
+ list(APPEND ASM_SOURCE
+ ke/arm/boot.s
+ ke/arm/ctxswtch.s
+ ke/arm/stubs_asm.s
+ ke/arm/trap.s)
list(APPEND SOURCE
config/arm/cmhardwr.c
- ke/arm/boot.s
ke/arm/cpu.c
- ke/arm/ctxswtch.s
ke/arm/exp.c
ke/arm/kiinit.c
- ke/arm/stubs_asm.s
ke/arm/thrdini.c
- ke/arm/trap.s
ke/arm/trapc.c
ke/arm/usercall.c
mm/arm/page.c
mm/ARM3/arm/init.c
ps/arm/psctx.c
rtl/arm/rtlexcpt.c)
-elseif(ARCH MATCHES powerpc)
+elseif(ARCH STREQUAL "powerpc")
+ list(APPEND ASM_SOURCE
+ ke/powerpc/main_asm.S
+ ke/powerpc/ctxhelp.S)
list(APPEND SOURCE
config/powerpc/cmhardwr.c
- ke/powerpc/main_asm.S
ke/powerpc/cpu.c
ke/powerpc/exp.c
ke/powerpc/kiinit.c
ke/powerpc/systimer.c
ke/powerpc/thrdini.c
ke/powerpc/ctxswitch.c
- ke/powerpc/ctxhelp.S
mm/powerpc/pfault.c
mm/powerpc/page.c)
endif()
if(NOT _WINKD_)
- if(ARCH MATCHES i386)
+ if(ARCH STREQUAL "i386")
list(APPEND SOURCE
+ kd/i386/kdbg.c
kd/i386/kdmemsup.c
kd/wrappers/gdbstub.c)
if(KDBG)
- list(APPEND SOURCE
- kdbg/i386/i386-dis.c
- kdbg/i386/kdb_help.S)
+ list(APPEND ASM_SOURCE kdbg/i386/kdb_help.S)
+ list(APPEND SOURCE kdbg/i386/i386-dis.c)
endif()
- elseif(ARCH MATCHES amd64)
+ elseif(ARCH STREQUAL "amd64")
list(APPEND SOURCE
kd/amd64/kd.c
+ kd/i386/kdbg.c # Use the x86 file
kd/amd64/kdmemsup.c)
if(KDBG)
+ list(APPEND ASM_SOURCE kdbg/amd64/kdb_help.S)
list(APPEND SOURCE
kdbg/amd64/i386-dis.c
- kdbg/amd64/kdb_help.S
kdbg/amd64/kdb.c)
endif()
- elseif(ARCH MATCHES powerpc)
+ elseif(ARCH STREQUAL "arm")
+ list(APPEND SOURCE kd/arm/kdbg.c)
+ elseif(ARCH STREQUAL "powerpc")
list(APPEND SOURCE kd/wrappers/gdbstub_powerpc.c)
endif()
endif()
if(DBG OR KDBG)
+ #list(APPEND SOURCE kdbg/kdb_symbols.cmake.c)
list(APPEND SOURCE kdbg/kdb_symbols.c)
endif()
kd64/kdprint.c
kd64/kdtrap.c)
- if(ARCH MATCHES i386)
+ if(ARCH STREQUAL "i386")
list(APPEND SOURCE kd64/i386/kdx86.c)
- elseif(ARCH MATCHES amd64)
+ elseif(ARCH STREQUAL "amd64")
list(APPEND SOURCE kd64/amd64/kdx64.c)
- elseif(ARCH MATCHES arm)
+ elseif(ARCH STREQUAL "arm")
list(APPEND SOURCE kd64/arm/kdarm.c)
endif()
endif()
-add_executable(ntoskrnl ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl_ntoskrnl.h.gch ${SOURCE})
+add_asm_files(ntoskrnl_asm ${ASM_SOURCE})
+
+add_executable(ntoskrnl
+ ${ntoskrnl_asm}
+ ${SOURCE}
+ ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
-set_entrypoint(ntoskrnl KiSystemStartup@4)
+if(ARCH STREQUAL "i386")
+ set_entrypoint(ntoskrnl KiSystemStartup 4)
+else()
+ set_entrypoint(ntoskrnl KiSystemStartup)
+endif()
set_subsystem(ntoskrnl native)
if(MSVC)
set_image_base(ntoskrnl 0x80800000)
endif()
+# Linker bug
+if(NOT MSVC AND LTCG)
+ add_target_link_flags(ntoskrnl "-shared")
+endif()
+
target_link_libraries(ntoskrnl
cportlib
csq
ioevent)
add_importlibs(ntoskrnl hal kdcom bootvid)
+add_pch(ntoskrnl include/ntoskrnl.h)
+add_dependencies(ntoskrnl psdk bugcodes asm)
+add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
-add_pch(ntoskrnl ${CMAKE_CURRENT_SOURCE_DIR}/include/ntoskrnl.h ${SOURCE})
-add_dependencies(ntoskrnl psdk bugcodes kernel_zw kernel_napi asm)
+if(BUILD_MP)
+ spec2def(ntkrnlmp.exe ntoskrnl.spec)
-add_minicd_target(ntoskrnl reactos ntoskrnl.exe)
-add_livecd_target(ntoskrnl reactos/system32)
-add_importlib_target(ntoskrnl.spec)
+ if(MSVC_IDE AND (CMAKE_VERSION MATCHES "ReactOS"))
+ set_source_files_properties(${ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "CONFIG_SMP")
+ endif()
+
+ add_asm_files(ntkrnlmp_asm ${ASM_SOURCE})
+
+ add_executable(ntkrnlmp
+ ${ntkrnlmp_asm}
+ ${SOURCE}
+ ${CMAKE_CURRENT_BINARY_DIR}/ntkrnlmp.def)
+
+ add_target_compile_definitions(ntkrnlmp CONFIG_SMP)
+
+ if(ARCH STREQUAL "i386")
+ set_entrypoint(ntkrnlmp KiSystemStartup 4)
+ else()
+ set_entrypoint(ntkrnlmp KiSystemStartup)
+ endif()
+ set_subsystem(ntkrnlmp native)
+
+ if(MSVC)
+ set_image_base(ntkrnlmp 0x00400000)
+ else()
+ set_image_base(ntkrnlmp 0x80800000)
+ endif()
+
+ # Linker bug
+ if(NOT MSVC AND LTCG)
+ add_target_link_flags(ntkrnlmp "-shared")
+ endif()
+
+ target_link_libraries(ntkrnlmp cportlib csq ${PSEH_LIB} cmlib rtl rossym libcntpr wdmguid ioevent)
+ add_importlibs(ntkrnlmp hal kdcom bootvid)
+ add_dependencies(ntkrnlmp psdk bugcodes asm)
+ add_cd_file(TARGET ntkrnlmp DESTINATION reactos/system32 NO_CAB FOR all)
+endif()
-add_library(ntdllsys ntdll.S)
-set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE C)
+add_asm_files(ntdllsys_asm ntdll.S)
+add_library(ntdllsys ${ntdllsys_asm})
+set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")