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