[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 ntoskrnl_${ARCH}.def)
246
247 set_source_files_properties(ntoskrnl_${ARCH}.def PROPERTIES EXTERNAL_OBJECT TRUE)
248
249 if(ARCH MATCHES i386)
250 list(APPEND SOURCE
251 config/i386/cmhardwr.c
252 ex/i386/interlck_asm.S
253 ex/i386/fastinterlck_asm.S
254 ex/i386/ioport.S
255 ke/freeldr.c
256 ke/i386/abios.c
257 ke/i386/cpu.c
258 ke/i386/context.c
259 ke/i386/ctxswitch.S
260 ke/i386/exp.c
261 ke/i386/irqobj.c
262 ke/i386/kiinit.c
263 ke/i386/ldt.c
264 ke/i386/mtrr.c
265 ke/i386/patpge.c
266 ke/i386/thrdini.c
267 ke/i386/trap.s
268 ke/i386/traphdlr.c
269 ke/i386/usercall_asm.S
270 ke/i386/usercall.c
271 ke/i386/v86vdm.c
272 mm/i386/page.c
273 mm/ARM3/i386/init.c
274 ps/i386/psctx.c
275 ps/i386/psldt.c
276 rtl/i386/stack.S
277 vdm/vdmmain.c
278 vdm/vdmexec.c)
279 elseif(ARCH MATCHES amd64)
280 list(APPEND SOURCE
281 config/i386/cmhardwr.c
282 ex/amd64/fastinterlck.c
283 ke/amd64/boot.S
284 ke/amd64/context.c
285 ke/amd64/cpu.c
286 ke/amd64/ctxswitch.S
287 ke/amd64/except.c
288 ke/amd64/interrupt.c
289 ke/amd64/irql.c
290 ke/amd64/kiinit.c
291 ke/amd64/spinlock.c
292 ke/amd64/stubs.c
293 ke/amd64/thrdini.c
294 ke/amd64/trap.S
295 mm/amd64/init.c
296 mm/amd64/page.c
297 ps/amd64/psctx.c)
298 elseif(ARCH MATCHES arm)
299 list(APPEND SOURCE
300 config/arm/cmhardwr.c
301 ke/arm/boot.s
302 ke/arm/cpu.c
303 ke/arm/ctxswtch.s
304 ke/arm/exp.c
305 ke/arm/kiinit.c
306 ke/arm/stubs_asm.s
307 ke/arm/thrdini.c
308 ke/arm/trap.s
309 ke/arm/trapc.c
310 ke/arm/usercall.c
311 mm/arm/page.c
312 mm/ARM3/arm/init.c
313 ps/arm/psctx.c
314 rtl/arm/rtlexcpt.c)
315 elseif(ARCH MATCHES powerpc)
316 list(APPEND SOURCE
317 config/powerpc/cmhardwr.c
318 ke/powerpc/main_asm.S
319 ke/powerpc/cpu.c
320 ke/powerpc/exp.c
321 ke/powerpc/kiinit.c
322 ke/powerpc/ppc_irq.c
323 ke/powerpc/stubs.c
324 ke/powerpc/systimer.c
325 ke/powerpc/thrdini.c
326 ke/powerpc/ctxswitch.c
327 ke/powerpc/ctxhelp.S
328 mm/powerpc/pfault.c
329 mm/powerpc/page.c)
330 endif(ARCH MATCHES i386)
331
332 if(NOT _WINKD_)
333
334 if(ARCH MATCHES i386)
335 list(APPEND SOURCE
336 kd/i386/kdmemsup.c
337 kd/wrappers/gdbstub.c)
338
339 if(KDBG)
340 list(APPEND SOURCE
341 kdbg/i386/i386-dis.c
342 kdbg/i386/kdb_help.S
343 kdbg/i386/longjmp.S
344 kdbg/i386/setjmp.S)
345 endif(KDBG)
346
347 elseif(ARCH MATCHES amd64)
348 list(APPEND SOURCE
349 kd/amd64/kd.c
350 kd/amd64/kdmemsup.c)
351
352 if(KDBG)
353 list(APPEND SOURCE
354 kdbg/amd64/i386-dis.c
355 kdbg/amd64/kdb_help.S
356 kdbg/amd64/kdb.c)
357 endif(KDBG)
358
359 elseif(ARCH MATCHES powerpc)
360 list(APPEND SOURCE kd/wrappers/gdbstub_powerpc.c)
361
362 endif(ARCH MATCHES i386)
363
364 if(KDBG)
365 list(APPEND SOURCE
366 kdbg/kdb.c
367 kdbg/kdb_cli.c
368 kdbg/kdb_expr.c
369 kdbg/kdb_keyboard.c
370 kdbg/kdb_serial.c)
371 endif(KDBG)
372
373 if(DBG OR KDBG)
374 list(APPEND SOURCE kdbg/kdb_symbols.c)
375 endif(DBG OR KDBG)
376
377 list(APPEND SOURCE
378 kd/wrappers/bochs.c
379 kd/wrappers/kdbg.c
380 kd/kdinit.c
381 kd/kdio.c
382 kd/kdmain.c)
383
384 else() # _WINKD_
385
386 list(APPEND SOURCE
387 kd64/kdapi.c
388 kd64/kdbreak.c
389 kd64/kddata.c
390 kd64/kdinit.c
391 kd64/kdlock.c
392 kd64/kdprint.c
393 kd64/kdtrap.c)
394
395 if(ARCH MATCHES i386)
396 list(APPEND SOURCE kd64/i386/kdx86.c)
397 elseif(ARCH MATCHES amd64)
398 list(APPEND SOURCE kd64/amd64/kdx64.c)
399 elseif(ARCH MATCHES arm)
400 list(APPEND SOURCE kd64/arm/kdarm.c)
401 endif(ARCH MATCHES i386)
402
403 endif(NOT _WINKD_)
404
405 add_executable(ntoskrnl ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl_ntoskrnl.h.gch)
406
407 set_target_properties(ntoskrnl PROPERTIES LINK_FLAGS "-Wl,-entry,_KiSystemStartup@4 -Wl,--image-base,0x80800000 -Wl,--subsystem,native")
408
409 target_link_libraries(ntoskrnl
410 cportlib
411 csq
412 pseh
413 cmlib
414 rtl
415 rossym
416 libcntpr
417 wdmguid
418 ioevent)
419
420 add_importlibs(ntoskrnl hal kdcom bootvid)
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)
425
426 add_minicd_target(ntoskrnl reactos ntoskrnl.exe)
427 add_livecd_target(ntoskrnl reactos/system32)