# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2024 Z-Wave-Alliance <https://z-wavealliance.org/>
cmake_minimum_required(VERSION 3.23.5)

project(z-wave-xml)

add_custom_target(validate
  COMMAND xmllint --noout --schema ${CMAKE_SOURCE_DIR}/zw_manufacturers.xsd ${CMAKE_SOURCE_DIR}/zw_manufacturers.xml
  COMMAND xmllint --noout --schema ${CMAKE_SOURCE_DIR}/zwave.xsd ${CMAKE_SOURCE_DIR}/zwave.xml
)

add_custom_target(generate
  COMMAND python ${CMAKE_SOURCE_DIR}/scripts/generate_c_headers.py --root ${CMAKE_CURRENT_SOURCE_DIR}/
)
add_dependencies(generate validate)

add_library(xml-headers INTERFACE)
target_include_directories(xml-headers INTERFACE ${CMAKE_SOURCE_DIR}/dist/)
add_dependencies(xml-headers generate)

add_executable(test test/main.c)
target_link_libraries(test PRIVATE xml-headers)
