cmake: replace FindOptionalPackage macros with FindFeature macros

This commit is contained in:
Marc-André Moreau 2012-11-02 19:27:01 -04:00
parent a4bf11cdb6
commit e62860ab29
17 changed files with 257 additions and 152 deletions

View File

@ -38,10 +38,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
# Check for cmake compatibility (enable/disable features) # Check for cmake compatibility (enable/disable features)
include(CheckCmakeCompat) include(CheckCmakeCompat)
include(FindFeature)
include(AutoVersioning) include(AutoVersioning)
include(ConfigOptions) include(ConfigOptions)
include(ComplexLibrary) include(ComplexLibrary)
include(FindOptionalPackage) include(FeatureSummary)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(GNUInstallDirsWrapper) include(GNUInstallDirsWrapper)
@ -174,39 +175,107 @@ if(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl-framework,CoreFoundation") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl-framework,CoreFoundation")
endif() 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) if(ANDROID)
set(WITH_X11 OFF) set(X11_FEATURE_TYPE "DISABLED")
set(WITH_CUPS OFF) set(DIRECTFB_FEATURE_TYPE "DISABLED")
set(WITH_ALSA OFF) set(ALSA_FEATURE_TYPE "DISABLED")
set(WITH_PULSE OFF) set(PULSE_FEATURE_TYPE "DISABLED")
set(WITH_FFMPEG OFF) set(CUPS_FEATURE_TYPE "DISABLED")
set(WITH_GSTREAMER OFF) set(PCSC_FEATURE_TYPE "DISABLED")
set(WITH_PCSC OFF) set(FFMPEG_FEATURE_TYPE "DISABLED")
set(GSTREAMER_FEATURE_TYPE "DISABLED")
endif() endif()
if(NOT WIN32) if(IOS)
find_required_package(ZLIB) set(X11_FEATURE_TYPE "DISABLED")
find_optional_package(PCSC) set(DIRECTFB_FEATURE_TYPE "DISABLED")
find_optional_package(PulseAudio) set(ALSA_FEATURE_TYPE "DISABLED")
set(PULSE_FEATURE_TYPE "DISABLED")
if(NOT ANDROID) set(CUPS_FEATURE_TYPE "DISABLED")
find_suggested_package(Cups) set(PCSC_FEATURE_TYPE "DISABLED")
endif() set(FFMPEG_FEATURE_TYPE "DISABLED")
set(GSTREAMER_FEATURE_TYPE "DISABLED")
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()
endif() 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) if(WIN32)
set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}) set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX})
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}) set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX})
@ -250,7 +319,7 @@ set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
include(CTest) include(CTest)
if(BUILD_TESTING) if(BUILD_TESTING)
find_optional_package(Cmockery) find_package(Cmockery)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_TEST_EXPORTS") 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) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif() endif()
# Intel Performance Primitives
#find_optional_package(IPP)
if(WITH_CUNIT) if(WITH_CUNIT)
message(FATAL_ERROR "cunit (WITH_CUNIT) is deprecated please use BUILD_TESTING to build ctest tests. 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.") 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") cpack_add_component(clients DISPLAY_NAME "Clients")
set(CPACK_COMPONENTS_ALL clients libraries headers) set(CPACK_COMPONENTS_ALL clients libraries headers)

View File

@ -26,17 +26,13 @@ else()
add_subdirectory(Sample) add_subdirectory(Sample)
endif() endif()
find_optional_package(DirectFB)
if(WITH_DIRECTFB) if(WITH_DIRECTFB)
add_subdirectory(DirectFB) add_subdirectory(DirectFB)
endif() endif()
endif() endif()
if((NOT WIN32) AND (NOT ANDROID) AND (NOT IOS)) if(WITH_X11)
find_suggested_package(X11) add_subdirectory(X11)
if(WITH_X11)
add_subdirectory(X11)
endif()
endif() endif()
if(APPLE AND (NOT IOS)) if(APPLE AND (NOT IOS))

View File

@ -4,8 +4,6 @@ project(MacFreeRDP)
set(MODULE_NAME "MacFreeRDP") set(MODULE_NAME "MacFreeRDP")
set(MODULE_PREFIX "FREERDP_CLIENT_MAC") set(MODULE_PREFIX "FREERDP_CLIENT_MAC")
find_required_package(OpenSSL)
set(FRAMEWORK_HEADERS_PATH /System/Library/Frameworks/Cocoa.framework/Versions/A/Headers/) set(FRAMEWORK_HEADERS_PATH /System/Library/Frameworks/Cocoa.framework/Versions/A/Headers/)
include_directories(${FRAMEWORK_HEADERS_PATH} /System/Library/Frameworks) 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 the info plist to the custom instance
set_target_properties(MacFreeRDP PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) 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} ${EXTRA_LIBS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client)

