8c669a8ee82901cc9eda2a7a4d31736c6a708afb
[reactos.git] / ntoskrnl / CMakeLists.txt
1
2 spec2def(ntoskrnl.exe ntoskrnl.spec)
3
4 include_directories(
5 ${REACTOS_SOURCE_DIR}
6 ${REACTOS_SOURCE_DIR}/lib/cmlib
7 include
8 ${CMAKE_CURRENT_BINARY_DIR}/include
9 ${CMAKE_CURRENT_BINARY_DIR}/include/internal
10 ${REACTOS_SOURCE_DIR}/include/reactos/drivers)
11
12 add_definitions(
13 -D__NTOSKRNL__
14 -D_NTOSKRNL_
15 -D_NTSYSTEM_
16 -D_IN_KERNEL_
17 -DNTDDI_VERSION=0x05020400)
18
19 set_rc_compiler()
20
21 set(NEWCC FALSE)
22
23 if(NEWCC)
24 add_definitions(-DNEWCC)
25 list(APPEND SOURCE
26 cache/cachesub.c
27 cache/copysup.c
28 cache/fssup.c
29 cache/lazyrite.c
30 cache/logsup.c
31 cache/mdlsup.c
32 cache/pinsup.c
33 cache/section/data.c
34 cache/section/fault.c
35 cache/section/io.c
36 cache/section/reqtools.c
37 cache/section/sptab.c
38 cache/section/swapout.c)
39 else()
40 list(APPEND SOURCE
41 cc/cacheman.c
42 cc/copy.c
43 cc/fs.c
44 cc/mdl.c
45 cc/pin.c
46 cc/view.c)
47 endif()
48
49 list(APPEND SOURCE
50 config/cmalloc.c
51 config/cmapi.c
52 config/cmboot.c
53 config/cmcheck.c
54 config/cmconfig.c
55 config/cmcontrl.c
56 config/cmdata.c
57 config/cmdelay.c
58 config/cmhook.c
59 config/cmhvlist.c
60 config/cmindex.c
61 config/cminit.c
62 config/cmkcbncb.c
63 config/cmkeydel.c
64 config/cmlazy.c
65 config/cmmapvw.c
66 config/cmname.c
67 config/cmnotify.c
68 config/cmparse.c
69 config/cmquota.c
70 config/cmse.c
71 config/cmsecach.c
72 config/cmsysini.c
73 config/cmvalche.c
74 config/cmvalue.c
75 config/cmwraprs.c
76 config/ntapi.c
77 dbgk/dbgkobj.c
78 dbgk/dbgkutil.c
79 ex/atom.c
80 ex/callback.c
81 ex/dbgctrl.c
82 ex/efi.c
83 ex/event.c
84 ex/evtpair.c
85 ex/exintrin.c
86 ex/fastinterlck.c
87 ex/fmutex.c
88 ex/handle.c
89 ex/harderr.c
90 ex/hdlsterm.c
91 ex/init.c
92 ex/keyedevt.c
93 ex/locale.c
94 ex/lookas.c
95 ex/mutant.c
96 ex/profile.c
97 ex/pushlock.c
98 ex/resource.c
99 ex/rundown.c
100 ex/sem.c
101 ex/shutdown.c
102 ex/sysinfo.c
103 ex/time.c
104 ex/timer.c
105 ex/uuid.c
106 ex/win32k.c
107 ex/work.c
108 ex/xipdisp.c
109 ex/zone.c
110 fsrtl/dbcsname.c
111 fsrtl/fastio.c
112 fsrtl/faulttol.c
113 fsrtl/filelock.c
114 fsrtl/filter.c
115 fsrtl/filtrctx.c
116 fsrtl/fsfilter.c
117 fsrtl/fsrtlpc.c
118 fsrtl/largemcb.c
119 fsrtl/name.c
120 fsrtl/notify.c
121 fsrtl/oplock.c
122 fsrtl/pnp.c
123 fsrtl/stackovf.c
124 fsrtl/tunnel.c
125 fsrtl/unc.c
126 fstub/disksup.c
127 fstub/fstubex.c
128 fstub/halstub.c
129 inbv/inbv.c
130 inbv/inbvport.c
131 io/iomgr/adapter.c
132 io/iomgr/arcname.c
133 io/iomgr/bootlog.c
134 io/iomgr/controller.c
135 io/iomgr/device.c
136 io/iomgr/deviface.c
137 io/iomgr/driver.c
138 io/iomgr/error.c
139 io/iomgr/file.c
140 io/iomgr/iocomp.c
141 io/iomgr/ioevent.c
142 io/iomgr/iofunc.c
143 io/iomgr/iomdl.c
144 io/iomgr/iomgr.c
145 io/iomgr/iorsrce.c
146 io/iomgr/iotimer.c
147 io/iomgr/iowork.c
148 io/iomgr/irp.c
149 io/iomgr/irq.c
150 io/iomgr/ramdisk.c
151 io/iomgr/rawfs.c
152 io/iomgr/remlock.c
153 io/iomgr/symlink.c
154 io/iomgr/util.c
155 io/iomgr/volume.c
156 io/pnpmgr/plugplay.c
157 io/pnpmgr/pnpdma.c
158 io/pnpmgr/pnpinit.c
159 io/pnpmgr/pnpmgr.c
160 io/pnpmgr/pnpnotify.c
161 io/pnpmgr/pnpreport.c
162 io/pnpmgr/pnpres.c
163 io/pnpmgr/pnproot.c
164 io/pnpmgr/pnputil.c
165 ke/apc.c
166 ke/balmgr.c
167 ke/bug.c
168 ke/clock.c
169 ke/config.c
170 ke/devqueue.c
171 ke/dpc.c
172 ke/eventobj.c
173 ke/except.c
174 ke/freeze.c
175 ke/gate.c
176 ke/gmutex.c
177 ke/ipi.c
178 ke/krnlinit.c
179 ke/mutex.c
180 ke/procobj.c
181 ke/profobj.c
182 ke/queue.c
183 ke/semphobj.c
184 ke/spinlock.c
185 ke/thrdobj.c
186 ke/thrdschd.c
187 ke/time.c
188 ke/timerobj.c
189 ke/wait.c
190 lpc/close.c
191 lpc/complete.c
192 lpc/connect.c
193 lpc/create.c
194 lpc/listen.c
195 lpc/port.c
196 lpc/reply.c
197 lpc/send.c
198 mm/ARM3/contmem.c
199 mm/ARM3/drvmgmt.c
200 mm/ARM3/dynamic.c
201 mm/ARM3/expool.c
202 mm/ARM3/hypermap.c
203 mm/ARM3/iosup.c
204 mm/ARM3/largepag.c
205 mm/ARM3/mdlsup.c
206 mm/ARM3/mmdbg.c
207 mm/ARM3/mminit.c
208 mm/ARM3/mmsup.c
209 mm/ARM3/ncache.c
210 mm/ARM3/pagfault.c
211 mm/ARM3/pfnlist.c
212 mm/ARM3/pool.c
213 mm/ARM3/procsup.c
214 mm/ARM3/section.c
215 mm/ARM3/sysldr.c
216 mm/ARM3/syspte.c
217 mm/ARM3/vadnode.c
218 mm/ARM3/virtual.c
219 mm/ARM3/zeropage.c
220 mm/anonmem.c
221 mm/balance.c
222 mm/freelist.c
223 mm/marea.c
224 mm/mmfault.c
225 mm/mminit.c
226 mm/pagefile.c
227 mm/pageop.c
228 mm/region.c
229 mm/rmap.c
230 mm/section.c
231 ob/obdir.c
232 ob/obhandle.c
233 ob/obinit.c
234 ob/oblife.c
235 ob/oblink.c
236 ob/obname.c
237 ob/obref.c
238 ob/obsdcach.c
239 ob/obsecure.c
240 ob/obwait.c
241 po/events.c
242 po/guid.c
243 po/poshtdwn.c
244 po/povolume.c
245 po/power.c
246 ps/debug.c
247 ps/job.c
248 ps/kill.c
249 ps/process.c
250 ps/psmgr.c
251 ps/psnotify.c
252 ps/query.c
253 ps/quota.c
254 ps/security.c
255 ps/state.c
256 ps/thread.c
257 ps/win32.c
258 rtl/libsupp.c
259 rtl/misc.c
260 se/access.c
261 se/acl.c
262 se/audit.c
263 se/lsa.c
264 se/priv.c
265 se/sd.c
266 se/semgr.c
267 se/sid.c
268 se/token.c
269 vf/driver.c
270 wmi/wmi.c
271 ntoskrnl.rc
272 ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S
273 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
274
275 if(ARCH MATCHES i386)
276 list(APPEND SOURCE
277 config/i386/cmhardwr.c
278 ex/i386/interlck_asm.S
279 ex/i386/fastinterlck_asm.S
280 ex/i386/ioport.S
281 ke/freeldr.c
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 MATCHES amd64)
306 list(APPEND SOURCE
307 config/i386/cmhardwr.c
308 ex/amd64/fastinterlck.c
309 ke/amd64/boot.S
310 ke/amd64/context.c
311 ke/amd64/cpu.c
312 ke/amd64/ctxswitch.S
313 ke/amd64/except.c
314 ke/amd64/interrupt.c
315 ke/amd64/irql.c
316 ke/amd64/kiinit.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 MATCHES 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 MATCHES 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 MATCHES 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 MATCHES 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 MATCHES 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.c)
393 endif()
394
395 list(APPEND SOURCE
396 kd/wrappers/bochs.c
397 kd/wrappers/kdbg.c
398 kd/kdinit.c
399 kd/kdio.c
400 kd/kdmain.c)
401
402 else() # _WINKD_
403
404 list(APPEND SOURCE
405 kd64/kdapi.c
406 kd64/kdbreak.c
407 kd64/kddata.c
408 kd64/kdinit.c
409 kd64/kdlock.c
410 kd64/kdprint.c
411 kd64/kdtrap.c)
412
413 if(ARCH MATCHES i386)
414 list(APPEND SOURCE kd64/i386/kdx86.c)
415 elseif(ARCH MATCHES amd64)
416 list(APPEND SOURCE kd64/amd64/kdx64.c)
417 elseif(ARCH MATCHES arm)
418 list(APPEND SOURCE kd64/arm/kdarm.c)
419 endif()
420
421 endif()
422
423 add_executable(ntoskrnl ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl_ntoskrnl.h.gch ${SOURCE})
424
425 set_entrypoint(ntoskrnl KiSystemStartup@4)
426 set_subsystem(ntoskrnl native)
427
428 if(MSVC)
429 set_image_base(ntoskrnl 0x00400000)
430 else()
431 set_image_base(ntoskrnl 0x80800000)
432 endif()
433
434 target_link_libraries(ntoskrnl
435 cportlib
436 csq
437 ${PSEH_LIB}
438 cmlib
439 rtl
440 rossym
441 libcntpr
442 wdmguid
443 ioevent)
444
445 add_importlibs(ntoskrnl hal kdcom bootvid)
446
447 add_pch(ntoskrnl ${CMAKE_CURRENT_SOURCE_DIR}/include/ntoskrnl.h ${SOURCE})
448 set_source_files_properties(${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S PROPERTIES GENERATED TRUE)
449 add_dependencies(ntoskrnl psdk bugcodes kernel_zw kernel_napi asm)
450
451 add_minicd_target(ntoskrnl reactos ntoskrnl.exe)
452 add_livecd_target(ntoskrnl reactos/system32)
453 add_importlib_target(ntoskrnl.spec ntoskrnl.exe)