From f26dba318ecc765f41b909e3e0dde470988f738c Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Mon, 14 Nov 2022 10:58:52 +0100 Subject: Allow building with(out) Lomiri features --- src/CMakeLists.txt | 32 +++++++++++++++++++++----------- src/main.cpp | 13 ++++++++++--- 2 files changed, 31 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b7e91aa..33e42c3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,19 +4,29 @@ add_compile_options( ${CXX_WARNING_ARGS} ) -add_library( - ${SERVICE_LIB} - STATIC - adbd-client.cpp - exporter.cpp - greeter.cpp - indicator.cpp - rotation-lock.cpp - usb-manager.cpp - usb-monitor.cpp - usb-snap.cpp +set (SERVICE_LIB_SOURCES + exporter.cpp + indicator.cpp + rotation-lock.cpp ) +if (ENABLE_LOMIRI_FEATURES) + list (APPEND + SERVICE_LIB_SOURCES + greeter.cpp + adbd-client.cpp + usb-manager.cpp + usb-monitor.cpp + usb-snap.cpp + ) +endif () + +add_library (${SERVICE_LIB} STATIC ${SERVICE_LIB_SOURCES}) + +if (ENABLE_LOMIRI_FEATURES) + target_link_libraries(${SERVICE_LIB} Qt5::Core) +endif () + add_executable( ${SERVICE_EXEC} main.cpp diff --git a/src/main.cpp b/src/main.cpp index f145504..03c72c6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,6 @@ /* * Copyright 2014 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,21 +16,23 @@ * * Authors: * Charles Kerr + * Robert Tari */ #include #include +#ifdef LOMIRI_FEATURES_ENABLED #include #include #include +#include +#include +#endif #include // bindtextdomain() #include - #include -#include -#include extern "C" { @@ -65,6 +68,8 @@ main(int /*argc*/, char** /*argv*/) exporters.push_back(exporter); } +#ifdef LOMIRI_FEATURES_ENABLED + gboolean bHasSocket = FALSE; if (ayatana_common_utils_is_lomiri()) @@ -92,6 +97,8 @@ main(int /*argc*/, char** /*argv*/) g_message("No /dev/socket/adbd socket found, skipping UsbManager"); } +#endif + // let's go! g_main_loop_run(loop); -- cgit v1.2.3