xref: /reactos/hal/halx86/CMakeLists.txt (revision 9393fc32)
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)
47include(up.cmake)
48include(smp.cmake)
49
50if(ARCH STREQUAL "i386")
51    include(pcidata.cmake)
52    include(legacy.cmake)
53    include(pic.cmake)
54    include(xbox.cmake)
55    include(pc98.cmake)
56    add_subdirectory(minihal)
57
58    remove_definitions(-DSARCH_XBOX)
59    remove_definitions(-DSARCH_PC98)
60
61    # hal
62    add_hal(hal SOURCES pic/halpic.rc COMPONENTS generic legacy up pic)
63    add_hal(halacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi up pic)
64    add_hal(halaacpi SOURCES apic/halaacpi.rc COMPONENTS generic acpi up apic)
65    add_hal(halapic SOURCES apic/halapic.rc COMPONENTS generic legacy up apic)
66    add_hal(halxbox SOURCES xbox/halxbox.rc COMPONENTS xbox up)
67    add_hal(halpc98 SOURCES pc98/halpc98.rc COMPONENTS pc98 up)
68
69    #add_hal(halmacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp pic)
70
71elseif(ARCH STREQUAL "amd64")
72
73    list(APPEND HAL_SOURCE
74        amd64/x86bios.c)
75
76    add_hal(hal SOURCES ${HAL_SOURCE} COMPONENTS generic acpi up apic)
77    target_link_libraries(hal fast486)
78
79    add_hal(halmp SOURCES ${HAL_SOURCE} COMPONENTS generic acpi smp apic)
80    target_link_libraries(halmp fast486)
81
82endif()
83