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