[MEDIA][CMAKE] Create add_driver_inf cmake function 2444/head
authorVictor Perevertkin <victor.perevertkin@reactos.org>
Sun, 26 Apr 2020 16:50:44 +0000 (19:50 +0300)
committerVictor Perevertkin <victor.perevertkin@reactos.org>
Sun, 26 Apr 2020 17:28:04 +0000 (20:28 +0300)
*.inf files for drivers can now be placed along with the driver code

31 files changed:
drivers/bus/acpi/CMakeLists.txt
drivers/bus/acpi/acpi.inf [moved from media/inf/acpi.inf with 100% similarity]
drivers/filesystems/btrfs/CMakeLists.txt
drivers/filesystems/btrfs/btrfs.inf [moved from media/inf/btrfs.inf with 100% similarity]
drivers/network/dd/e1000/CMakeLists.txt
drivers/network/dd/e1000/nete1000.inf [moved from media/inf/nete1000.inf with 100% similarity]
drivers/network/dd/ne2000/CMakeLists.txt
drivers/network/dd/ne2000/netne2000.inf [moved from media/inf/netisa.inf with 100% similarity]
drivers/network/dd/ne2000/netrtl8029.inf [moved from media/inf/netrtpnt.inf with 100% similarity]
drivers/network/dd/netkvm/CMakeLists.txt
drivers/network/dd/netkvm/netkvm.inf [moved from media/inf/netkvm.inf with 100% similarity]
drivers/network/dd/pcnet/CMakeLists.txt
drivers/network/dd/pcnet/netpcnet.inf [moved from media/inf/netamd.inf with 100% similarity]
drivers/network/dd/rtl8139/CMakeLists.txt
drivers/network/dd/rtl8139/netrtl8139.inf [moved from media/inf/netrtl.inf with 100% similarity]
drivers/processor/processr/CMakeLists.txt
drivers/processor/processr/cpu.inf [moved from media/inf/cpu.inf with 100% similarity]
drivers/storage/class/cdrom/CMakeLists.txt
drivers/storage/class/cdrom/cdrom.inf [moved from media/inf/cdrom.inf with 100% similarity]
drivers/storage/class/disk/CMakeLists.txt
drivers/storage/class/disk/disk.inf [moved from media/inf/disk.inf with 100% similarity]
drivers/storage/class/disk_new/CMakeLists.txt
drivers/storage/floppy/fdc/CMakeLists.txt
drivers/usb/usbstor/CMakeLists.txt
drivers/usb/usbstor/usbstor.inf [moved from media/inf/usbstor.inf with 100% similarity]
drivers/wdm/audio/hdaudbus/CMakeLists.txt
drivers/wdm/audio/hdaudbus/hdaudbus.inf [moved from media/inf/hdaudbus.inf with 100% similarity]
media/inf/CMakeLists.txt
sdk/cmake/CMakeMacros.cmake
win32ss/drivers/miniport/xboxvmp/CMakeLists.txt
win32ss/drivers/miniport/xboxvmp/xboxdisp.inf [moved from media/inf/xboxdisp.inf with 100% similarity]

