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