2023-04-27 19:35:18 +08:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
|
|
project(kmsvnc LANGUAGES C)
|
|
|
|
|
|
|
|
IF(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
|
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
|
|
|
|
endif()
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_search_module(LIBDRM REQUIRED libdrm)
|
|
|
|
pkg_search_module(LIBVNCSERVER REQUIRED libvncserver)
|
|
|
|
pkg_search_module(XKBCOMMON REQUIRED xkbcommon)
|
2023-04-29 02:05:13 +08:00
|
|
|
pkg_search_module(LIBVA REQUIRED libva)
|
|
|
|
pkg_search_module(LIBVA_DRM REQUIRED libva-drm)
|
2023-04-27 19:35:18 +08:00
|
|
|
|
2024-01-23 10:39:39 +08:00
|
|
|
add_executable(kmsvnc)
|
|
|
|
set(kmsvnc_SOURCES kmsvnc.c drm.c input.c keymap.c va.c drm_master.c)
|
|
|
|
|
2023-04-27 19:35:18 +08:00
|
|
|
include(CheckIncludeFiles)
|
|
|
|
CHECK_INCLUDE_FILES("linux/uinput.h;linux/dma-buf.h" HAVE_LINUX_API_HEADERS)
|
|
|
|
IF(NOT HAVE_LINUX_API_HEADERS)
|
|
|
|
message(FATAL_ERROR "linux-api-headers not found")
|
|
|
|
ENDIF()
|
|
|
|
|
2024-01-23 10:39:39 +08:00
|
|
|
include(CheckSymbolExists)
|
|
|
|
check_symbol_exists(SYS_pidfd_getfd "sys/syscall.h" HAVE_PIDFD_GETFD_SYSCALL)
|
|
|
|
IF(NOT HAVE_PIDFD_GETFD_SYSCALL)
|
|
|
|
message(WARNING "pidfd_getfd syscall not found, the --screen-blank options will be disabled")
|
|
|
|
target_compile_options(kmsvnc PUBLIC -DDISABLE_KMSVNC_SCREEN_BLANK)
|
|
|
|
list(REMOVE_ITEM kmsvnc_SOURCES drm_master.c)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
target_sources(kmsvnc PUBLIC
|
|
|
|
${kmsvnc_SOURCES}
|
|
|
|
)
|
2023-04-27 19:35:18 +08:00
|
|
|
target_include_directories(kmsvnc PUBLIC
|
|
|
|
${LIBDRM_INCLUDEDIR}
|
|
|
|
${LIBVNCSERVER_INCLUDEDIR}
|
|
|
|
${XKBCOMMON_INCLUDEDIR}
|
2023-04-29 02:05:13 +08:00
|
|
|
${LIBVA_INCLUDEDIR}
|
|
|
|
${LIBVA_DRM_INCLUDEDIR}
|
2023-04-27 19:35:18 +08:00
|
|
|
)
|
2024-01-23 10:39:39 +08:00
|
|
|
target_compile_options(kmsvnc PUBLIC
|
|
|
|
${LIBDRM_CFLAGS}
|
|
|
|
${LIBVNCSERVER_CFLAGS}
|
|
|
|
${XKBCOMMON_CFLAGS}
|
|
|
|
${LIBVA_CFLAGS}
|
|
|
|
${LIBVA_DRM_CFLAGS}
|
|
|
|
)
|
2023-04-27 19:35:18 +08:00
|
|
|
target_link_libraries(kmsvnc PUBLIC
|
|
|
|
m
|
|
|
|
${LIBDRM_LIBRARIES}
|
|
|
|
${LIBVNCSERVER_LIBRARIES}
|
|
|
|
${XKBCOMMON_LIBRARIES}
|
2023-04-29 02:05:13 +08:00
|
|
|
${LIBVA_LIBRARIES}
|
|
|
|
${LIBVA_DRM_LIBRARIES}
|
2023-04-27 19:35:18 +08:00
|
|
|
)
|
|
|
|
install(TARGETS kmsvnc RUNTIME DESTINATION bin)
|