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 if(NOT MSVC) 19 foreach(_component ${_haldata_COMPONENTS}) 20 list(APPEND _haldata_SOURCES "$<TARGET_OBJECTS:lib_hal_${_component}>") 21 endforeach() 22 add_library(${_halname} MODULE 23 ${_haldata_SOURCES} 24 ${CMAKE_CURRENT_BINARY_DIR}/hal.def) 25 else() 26 foreach(_component ${_haldata_COMPONENTS}) 27 list(APPEND _haldata_LIBS "lib_hal_${_component}") 28 endforeach() 29 add_library(${_halname} MODULE 30 ${_haldata_SOURCES} 31 ${CMAKE_CURRENT_BINARY_DIR}/hal.def) 32 target_link_libraries(${_halname} ${_haldata_LIBS}) 33 endif() 34 35 target_link_libraries(${_halname} libcntpr) 36 add_importlibs(${_halname} ntoskrnl) 37 #add_pch(${_halname} include/hal.h) 38 add_dependencies(${_halname} psdk asm) 39 set_module_type(${_halname} kerneldll ENTRYPOINT HalInitSystem 8) 40 add_cd_file(TARGET ${_halname} DESTINATION reactos/system32 NO_CAB FOR all) 41 if(MSVC) 42 add_target_link_flags(${_halname} "/ignore:4216 /ignore:4078") 43 else() 44 target_link_libraries(${_halname} -lgcc) 45 endif() 46endfunction() 47 48# The components 49include(generic.cmake) 50include(acpi.cmake) 51include(apic.cmake) 52 53if(ARCH STREQUAL "i386") 54 include(pcidata.cmake) 55 include(legacy.cmake) 56 include(up.cmake) 57 include(pic.cmake) 58 include(xbox.cmake) 59 add_subdirectory(minihal) 60 61 # hal 62 add_hal(hal SOURCES up/halup.rc COMPONENTS generic legacy up pic) 63 add_hal(halacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up pic) 64 add_hal(halapic SOURCES acpi/halacpi.rc COMPONENTS generic legacy up apic) 65 add_hal(halaacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up apic) 66 add_hal(halxbox SOURCES xbox/halxbox.rc COMPONENTS xbox 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