View File

@ -64,28 +64,45 @@ if(WITH_MANPAGES)
endif(XMLTO_FOUND) endif(XMLTO_FOUND)
endif(WITH_MANPAGES) 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) if(WITH_XINERAMA)
add_definitions(-DWITH_XINERAMA) add_definitions(-DWITH_XINERAMA)
include_directories(${XINERAMA_INCLUDE_DIRS}) include_directories(${XINERAMA_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XINERAMA_LIBRARIES}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XINERAMA_LIBRARIES})
endif() endif()
find_suggested_package(Xext)
if(WITH_XEXT) if(WITH_XEXT)
add_definitions(-DWITH_XEXT) add_definitions(-DWITH_XEXT)
include_directories(${XEXT_INCLUDE_DIRS}) include_directories(${XEXT_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XEXT_LIBRARIES}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XEXT_LIBRARIES})
endif() endif()
find_suggested_package(Xcursor)
if(WITH_XCURSOR) if(WITH_XCURSOR)
add_definitions(-DWITH_XCURSOR) add_definitions(-DWITH_XCURSOR)
include_directories(${XCURSOR_INCLUDE_DIRS}) include_directories(${XCURSOR_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XCURSOR_LIBRARIES}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XCURSOR_LIBRARIES})
endif() endif()
find_suggested_package(Xv)
if(WITH_XV) if(WITH_XV)
add_definitions(-DWITH_XV) add_definitions(-DWITH_XV)
include_directories(${XV_INCLUDE_DIRS}) include_directories(${XV_INCLUDE_DIRS})

View File

@ -7,10 +7,10 @@
include(FindPkgConfig) include(FindPkgConfig)
if (PKG_CONFIG_FOUND) if(PKG_CONFIG_FOUND)
pkg_check_modules(AVCODEC libavcodec) pkg_check_modules(AVCODEC libavcodec)
pkg_check_modules(AVUTIL libavutil) pkg_check_modules(AVUTIL libavutil)
endif ( PKG_CONFIG_FOUND ) endif()
# avcodec # avcodec
find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h PATHS ${AVCODEC_INCLUDE_DIRS}) 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) set(AVUTIL_FOUND TRUE)
endif() endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND)
if(FFMPEG_FOUND) if(FFMPEG_FOUND)
@ -36,4 +36,5 @@ if(FFMPEG_FOUND)
set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY}) set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY})
endif() endif()
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARYS) mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)

59
cmake/FindFeature.cmake Normal file
View File

@ -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)

View File

@ -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)

View File

@ -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 <nils@nils-andresen.de>
#
# 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)

View File

@ -8,7 +8,7 @@ endif()
find_path(PULSE_INCLUDE_DIR pulse/pulseaudio.h PATHS ${PULSE_INCLUDE_DIRS} PATH_SUFFIXES pulse ) 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_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) mark_as_advanced(PULSE_INCLUDE_DIR PULSE_LIBRARY)

View File

@ -48,29 +48,30 @@ if(CMAKE_SYSTEM_NAME MATCHES Solaris)
set(WITH_SUN true) set(WITH_SUN true)
endif() endif()
if(NOT WIN32 AND (NOT ANDROID)) set(XKBFILE_FEATURE_TYPE "RECOMMENDED")
find_suggested_package(X11) set(XKBFILE_FEATURE_PURPOSE "X11 keyboard")
if(WITH_X11) set(XKBFILE_FEATURE_DESCRIPTION "X11 keyboard file extension")
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) find_feature(XKBFile ${XKBFILE_FEATURE_TYPE} ${XKBFILE_FEATURE_PURPOSE} ${XKBFILE_FEATURE_DESCRIPTION})
add_definitions(-DWITH_SUN)
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_SUN_SRCS})
elseif(NOT APPLE)
find_suggested_package(XKBFile)
endif()
if(WITH_XKBFILE) if(WITH_X11)
add_definitions(-DWITH_XKBFILE) add_definitions(-DWITH_X11)
include_directories(${XKBFILE_INCLUDE_DIRS}) include_directories(${X11_INCLUDE_DIRS})
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_XKBFILE_SRCS}) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_X11_SRCS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XKBFILE_LIBRARIES}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${X11_LIBRARIES})
else()
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${${MODULE_PREFIX}_X11_KEYMAP_SRCS}) if(WITH_SUN)
endif() 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()
endif() endif()

View File

