76d21c9b038b48130ab62a4e86634255b45943fd
[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}/lib/cmlib)
6 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs)
7
8 add_definitions(-D_NTHAL_ -D_BLDR_ -D_NTSYSTEM_)
9
10 list(APPEND BOOTLIB_SOURCE
11 app/bootmgr/bootmgr.h
12 lib/bootlib.c
13 lib/misc/bcd.c
14 lib/misc/util.c
15 lib/firmware/efi/firmware.c
16 lib/mm/mm.c
17 lib/mm/pagealloc.c
18 lib/mm/heapalloc.c
19 lib/mm/blkalloc.c
20 lib/mm/descriptor.c
21 lib/platform/time.c
22 lib/io/io.c
23 lib/io/device.c
24 lib/io/file.c
25 lib/io/fat.c
26 lib/platform/display.c)
27
28 if(ARCH STREQUAL "i386")
29 list(APPEND BOOTLIB_ASM_SOURCE
30 #lib/arch/i386/foo.asm
31 )
32 list(APPEND BOOTLIB_SOURCE
33 lib/arch/i386/arch.c
34 lib/mm/i386/mmx86.c
35 )
36 elseif(ARCH STREQUAL "amd64")
37 list(APPEND BOOTLIB_ASM_SOURCE
38 #lib/arch/amd64/foo.asm
39 )
40 list(APPEND BOOTLIB_SOURCE
41 #lib/arch/amd64/foo.c
42 )
43 else()
44 #TBD
45 endif()
46
47 add_asm_files(bootlib_asm ${BOOTLIB_ASM_SOURCE})
48 add_library(bootlib ${BOOTLIB_SOURCE} ${bootlib_asm})
49 add_pch(bootlib app/bootmgr/bootmgr.h BOOTLIB_SOURCE)
50 add_dependencies(bootlib bugcodes)
51
52 list(APPEND BOOTMGR_BASE_SOURCE
53 app/bootmgr/efiemu.c
54 app/bootmgr/bootmgr.c
55 app/bootmgr/rtlcompat.c
56 )
57
58 add_executable(bootmgfw ${BOOTMGR_BASE_SOURCE})
59 set_target_properties(bootmgfw PROPERTIES SUFFIX ".efi")
60
61 if(MSVC)
62 add_target_link_flags(bootmgfw "/ignore:4078 /ignore:4254 /DRIVER /FIXED")
63 else()
64 add_target_link_flags(bootmgfw "-Wl,--strip-all,--exclude-all-symbols")
65 endif()
66
67 set_image_base(bootmgfw 0x10000)
68
69 if(MSVC)
70 set_subsystem(bootmgfw EFI_APPLICATION)
71 else()
72 set_subsystem(bootmgfw 10)
73 endif()
74
75 set_entrypoint(bootmgfw EfiEntry)
76
77 target_link_libraries(bootmgfw bootlib cportlib cmlib rtl libcntpr)
78
79 if(STACK_PROTECTOR)
80 target_link_libraries(bootmgfw gcc_ssp)
81 elseif(RUNTIME_CHECKS)
82 target_link_libraries(bootmgfw runtmchk)
83 endif()
84
85 add_dependencies(bootmgfw asm bugcodes)
86
87 add_cd_file(TARGET bootmgfw FILE ${_bootmgfw_output_file} DESTINATION efi/boot NO_CAB FOR bootcd regtest NAME_ON_CD bootia32.efi)
88