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