63 lines
1.6 KiB
CMake
63 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.10 )
|
|
set(CMAKE_C_STANDARD 11)
|
|
project(wlgol
|
|
VERSION 0.0.1
|
|
DESCRIPTION "Wayland Game Of Life"
|
|
LANGUAGES C)
|
|
|
|
# Download 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")
|
|
|
|
# Generation of xdg-shell.h and 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
|
|
)
|
|
|
|
set(SOURCES
|
|
tkeyboard.c
|
|
tpointer.c
|
|
hashtable.c
|
|
${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.c
|
|
)
|
|
|
|
set(GENHEADERS
|
|
${CMAKE_CURRENT_BINARY_DIR}/include/xdg-shell.h
|
|
)
|
|
|
|
add_executable(wlgol wlgol.c ${SOURCES} ${GENHEADERS})
|
|
|
|
target_include_directories(wlgol
|
|
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
)
|
|
|
|
target_link_libraries(wlgol
|
|
wayland-client
|
|
wayland-cursor
|
|
)
|
|
|
|
|
|
|
|
add_executable(test_hashtable tests/test_hashtable.c
|
|
${SOURCES}
|
|
)
|
|
target_link_libraries(test_hashtable
|
|
wayland-client
|
|
wayland-cursor
|
|
)
|
|
target_include_directories(test_hashtable
|
|
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
)
|
|
|
|
enable_testing()
|
|
add_test(NAME Hashtable COMMAND test_hashtable)
|