include
${REACTOS_SOURCE_DIR}/ntoskrnl/include)
-list(APPEND HAL_GENERIC_SOURCE
- generic/beep.c
- generic/cmos.c
- generic/display.c
- generic/dma.c
- generic/drive.c
- generic/memory.c
- generic/misc.c
- generic/profil.c
- generic/reboot.c
- generic/sysinfo.c
- generic/timer.c
- generic/usage.c)
+function(add_hal _halname)
+ cmake_parse_arguments(_haldata "" "" "SOURCES;COMPONENTS" ${ARGN})
+
+ # Handle the spec file for the dll name
+ spec2def(${_halname}.dll ../hal.spec ADD_IMPORTLIB)
+
+ # Create the actual target
+ if(NOT MSVC AND (CMAKE_VERSION VERSION_GREATER 2.8.7))
+ foreach(_component ${_haldata_COMPONENTS})
+ list(APPEND _haldata_SOURCES "$<TARGET_OBJECTS:lib_hal_${_component}>")
+ endforeach()
+ add_library(${_halname} SHARED
+ ${_haldata_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/hal.def)
+ else()
+ foreach(_component ${_haldata_COMPONENTS})
+ list(APPEND _haldata_LIBS "lib_hal_${_component}")
+ endforeach()
+ add_library(${_halname} SHARED
+ ${_haldata_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/hal.def)
+ target_link_libraries(${_halname} ${_haldata_LIBS})
+ endif()
+
+ target_link_libraries(${_halname} libcntpr)
+ add_importlibs(${_halname} ntoskrnl)
+ #add_pch(${_halname} include/hal.h)
+ add_dependencies(${_halname} psdk bugcodes asm)
+ set_entrypoint(${_halname} HalInitSystem 8)
+ set_subsystem(${_halname} native)
+ set_image_base(${_halname} 0x00010000)
+ add_cd_file(TARGET ${_halname} DESTINATION reactos/system32 NO_CAB FOR all)
+ if(MSVC)
+ add_target_link_flags(${_halname} "/ignore:4216 /ignore:4078")
+ else()
+ target_link_libraries(${_halname} -lgcc)
+ endif()
+endfunction()
+
+# The components
+include(generic.cmake)
+include(acpi.cmake)
+include(apic.cmake)
+
+if(ARCH STREQUAL "i386")
+ include(pcidata.cmake)
+ include(legacy.cmake)
+ include(up.cmake)
+ include(pic.cmake)
+ include(minihal.cmake)
-if(ARCH MATCHES i386)
- list(APPEND HAL_GENERIC_SOURCE
- generic/bios.c
- generic/halinit.c
- generic/i386/portio.c
- generic/i386/systimer.S
- generic/i386/trap.S)
-endif()
-
-list(APPEND HAL_GENERIC_PCAT_SOURCE
- generic/legacy/bus/bushndlr.c
- generic/legacy/bus/cmosbus.c
- generic/legacy/bus/isabus.c
- generic/legacy/bus/pcibus.c
- generic/legacy/bus/pcidata.c
- generic/legacy/bus/sysbus.c
- generic/legacy/bussupp.c
- generic/legacy/halpcat.c)
-
-list(APPEND HAL_GENERIC_ACPI_SOURCE
- generic/acpi/halacpi.c
- generic/acpi/halpnpdd.c
- generic/acpi/busemul.c
- generic/legacy/bus/pcibus.c)
-
-if(ARCH MATCHES i386)
-
- list(APPEND HAL_GENERIC_UP_SOURCE
- generic/spinlock.c
- up/pic.c
- up/processor.c)
+ # hal
+ add_hal(hal SOURCES up/halup.rc COMPONENTS generic legacy up pic)
+ add_hal(halacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up pic)
+ add_hal(halapic SOURCES acpi/halacpi.rc COMPONENTS generic legacy up apic)
+ add_hal(halaacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up apic)
- list(APPEND MINI_HAL_SOURCE
- generic/i386/portio.c
- generic/i386/systimer.S
- generic/legacy/bus/bushndlr.c
- generic/legacy/bus/cmosbus.c
- generic/legacy/bus/isabus.c
- generic/legacy/bus/pcibus.c
- generic/legacy/bus/sysbus.c
- generic/legacy/bussupp.c
- generic/beep.c
- generic/bios.c
- generic/cmos.c
- generic/dma.c
- generic/display.c
- generic/drive.c
- generic/misc.c
- generic/profil.c
- generic/reboot.c
- generic/spinlock.c
- generic/sysinfo.c
- generic/timer.c
- generic/usage.c
- up/halinit_up.c
- up/pic.c
- up/processor.c)
+ #add_hal(halmps SOURCES up/halup.rc COMPONENTS generic legacy smp pic)
+ #add_hal(halmacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp pic)
+ #add_hal(halmapic SOURCES acpi/halacpi.rc COMPONENTS generic legacy smp apic)
+ #add_hal(halmaacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp apic)
- spec2def(hal.dll ../hal.spec)
+elseif(ARCH STREQUAL "amd64")
list(APPEND HAL_SOURCE
- ${CMAKE_CURRENT_BINARY_DIR}/hal_hal.h.gch
- ${HAL_GENERIC_SOURCE}
- ${HAL_GENERIC_PCAT_SOURCE}
- ${HAL_GENERIC_UP_SOURCE}
- up/halinit_up.c
- up/halup.rc
- ${CMAKE_CURRENT_BINARY_DIR}/hal.def)
-
- # hal
- add_library(hal SHARED ${HAL_SOURCE})
- add_pch(hal ${CMAKE_CURRENT_SOURCE_DIR}/include/hal.h ${HAL_SOURCE})
- add_dependencies(hal psdk bugcodes)
-
- set_entrypoint(hal HalInitSystem@8)
- set_subsystem(hal native)
- set_image_base(hal 0x00010000)
- add_importlibs(hal ntoskrnl)
- target_link_libraries(hal libcntpr)
-
- add_minicd_target(hal reactos hal.dll)
- add_livecd_target(hal reactos/system32)
+ generic/spinlock.c
+ amd64/x86bios.c
+ amd64/halinit.c
+ amd64/processor.c)
- # mini_hal
- add_library(mini_hal ${MINI_HAL_SOURCE})
- set_property(TARGET mini_hal PROPERTY COMPILE_DEFINITIONS "_BLDR_;_MINIHAL_")
- add_dependencies(mini_hal psdk bugcodes asm)
+ add_hal(hal SOURCES ${HAL_SOURCE} COMPONENTS generic acpi apic)
-elseif(ARCH MATCHES amd64)
-#TBD
endif()
-
-add_importlib_target(../hal.spec)