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 106# dynamic analysis switches 107if(STACK_PROTECTOR) 108 target_sources(bootmgfw PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) 109endif() 110 111if(RUNTIME_CHECKS) 112 target_link_libraries(bootmgfw runtmchk) 113endif() 114 115add_dependencies(bootmgfw asm bugcodes) 116 117list(APPEND ROSLOAD_BASE_SOURCE 118 app/rosload/rosload.c 119 app/rosload/roslogo.c 120 ) 121 122if(ARCH STREQUAL "i386") 123 list(APPEND ROSLOAD_ASM_SOURCE 124 app/rosload/i386/osxfera.s 125 ) 126endif() 127 128add_asm_files(rosload_asm ${ROSLOAD_ASM_SOURCE}) 129add_executable(rosload ${ROSLOAD_BASE_SOURCE} ${rosload_asm}) 130set_target_properties(rosload PROPERTIES SUFFIX ".efi") 131 132if(MSVC) 133 add_target_link_flags(rosload "/ignore:4078 /ignore:4254 /DRIVER") 134else() 135 add_target_link_flags(rosload "-Wl,--strip-all,--exclude-all-symbols,--dynamicbase,--pic-executable") 136endif() 137 138set_image_base(rosload 0x10000) 139 140if(MSVC) 141 set_subsystem(rosload BOOT_APPLICATION) 142else() 143 set_subsystem(rosload 16) 144endif() 145 146if(ARCH STREQUAL "i386") 147 set_entrypoint(rosload OslMain 4) 148else() 149 set_entrypoint(rosload OslMain) 150endif() 151 152target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr) 153 154# dynamic analysis switches 155if(STACK_PROTECTOR) 156 target_sources(rosload PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>) 157endif() 158 159if(RUNTIME_CHECKS) 160 target_link_libraries(rosload runtmchk) 161endif() 162 163add_dependencies(rosload asm bugcodes) 164 165add_cd_file(TARGET rosload DESTINATION reactos/system32/boot NO_CAB FOR all) 166