1 2add_definitions( 3 -D_NTHALDLL_ 4 -D_NTHAL_) 5 6include_directories( 7 include 8 ${REACTOS_SOURCE_DIR}/ntoskrnl/include 9 ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/fast486) 10 11function(add_hal _halname) 12 cmake_parse_arguments(_haldata "" "" "SOURCES;COMPONENTS" ${ARGN}) 13 14 # Handle the spec file for the dll name 15 spec2def(${_halname}.dll ../hal.spec ADD_IMPORTLIB) 16 17 # Create the actual target 18 foreach(_component ${_haldata_COMPONENTS}) 19 list(APPEND _haldata_SOURCES "$<TARGET_OBJECTS:lib_hal_${_component}>") 20 endforeach() 21 add_library(${_halname} MODULE 22 ${_haldata_SOURCES} 23 ${CMAKE_CURRENT_BINARY_DIR}/hal.def) 24 25 if(${_halname} STREQUAL "hal") 26 target_link_libraries(${_halname} libcntpr arbiter) 27 else() 28 target_link_libraries(${_halname} libcntpr) 29 endif() 30 31 add_importlibs(${_halname} ntoskrnl) 32 #add_pch(${_halname} include/hal.h) 33 add_dependencies(${_halname} psdk asm) 34 set_module_type(${_halname} kerneldll ENTRYPOINT HalInitSystem 8) 35 add_cd_file(TARGET ${_halname} DESTINATION reactos/system32 NO_CAB FOR all) 36 if(MSVC) 37 add_target_link_flags(${_halname} "/ignore:4216 /SECTION:INIT,ERWD") 38 else() 39 target_link_libraries(${_halname} -lgcc) 40 endif() 41endfunction() 42 43# The components 44include(generic.cmake) 45include(acpi.cmake) 46include(apic.cmake) 47 48if(ARCH STREQUAL "i386") 49 include(pcidata.cmake) 50 include(legacy.cmake) 51 include(up.cmake) 52 include(pic.cmake) 53 include(xbox.cmake) 54 include(pc98.cmake) 55 add_subdirectory(minihal) 56 57 remove_definitions(-DSARCH_XBOX) 58 remove_definitions(-DSARCH_PC98) 59 60 # hal 61 add_hal(hal SOURCES up/halup.rc COMPONENTS generic legacy up pic) 62 add_hal(halacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up pic) 63 add_hal(halapic SOURCES acpi/halacpi.rc COMPONENTS generic legacy up apic) 64 add_hal(halaacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up apic) 65 add_hal(halxbox SOURCES xbox/halxbox.rc COMPONENTS xbox up) 66 add_hal(halpc98 SOURCES pc98/halpc98.rc COMPONENTS pc98 up) 67 68 #add_hal(halmps SOURCES up/halup.rc COMPONENTS generic legacy smp pic) 69 #add_hal(halmacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp pic) 70 #add_hal(halmapic SOURCES acpi/halacpi.rc COMPONENTS generic legacy smp apic) 71 #add_hal(halmaacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp apic) 72 73elseif(ARCH STREQUAL "amd64") 74 75 list(APPEND HAL_SOURCE 76 generic/spinlock.c 77 amd64/x86bios.c 78 amd64/halinit.c 79 amd64/processor.c) 80 81 add_hal(hal SOURCES ${HAL_SOURCE} COMPONENTS generic acpi apic) 82 target_link_libraries(hal fast486) 83 84endif() 85