diff --git a/CMakeLists.txt b/CMakeLists.txt index f6c25f09b..d328ba1ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,10 +38,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) # Check for cmake compatibility (enable/disable features) include(CheckCmakeCompat) +include(FindFeature) include(AutoVersioning) include(ConfigOptions) include(ComplexLibrary) -include(FindOptionalPackage) +include(FeatureSummary) include(CheckCCompilerFlag) include(GNUInstallDirsWrapper) @@ -174,39 +175,107 @@ if(APPLE) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl-framework,CoreFoundation") endif() -# Android +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_package(Threads REQUIRED) + +if(UNIX OR CYGWIN) + set(X11_FEATURE_TYPE "RECOMMENDED") +else() + set(X11_FEATURE_TYPE "DISABLED") +endif() + +set(X11_FEATURE_PURPOSE "X11") +set(X11_FEATURE_DESCRIPTION "X11 client and server") + +set(DIRECTFB_FEATURE_TYPE "OPTIONAL") +set(DIRECTFB_FEATURE_PURPOSE "DirectFB") +set(DIRECTFB_FEATURE_DESCRIPTION "DirectFB client") + +set(ZLIB_FEATURE_TYPE "REQUIRED") +set(ZLIB_FEATURE_PURPOSE "compression") +set(ZLIB_FEATURE_DESCRIPTION "data compression") + +set(OPENSSL_FEATURE_TYPE "REQUIRED") +set(OPENSSL_FEATURE_PURPOSE "cryptography") +set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions") + +set(ALSA_FEATURE_TYPE "RECOMMENDED") +set(ALSA_FEATURE_PURPOSE "sound") +set(ALSA_FEATURE_DESCRIPTION "audio input, audio output and multimedia redirection") + +set(PULSE_FEATURE_TYPE "OPTIONAL") +set(PULSE_FEATURE_PURPOSE "sound") +set(PULSE_FEATURE_DESCRIPTION "audio input, audio output and multimedia redirection") + +set(CUPS_FEATURE_TYPE "OPTIONAL") +set(CUPS_FEATURE_PURPOSE "printing") +set(CUPS_FEATURE_DESCRIPTION "printer device redirection") + +set(PCSC_FEATURE_TYPE "OPTIONAL") +set(PCSC_FEATURE_PURPOSE "smart card") +set(PCSC_FEATURE_DESCRIPTION "smart card device redirection") + +set(FFMPEG_FEATURE_TYPE "RECOMMENDED") +set(FFMPEG_FEATURE_PURPOSE "multimedia") +set(FFMPEG_FEATURE_DESCRIPTION "multimedia redirection, audio and video playback") + +set(GSTREAMER_FEATURE_TYPE "RECOMMENDED") +set(GSTREAMER_FEATURE_PURPOSE "multimedia") +set(GSTREAMER_FEATURE_DESCRIPTION "multimedia redirection, audio and video playback") + +if(WIN32) + set(X11_FEATURE_TYPE "DISABLED") + set(DIRECTFB_FEATURE_TYPE "DISABLED") + set(ALSA_FEATURE_TYPE "DISABLED") + set(PULSE_FEATURE_TYPE "DISABLED") + set(CUPS_FEATURE_TYPE "DISABLED") + set(PCSC_FEATURE_TYPE "DISABLED") + set(FFMPEG_FEATURE_TYPE "DISABLED") + set(GSTREAMER_FEATURE_TYPE "DISABLED") +endif() + +if(APPLE) + set(DIRECTFB_FEATURE_TYPE "DISABLED") + set(FFMPEG_FEATURE_TYPE "OPTIONAL") +endif() + if(ANDROID) - set(WITH_X11 OFF) - set(WITH_CUPS OFF) - set(WITH_ALSA OFF) - set(WITH_PULSE OFF) - set(WITH_FFMPEG OFF) - set(WITH_GSTREAMER OFF) - set(WITH_PCSC OFF) + set(X11_FEATURE_TYPE "DISABLED") + set(DIRECTFB_FEATURE_TYPE "DISABLED") + set(ALSA_FEATURE_TYPE "DISABLED") + set(PULSE_FEATURE_TYPE "DISABLED") + set(CUPS_FEATURE_TYPE "DISABLED") + set(PCSC_FEATURE_TYPE "DISABLED") + set(FFMPEG_FEATURE_TYPE "DISABLED") + set(GSTREAMER_FEATURE_TYPE "DISABLED") endif() -if(NOT WIN32) - find_required_package(ZLIB) - find_optional_package(PCSC) - find_optional_package(PulseAudio) - - if(NOT ANDROID) - find_suggested_package(Cups) - endif() - - if(NOT APPLE) - find_suggested_package(XRandR) - find_suggested_package(Gstreamer) - if(NOT ANDROID) - find_suggested_package(ALSA) - endif() - endif() - - if((NOT ANDROID) AND (NOT APPLE)) - find_suggested_package(FFmpeg) - endif() +if(IOS) + set(X11_FEATURE_TYPE "DISABLED") + set(DIRECTFB_FEATURE_TYPE "DISABLED") + set(ALSA_FEATURE_TYPE "DISABLED") + set(PULSE_FEATURE_TYPE "DISABLED") + set(CUPS_FEATURE_TYPE "DISABLED") + set(PCSC_FEATURE_TYPE "DISABLED") + set(FFMPEG_FEATURE_TYPE "DISABLED") + set(GSTREAMER_FEATURE_TYPE "DISABLED") endif() +find_feature(X11 ${X11_FEATURE_TYPE} ${X11_FEATURE_PURPOSE} ${X11_FEATURE_DESCRIPTION}) +find_feature(DirectFB ${DIRECTFB_FEATURE_TYPE} ${DIRECTFB_FEATURE_PURPOSE} ${DIRECTFB_FEATURE_DESCRIPTION}) + +find_feature(ZLIB ${ZLIB_FEATURE_TYPE} ${ZLIB_FEATURE_PURPOSE} ${ZLIB_FEATURE_DESCRIPTION}) +find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION}) + +find_feature(ALSA ${ALSA_FEATURE_TYPE} ${ALSA_FEATURE_PURPOSE} ${ALSA_FEATURE_DESCRIPTION}) +find_feature(Pulse ${PULSE_FEATURE_TYPE} ${PULSE_FEATURE_PURPOSE} ${PULSE_FEATURE_DESCRIPTION}) + +find_feature(Cups ${CUPS_FEATURE_TYPE} ${CUPS_FEATURE_PURPOSE} ${CUPS_FEATURE_DESCRIPTION}) +find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DESCRIPTION}) + +find_feature(FFmpeg ${FFMPEG_FEATURE_TYPE} ${FFMPEG_FEATURE_PURPOSE} ${FFMPEG_FEATURE_DESCRIPTION}) +find_feature(Gstreamer ${GSTREAMER_FEATURE_TYPE} ${GSTREAMER_FEATURE_PURPOSE} ${GSTREAMER_FEATURE_DESCRIPTION}) + if(WIN32) set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}) set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}) @@ -250,7 +319,7 @@ set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") include(CTest) if(BUILD_TESTING) - find_optional_package(Cmockery) + find_package(Cmockery) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_TEST_EXPORTS") @@ -275,9 +344,6 @@ if(NOT MSVC) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() -# Intel Performance Primitives -#find_optional_package(IPP) - if(WITH_CUNIT) message(FATAL_ERROR "cunit (WITH_CUNIT) is deprecated please use BUILD_TESTING to build ctest tests. The cunit directory contains the old tests and is kept until all tests are converted.") @@ -364,4 +430,3 @@ cpack_add_component(libraries DISPLAY_NAME "Libraries") cpack_add_component(clients DISPLAY_NAME "Clients") set(CPACK_COMPONENTS_ALL clients libraries headers) - diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 401d8f642..a5eb5b315 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -26,17 +26,13 @@ else() add_subdirectory(Sample) endif() - find_optional_package(DirectFB) if(WITH_DIRECTFB) add_subdirectory(DirectFB) endif() endif() -if((NOT WIN32) AND (NOT ANDROID) AND (NOT IOS)) - find_suggested_package(X11) - if(WITH_X11) - add_subdirectory(X11) - endif() +if(WITH_X11) + add_subdirectory(X11) endif() if(APPLE AND (NOT IOS)) diff --git a/client/Mac/CMakeLists.txt b/client/Mac/CMakeLists.txt index 939db77ea..8e7a1a0ec 100644 --- a/client/Mac/CMakeLists.txt +++ b/client/Mac/CMakeLists.txt @@ -4,8 +4,6 @@ project(MacFreeRDP) set(MODULE_NAME "MacFreeRDP") set(MODULE_PREFIX "FREERDP_CLIENT_MAC") -find_required_package(OpenSSL) - set(FRAMEWORK_HEADERS_PATH /System/Library/Frameworks/Cocoa.framework/Versions/A/Headers/) include_directories(${FRAMEWORK_HEADERS_PATH} /System/Library/Frameworks) @@ -74,8 +72,6 @@ set_target_properties(MacFreeRDP PROPERTIES XCODE_ATTRIBUTE_ARCHS "$(NATIVE_ARCH # Set the info plist to the custom instance set_target_properties(MacFreeRDP PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) -#find_optional_package(MacAudio) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${EXTRA_LIBS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client) diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 722a55b4c..0664a1124 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -64,28 +64,45 @@ if(WITH_MANPAGES) endif(XMLTO_FOUND) endif(WITH_MANPAGES) -find_suggested_package(Xinerama) +set(XINERAMA_FEATURE_TYPE "RECOMMENDED") +set(XINERAMA_FEATURE_PURPOSE "multi-monitor") +set(XINERAMA_FEATURE_DESCRIPTION "X11 multi-monitor extension") + +set(XEXT_FEATURE_TYPE "RECOMMENDED") +set(XEXT_FEATURE_PURPOSE "X11 extension") +set(XEXT_FEATURE_DESCRIPTION "X11 core extensions") + +set(XCURSOR_FEATURE_TYPE "RECOMMENDED") +set(XCURSOR_FEATURE_PURPOSE "cursor") +set(XCURSOR_FEATURE_DESCRIPTION "X11 cursor extension") + +set(XV_FEATURE_TYPE "RECOMMENDED") +set(XV_FEATURE_PURPOSE "video") +set(XV_FEATURE_DESCRIPTION "X11 video extension") + +find_feature(Xinerama ${XINERAMA_FEATURE_TYPE} ${XINERAMA_FEATURE_PURPOSE} ${XINERAMA_FEATURE_DESCRIPTION}) +find_feature(Xext ${XEXT_FEATURE_TYPE} ${XEXT_FEATURE_PURPOSE} ${XEXT_FEATURE_DESCRIPTION}) +find_feature(Xcursor ${XCURSOR_FEATURE_TYPE} ${XCURSOR_FEATURE_PURPOSE} ${XCURSOR_FEATURE_DESCRIPTION}) +find_feature(Xv ${XV_FEATURE_TYPE} ${XV_FEATURE_PURPOSE} ${XV_FEATURE_DESCRIPTION}) + if(WITH_XINERAMA) add_definitions(-DWITH_XINERAMA) include_directories(${XINERAMA_INCLUDE_DIRS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XINERAMA_LIBRARIES}) endif() -find_suggested_package(Xext) if(WITH_XEXT) add_definitions(-DWITH_XEXT) include_directories(${XEXT_INCLUDE_DIRS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XEXT_LIBRARIES}) endif() -find_suggested_package(Xcursor) if(WITH_XCURSOR) add_definitions(-DWITH_XCURSOR) include_directories(${XCURSOR_INCLUDE_DIRS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XCURSOR_LIBRARIES}) endif() -find_suggested_package(Xv) if(WITH_XV) add_definitions(-DWITH_XV) include_directories(${XV_INCLUDE_DIRS}) diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index add7336ed..aa0883a68 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -7,10 +7,10 @@ include(FindPkgConfig) -if (PKG_CONFIG_FOUND) +if(PKG_CONFIG_FOUND) pkg_check_modules(AVCODEC libavcodec) pkg_check_modules(AVUTIL libavutil) -endif ( PKG_CONFIG_FOUND ) +endif() # avcodec find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h PATHS ${AVCODEC_INCLUDE_DIRS}) @@ -28,7 +28,7 @@ if(AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY) set(AVUTIL_FOUND TRUE) endif() - +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND) if(FFMPEG_FOUND) @@ -36,4 +36,5 @@ if(FFMPEG_FOUND) set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY}) endif() -mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARYS) +mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES) + diff --git a/cmake/FindFeature.cmake b/cmake/FindFeature.cmake new file mode 100644 index 000000000..86362959e --- /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}=OFF\"") + 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/FindGstreamer.cmake b/cmake/FindGstreamer.cmake index dccb20082..4a290227c 100644 --- a/cmake/FindGstreamer.cmake +++ b/cmake/FindGstreamer.cmake @@ -1,2 +1,20 @@ -pkg_check_modules(GSTREAMER gstreamer-plugins-base-0.10 gstreamer-0.10) + +include(FindPkgConfig) + +pkg_check_modules(PC_GSTREAMER_0_10 gstreamer-0.10) +pkg_check_modules(PC_GSTREAMER_PLUGINS_BASE_0_10 gstreamer-plugins-base-0.10) + +if(PC_GSTREAMER_0_10_FOUND AND PC_GSTREAMER_PLUGINS_BASE_0_10_FOUND) + set(GSTREAMER_FOUND TRUE) +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSTREAMER DEFAULT_MSG GSTREAMER_FOUND) + +if(GSTREAMER_FOUND) + set(GSTREAMER_INCLUDE_DIRS ${PC_GSTREAMER_0_10_INCLUDE_DIRS} ${PC_GSTREAMER_PLUGINS_BASE_0_10_INCLUDE_DIRS}) + set(GSTREAMER_LIBRARIES ${PC_GSTREAMER_0_10_LIBRARIES} ${PC_GSTREAMER_PLUGINS_BASE_0_10_LIBRARIES}) +endif() + +mark_as_advanced(GSTREAMER_FOUND GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES) diff --git a/cmake/FindOptionalPackage.cmake b/cmake/FindOptionalPackage.cmake deleted file mode 100644 index 3e543bdc4..000000000 --- a/cmake/FindOptionalPackage.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# - FindOptionalPackage -# Enable or disable optional packages. Also force optional packages. -# -# This module defines the following macros: -# find_required_package : find a required package, can not be disabled -# find_suggested_package : find a suggested package - required but can be disabled -# find_optional_package : find an optional package - required only if enabled -# - -#============================================================================= -# Copyright 2011 Nils Andresen -# -# 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. -#============================================================================= - -macro(find_required_package _normal_package) - find_package(${_normal_package} REQUIRED) -endmacro(find_required_package) - -macro(find_suggested_package _normal_package) - string(TOUPPER ${_normal_package} _upper_package) - option(WITH_${_upper_package} "Add dependency to ${_normal_package} - recommended" ON) - - if(WITH_${_upper_package}) - message(STATUS "Finding suggested package ${_normal_package}.") - message(STATUS " Disable this using \"-DWITH_${_upper_package}=OFF\".") - find_package(${_normal_package} REQUIRED) - endif(WITH_${_upper_package}) -endmacro(find_suggested_package) - -macro(find_optional_package _normal_package) - string(TOUPPER ${_normal_package} _upper_package) - option(WITH_${_upper_package} "Add dependency to ${_normal_package}" OFF) - - if(WITH_${_upper_package}) - find_package(${_normal_package} REQUIRED) - else(WITH_${_upper_package}) - message(STATUS "Skipping optional package ${_normal_package}.") - message(STATUS " Enable this using \"-DWITH_${_upper_package}=ON\".") - endif(WITH_${_upper_package}) -endmacro(find_optional_package) diff --git a/cmake/FindPulseAudio.cmake b/cmake/FindPulse.cmake similarity index 77% rename from cmake/FindPulseAudio.cmake rename to cmake/FindPulse.cmake index 1dd51f789..7c5ae83ed 100644 --- a/cmake/FindPulseAudio.cmake +++ b/cmake/FindPulse.cmake @@ -8,7 +8,7 @@ endif() find_path(PULSE_INCLUDE_DIR pulse/pulseaudio.h PATHS ${PULSE_INCLUDE_DIRS} PATH_SUFFIXES pulse ) find_library(PULSE_LIBRARY pulse PATHS ${PULSE_LIBRARY_DIRS}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PulseAudio DEFAULT_MSG PULSE_INCLUDE_DIR PULSE_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pulse DEFAULT_MSG PULSE_INCLUDE_DIR PULSE_LIBRARY) mark_as_advanced(PULSE_INCLUDE_DIR PULSE_LIBRARY) diff --git a/libfreerdp/locale/CMakeLists.txt b/libfreerdp/locale/CMakeLists.txt index 438baa296..e47490b06 100644 --- a/libfreerdp/locale/CMakeLists.txt +++ b/libfreerdp/locale/CMakeLists.txt @@ -48,29 +48,30 @@ if(CMAKE_SYSTEM_NAME MATCHES Solaris) set(WITH_SUN true) endif() -if(NOT WIN32 AND (NOT ANDROID)) - find_suggested_package(X11) - if(WITH_X11) - add_definitions(-DWITH_X11) - include_directories(${X11_INCLUDE_DIRS}) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_X11_SRCS}) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${X11_LIBRARIES}) +set(XKBFILE_FEATURE_TYPE "RECOMMENDED") +set(XKBFILE_FEATURE_PURPOSE "X11 keyboard") +set(XKBFILE_FEATURE_DESCRIPTION "X11 keyboard file extension") - if(WITH_SUN) - add_definitions(-DWITH_SUN) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_SUN_SRCS}) - elseif(NOT APPLE) - find_suggested_package(XKBFile) - endif() +find_feature(XKBFile ${XKBFILE_FEATURE_TYPE} ${XKBFILE_FEATURE_PURPOSE} ${XKBFILE_FEATURE_DESCRIPTION}) - if(WITH_XKBFILE) - add_definitions(-DWITH_XKBFILE) - include_directories(${XKBFILE_INCLUDE_DIRS}) - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_XKBFILE_SRCS}) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XKBFILE_LIBRARIES}) - else() - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_X11_KEYMAP_SRCS}) - endif() +if(WITH_X11) + add_definitions(-DWITH_X11) + include_directories(${X11_INCLUDE_DIRS}) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_X11_SRCS}) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${X11_LIBRARIES}) + + if(WITH_SUN) + add_definitions(-DWITH_SUN) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_SUN_SRCS}) + endif() + + if(WITH_XKBFILE) + add_definitions(-DWITH_XKBFILE) + include_directories(${XKBFILE_INCLUDE_DIRS}) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_XKBFILE_SRCS}) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XKBFILE_LIBRARIES}) + else() + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_X11_KEYMAP_SRCS}) endif() endif() diff --git a/libfreerdp/utils/CMakeLists.txt b/libfreerdp/utils/CMakeLists.txt index 33118276c..ef5ee621d 100644 --- a/libfreerdp/utils/CMakeLists.txt +++ b/libfreerdp/utils/CMakeLists.txt @@ -18,9 +18,6 @@ set(MODULE_NAME "freerdp-utils") set(MODULE_PREFIX "FREERDP_UTILS") -set(CMAKE_THREAD_PREFER_PTHREAD) -find_required_package(Threads) - set(${MODULE_PREFIX}_SRCS args.c dsp.c diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 741f98d4b..97bef04f5 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -24,12 +24,11 @@ if(NOT WIN32) add_subdirectory(Sample) endif() - find_suggested_package(X11) - if(WITH_X11 AND (NOT APPLE)) + if(WITH_X11) add_subdirectory(X11) endif() - if(APPLE) + if(APPLE AND (NOT IOS)) add_subdirectory(Mac) endif() else() diff --git a/server/X11/CMakeLists.txt b/server/X11/CMakeLists.txt index 11ff4e054..74a1a4c47 100644 --- a/server/X11/CMakeLists.txt +++ b/server/X11/CMakeLists.txt @@ -29,27 +29,49 @@ set(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -find_suggested_package(XShm) +set(XEXT_FEATURE_TYPE "RECOMMENDED") +set(XEXT_FEATURE_PURPOSE "X11 extension") +set(XEXT_FEATURE_DESCRIPTION "X11 core extensions") + +set(XSHM_FEATURE_TYPE "RECOMMENDED") +set(XSHM_FEATURE_PURPOSE "X11 shared memory") +set(XSHM_FEATURE_DESCRIPTION "X11 shared memory extension") + +set(XTEST_FEATURE_TYPE "RECOMMENDED") +set(XTEST_FEATURE_PURPOSE "X11 input event injection") +set(XTEST_FEATURE_DESCRIPTION "X11 input event injection extension") + +set(XFIXES_FEATURE_TYPE "RECOMMENDED") +set(XFIXES_FEATURE_PURPOSE "X11 region") +set(XFIXES_FEATURE_DESCRIPTION "X11 region fix extension") + +set(XDAMAGE_FEATURE_TYPE "RECOMMENDED") +set(XDAMAGE_FEATURE_PURPOSE "X11 region damage") +set(XDAMAGE_FEATURE_DESCRIPTION "X11 region damage extension") + +find_feature(Xext ${XEXT_FEATURE_TYPE} ${XEXT_FEATURE_PURPOSE} ${XEXT_FEATURE_DESCRIPTION}) +find_feature(XShm ${XSHM_FEATURE_TYPE} ${XSHM_FEATURE_PURPOSE} ${XSHM_FEATURE_DESCRIPTION}) +find_feature(XTest ${XTEST_FEATURE_TYPE} ${XTEST_FEATURE_PURPOSE} ${XTEST_FEATURE_DESCRIPTION}) +find_feature(Xfixes ${XFIXES_FEATURE_TYPE} ${XFIXES_FEATURE_PURPOSE} ${XFIXES_FEATURE_DESCRIPTION}) +find_feature(Xdamage ${XDAMAGE_FEATURE_TYPE} ${XDAMAGE_FEATURE_PURPOSE} ${XDAMAGE_FEATURE_DESCRIPTION}) + if(WITH_XSHM) add_definitions(-DWITH_XSHM) include_directories(${XSHM_INCLUDE_DIRS}) endif() -find_suggested_package(Xext) if(WITH_XEXT) add_definitions(-DWITH_XEXT) include_directories(${XEXT_INCLUDE_DIRS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XEXT_LIBRARIES}) endif() -find_suggested_package(Xdamage) if(WITH_XDAMAGE) add_definitions(-DWITH_XDAMAGE) include_directories(${XDAMAGE_INCLUDE_DIRS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XDAMAGE_LIBRARIES}) endif() -find_suggested_package(Xfixes) if(WITH_XFIXES) add_definitions(-DWITH_XFIXES) include_directories(${XFIXES_INCLUDE_DIRS}) @@ -57,7 +79,6 @@ if(WITH_XFIXES) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XFIXES_LIBRARIES}) endif() -find_suggested_package(XTest) if(WITH_XTEST) add_definitions(-DWITH_XTEST) include_directories(${XTEST_INCLUDE_DIRS}) diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index fdda202da..6e6c13892 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -38,9 +38,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/) # Check for cmake compatibility (enable/disable features) include(CheckCmakeCompat) +include(FindFeature) include(AutoVersioning) include(ConfigOptions) -include(FindOptionalPackage) include(CheckCCompilerFlag) include(GNUInstallDirsWrapper) @@ -61,11 +61,6 @@ if(NOT DEFINED BUILD_SHARED_LIBS) set(BUILD_SHARED_LIBS ON) endif() -# Libraries that we have a hard dependency on -if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES) - find_required_package(OpenSSL) -endif() - if(FREERDP_BUILD) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE) else() diff --git a/winpr/libwinpr/handle/CMakeLists.txt b/winpr/libwinpr/handle/CMakeLists.txt index 9c6124ea7..73b73d336 100644 --- a/winpr/libwinpr/handle/CMakeLists.txt +++ b/winpr/libwinpr/handle/CMakeLists.txt @@ -18,9 +18,6 @@ set(MODULE_NAME "winpr-handle") set(MODULE_PREFIX "WINPR_HANDLE") -set(CMAKE_THREAD_PREFER_PTHREAD) -find_required_package(Threads) - set(${MODULE_PREFIX}_SRCS handle.c table.c) diff --git a/winpr/libwinpr/synch/CMakeLists.txt b/winpr/libwinpr/synch/CMakeLists.txt index 3c1f40f34..2433b787e 100644 --- a/winpr/libwinpr/synch/CMakeLists.txt +++ b/winpr/libwinpr/synch/CMakeLists.txt @@ -18,9 +18,6 @@ set(MODULE_NAME "winpr-synch") set(MODULE_PREFIX "WINPR_SYNCH") -set(CMAKE_THREAD_PREFER_PTHREAD) -find_required_package(Threads) - set(${MODULE_PREFIX}_SRCS address.c barrier.c diff --git a/winpr/libwinpr/thread/CMakeLists.txt b/winpr/libwinpr/thread/CMakeLists.txt index cd0898a1b..daf646a39 100644 --- a/winpr/libwinpr/thread/CMakeLists.txt +++ b/winpr/libwinpr/thread/CMakeLists.txt @@ -18,9 +18,6 @@ set(MODULE_NAME "winpr-thread") set(MODULE_PREFIX "WINPR_THREAD") -set(CMAKE_THREAD_PREFER_PTHREAD) -find_required_package(Threads) - set(${MODULE_PREFIX}_SRCS process.c processor.c