Sunshine/cmake/macros/linux.cmake

32 lines
1.2 KiB
CMake

# linux specific macros
# GEN_WAYLAND: args = `filename`
macro(GEN_WAYLAND filename)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated-src)
message("wayland-scanner private-code \
${CMAKE_SOURCE_DIR}/third-party/wayland-protocols/${filename}.xml \
${CMAKE_BINARY_DIR}/generated-src/${filename}.c")
message("wayland-scanner client-header \
${CMAKE_SOURCE_DIR}/third-party/wayland-protocols/${filename}.xml \
${CMAKE_BINARY_DIR}/generated-src/${filename}.h")
execute_process(
COMMAND wayland-scanner private-code
${CMAKE_SOURCE_DIR}/third-party/wayland-protocols/${filename}.xml
${CMAKE_BINARY_DIR}/generated-src/${filename}.c
COMMAND wayland-scanner client-header
${CMAKE_SOURCE_DIR}/third-party/wayland-protocols/${filename}.xml
${CMAKE_BINARY_DIR}/generated-src/${filename}.h
RESULT_VARIABLE EXIT_INT
)
if(NOT ${EXIT_INT} EQUAL 0)
message(FATAL_ERROR "wayland-scanner failed")
endif()
list(APPEND PLATFORM_TARGET_FILES
${CMAKE_BINARY_DIR}/generated-src/${filename}.c
${CMAKE_BINARY_DIR}/generated-src/${filename}.h)
endmacro()