[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 io/iomgr/adapter.c
104 io/iomgr/arcname.c
105 io/iomgr/bootlog.c
106 io/iomgr/controller.c
107 io/iomgr/device.c
108 io/iomgr/deviface.c
109 io/iomgr/driver.c
110 io/iomgr/error.c
111 io/iomgr/file.c
112 io/iomgr/iocomp.c
113 io/iomgr/ioevent.c
114 io/iomgr/iofunc.c
115 io/iomgr/iomdl.c
116 io/iomgr/iomgr.c
117 io/iomgr/iorsrce.c
118 io/iomgr/iotimer.c
119 io/iomgr/iowork.c
120 io/iomgr/irp.c
121 io/iomgr/irq.c
122 io/iomgr/ramdisk.c
123 io/iomgr/rawfs.c
124 io/iomgr/remlock.c
125 io/iomgr/symlink.c
126 io/iomgr/util.c
127 io/iomgr/volume.c
128 io/pnpmgr/plugplay.c
129 io/pnpmgr/pnpdma.c
130 io/pnpmgr/pnpinit.c
131 io/pnpmgr/pnpmgr.c
132 io/pnpmgr/pnpnotify.c
133 io/pnpmgr/pnpreport.c
134 io/pnpmgr/pnpres.c
135 io/pnpmgr/pnproot.c
136 io/pnpmgr/pnputil.c
137 ke/apc.c
138 ke/balmgr.c
139 ke/bug.c
140 ke/clock.c
141 ke/config.c
142 ke/devqueue.c
143 ke/dpc.c
144 ke/eventobj.c
145 ke/except.c
146 ke/freeze.c
147 ke/gate.c
148 ke/gmutex.c
149 ke/ipi.c
150 ke/krnlinit.c
151 ke/mutex.c
152 ke/procobj.c
153 ke/profobj.c
154 ke/queue.c
155 ke/semphobj.c
156 ke/spinlock.c
157 ke/thrdobj.c
158 ke/thrdschd.c
159 ke/time.c
160 ke/timerobj.c
161 ke/wait.c
162 lpc/close.c
163 lpc/complete.c
164 lpc/connect.c
165 lpc/create.c
166 lpc/listen.c
167 lpc/port.c
168 lpc/reply.c
169 lpc/send.c
170 mm/ARM3/contmem.c
171 mm/ARM3/drvmgmt.c
172 mm/ARM3/dynamic.c
173 mm/ARM3/expool.c
174 mm/ARM3/hypermap.c
175 mm/ARM3/iosup.c
176 mm/ARM3/largepag.c
177 mm/ARM3/mdlsup.c
178 mm/ARM3/mmdbg.c
179 mm/ARM3/mminit.c
180 mm/ARM3/mmsup.c
181 mm/ARM3/ncache.c
182 mm/ARM3/pagfault.c
183 mm/ARM3/pfnlist.c
184 mm/ARM3/pool.c
185 mm/ARM3/procsup.c
186 mm/ARM3/sysldr.c
187 mm/ARM3/syspte.c
188 mm/ARM3/vadnode.c
189 mm/ARM3/virtual.c
190 mm/anonmem.c
191 mm/balance.c
192 mm/freelist.c
193 mm/marea.c
194 mm/mmfault.c
195 mm/mminit.c
196 mm/mpw.c
197 mm/pagefile.c
198 mm/pageop.c
199 mm/pe.c
200 mm/ppool.c
201 mm/procsup.c
202 mm/region.c
203 mm/rmap.c
204 mm/section.c
205 mm/virtual.c
206 ob/obdir.c
207 ob/obhandle.c
208 ob/obinit.c
209 ob/oblife.c
210 ob/oblink.c
211 ob/obname.c
212 ob/obref.c
213 ob/obsdcach.c
214 ob/obsecure.c
215 ob/obwait.c
216 po/events.c
217 po/poshtdwn.c
218 po/povolume.c
219 po/power.c
220 ps/debug.c
221 ps/job.c
222 ps/kill.c
223 ps/process.c
224 ps/psmgr.c
225 ps/psnotify.c
226 ps/query.c
227 ps/quota.c
228 ps/security.c
229 ps/state.c
230 ps/thread.c
231 ps/win32.c
232 rtl/libsupp.c
233 rtl/misc.c
234 se/access.c
235 se/acl.c
236 se/audit.c
237 se/lsa.c
238 se/priv.c
239 se/sd.c
240 se/semgr.c
241 se/sid.c
242 se/token.c
243 vf/driver.c
244 wmi/wmi.c
245 ntoskrnl.rc
246 ${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S)
247
248 if(ARCH MATCHES i386)
249 list(APPEND SOURCE
250 config/i386/cmhardwr.c
251 ex/i386/interlck_asm.S
252 ex/i386/fastinterlck_asm.S
253 ex/i386/ioport.S
254 ke/freeldr.c
255 ke/i386/abios.c
256 ke/i386/cpu.c
257 ke/i386/context.c
258 ke/i386/ctxswitch.S
259 ke/i386/exp.c
260 ke/i386/irqobj.c
261 ke/i386/kiinit.c
262 ke/i386/ldt.c
263 ke/i386/mtrr.c
264 ke/i386/patpge.c
265 ke/i386/thrdini.c
266 ke/i386/trap.s
267 ke/i386/traphdlr.c
268 ke/i386/usercall_asm.S
269 ke/i386/usercall.c
270 ke/i386/v86vdm.c
271 mm/i386/page.c
272 mm/ARM3/i386/init.c
273 ps/i386/psctx.c
274 ps/i386/psldt.c
275 rtl/i386/stack.S
276 vdm/vdmmain.c
277 vdm/vdmexec.c)
278 elseif(ARCH MATCHES amd64)
279 list(APPEND SOURCE
280 config/i386/cmhardwr.c
281 ex/amd64/fastinterlck.c
282 ke/amd64/boot.S
283 ke/amd64/context.c
284 ke/amd64/cpu.c
285 ke/amd64/ctxswitch.S
286 ke/amd64/except.c
287 ke/amd64/interrupt.c
288 ke/amd64/irql.c
289 ke/amd64/kiinit.c
290 ke/amd64/spinlock.c
291 ke/amd64/stubs.c
292 ke/amd64/thrdini.c
293 ke/amd64/trap.S
294 mm/amd64/init.c
295 mm/amd64/page.c
296 ps/amd64/psctx.c)
297 elseif(ARCH MATCHES arm)
298 list(APPEND SOURCE
299 config/arm/cmhardwr.c
300 ke/arm/boot.s
301 ke/arm/cpu.c
302 ke/arm/ctxswtch.s
303 ke/arm/exp.c
304 ke/arm/kiinit.c
305 ke/arm/stubs_asm.s
306 ke/arm/thrdini.c
307 ke/arm/trap.s
308 ke/arm/trapc.c
309 ke/arm/usercall.c
310 mm/arm/page.c
311 mm/ARM3/arm/init.c
312 ps/arm/psctx.c
313 rtl/arm/rtlexcpt.c)
314 elseif(ARCH MATCHES powerpc)
315 list(APPEND SOURCE
316 config/powerpc/cmhardwr.c
317 ke/powerpc/main_asm.S
318 ke/powerpc/cpu.c
319 ke/powerpc/exp.c
320 ke/powerpc/kiinit.c
321 ke/powerpc/ppc_irq.c
322 ke/powerpc/stubs.c
323 ke/powerpc/systimer.c
324 ke/powerpc/thrdini.c
325 ke/powerpc/ctxswitch.c
326 ke/powerpc/ctxhelp.S
327 mm/powerpc/pfault.c
328 mm/powerpc/page.c)
329 endif(ARCH MATCHES i386)
330
331 if(NOT _WINKD_)
332
333 if(ARCH MATCHES i386)
334 list(APPEND SOURCE
335 kd/i386/kdmemsup.c
336 kd/wrappers/gdbstub.c)
337
338 if(KDBG)
339 list(APPEND SOURCE
340 kdbg/i386/i386-dis.c
341 kdbg/i386/kdb_help.S
342 kdbg/i386/longjmp.S
343 kdbg/i386/setjmp.S)
344 endif(KDBG)
345
346 elseif(ARCH MATCHES amd64)
347 list(APPEND SOURCE
348 kd/amd64/kd.c
349 kd/amd64/kdmemsup.c)
350
351 if(KDBG)
352 list(APPEND SOURCE
353 kdbg/amd64/i386-dis.c
354 kdbg/amd64/kdb_help.S
355 kdbg/amd64/kdb.c)
356 endif(KDBG)
357
358 elseif(ARCH MATCHES powerpc)
359 list(APPEND SOURCE kd/wrappers/gdbstub_powerpc.c)
360
361 endif(ARCH MATCHES i386)
362
363 if(KDBG)
364 list(APPEND SOURCE
365 kdbg/kdb.c
366 kdbg/kdb_cli.c
367 kdbg/kdb_expr.c
368 kdbg/kdb_keyboard.c
369 kdbg/kdb_serial.c)
370 endif(KDBG)
371
372 if(DBG OR KDBG)
373 list(APPEND SOURCE kdbg/kdb_symbols.c)
374 endif(DBG OR KDBG)
375
376 list(APPEND SOURCE
377 kd/wrappers/bochs.c
378 kd/wrappers/kdbg.c
379 kd/kdinit.c
380 kd/kdio.c
381 kd/kdmain.c)
382
383 else() # _WINKD_
384
385 list(APPEND SOURCE
386 kd64/kdapi.c
387 kd64/kdbreak.c
388 kd64/kddata.c
389 kd64/kdinit.c
390 kd64/kdlock.c
391 kd64/kdprint.c
392 kd64/kdtrap.c)
393
394 if(ARCH MATCHES i386)
395 list(APPEND SOURCE kd64/i386/kdx86.c)
396 elseif(ARCH MATCHES amd64)
397 list(APPEND SOURCE kd64/amd64/kdx64.c)
398 elseif(ARCH MATCHES arm)
399 list(APPEND SOURCE kd64/arm/kdarm.c)
400 endif(ARCH MATCHES i386)
401
402 endif(NOT _WINKD_)
403
404 add_executable(ntoskrnl ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl_ntoskrnl.h.gch)
405
406 set_target_properties(ntoskrnl PROPERTIES LINK_FLAGS "-Wl,-entry,_KiSystemStartup@4 -Wl,--image-base,0x80800000 -Wl,--subsystem,native")
407
408 target_link_libraries(ntoskrnl
409 ${CMAKE_CURRENT_SOURCE_DIR}/ntoskrnl_i386.def
410 csq
411 -lhal
412 pseh
413 cmlib
414 rtl
415 rossym
416 libcntpr
417 -lkdcom
418 -lbootvid
419 wdmguid
420 ioevent)
421
422 add_pch(ntoskrnl ${CMAKE_CURRENT_SOURCE_DIR}/include/ntoskrnl.h ${SOURCE})
423 set_source_files_properties(${REACTOS_BINARY_DIR}/ntoskrnl/ex/zw.S PROPERTIES GENERATED TRUE)
424 add_dependencies(ntoskrnl psdk bugcodes kernel_zw kernel_napi)