index c7be9f2..69d26a1 100644 (file)
@@ -203,6 +203,7 @@ target_link_libraries(acpi wdmguid acpica memcmp strtol ${PSEH_LIB})
 add_importlibs(acpi ntoskrnl hal)
 add_pch(acpi precomp.h ACPI_SOURCE)
 add_cd_file(TARGET acpi DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_driver_inf(acpi acpi.inf)
 
 add_subdirectory(cmbatt)
 add_subdirectory(compbatt)
similarity index 100%
rename from media/inf/acpi.inf
rename to drivers/bus/acpi/acpi.inf
index b45a57c..0fd4908 100644 (file)
@@ -70,3 +70,4 @@ set_module_type(btrfs kernelmodedriver)
 target_link_libraries(btrfs rtlver zlib_solo chkstk wdmguid ${PSEH_LIB})
 add_importlibs(btrfs ntoskrnl hal)
 add_cd_file(TARGET btrfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_driver_inf(btrfs btrfs.inf)
index 2e0bf13..8bb4aa2 100644 (file)
@@ -19,3 +19,4 @@ add_pch(e1000 nic.h SOURCE)
 set_module_type(e1000 kernelmodedriver)
 add_importlibs(e1000 ndis ntoskrnl hal)
 add_cd_file(TARGET e1000 DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(e1000 nete1000.inf)
index 7e720aa..ba6af5b 100644 (file)
@@ -11,3 +11,4 @@ add_pch(ne2000 include/ne2000.h SOURCE)
 set_module_type(ne2000 kernelmodedriver)
 add_importlibs(ne2000 ndis ntoskrnl hal)
 add_cd_file(TARGET ne2000 DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(ne2000 netne2000.inf netrtl8029.inf)
index 7290684..8816535 100644 (file)
@@ -24,6 +24,7 @@ add_library(netkvm MODULE ${SOURCE} wxp/parandis.rc)
 set_module_type(netkvm kernelmodedriver)
 add_importlibs(netkvm ndis ntoskrnl hal)
 add_cd_file(TARGET netkvm DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(netkvm netkvm.inf)
 
 if (NOT MSVC)
     add_compile_flags("-Wno-unused-function")
index 34e5826..439073e 100644 (file)
@@ -15,3 +15,4 @@ add_pch(pcnet pcnet.h SOURCE)
 set_module_type(pcnet kernelmodedriver)
 add_importlibs(pcnet ndis ntoskrnl hal)
 add_cd_file(TARGET pcnet DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(pcnet netpcnet.inf)
index 59ad7fc..82b7aec 100644 (file)
@@ -16,3 +16,4 @@ add_pch(rtl8139 nic.h SOURCE)
 set_module_type(rtl8139 kernelmodedriver)
 add_importlibs(rtl8139 ndis ntoskrnl hal)
 add_cd_file(TARGET rtl8139 DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(rtl8139 netrtl8139.inf)
index 9bbd366..bfd8b71 100644 (file)
@@ -10,3 +10,4 @@ set_module_type(processr kernelmodedriver)
 add_importlibs(processr hal ntoskrnl)
 add_pch(processr processr.h SOURCE)
 add_cd_file(TARGET processr DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(processr cpu.inf)
index c764fdf..97b7a24 100644 (file)
@@ -12,3 +12,4 @@ add_importlibs(cdrom class2 scsiport ntoskrnl hal)
 add_pch(cdrom precomp.h SOURCE)
 add_cd_file(TARGET cdrom DESTINATION reactos/system32/drivers NO_CAB FOR all)
 add_registry_inf(cdrom_reg.inf)
+add_driver_inf(cdrom cdrom.inf)
index 70fdda9..eb2ff3f 100644 (file)
@@ -5,3 +5,4 @@ set_module_type(disk kernelmodedriver)
 add_importlibs(disk class2 scsiport ntoskrnl hal)
 add_cd_file(TARGET disk DESTINATION reactos/system32/drivers NO_CAB FOR all)
 add_registry_inf(disk_reg.inf)
+add_driver_inf(disk disk.inf)
index 252f673..8860e9b 100644 (file)
@@ -22,3 +22,4 @@ set_module_type(disk_new kernelmodedriver)
 add_importlibs(disk_new classpnp ntoskrnl hal)
 add_pch(disk_new disk.h SOURCE)
 add_cd_file(TARGET disk_new DESTINATION reactos/system32/drivers NO_CAB FOR all)
+#add_driver_inf(disk_new diskdev.inf)
index a9c6211..839f775 100644 (file)
@@ -11,3 +11,4 @@ set_module_type(fdc kernelmodedriver)
 add_importlibs(fdc hal ntoskrnl)
 add_pch(fdc fdc.h SOURCE)
 add_cd_file(TARGET fdc DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(fdc fdc.inf)
index 82e445f..567ee54 100644 (file)
@@ -23,3 +23,4 @@ set_module_type(usbstor kernelmodedriver)
 add_importlibs(usbstor ntoskrnl hal usbd)
 add_pch(usbstor usbstor.h SOURCE)
 add_cd_file(TARGET usbstor DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_driver_inf(usbstor usbstor.inf)
index 952dd72..3c5883d 100644 (file)
@@ -15,3 +15,4 @@ set_module_type(hdaudbus kernelmodedriver)
 target_link_libraries(hdaudbus libcntpr ${PSEH_LIB})
 add_importlibs(hdaudbus ntoskrnl hal)
 add_cd_file(TARGET hdaudbus DESTINATION reactos/system32/drivers FOR all)
+add_driver_inf(hdaudbus hdaudbus.inf)
index 6d0a50b..ba9f1fc 100644 (file)
@@ -1,20 +1,14 @@
 
 list(APPEND INF_FILES
-    acpi.inf
     audio.inf
     battery.inf
     bda.inf
     bth.inf
-    btrfs.inf
     c_image.inf
-    cdrom.inf
-    cpu.inf
-    disk.inf
     display.inf
     fdc.inf
     flpydisk.inf
     hal.inf
-    hdaudbus.inf
     hdc.inf
     input.inf
     keyboard.inf
@@ -25,12 +19,6 @@ list(APPEND INF_FILES
     monitor.inf
     msmouse.inf
     NET_NIC.inf
-    netamd.inf
-    nete1000.inf
-    netisa.inf
-    netkvm.inf
-    netrtl.inf
-    netrtpnt.inf
     nettcpip.inf
     ports.inf
     scsi.inf
@@ -38,10 +26,8 @@ list(APPEND INF_FILES
     unknown.inf
     usb.inf
     usbport.inf
-    usbstor.inf
     wdmaudio.inf
-    wmiacpi.inf
-    xboxdisp.inf)
+    wmiacpi.inf)
 
 list(APPEND UTF8_INF_FILES
     defltws.inf
@@ -49,17 +35,8 @@ list(APPEND UTF8_INF_FILES
     intl.inf
     layout.inf)
 
-foreach(item ${INF_FILES})
-    set(_converted_item ${CMAKE_CURRENT_BINARY_DIR}/${item})
-    set(_source_item ${CMAKE_CURRENT_SOURCE_DIR}/${item})
-    add_custom_command(OUTPUT "${_converted_item}"
-                       COMMAND native-utf16le "${_source_item}" "${_converted_item}"
-                       DEPENDS native-utf16le "${_source_item}")
-    add_cd_file(TARGET converted_inf_files FILE ${_converted_item} DESTINATION reactos/inf FOR all)
-    list(APPEND _converted_inf_files ${_converted_item})
-endforeach(item)
-
-add_custom_target(converted_inf_files DEPENDS ${_converted_inf_files})
+# module name is used for a custom target creation, so we can put any unique name here
+add_driver_inf(media_inf ${INF_FILES})
 
 foreach(item ${UTF8_INF_FILES})
     add_cd_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${item}" DESTINATION reactos/inf FOR all)
index a3be90b..d29b95a 100644 (file)
@@ -298,7 +298,7 @@ macro(dir_to_num dir var)
     elseif(${dir} STREQUAL reactos/3rdParty)
         set(${var} 63)
     elseif(${dir} STREQUAL reactos/Resources/Themes/Lunar)
-        set(${var} 64) 
+        set(${var} 64)
     elseif(${dir} STREQUAL reactos/Resources/Themes/Mizu)
         set(${var} 65)
     elseif(${dir} STREQUAL reactos/system32/spool/prtprocs/x64)
@@ -908,6 +908,21 @@ function(create_registry_hives)
 
 endfunction()
 
+function(add_driver_inf _module)
+    # Add to the inf files list
+    foreach(_file ${ARGN})
+        set(_converted_item ${CMAKE_CURRENT_BINARY_DIR}/${_file})
+        set(_source_item ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
+        add_custom_command(OUTPUT "${_converted_item}"
+                           COMMAND native-utf16le "${_source_item}" "${_converted_item}"
+                           DEPENDS native-utf16le "${_source_item}")
+        add_cd_file(FILE ${_converted_item} DESTINATION reactos/inf FOR all)
+        list(APPEND _converted_inf_files ${_converted_item})
+    endforeach()
+
+    add_custom_target(${_module}_inf_files DEPENDS ${_converted_inf_files})
+endfunction()
+
 if(KDBG)
     set(ROSSYM_LIB "rossym")
 else()
index e9d37f0..2595ebb 100644 (file)
@@ -11,3 +11,4 @@ set_module_type(xboxvmp kernelmodedriver)
 add_importlibs(xboxvmp ntoskrnl videoprt)
 add_cd_file(TARGET xboxvmp DESTINATION reactos/system32/drivers FOR all)
 add_registry_inf(xboxvmp_reg.inf)
+add_driver_inf(xboxvmp xboxdisp.inf)