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 if (${_halname} STREQUAL "hal") 36 target_link_libraries(${_halname} libcntpr arbiter) 37 else() 38 target_link_libraries(${_halname} libcntpr) 39 endif() 40 41 add_importlibs(${_halname} ntoskrnl) 42 #add_pch(${_halname} include/hal.h) 43 add_dependencies(${_halname} psdk asm) 44 set_module_type(${_halname} kerneldll ENTRYPOINT HalInitSystem 8) 45 add_cd_file(TARGET ${_halname} DESTINATION reactos/system32 NO_CAB FOR all) 46 if(MSVC) 47 add_target_link_flags(${_halname} "/ignore:4216 /ignore:4078") 48 else() 49 target_link_libraries(${_halname} -lgcc) 50 endif() 51endfunction() 52 53# The components 54include(generic.cmake) 55include(acpi.cmake) 56include(apic.cmake) 57 58if(ARCH STREQUAL "i386") 59 include(pcidata.cmake) 60 include(legacy.cmake) 61 include(up.cmake) 62 include(pic.cmake) 63 include(xbox.cmake) 64 add_subdirectory(minihal) 65 66 # hal 67 add_hal(hal SOURCES up/halup.rc COMPONENTS generic legacy up pic) 68 add_hal(halacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up pic) 69 add_hal(halapic SOURCES acpi/halacpi.rc COMPONENTS generic legacy up apic) 70 add_hal(halaacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up apic) 71 add_hal(halxbox SOURCES xbox/halxbox.rc COMPONENTS xbox up) 72 73 #add_hal(halmps SOURCES up/halup.rc COMPONENTS generic legacy smp pic) 74 #add_hal(halmacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp pic) 75 #add_hal(halmapic SOURCES acpi/halacpi.rc COMPONENTS generic legacy smp apic) 76 #add_hal(halmaacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp apic) 77 78elseif(ARCH STREQUAL "amd64") 79 80 list(APPEND HAL_SOURCE 81 generic/spinlock.c 82 amd64/x86bios.c 83 amd64/halinit.c 84 amd64/processor.c) 85 86 add_hal(hal SOURCES ${HAL_SOURCE} COMPONENTS generic acpi apic) 87 target_link_libraries(hal fast486) 88 89endif() 90