@ -18,9 +18,6 @@
set(MODULE_NAME "freerdp-utils") set(MODULE_NAME "freerdp-utils")
set(MODULE_PREFIX "FREERDP_UTILS") set(MODULE_PREFIX "FREERDP_UTILS")
set(CMAKE_THREAD_PREFER_PTHREAD)
find_required_package(Threads)
set(${MODULE_PREFIX}_SRCS set(${MODULE_PREFIX}_SRCS
args.c args.c
dsp.c dsp.c

View File

@ -24,12 +24,11 @@ if(NOT WIN32)
add_subdirectory(Sample) add_subdirectory(Sample)
endif() endif()
find_suggested_package(X11) if(WITH_X11)
if(WITH_X11 AND (NOT APPLE))
add_subdirectory(X11) add_subdirectory(X11)
endif() endif()
if(APPLE) if(APPLE AND (NOT IOS))
add_subdirectory(Mac) add_subdirectory(Mac)
endif() endif()
else() else()

View File

@ -29,27 +29,49 @@ set(${MODULE_PREFIX}_SRCS
add_executable(${MODULE_NAME} ${${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) if(WITH_XSHM)
add_definitions(-DWITH_XSHM) add_definitions(-DWITH_XSHM)
include_directories(${XSHM_INCLUDE_DIRS}) include_directories(${XSHM_INCLUDE_DIRS})
endif() endif()
find_suggested_package(Xext)
if(WITH_XEXT) if(WITH_XEXT)
add_definitions(-DWITH_XEXT) add_definitions(-DWITH_XEXT)
include_directories(${XEXT_INCLUDE_DIRS}) include_directories(${XEXT_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XEXT_LIBRARIES}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XEXT_LIBRARIES})
endif() endif()
find_suggested_package(Xdamage)
if(WITH_XDAMAGE) if(WITH_XDAMAGE)
add_definitions(-DWITH_XDAMAGE) add_definitions(-DWITH_XDAMAGE)
include_directories(${XDAMAGE_INCLUDE_DIRS}) include_directories(${XDAMAGE_INCLUDE_DIRS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XDAMAGE_LIBRARIES}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XDAMAGE_LIBRARIES})
endif() endif()
find_suggested_package(Xfixes)
if(WITH_XFIXES) if(WITH_XFIXES)
add_definitions(-DWITH_XFIXES) add_definitions(-DWITH_XFIXES)
include_directories(${XFIXES_INCLUDE_DIRS}) include_directories(${XFIXES_INCLUDE_DIRS})
@ -57,7 +79,6 @@ if(WITH_XFIXES)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XFIXES_LIBRARIES}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XFIXES_LIBRARIES})
endif() endif()
find_suggested_package(XTest)
if(WITH_XTEST) if(WITH_XTEST)
add_definitions(-DWITH_XTEST) add_definitions(-DWITH_XTEST)
include_directories(${XTEST_INCLUDE_DIRS}) include_directories(${XTEST_INCLUDE_DIRS})

View File

@ -38,9 +38,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/)
# Check for cmake compatibility (enable/disable features) # Check for cmake compatibility (enable/disable features)
include(CheckCmakeCompat) include(CheckCmakeCompat)
include(FindFeature)
include(AutoVersioning) include(AutoVersioning)
include(ConfigOptions) include(ConfigOptions)
include(FindOptionalPackage)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(GNUInstallDirsWrapper) include(GNUInstallDirsWrapper)
@ -61,11 +61,6 @@ if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON) set(BUILD_SHARED_LIBS ON)
endif() 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) if(FREERDP_BUILD)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
else() else()

View File

@ -18,9 +18,6 @@
set(MODULE_NAME "winpr-handle") set(MODULE_NAME "winpr-handle")
set(MODULE_PREFIX "WINPR_HANDLE") set(MODULE_PREFIX "WINPR_HANDLE")
set(CMAKE_THREAD_PREFER_PTHREAD)
find_required_package(Threads)
set(${MODULE_PREFIX}_SRCS set(${MODULE_PREFIX}_SRCS
handle.c handle.c
table.c) table.c)

View File

@ -18,9 +18,6 @@
set(MODULE_NAME "winpr-synch") set(MODULE_NAME "winpr-synch")
set(MODULE_PREFIX "WINPR_SYNCH") set(MODULE_PREFIX "WINPR_SYNCH")
set(CMAKE_THREAD_PREFER_PTHREAD)
find_required_package(Threads)
set(${MODULE_PREFIX}_SRCS set(${MODULE_PREFIX}_SRCS
address.c address.c
barrier.c barrier.c

View File

@ -18,9 +18,6 @@
set(MODULE_NAME "winpr-thread") set(MODULE_NAME "winpr-thread")
set(MODULE_PREFIX "WINPR_THREAD") set(MODULE_PREFIX "WINPR_THREAD")
set(CMAKE_THREAD_PREFER_PTHREAD)
find_required_package(Threads)
set(${MODULE_PREFIX}_SRCS set(${MODULE_PREFIX}_SRCS
process.c process.c
processor.c processor.c