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