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