Sync with trunk r58033.
[reactos.git] / ntoskrnl / CMakeLists.txt
1
2 PROJECT(NTOS)
3
4 spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB)
5
6 include_directories(
7 ${REACTOS_SOURCE_DIR}
8 ${REACTOS_SOURCE_DIR}/lib/cmlib
9 include
10 ${CMAKE_CURRENT_BINARY_DIR}/include
11 ${CMAKE_CURRENT_BINARY_DIR}/include/internal
12 ${REACTOS_SOURCE_DIR}/include/reactos/drivers)
13
14 add_definitions(
15 -D__NTOSKRNL__
16 -D_NTOSKRNL_
17 -D_NTSYSTEM_
18 -D_IN_KERNEL_
19 -DNTDDI_VERSION=0x05020400)
20
21 if(NOT DEFINED NEWCC)
22 set(NEWCC FALSE)
23 endif()
24
25 if(NEWCC)
26 add_definitions(-DNEWCC)
27 list(APPEND SOURCE
28 cache/cachesub.c
29 cache/copysup.c
30 cache/fssup.c
31 cache/lazyrite.c
32 cache/logsup.c
33 cache/mdlsup.c
34 cache/pinsup.c)
35 else()
36 list(APPEND SOURCE
37 cc/cacheman.c
38 cc/copy.c
39 cc/fs.c
40 cc/mdl.c
41 cc/pin.c
42 cc/view.c)
43 endif()
44
45 list(APPEND SOURCE
46 cache/section/io.c
47 cache/section/data.c
48 cache/section/fault.c
49 cache/section/reqtools.c
50 cache/section/sptab.c
51 cache/section/swapout.c
52 config/cmalloc.c
53 config/cmapi.c
54 config/cmboot.c
55 config/cmcheck.c
56 config/cmconfig.c
57 config/cmcontrl.c
58 config/cmdata.c
59 config/cmdelay.c
60 config/cmhook.c
61 config/cmhvlist.c
62 config/cmindex.c
63 config/cminit.c
64 config/cmkcbncb.c
65 config/cmkeydel.c
66 config/cmlazy.c
67 config/cmmapvw.c
68 config/cmname.c
69 config/cmnotify.c
70 config/cmparse.c
71 config/cmquota.c
72 config/cmse.c
73 config/cmsecach.c
74 config/cmsysini.c
75 config/cmvalche.c
76 config/cmvalue.c
77 config/cmwraprs.c
78 config/ntapi.c
79 dbgk/dbgkobj.c
80 dbgk/dbgkutil.c
81 ex/atom.c
82 ex/callback.c
83 ex/dbgctrl.c
84 ex/efi.c
85 ex/event.c
86 ex/evtpair.c
87 ex/exintrin.c
88 ex/fmutex.c
89 ex/handle.c
90 ex/harderr.c
91 ex/hdlsterm.c
92 ex/init.c
93 ex/interlocked.c
94 ex/keyedevt.c
95 ex/locale.c
96 ex/lookas.c
97 ex/mutant.c
98 ex/profile.c
99 ex/pushlock.c
100 ex/resource.c
101 ex/rundown.c
102 ex/sem.c
103 ex/shutdown.c
104 ex/sysinfo.c
105 ex/time.c
106 ex/timer.c
107 ex/uuid.c
108 ex/win32k.c
109 ex/work.c
110 ex/xipdisp.c
111 ex/zone.c
112 ex/zw.S
113 fsrtl/dbcsname.c
114 fsrtl/fastio.c
115 fsrtl/faulttol.c
116 fsrtl/filelock.c
117 fsrtl/filter.c
118 fsrtl/filtrctx.c
119 fsrtl/fsfilter.c
120 fsrtl/fsrtlpc.c
121 fsrtl/largemcb.c
122 fsrtl/mcb.c
123 fsrtl/name.c
124 fsrtl/notify.c
125 fsrtl/oplock.c
126 fsrtl/pnp.c
127 fsrtl/stackovf.c
128 fsrtl/tunnel.c
129 fsrtl/unc.c
130 fstub/disksup.c
131 fstub/fstubex.c
132 fstub/halstub.c
133 fstub/translate.c
134 inbv/inbv.c
135 inbv/inbvport.c
136 io/iomgr/adapter.c
137 io/iomgr/arcname.c
138 io/iomgr/bootlog.c
139 io/iomgr/controller.c
140 io/iomgr/device.c
141 io/iomgr/deviface.c
142 io/iomgr/driver.c
143 io/iomgr/error.c
144 io/iomgr/file.c
145 io/iomgr/iocomp.c
146 io/iomgr/ioevent.c
147 io/iomgr/iofunc.c
148 io/iomgr/iomdl.c
149 io/iomgr/iomgr.c
150 io/iomgr/iorsrce.c
151 io/iomgr/iotimer.c
152 io/iomgr/iowork.c
153 io/iomgr/irp.c
154 io/iomgr/irq.c
155 io/iomgr/ramdisk.c
156 io/iomgr/rawfs.c
157 io/iomgr/remlock.c
158 io/iomgr/symlink.c
159 io/iomgr/util.c
160 io/iomgr/volume.c
161 io/pnpmgr/plugplay.c
162 io/pnpmgr/pnpdma.c
163 io/pnpmgr/pnpinit.c
164 io/pnpmgr/pnpmgr.c
165 io/pnpmgr/pnpnotify.c
166 io/pnpmgr/pnpreport.c
167 io/pnpmgr/pnpres.c
168 io/pnpmgr/pnproot.c
169 io/pnpmgr/pnputil.c
170 ke/apc.c
171 ke/balmgr.c
172 ke/bug.c
173 ke/clock.c
174 ke/config.c
175 ke/devqueue.c
176 ke/dpc.c
177 ke/eventobj.c
178 ke/except.c
179 ke/freeze.c
180 ke/gate.c
181 ke/gmutex.c
182 ke/ipi.c
183 ke/krnlinit.c
184 ke/mutex.c
185 ke/procobj.c
186 ke/profobj.c
187 ke/queue.c
188 ke/semphobj.c
189 ke/spinlock.c
190 ke/thrdobj.c
191 ke/thrdschd.c
192 ke/time.c
193 ke/timerobj.c
194 ke/wait.c
195 lpc/close.c
196 lpc/complete.c
197 lpc/connect.c
198 lpc/create.c
199 lpc/listen.c
200 lpc/port.c
201 lpc/reply.c
202 lpc/send.c
203 mm/ARM3/contmem.c
204 mm/ARM3/drvmgmt.c
205 mm/ARM3/dynamic.c
206 mm/ARM3/expool.c
207 mm/ARM3/hypermap.c
208 mm/ARM3/iosup.c
209 mm/ARM3/largepag.c
210 mm/ARM3/mdlsup.c
211 mm/ARM3/mmdbg.c
212 mm/ARM3/mminit.c
213 mm/ARM3/mmsup.c
214 mm/ARM3/ncache.c
215 mm/ARM3/pagfault.c
216 mm/ARM3/pfnlist.c
217 mm/ARM3/pool.c
218 mm/ARM3/procsup.c
219 mm/ARM3/section.c
220 mm/ARM3/special.c
221 mm/ARM3/sysldr.c
222 mm/ARM3/syspte.c
223 mm/ARM3/vadnode.c
224 mm/ARM3/virtual.c
225 mm/ARM3/zeropage.c
226 mm/balance.c
227 mm/freelist.c
228 mm/marea.c
229 mm/mmfault.c
230 mm/mminit.c
231 mm/pagefile.c
232 mm/region.c
233 mm/rmap.c
234 mm/section.c
235 ob/obdir.c
236 ob/obhandle.c
237 ob/obinit.c
238 ob/oblife.c
239 ob/oblink.c
240 ob/obname.c
241 ob/obref.c
242 ob/obsdcach.c
243 ob/obsecure.c
244 ob/obwait.c
245 po/events.c
246 po/guid.c
247 po/poshtdwn.c
248 po/povolume.c
249 po/power.c
250 ps/debug.c
251 ps/job.c
252 ps/kill.c
253 ps/process.c
254 ps/psmgr.c
255 ps/psnotify.c
256 ps/query.c
257 ps/quota.c
258 ps/security.c
259 ps/state.c
260 ps/thread.c
261 ps/win32.c
262 rtl/libsupp.c
263 rtl/misc.c
264 se/access.c
265 se/acl.c
266 se/audit.c
267 se/lsa.c
268 se/priv.c
269 se/sd.c
270 se/semgr.c
271 se/sid.c
272 se/token.c
273 vf/driver.c
274 wmi/wmi.c
275 ntoskrnl.rc)
276
277 if(ARCH STREQUAL "i386")
278 list(APPEND SOURCE
279 config/i386/cmhardwr.c
280 ex/i386/fastinterlck_asm.S
281 ex/i386/ioport.S
282 ke/i386/abios.c
283 ke/i386/cpu.c
284 ke/i386/context.c
285 ke/i386/ctxswitch.S
286 ke/i386/exp.c
287 ke/i386/irqobj.c
288 ke/i386/kiinit.c
289 ke/i386/ldt.c
290 ke/i386/mtrr.c
291 ke/i386/patpge.c
292 ke/i386/thrdini.c
293 ke/i386/trap.s
294 ke/i386/traphdlr.c
295 ke/i386/usercall_asm.S
296 ke/i386/usercall.c
297 ke/i386/v86vdm.c
298 mm/i386/page.c
299 mm/ARM3/i386/init.c
300 ps/i386/psctx.c
301 ps/i386/psldt.c
302 rtl/i386/stack.S
303 vdm/vdmmain.c
304 vdm/vdmexec.c)
305 elseif(ARCH STREQUAL "amd64")
306 list(APPEND SOURCE
307 config/i386/cmhardwr.c
308 ke/amd64/boot.S
309 ke/amd64/context.c
310 ke/amd64/cpu.c
311 ke/amd64/ctxswitch.S
312 ke/amd64/except.c
313 ke/amd64/interrupt.c
314 ke/amd64/irql.c
315 ke/amd64/kiinit.c
316 ke/amd64/krnlinit.c
317 ke/amd64/spinlock.c
318 ke/amd64/stubs.c
319 ke/amd64/thrdini.c
320 ke/amd64/trap.S
321 mm/amd64/init.c
322 mm/amd64/page.c
323 ps/amd64/psctx.c)
324 elseif(ARCH STREQUAL "arm")
325 list(APPEND SOURCE
326 config/arm/cmhardwr.c
327 ke/arm/boot.s
328 ke/arm/cpu.c
329 ke/arm/ctxswtch.s
330 ke/arm/exp.c
331 ke/arm/kiinit.c
332 ke/arm/stubs_asm.s
333 ke/arm/thrdini.c
334 ke/arm/trap.s
335 ke/arm/trapc.c
336 ke/arm/usercall.c
337 mm/arm/page.c
338 mm/ARM3/arm/init.c
339 ps/arm/psctx.c
340 rtl/arm/rtlexcpt.c)
341 elseif(ARCH STREQUAL "powerpc")
342 list(APPEND SOURCE
343 config/powerpc/cmhardwr.c
344 ke/powerpc/main_asm.S
345 ke/powerpc/cpu.c
346 ke/powerpc/exp.c
347 ke/powerpc/kiinit.c
348 ke/powerpc/ppc_irq.c
349 ke/powerpc/stubs.c
350 ke/powerpc/systimer.c
351 ke/powerpc/thrdini.c
352 ke/powerpc/ctxswitch.c
353 ke/powerpc/ctxhelp.S
354 mm/powerpc/pfault.c
355 mm/powerpc/page.c)
356 endif()
357
358 if(NOT _WINKD_)
359 if(ARCH STREQUAL "i386")
360 list(APPEND SOURCE
361 kd/i386/kdmemsup.c
362 kd/wrappers/gdbstub.c)
363 if(KDBG)
364 list(APPEND SOURCE
365 kdbg/i386/i386-dis.c
366 kdbg/i386/kdb_help.S)
367 endif()
368 elseif(ARCH STREQUAL "amd64")
369 list(APPEND SOURCE
370 kd/amd64/kd.c
371 kd/amd64/kdmemsup.c)
372 if(KDBG)
373 list(APPEND SOURCE
374 kdbg/amd64/i386-dis.c
375 kdbg/amd64/kdb_help.S
376 kdbg/amd64/kdb.c)
377 endif()
378 elseif(ARCH STREQUAL "powerpc")
379 list(APPEND SOURCE kd/wrappers/gdbstub_powerpc.c)
380 endif()
381
382 if(KDBG)
383 list(APPEND SOURCE
384 kdbg/kdb.c
385 kdbg/kdb_cli.c
386 kdbg/kdb_expr.c
387 kdbg/kdb_keyboard.c
388 kdbg/kdb_serial.c)
389 endif()
390
391 if(DBG OR KDBG)
392 #list(APPEND SOURCE kdbg/kdb_symbols.cmake.c)
393 list(APPEND SOURCE kdbg/kdb_symbols.c)
394 endif()
395
396 list(APPEND SOURCE
397 kd/wrappers/bochs.c
398 kd/wrappers/kdbg.c
399 kd/kdinit.c
400 kd/kdio.c
401 kd/kdmain.c)
402
403 else() # _WINKD_
404
405 list(APPEND SOURCE
406 kd64/kdapi.c
407 kd64/kdbreak.c
408 kd64/kddata.c
409 kd64/kdinit.c
410 kd64/kdlock.c
411 kd64/kdprint.c
412 kd64/kdtrap.c)
413
414 if(ARCH STREQUAL "i386")
415 list(APPEND SOURCE kd64/i386/kdx86.c)
416 elseif(ARCH STREQUAL "amd64")
417 list(APPEND SOURCE kd64/amd64/kdx64.c)
418 elseif(ARCH STREQUAL "arm")
419 list(APPEND SOURCE kd64/arm/kdarm.c)
420 endif()
421
422 endif()
423
424 add_executable(ntoskrnl
425 ${SOURCE}
426 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
427
428 if(ARCH STREQUAL "i386")
429 set_entrypoint(ntoskrnl KiSystemStartup 4)
430 else()
431 set_entrypoint(ntoskrnl KiSystemStartup)
432 endif()
433 set_subsystem(ntoskrnl native)
434
435 if(MSVC)
436 set_image_base(ntoskrnl 0x00400000)
437 else()
438 set_image_base(ntoskrnl 0x80800000)
439 endif()
440
441 # Linker bug
442 if(NOT MSVC AND LTCG)
443 add_target_link_flags(ntoskrnl "-shared")
444 endif()
445
446 target_link_libraries(ntoskrnl
447 cportlib
448 csq
449 ${PSEH_LIB}
450 cmlib
451 rtl
452 rossym
453 libcntpr
454 wdmguid
455 ioevent)
456
457 add_importlibs(ntoskrnl hal kdcom bootvid)
458 add_pch(ntoskrnl include/ntoskrnl.h)
459 add_dependencies(ntoskrnl psdk bugcodes asm)
460 add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
461
462 if(BUILD_MP)
463 spec2def(ntkrnlmp.exe ntoskrnl.spec)
464
465 add_executable(ntkrnlmp
466 ${SOURCE}
467 ${CMAKE_CURRENT_BINARY_DIR}/ntkrnlmp.def)
468
469 add_target_compile_definitions(ntkrnlmp CONFIG_SMP)
470
471 if(ARCH STREQUAL "i386")
472 set_entrypoint(ntkrnlmp KiSystemStartup 4)
473 else()
474 set_entrypoint(ntkrnlmp KiSystemStartup)
475 endif()
476 set_subsystem(ntkrnlmp native)
477
478 if(MSVC)
479 set_image_base(ntkrnlmp 0x00400000)
480 else()
481 set_image_base(ntkrnlmp 0x80800000)
482 endif()
483
484 # Linker bug
485 if(NOT MSVC AND LTCG)
486 add_target_link_flags(ntkrnlmp "-shared")
487 endif()
488
489 target_link_libraries(ntkrnlmp cportlib csq ${PSEH_LIB} cmlib rtl rossym libcntpr wdmguid ioevent)
490 add_importlibs(ntkrnlmp hal kdcom bootvid)
491 add_dependencies(ntkrnlmp psdk bugcodes asm)
492 add_cd_file(TARGET ntkrnlmp DESTINATION reactos/system32 NO_CAB FOR all)
493 endif()
494
495 add_library(ntdllsys ntdll.S)