* Sync to trunk HEAD (r53298).
[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/reqtools.c
36 cache/section/sptab.c
37 cache/section/swapout.c)
38 else()
39 list(APPEND SOURCE
40 cc/cacheman.c
41 cc/copy.c
42 cc/fs.c
43 cc/mdl.c
44 cc/pin.c
45 cc/view.c)
46 endif()
47
48 list(APPEND SOURCE
49 cache/section/io.c
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/fmutex.c
87 ex/handle.c
88 ex/harderr.c
89 ex/hdlsterm.c
90 ex/init.c
91 ex/interlocked.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 ex/zw.S
111 fsrtl/dbcsname.c
112 fsrtl/fastio.c
113 fsrtl/faulttol.c
114 fsrtl/filelock.c
115 fsrtl/filter.c
116 fsrtl/filtrctx.c
117 fsrtl/fsfilter.c
118 fsrtl/fsrtlpc.c
119 fsrtl/largemcb.c
120 fsrtl/name.c
121 fsrtl/notify.c
122 fsrtl/oplock.c
123 fsrtl/pnp.c
124 fsrtl/stackovf.c
125 fsrtl/tunnel.c
126 fsrtl/unc.c
127 fstub/disksup.c
128 fstub/fstubex.c
129 fstub/halstub.c
130 fstub/translate.c
131 inbv/inbv.c
132 inbv/inbvport.c
133 io/iomgr/adapter.c
134 io/iomgr/arcname.c
135 io/iomgr/bootlog.c
136 io/iomgr/controller.c
137 io/iomgr/device.c
138 io/iomgr/deviface.c
139 io/iomgr/driver.c
140 io/iomgr/error.c
141 io/iomgr/file.c
142 io/iomgr/iocomp.c
143 io/iomgr/ioevent.c
144 io/iomgr/iofunc.c
145 io/iomgr/iomdl.c
146 io/iomgr/iomgr.c
147 io/iomgr/iorsrce.c
148 io/iomgr/iotimer.c
149 io/iomgr/iowork.c
150 io/iomgr/irp.c
151 io/iomgr/irq.c
152 io/iomgr/ramdisk.c
153 io/iomgr/rawfs.c
154 io/iomgr/remlock.c
155 io/iomgr/symlink.c
156 io/iomgr/util.c
157 io/iomgr/volume.c
158 io/pnpmgr/plugplay.c
159 io/pnpmgr/pnpdma.c
160 io/pnpmgr/pnpinit.c
161 io/pnpmgr/pnpmgr.c
162 io/pnpmgr/pnpnotify.c
163 io/pnpmgr/pnpreport.c
164 io/pnpmgr/pnpres.c
165 io/pnpmgr/pnproot.c
166 io/pnpmgr/pnputil.c
167 ke/apc.c
168 ke/balmgr.c
169 ke/bug.c
170 ke/clock.c
171 ke/config.c
172 ke/devqueue.c
173 ke/dpc.c
174 ke/eventobj.c
175 ke/except.c
176 ke/freeze.c
177 ke/gate.c
178 ke/gmutex.c
179 ke/ipi.c
180 ke/krnlinit.c
181 ke/mutex.c
182 ke/procobj.c
183 ke/profobj.c
184 ke/queue.c
185 ke/semphobj.c
186 ke/spinlock.c
187 ke/thrdobj.c
188 ke/thrdschd.c
189 ke/time.c
190 ke/timerobj.c
191 ke/wait.c
192 lpc/close.c
193 lpc/complete.c
194 lpc/connect.c
195 lpc/create.c
196 lpc/listen.c
197 lpc/port.c
198 lpc/reply.c
199 lpc/send.c
200 mm/ARM3/contmem.c
201 mm/ARM3/drvmgmt.c
202 mm/ARM3/dynamic.c
203 mm/ARM3/expool.c
204 mm/ARM3/hypermap.c
205 mm/ARM3/iosup.c
206 mm/ARM3/largepag.c
207 mm/ARM3/mdlsup.c
208 mm/ARM3/mmdbg.c
209 mm/ARM3/mminit.c
210 mm/ARM3/mmsup.c
211 mm/ARM3/ncache.c
212 mm/ARM3/pagfault.c
213 mm/ARM3/pfnlist.c
214 mm/ARM3/pool.c
215 mm/ARM3/procsup.c
216 mm/ARM3/section.c
217 mm/ARM3/sysldr.c
218 mm/ARM3/syspte.c
219 mm/ARM3/vadnode.c
220 mm/ARM3/virtual.c
221 mm/ARM3/zeropage.c
222 mm/anonmem.c
223 mm/balance.c
224 mm/freelist.c
225 mm/marea.c
226 mm/mmfault.c
227 mm/mminit.c
228 mm/pagefile.c
229 mm/pageop.c
230 mm/region.c
231 mm/rmap.c
232 mm/section.c
233 ob/obdir.c
234 ob/obhandle.c
235 ob/obinit.c
236 ob/oblife.c
237 ob/oblink.c
238 ob/obname.c
239 ob/obref.c
240 ob/obsdcach.c
241 ob/obsecure.c
242 ob/obwait.c
243 po/events.c
244 po/guid.c
245 po/poshtdwn.c
246 po/povolume.c
247 po/power.c
248 ps/debug.c
249 ps/job.c
250 ps/kill.c
251 ps/process.c
252 ps/psmgr.c
253 ps/psnotify.c
254 ps/query.c
255 ps/quota.c
256 ps/security.c
257 ps/state.c
258 ps/thread.c
259 ps/win32.c
260 rtl/libsupp.c
261 rtl/misc.c
262 se/access.c
263 se/acl.c
264 se/audit.c
265 se/lsa.c
266 se/priv.c
267 se/sd.c
268 se/semgr.c
269 se/sid.c
270 se/token.c
271 vf/driver.c
272 wmi/wmi.c
273 ntoskrnl.rc
274 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
275
276 if(ARCH MATCHES i386)
277 list(APPEND SOURCE
278 config/i386/cmhardwr.c
279 ex/i386/fastinterlck_asm.S
280 ex/i386/ioport.S
281 ke/i386/abios.c
282 ke/i386/cpu.c
283 ke/i386/context.c
284 ke/i386/ctxswitch.S
285 ke/i386/exp.c
286 ke/i386/irqobj.c
287 ke/i386/kiinit.c
288 ke/i386/ldt.c
289 ke/i386/mtrr.c
290 ke/i386/patpge.c
291 ke/i386/thrdini.c
292 ke/i386/trap.s
293 ke/i386/traphdlr.c
294 ke/i386/usercall_asm.S
295 ke/i386/usercall.c
296 ke/i386/v86vdm.c
297 mm/i386/page.c
298 mm/ARM3/i386/init.c
299 ps/i386/psctx.c
300 ps/i386/psldt.c
301 rtl/i386/stack.S
302 vdm/vdmmain.c
303 vdm/vdmexec.c)
304 elseif(ARCH MATCHES amd64)
305 list(APPEND SOURCE
306 config/i386/cmhardwr.c
307 ke/amd64/boot.S
308 ke/amd64/context.c
309 ke/amd64/cpu.c
310 ke/amd64/ctxswitch.S
311 ke/amd64/except.c
312 ke/amd64/interrupt.c
313 ke/amd64/irql.c
314 ke/amd64/kiinit.c
315 ke/amd64/spinlock.c
316 ke/amd64/stubs.c
317 ke/amd64/thrdini.c
318 ke/amd64/trap.S
319 mm/amd64/init.c
320 mm/amd64/page.c
321 ps/amd64/psctx.c)
322 elseif(ARCH MATCHES arm)
323 list(APPEND SOURCE
324 config/arm/cmhardwr.c
325 ke/arm/boot.s
326 ke/arm/cpu.c
327 ke/arm/ctxswtch.s
328 ke/arm/exp.c
329 ke/arm/kiinit.c
330 ke/arm/stubs_asm.s
331 ke/arm/thrdini.c
332 ke/arm/trap.s
333 ke/arm/trapc.c
334 ke/arm/usercall.c
335 mm/arm/page.c
336 mm/ARM3/arm/init.c
337 ps/arm/psctx.c
338 rtl/arm/rtlexcpt.c)
339 elseif(ARCH MATCHES powerpc)
340 list(APPEND SOURCE
341 config/powerpc/cmhardwr.c
342 ke/powerpc/main_asm.S
343 ke/powerpc/cpu.c
344 ke/powerpc/exp.c
345 ke/powerpc/kiinit.c
346 ke/powerpc/ppc_irq.c
347 ke/powerpc/stubs.c
348 ke/powerpc/systimer.c
349 ke/powerpc/thrdini.c
350 ke/powerpc/ctxswitch.c
351 ke/powerpc/ctxhelp.S
352 mm/powerpc/pfault.c
353 mm/powerpc/page.c)
354 endif()
355
356 if(NOT _WINKD_)
357 if(ARCH MATCHES i386)
358 list(APPEND SOURCE
359 kd/i386/kdmemsup.c
360 kd/wrappers/gdbstub.c)
361 if(KDBG)
362 list(APPEND SOURCE
363 kdbg/i386/i386-dis.c
364 kdbg/i386/kdb_help.S)
365 endif()
366 elseif(ARCH MATCHES amd64)
367 list(APPEND SOURCE
368 kd/amd64/kd.c
369 kd/amd64/kdmemsup.c)
370 if(KDBG)
371 list(APPEND SOURCE
372 kdbg/amd64/i386-dis.c
373 kdbg/amd64/kdb_help.S
374 kdbg/amd64/kdb.c)
375 endif()
376 elseif(ARCH MATCHES powerpc)
377 list(APPEND SOURCE kd/wrappers/gdbstub_powerpc.c)
378 endif()
379
380 if(KDBG)
381 list(APPEND SOURCE
382 kdbg/kdb.c
383 kdbg/kdb_cli.c
384 kdbg/kdb_expr.c
385 kdbg/kdb_keyboard.c
386 kdbg/kdb_serial.c)
387 endif()
388
389 if(DBG OR KDBG)
390 list(APPEND SOURCE kdbg/kdb_symbols.cmake.c)
391 endif()
392
393 list(APPEND SOURCE
394 kd/wrappers/bochs.c
395 kd/wrappers/kdbg.c
396 kd/kdinit.c
397 kd/kdio.c
398 kd/kdmain.c)
399
400 else() # _WINKD_
401
402 list(APPEND SOURCE
403 kd64/kdapi.c
404 kd64/kdbreak.c
405 kd64/kddata.c
406 kd64/kdinit.c
407 kd64/kdlock.c
408 kd64/kdprint.c
409 kd64/kdtrap.c)
410
411 if(ARCH MATCHES i386)
412 list(APPEND SOURCE kd64/i386/kdx86.c)
413 elseif(ARCH MATCHES amd64)
414 list(APPEND SOURCE kd64/amd64/kdx64.c)
415 elseif(ARCH MATCHES arm)
416 list(APPEND SOURCE kd64/arm/kdarm.c)
417 endif()
418
419 endif()
420
421 add_executable(ntoskrnl ${SOURCE})
422
423 if (ARCH MATCHES i386)
424 set_entrypoint(ntoskrnl KiSystemStartup@4)
425 else()
426 set_entrypoint(ntoskrnl KiSystemStartup)
427 endif()
428 set_subsystem(ntoskrnl native)
429
430 if(MSVC)
431 set_image_base(ntoskrnl 0x00400000)
432 else()
433 set_image_base(ntoskrnl 0x80800000)
434 endif()
435
436 target_link_libraries(ntoskrnl
437 cportlib
438 csq
439 ${PSEH_LIB}
440 cmlib
441 rtl
442 rossym
443 libcntpr
444 wdmguid
445 ioevent)
446
447 add_importlibs(ntoskrnl hal kdcom bootvid)
448
449 add_pch(ntoskrnl include/ntoskrnl.h)
450 add_dependencies(ntoskrnl psdk bugcodes asm)
451
452 add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
453 add_importlib_target(ntoskrnl.spec)
454
455 add_library(ntdllsys ntdll.S)