diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2021-03-26 11:06:27 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2021-03-26 11:06:27 +0300 |
commit | 3d7ce6be51070726f52f41aa33861d3a6471e59e (patch) | |
tree | e188d1e9f6e9bea1539b49a55a2b1a881bda70fd | |
parent | 17ed492851b7396ae67d784e2dd5a0c9d2f5824a (diff) |
Adding missing cmake files
-rw-r--r-- | cmake/FindFeature.cmake | 59 | ||||
-rw-r--r-- | cmake/FindWayland.cmake | 69 |
2 files changed, 128 insertions, 0 deletions
diff --git a/cmake/FindFeature.cmake b/cmake/FindFeature.cmake new file mode 100644 index 000000000..783971b94 --- /dev/null +++ b/cmake/FindFeature.cmake @@ -0,0 +1,59 @@ + +# types: DISABLED < RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED + +macro(find_feature _feature _type _purpose _description) + + string(TOUPPER ${_feature} _feature_upper) + string(TOLOWER ${_type} _type_lower) + + if(${_type} STREQUAL "DISABLED") + set(_feature_default "OFF") + message(STATUS "Skipping ${_type_lower} feature ${_feature} for ${_purpose} (${_description})") + else() + if(${_type} STREQUAL "REQUIRED") + set(_feature_default "ON") + message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})") + find_package(${_feature} REQUIRED) + elseif(${_type} STREQUAL "RECOMMENDED") + if(NOT ${WITH_${_feature_upper}}) + set(_feature_default "OFF") + message(STATUS "Skipping ${_type_lower} feature ${_feature} for ${_purpose} (${_description})") + else() + set(_feature_default "ON") + message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})") + message(STATUS " Disable feature ${_feature} using \"-DWITH_${_feature_upper}=OFF\"") + find_package(${_feature}) + endif() + elseif(${_type} STREQUAL "OPTIONAL") + if(${WITH_${_feature_upper}}) + set(_feature_default "ON") + message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})") + find_package(${_feature} REQUIRED) + else() + set(_feature_default "OFF") + message(STATUS "Skipping ${_type_lower} feature ${_feature} for ${_purpose} (${_description})") + message(STATUS " Enable feature ${_feature} using \"-DWITH_${_feature_upper}=ON\"") + endif() + else() + set(_feature_default "ON") + message(STATUS "Finding ${_type_lower} feature ${_feature} for ${_purpose} (${_description})") + find_package(${_feature}) + endif() + + + if(NOT ${${_feature_upper}_FOUND}) + if(${_feature_default}) + message(WARNING " feature ${_feature} was requested but could not be found! ${_feature_default} / ${${_feature_upper}_FOUND}") + endif() + set(_feature_default "OFF") + endif() + + option(WITH_${_feature_upper} "Enable feature ${_feature} for ${_purpose}" ${_feature_default}) + + set_package_properties(${_feature} PROPERTIES + TYPE ${_type} + PURPOSE "${_purpose}" + DESCRIPTION "${_description}") + endif() +endmacro(find_feature) + diff --git a/cmake/FindWayland.cmake b/cmake/FindWayland.cmake new file mode 100644 index 000000000..e35173355 --- /dev/null +++ b/cmake/FindWayland.cmake @@ -0,0 +1,69 @@ +# - Finds Wayland +# Find the Wayland libraries that are needed for UWAC +# +# This module defines the following variables: +# WAYLAND_FOUND - true if UWAC has been found +# WAYLAND_LIBS - Set to the full path to wayland client libraries +# WAYLAND_INCLUDE_DIR - Set to the include directories for wayland +# XKBCOMMON_LIBS - Set to the full path to xkbcommon libraries +# XKBCOMMON_INCLUDE_DIR - Set to the include directories for xkbcommon +# + +#============================================================================= +# Copyright 2015 David Fort <contact@hardening-consulting.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +include(FindPkgConfig) + +if(PKG_CONFIG_FOUND) + pkg_check_modules(WAYLAND_SCANNER_PC wayland-scanner) + pkg_check_modules(WAYLAND_CLIENT_PC wayland-client) + pkg_check_modules(WAYLAND_CURSOR_PC wayland-cursor) + pkg_check_modules(XKBCOMMON_PC xkbcommon) +endif() + +find_program(WAYLAND_SCANNER wayland-scanner + HINTS "${WAYLAND_SCANNER_PC_PREFIX}/bin" +) + +find_path(WAYLAND_INCLUDE_DIR wayland-client.h + HINTS ${WAYLAND_CLIENT_PC_INCLUDE_DIRS} +) + +find_library(WAYLAND_CLIENT_LIB + NAMES "wayland-client" + HINTS "${WAYLAND_CLIENT_PC_LIBRARY_DIRS}" +) + +find_library(WAYLAND_CURSOR_LIB + NAMES "wayland-cursor" + HINTS "${WAYLAND_CURSOR_PC_LIBRARY_DIRS}" +) + +if (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB) + list(APPEND WAYLAND_LIBS ${WAYLAND_CLIENT_LIB} ${WAYLAND_CURSOR_LIB}) +endif (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB) + +find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h + HINTS ${XKBCOMMON_PC_INCLUDE_DIRS} +) + +find_library(XKBCOMMON_LIBS + NAMES xkbcommon + HINTS "${XKBCOMMON_PC_LIBRARY_DIRS}" +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_SCANNER WAYLAND_INCLUDE_DIR WAYLAND_LIBS XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBS) |