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