[NFS]
[reactos.git] / reactos / boot / environ / CMakeLists.txt
1
2 include_directories(BEFORE include)
3 include_directories(BEFORE include/efi)
4 include_directories(${REACTOS_SOURCE_DIR}/ntoskrnl/include)
5 include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/cmlib)
6 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs)
7 include_directories(${REACTOS_SOURCE_DIR}/drivers/filesystems)
8
9 add_definitions(-D_NTHAL_ -D_BLDR_ -D_NTSYSTEM_)
10
11 list(APPEND BOOTLIB_SOURCE
12 app/bootmgr/bootmgr.h
13 lib/bootlib.c
14 lib/misc/debug.c
15 lib/misc/bcd.c
16 lib/misc/bcdopt.c
17 lib/misc/bootreg.c
18 lib/misc/util.c
19 lib/misc/image.c
20 lib/misc/resource.c
21 lib/misc/font.c
22 lib/misc/rtlcompat.c
23 lib/firmware/fwutil.c
24 lib/firmware/efi/firmware.c
25 lib/mm/mm.c
26 lib/mm/pagealloc.c
27 lib/mm/heapalloc.c
28 lib/mm/blkalloc.c
29 lib/mm/descriptor.c
30 lib/platform/time.c
31 lib/io/blkcache.c
32 lib/io/etfs.c
33 lib/io/io.c
34 lib/io/device.c
35 lib/io/file.c
36 lib/io/fat.c
37 lib/io/display/display.c
38 lib/io/display/emscons.c
39 lib/io/display/guicons.c
40 lib/io/display/textcons.c
41 lib/io/display/efi/textcons.c
42 lib/io/display/efi/guicons.c
43 lib/io/display/efi/gop.c
44 lib/io/display/efi/uga.c)
45
46 if(ARCH STREQUAL "i386")
47 list(APPEND BOOTLIB_ASM_SOURCE
48 lib/arch/i386/transfer.s
49 )
50 list(APPEND BOOTLIB_SOURCE
51 lib/arch/i386/arch.c
52 lib/mm/i386/mmx86.c
53 )
54 elseif(ARCH STREQUAL "amd64")
55 list(APPEND BOOTLIB_ASM_SOURCE
56 #lib/arch/amd64/foo.asm
57 )
58 list(APPEND BOOTLIB_SOURCE
59 #lib/arch/amd64/foo.c
60 lib/arch/stub/arch.c
61 lib/mm/stub/mm.c
62 )
63 else()
64 list(APPEND BOOTLIB_SOURCE
65 lib/arch/stub/arch.c
66 lib/mm/stub/mm.c
67 )
68 endif()
69
70 add_asm_files(bootlib_asm ${BOOTLIB_ASM_SOURCE})
71 add_library(bootlib ${BOOTLIB_SOURCE} ${bootlib_asm})
72 add_pch(bootlib app/bootmgr/bootmgr.h BOOTLIB_SOURCE)
73 add_dependencies(bootlib bugcodes asm bootmsg xdk)
74
75 list(APPEND BOOTMGR_BASE_SOURCE
76 app/bootmgr/efiemu.c
77 app/bootmgr/bootmgr.c
78 )
79
80 add_executable(bootmgfw ${BOOTMGR_BASE_SOURCE} app/bootmgr/bootmgr.rc)
81 set_target_properties(bootmgfw PROPERTIES SUFFIX ".efi")
82
83 if(MSVC)
84 add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER /FIXED")
85 else()
86 add_target_link_flags(bootmgfw "-Wl,--strip-all,--exclude-all-symbols")
87 endif()
88
89 set_image_base(bootmgfw 0x10000)
90
91 if(MSVC)
92 set_subsystem(bootmgfw EFI_APPLICATION)
93 else()
94 set_subsystem(bootmgfw 10)
95 endif()
96
97 set_entrypoint(bootmgfw EfiEntry)
98
99 target_link_libraries(bootmgfw bootlib cportlib cmlib rtl libcntpr)
100
101 if(STACK_PROTECTOR)
102 target_link_libraries(bootmgfw gcc_ssp)
103 elseif(RUNTIME_CHECKS)
104 target_link_libraries(bootmgfw runtmchk)
105 endif()
106
107 add_dependencies(bootmgfw asm bugcodes)
108
109 list(APPEND ROSLOAD_BASE_SOURCE
110 app/rosload/rosload.c
111 )
112
113 add_executable(rosload ${ROSLOAD_BASE_SOURCE})
114 set_target_properties(rosload PROPERTIES SUFFIX ".efi")
115
116 if(MSVC)
117 add_target_link_flags(rosload "/ignore:4078 /ignore:4254 /DRIVER")
118 else()
119 add_target_link_flags(rosload "-Wl,--strip-all,--exclude-all-symbols,--dynamicbase,--pic-executable")
120 endif()
121
122 set_image_base(rosload 0x10000)
123
124 if(MSVC)
125 set_subsystem(rosload BOOT_APPLICATION)
126 else()
127 set_subsystem(rosload 16)
128 endif()
129
130 if(ARCH STREQUAL "i386")
131 set_entrypoint(rosload OslMain 4)
132 else()
133 set_entrypoint(rosload OslMain)
134 endif()
135
136 target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr)
137
138 if(STACK_PROTECTOR)
139 target_link_libraries(rosload gcc_ssp)
140 elseif(RUNTIME_CHECKS)
141 target_link_libraries(rosload runtmchk)
142 endif()
143
144 add_dependencies(rosload asm bugcodes)
145
146 add_cd_file(TARGET rosload DESTINATION reactos/system32/boot NO_CAB FOR all)