summaryrefslogtreecommitdiff
path: root/Meta/CMake
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2022-01-17 16:53:17 -0700
committerLinus Groh <mail@linusgroh.de>2022-01-23 22:45:21 +0000
commit869c20b05dba6230d96166f2a5b74e823653274a (patch)
treec2b4404f0f14591c229ca77439893eaeea601961 /Meta/CMake
parentab1075e2961107a9f9d411d4afc0f4fe144dec36 (diff)
downloadserenity-869c20b05dba6230d96166f2a5b74e823653274a.zip
Meta+LibEDID: Download and generate the PNP ID database
This downloads the UEFI's published PNP ID database and generates a lookup table for use in LibEDID. The lookup table isn't optimized at all, but this can be easily done at a later point if needed.
Diffstat (limited to 'Meta/CMake')
-rw-r--r--Meta/CMake/pnp_ids.cmake31
-rw-r--r--Meta/CMake/serenity_options.cmake1
2 files changed, 32 insertions, 0 deletions
diff --git a/Meta/CMake/pnp_ids.cmake b/Meta/CMake/pnp_ids.cmake
new file mode 100644
index 0000000000..4ee371f8f2
--- /dev/null
+++ b/Meta/CMake/pnp_ids.cmake
@@ -0,0 +1,31 @@
+include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
+
+set(PNP_IDS_FILE pnp.ids)
+set(PNP_IDS_URL http://www.uefi.org/uefi-pnp-export)
+set(PNP_IDS_EXPORT_PATH ${CMAKE_BINARY_DIR}/pnp.ids.html)
+set(PNP_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${PNP_IDS_FILE})
+
+if(ENABLE_PNP_IDS_DOWNLOAD AND NOT EXISTS ${PNP_IDS_PATH})
+ message(STATUS "Downloading PNP ID database from ${PNP_IDS_URL}...")
+ file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
+ file(DOWNLOAD ${PNP_IDS_URL} ${PNP_IDS_EXPORT_PATH} INACTIVITY_TIMEOUT 10)
+
+ set(PNP_IDS_HEADER LibEDID/PnpIDs.h)
+ set(PNP_IDS_IMPLEMENTATION LibEDID/PnpIDs.cpp)
+ set(PNP_IDS_TARGET_PREFIX LibEDID_)
+
+ invoke_generator(
+ "PnpIDsData"
+ Lagom::GeneratePnpIDsData
+ "${PNP_IDS_EXPORT_PATH}"
+ "${PNP_IDS_TARGET_PREFIX}"
+ "${PNP_IDS_HEADER}"
+ "${PNP_IDS_IMPLEMENTATION}"
+ arguments -p "${PNP_IDS_EXPORT_PATH}"
+ )
+
+ set(PNP_IDS_SOURCES
+ ${PNP_IDS_HEADER}
+ ${PNP_IDS_IMPLEMENTATION}
+ )
+endif()
diff --git a/Meta/CMake/serenity_options.cmake b/Meta/CMake/serenity_options.cmake
index f5cbc5dec0..7c74bf1a08 100644
--- a/Meta/CMake/serenity_options.cmake
+++ b/Meta/CMake/serenity_options.cmake
@@ -6,6 +6,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/common_options.cmake)
serenity_option(ENABLE_PCI_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the pci.ids database at build time")
serenity_option(ENABLE_USB_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the usb.ids database at build time")
+serenity_option(ENABLE_PNP_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the pnp.ids database at build time")
serenity_option(ENABLE_KERNEL_ADDRESS_SANITIZER OFF CACHE BOOL "Enable kernel address sanitizer testing in gcc/clang")
serenity_option(ENABLE_KERNEL_COVERAGE_COLLECTION OFF CACHE BOOL "Enable KCOV and kernel coverage instrumentation in gcc/clang")
serenity_option(ENABLE_KERNEL_LTO OFF CACHE BOOL "Build the kernel with link-time optimization")