92381d6d3f4b839223d97eccc4dab757893c8441
[reactos.git] / 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 if (ARCH STREQUAL "arm")
85 add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER")
86 else()
87 add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER /FIXED")
88 endif()
89 else()
90 add_target_link_flags(bootmgfw "-Wl,--strip-all,--exclude-all-symbols")
91 endif()
92
93 set_image_base(bootmgfw 0x10000)
94
95 if(MSVC)
96 set_subsystem(bootmgfw EFI_APPLICATION)
97 else()
98 set_subsystem(bootmgfw 10)
99 endif()
100
101 set_entrypoint(bootmgfw EfiEntry)
102
103 target_link_libraries(bootmgfw bootlib cportlib cmlib rtl libcntpr)
104
105 if(STACK_PROTECTOR)
106 target_link_libraries(bootmgfw gcc_ssp)
107 elseif(RUNTIME_CHECKS)
108 target_link_libraries(bootmgfw runtmchk)
109 endif()
110
111 add_dependencies(bootmgfw asm bugcodes)
112
113 list(APPEND ROSLOAD_BASE_SOURCE
114 app/rosload/rosload.c
115 )
116
117 add_executable(rosload ${ROSLOAD_BASE_SOURCE})
118 set_target_properties(rosload PROPERTIES SUFFIX ".efi")
119
120 if(MSVC)
121 add_target_link_flags(rosload "/ignore:4078 /ignore:4254 /DRIVER")
122 else()
123 add_target_link_flags(rosload "-Wl,--strip-all,--exclude-all-symbols,--dynamicbase,--pic-executable")
124 endif()
125
126 set_image_base(rosload 0x10000)
127
128 if(MSVC)
129 set_subsystem(rosload BOOT_APPLICATION)
130 else()
131 set_subsystem(rosload 16)
132 endif()
133
134 if(ARCH STREQUAL "i386")
135 set_entrypoint(rosload OslMain 4)
136 else()
137 set_entrypoint(rosload OslMain)
138 endif()
139
140 target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr)
141
142 if(STACK_PROTECTOR)
143 target_link_libraries(rosload gcc_ssp)
144 elseif(RUNTIME_CHECKS)
145 target_link_libraries(rosload runtmchk)
146 endif()
147
148 add_dependencies(rosload asm bugcodes)
149
150 add_cd_file(TARGET rosload DESTINATION reactos/system32/boot NO_CAB FOR all)