[USB-BRINGUP-TRUNK]
[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/special.c
218 mm/ARM3/sysldr.c
219 mm/ARM3/syspte.c
220 mm/ARM3/vadnode.c
221 mm/ARM3/virtual.c
222 mm/ARM3/zeropage.c
223 mm/anonmem.c
224 mm/balance.c
225 mm/freelist.c
226 mm/marea.c
227 mm/mmfault.c
228 mm/mminit.c
229 mm/pagefile.c
230 mm/pageop.c
231 mm/region.c
232 mm/rmap.c
233 mm/section.c
234 ob/obdir.c
235 ob/obhandle.c
236 ob/obinit.c
237 ob/oblife.c
238 ob/oblink.c
239 ob/obname.c
240 ob/obref.c
241 ob/obsdcach.c
242 ob/obsecure.c
243 ob/obwait.c
244 po/events.c
245 po/guid.c
246 po/poshtdwn.c
247 po/povolume.c
248 po/power.c
249 ps/debug.c
250 ps/job.c
251 ps/kill.c
252 ps/process.c
253 ps/psmgr.c
254 ps/psnotify.c
255 ps/query.c
256 ps/quota.c
257 ps/security.c
258 ps/state.c
259 ps/thread.c
260 ps/win32.c
261 rtl/libsupp.c
262 rtl/misc.c
263 se/access.c
264 se/acl.c
265 se/audit.c
266 se/lsa.c
267 se/priv.c
268 se/sd.c
269 se/semgr.c
270 se/sid.c
271 se/token.c
272 vf/driver.c
273 wmi/wmi.c
274 ntoskrnl.rc
275 ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
276
277 if(ARCH MATCHES i386)
278 list(APPEND SOURCE
279 config/i386/cmhardwr.c
280 ex/i386/fastinterlck_asm.S
281 ex/i386/ioport.S
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 ke/amd64/boot.S
309 ke/amd64/context.c
310 ke/amd64/cpu.c
311 ke/amd64/ctxswitch.S
312 ke/amd64/except.c
313 ke/amd64/interrupt.c
314 ke/amd64/irql.c
315 ke/amd64/kiinit.c
316 ke/amd64/krnlinit.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.cmake.c)
393 list(APPEND SOURCE kdbg/kdb_symbols.c)
394 endif()
395
396 list(APPEND SOURCE
397 kd/wrappers/bochs.c
398 kd/wrappers/kdbg.c
399 kd/kdinit.c
400 kd/kdio.c
401 kd/kdmain.c)
402
403 else() # _WINKD_
404
405 list(APPEND SOURCE
406 kd64/kdapi.c
407 kd64/kdbreak.c
408 kd64/kddata.c
409 kd64/kdinit.c
410 kd64/kdlock.c
411 kd64/kdprint.c
412 kd64/kdtrap.c)
413
414 if(ARCH MATCHES i386)
415 list(APPEND SOURCE kd64/i386/kdx86.c)
416 elseif(ARCH MATCHES amd64)
417 list(APPEND SOURCE kd64/amd64/kdx64.c)
418 elseif(ARCH MATCHES arm)
419 list(APPEND SOURCE kd64/arm/kdarm.c)
420 endif()
421
422 endif()
423
424 add_executable(ntoskrnl ${SOURCE})
425
426 if (ARCH MATCHES i386)
427 set_entrypoint(ntoskrnl KiSystemStartup 4)
428 else()
429 set_entrypoint(ntoskrnl KiSystemStartup)
430 endif()
431 set_subsystem(ntoskrnl native)
432
433 if(MSVC)
434 set_image_base(ntoskrnl 0x00400000)
435 else()
436 set_image_base(ntoskrnl 0x80800000)
437 endif()
438
439 target_link_libraries(ntoskrnl
440 cportlib
441 csq
442 ${PSEH_LIB}
443 cmlib
444 rtl
445 rossym
446 libcntpr
447 wdmguid
448 ioevent)
449
450 add_importlibs(ntoskrnl hal kdcom bootvid)
451
452 add_pch(ntoskrnl include/ntoskrnl.h)
453 add_dependencies(ntoskrnl psdk bugcodes asm)
454
455 add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
456 add_importlib_target(ntoskrnl.spec)
457
458 add_library(ntdllsys ntdll.S)