cmake_minimum_required(VERSION 3.0) project(tetris) # Pobranie pliku xdg-shell.xml # file(DOWNLOAD "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/stable/xdg-shell/xdg-shell.xml" "${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.xml") # Wygenerowanie plików xdg-shell.h i xdg-shell.c add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/xdg-shell.h COMMAND wayland-scanner client-header ${CMAKE_SOURCE_DIR}/xdg-shell.xml ${CMAKE_CURRENT_BINARY_DIR}/include/xdg-shell.h DEPENDS ${CMAKE_SOURCE_DIR}/xdg-shell.xml ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.c COMMAND wayland-scanner private-code ${CMAKE_SOURCE_DIR}/xdg-shell.xml ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.c DEPENDS ${CMAKE_SOURCE_DIR}/xdg-shell.xml ) # Dodanie plików źródłowych set(SOURCES tetris.c ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.c ) # Dodaj pliki nagłówkowe do źródeł tetris set(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/include/xdg-shell.h ) # Kompilacja add_executable(tetris ${SOURCES} ${HEADERS}) # Dodaj pliki nagłówkowe do kompilacji target_include_directories(tetris PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include) # Dodanie biblioteki wayland-client target_link_libraries(tetris wayland-client)