Commit 0426584c authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Enable building the processcore plugins

Apparently I forgot to add the CMake stuff for this
parent f4f79e52
......@@ -10,7 +10,7 @@ set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.78")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECMakeSettings)
......@@ -84,6 +84,31 @@ if(Qt5WebEngineWidgets_FOUND AND Qt5WebChannel_FOUND)
endif()
add_feature_info("Scripting plugin support" WEBENGINE_SCRIPTING_ENABLED "Support scripting plugins using WebEngine and WebChannel")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
find_package(NL)
set_package_properties(NL PROPERTIES
TYPE REQUIRED
PURPOSE "Used for gathering socket info via the sock_diag netlink subsystem."
URL "https://github.com/thom311/libnl/"
)
find_package(libpcap)
set_package_properties(
libpcap PROPERTIES
TYPE RECOMMENDED
PURPOSE "libpcap is used for per-application network usage."
)
if(libpcap_FOUND )
set(BUILD_NETWORK_PLUGIN TRUE)
find_package(Libcap)
set_package_properties(Libcap PROPERTIES
TYPE OPTIONAL
PURPOSE "Needed for setting capabilities of the per-application network plugin."
)
endif()
endif()
set(HAVE_X11 ${X11_FOUND})
set(HAVE_XRES ${X11_XRes_FOUND})
configure_file(config-ksysguard.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ksysguard.h )
......
# Try to find the setcap binary and cap libraries
#
# This will define:
#
# Libcap_FOUND - system has the cap library and setcap binary
# Libcap_LIBRARIES - cap libraries to link against
# SETCAP_EXECUTABLE - path of the setcap binary
# In addition, the following targets are defined:
#
# Libcap::SetCapabilities
#
# Copyright (c) 2014, Hrvoje Senjan, <hrvoje.senjan@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_program(SETCAP_EXECUTABLE NAMES setcap DOC "The setcap executable")
find_library(Libcap_LIBRARIES NAMES cap DOC "The cap (capabilities) library")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libcap FOUND_VAR Libcap_FOUND
REQUIRED_VARS SETCAP_EXECUTABLE Libcap_LIBRARIES)
if(Libcap_FOUND AND NOT TARGET Libcap::SetCapabilities)
add_executable(Libcap::SetCapabilities IMPORTED)
set_target_properties(Libcap::SetCapabilities PROPERTIES
IMPORTED_LOCATION "${SETCAP_EXECUTABLE}"
)
endif()
mark_as_advanced(SETCAP_EXECUTABLE Libcap_LIBRARIES)
include(FeatureSummary)
set_package_properties(Libcap PROPERTIES
URL https://sites.google.com/site/fullycapable/
DESCRIPTION "Capabilities are a measure to limit the omnipotence of the superuser.")
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2013 Jörg Mayer
# SPDX-FileCopyrightText: 2017 Peter Wu
#
# Find the native netlink includes and library
#
# If they exist, differentiate between versions 1, 2 and 3.
# Version 1 does not have netlink/version.h
# Version 2 started separating libraries (libnl{,-genl,-route}).
# Version 3 (>= 3.2) started appending the major version number as suffix to
# library names (libnl-3)
#
# NL_INCLUDE_DIRS - where to find libnl.h, etc.
# NL_LIBRARIES - List of libraries when using libnl.
# NL_FOUND - True if libnl found.
if(NL_LIBRARIES AND NL_INCLUDE_DIRS)
# in cache already
SET(NL_FOUND TRUE)
else()
SET( SEARCHPATHS
/opt/local
/sw
/usr
/usr/local
)
find_package(PkgConfig)
pkg_check_modules(NL3 libnl-3.0 libnl-route-3.0)
if(NOT NL3_FOUND)
pkg_search_module(NL2 libnl-2.0)
endif()
# Try to find NL 2.0, 3.0 or 3.1 (/usr/include/netlink/version.h) or
# NL >= 3.2 (/usr/include/libnl3/netlink/version.h)
find_path(NL3_INCLUDE_DIR
PATH_SUFFIXES
include/libnl3
include
NAMES
netlink/version.h
HINTS
"${NL3_libnl-3.0_INCLUDEDIR}"
"${NL2_INCLUDEDIR}"
PATHS
$(SEARCHPATHS)
)
# NL version >= 2
if(NL3_INCLUDE_DIR)
find_library(NL3_LIBRARY
NAMES
nl-3 nl
PATH_SUFFIXES
lib64 lib
HINTS
"${NL3_libnl-3.0_LIBDIR}"
"${NL2_LIBDIR}"
PATHS
$(SEARCHPATHS)
)
find_library(NLROUTE_LIBRARY
NAMES
nl-route-3 nl-route
PATH_SUFFIXES
lib64 lib
HINTS
"${NL3_libnl-route-3.0_LIBDIR}"
"${NL2_LIBDIR}"
PATHS
$(SEARCHPATHS)
)
#
# If we don't have all of those libraries, we can't use libnl.
#
if(NL3_LIBRARY AND NLROUTE_LIBRARY)
set(NL_LIBRARY ${NL3_LIBRARY})
if(NL3_INCLUDE_DIR)
# NL2 and NL3 are similar and just affect how the version is reported in
# the --version output. In cast of doubt, assume NL3 since a library
# without version number could be any of 2.0, 3.0 or 3.1.
if(NOT NL3_FOUND AND NL2_FOUND)
set(HAVE_LIBNL2 1)
else()
set(HAVE_LIBNL3 1)
endif()
endif()
endif()
set(NL_INCLUDE_DIR ${NL3_INCLUDE_DIR})
endif()
# libnl-2 and libnl-3 not found, try NL version 1
if(NOT (NL_LIBRARY AND NL_INCLUDE_DIR))
pkg_search_module(NL1 libnl-1)
find_path(NL1_INCLUDE_DIR
NAMES
netlink/netlink.h
HINTS
"${NL1_INCLUDEDIR}"
PATHS
$(SEARCHPATHS)
)
find_library(NL1_LIBRARY
NAMES
nl
PATH_SUFFIXES
lib64 lib
HINTS
"${NL1_LIBDIR}"
PATHS
$(SEARCHPATHS)
)
set(NL_LIBRARY ${NL1_LIBRARY})
set(NL_INCLUDE_DIR ${NL1_INCLUDE_DIR})
if(NL1_LIBRARY AND NL1_INCLUDE_DIR)
set(HAVE_LIBNL1 1)
endif()
endif()
endif()
# MESSAGE(STATUS "LIB Found: ${NL_LIBRARY}, Suffix: ${NLSUFFIX}\n 1:${HAVE_LIBNL1}, 2:${HAVE_LIBNL2}, 3:${HAVE_LIBNL3}.")
# handle the QUIETLY and REQUIRED arguments and set NL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NL DEFAULT_MSG NL_LIBRARY NL_INCLUDE_DIR)
IF(NL_FOUND)
set(NL_LIBRARIES ${NL_LIBRARY} ${NLROUTE_LIBRARY})
set(NL_INCLUDE_DIRS ${NL_INCLUDE_DIR})
set(HAVE_LIBNL 1)
else()
set(NL_LIBRARIES )
set(NL_INCLUDE_DIRS)
endif()
MARK_AS_ADVANCED( NL_LIBRARIES NL_INCLUDE_DIRS )
# Copyright (c) 1995-2017, The Regents of the University of California
# through the Lawrence Berkeley National Laboratory and the
# International Computer Science Institute. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# (2) Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# (3) Neither the name of the University of California, Lawrence Berkeley
# National Laboratory, U.S. Dept. of Energy, International Computer
# Science Institute, nor the names of contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Note that some files in the distribution may carry their own copyright
# notices.
# - Try to find libpcap include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(libpcap)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# PCAP_ROOT_DIR Set this variable to the root installation of
# libpcap if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# PCAP_FOUND System has libpcap, include and library dirs found
# PCAP_INCLUDE_DIR The libpcap include directories.
# PCAP_LIBRARY The libpcap library (possibly includes a thread
# library e.g. required by pf_ring's libpcap)
# HAVE_PF_RING If a found version of libpcap supports PF_RING
find_path(PCAP_ROOT_DIR
NAMES include/pcap.h
)
find_path(PCAP_INCLUDE_DIR
NAMES pcap.h
HINTS ${PCAP_ROOT_DIR}/include
)
find_library(PCAP_LIBRARY
NAMES pcap
HINTS ${PCAP_ROOT_DIR}/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libpcap DEFAULT_MSG
PCAP_LIBRARY
PCAP_INCLUDE_DIR
)
include(CheckCSourceCompiles)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
check_c_source_compiles("int main() { return 0; }" PCAP_LINKS_SOLO)
set(CMAKE_REQUIRED_LIBRARIES)
# check if linking against libpcap also needs to link against a thread library
if (NOT PCAP_LINKS_SOLO)
find_package(Threads)
if (THREADS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
check_c_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS)
set(CMAKE_REQUIRED_LIBRARIES)
endif ()
if (THREADS_FOUND AND PCAP_NEEDS_THREADS)
set(_tmp ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
list(REMOVE_DUPLICATES _tmp)
set(PCAP_LIBRARY ${_tmp}
CACHE STRING "Libraries needed to link against libpcap" FORCE)
else ()
message(FATAL_ERROR "Couldn't determine how to link against libpcap")
endif ()
endif ()
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
check_function_exists(pcap_get_pfring_id HAVE_PF_RING)
set(CMAKE_REQUIRED_LIBRARIES)
mark_as_advanced(
PCAP_ROOT_DIR
PCAP_INCLUDE_DIR
PCAP_LIBRARY
)
......@@ -56,6 +56,7 @@ set_target_properties(processcore PROPERTIES VERSION ${KSYSGUARD_VERSION_STRING}
install(TARGETS processcore EXPORT libksysguardLibraryTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
add_subdirectory(declarative)
add_subdirectory(plugins)
########### install files ###############
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment