cmake_minimum_required(VERSION 3.5.0)
project(lomiri-session VERSION 0.2)

option(ENABLE_TOUCH_SESSION "Include support for touch session and lightdm integration" ON)

find_program(LOMIRI_BIN lomiri)
if(NOT LOMIRI_BIN)
	message(WARNING "make sure you have the lomiri shell installed at runtime!")
endif()
find_program(INOTIFYWAIT_BIN inotifywait)
if(NOT INOTIFYWAIT_BIN)
	message(WARNING "inotifywait binary not found, it's required for X11 support!")
endif()

install(PROGRAMS lomiri-session DESTINATION bin)

find_package(PkgConfig)
pkg_check_modules(PC_SYSTEMD libsystemd)

if(PC_SYSTEMD_FOUND)
	add_subdirectory(systemd)

	if(ENABLE_TOUCH_SESSION)
		find_program(LSC_BIN lomiri-system-compositor REQUIRED)

		add_subdirectory(touch)
	endif()
elseif(ENABLE_TOUCH_SESSION)
	set(ENABLE_TOUCH_SESSION OFF)
	message(WARNING "Support for touch session was enabled but it depends on systemd which wasn't found!")
endif()

add_subdirectory(desktop)
