You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
917 B
29 lines
917 B
file(READ "config/99-realsense-libusb.rules" contents HEX)
|
|
|
|
set(UDEV_HEADER "${CMAKE_CURRENT_BINARY_DIR}/udev-rules.h")
|
|
|
|
file(WRITE "${UDEV_HEADER}" "#ifndef __UDEV_RULES_H__\n")
|
|
file(APPEND "${UDEV_HEADER}" "#define __UDEV_RULES_H__\n")
|
|
file(APPEND "${UDEV_HEADER}" "#ifdef __cplusplus\n")
|
|
file(APPEND "${UDEV_HEADER}" "extern \"C\" {\n")
|
|
file(APPEND "${UDEV_HEADER}" "#endif\n")
|
|
|
|
file(APPEND "${UDEV_HEADER}" "const char "
|
|
"realsense_udev_rules[] = {")
|
|
|
|
string(LENGTH "${contents}" contents_length)
|
|
math(EXPR contents_length "${contents_length} - 1")
|
|
|
|
foreach(iter RANGE 0 ${contents_length} 2)
|
|
string(SUBSTRING ${contents} ${iter} 2 line)
|
|
file(APPEND "${UDEV_HEADER}" "0x${line},")
|
|
endforeach()
|
|
|
|
file(APPEND "${UDEV_HEADER}" "};\n")
|
|
|
|
file(APPEND "${UDEV_HEADER}" "#ifdef __cplusplus\n")
|
|
file(APPEND "${UDEV_HEADER}" "}\n")
|
|
file(APPEND "${UDEV_HEADER}" "#endif\n")
|
|
|
|
file(APPEND "${UDEV_HEADER}" "#endif//\n")
|