vcpkg/ports/freerdp/portfile.cmake
Kai Pastor 2f6176ce98
[freerdp] Update, cleanup + [libusb] Fix pc file (#32416)
* [freerdp] Update, cleanup

* Add freerdp feature test port

* Update baseline

* [freerdp] ffmpeg unsupported on windows

* libusb availability limitations

* [freerdp] Update supported platforms

* [freerdp] Update supported platforms

* [freerdp] Use ffmpeg link libraries

* [freerdp] Fix install destinations

* [freerdp] Fix tools

* [freerdp] Fix osx

* [freerdp] Fix patch

* [freerdp] Keep duplicate link libs

* [freerdp] Mac client needs Xcode

* [freerdp] Fix wfreerdp-server exe lib name

* [freerdp] Fix client-mac

* Fix patch

* CI

* Fix patch

* Fix patch

* Set PDB_NAME for server exe

* Trim patch

* Test urbdrc on windows

* [libusb] Fix pc file for windows

* [freerdp] Add missing find_dependency()

* [freerdp] Export interface include directories
2023-07-31 15:53:11 -07:00

117 lines
4.0 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO FreeRDP/FreeRDP
REF "${VERSION}"
SHA512 388c00d2f883b41d4ec127bcb871607429c136bfb99daf87f491e9f1e7d456e1fac403db9f9dec7611e729dfd2f913fa414ed3d0020d92c284c8f3ba1eeb80cb
HEAD_REF master
PATCHES
DontInstallSystemRuntimeLibs.patch
fix-include-path.patch
fix-install-destination.patch
keep-dup-libs.patch
wfreerdp-server-cli.patch
pr-7060-jni-onload.patch
find-dependency.patch
export-include.patch
)
file(REMOVE "${SOURCE_PATH}/cmake/FindOpenSSL.cmake")
file(WRITE "${SOURCE_PATH}/.source_version" "${VERSION}-vcpkg")
if("x11" IN_LIST FEATURES)
message(STATUS "${PORT} currently requires the following libraries from the system package manager:\n libxfixes-dev\n")
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
client-mac WITH_CLIENT_MAC
ffmpeg WITH_FFMPEG
ffmpeg WITH_SWSCALE
server WITH_SERVER
urbdrc CHANNEL_URBDRC
wayland WITH_WAYLAND
winpr-tools WITH_WINPR_TOOLS
x11 WITH_X11
)
vcpkg_list(SET GENERATOR_OPTION)
if(VCPKG_TARGET_IS_OSX)
list(APPEND GENERATOR_OPTION GENERATOR "Unix Makefiles")
endif()
vcpkg_find_acquire_program(PKGCONFIG)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
${GENERATOR_OPTION}
OPTIONS
${FEATURE_OPTIONS}
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
-DWITH_CCACHE=OFF
-DWITH_CLANG_FORMAT=OFF
-DWITH_MANPAGES=OFF
-DWITH_OPENSSL=ON
"-DMSVC_RUNTIME=${VCPKG_CRT_LINKAGE}"
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON
# Uncontrolled dependencies w.r.t. vcpkg ports
# Can be overriden in custom triplet file
-DWITH_ALSA=OFF
-DWITH_CAIRO=OFF
MAYBE_UNUSED_VARIABLES
MSVC_RUNTIME
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_list(SET tools)
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND tools wfreerdp)
if("server" IN_LIST FEATURES)
list(APPEND tools wfreerdp-server)
endif()
elseif(VCPKG_TARGET_IS_OSX)
if("client-mac" IN_LIST FEATURES)
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/client/Mac/cli/MacFreeRDP.app"
DESTINATION "${CURRENT_PACKAGES_DIR}/bin"
)
list(APPEND tools MacFreeRDP)
endif()
if("server" IN_LIST FEATURES)
list(APPEND tools mfreerdp-server)
endif()
endif()
if("wayland" IN_LIST FEATURES)
list(APPEND tools wlfreerdp)
endif()
if("x11" IN_LIST FEATURES)
list(APPEND tools xfreerdp)
endif()
if("winpr-tools" IN_LIST FEATURES)
list(APPEND tools winpr-hash winpr-makecert)
endif()
if("server" IN_LIST FEATURES)
list(APPEND tools freerdp-proxy freerdp-shadow-cli)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/FreeRDP-Server2 PACKAGE_NAME freerdp-server2 DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/FreeRDP-Shadow2 PACKAGE_NAME freerdp-shadow2 DO_NOT_DELETE_PARENT_CONFIG_PATH)
endif()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/FreeRDP-Client2 PACKAGE_NAME freerdp-client2 DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/WinPR2 PACKAGE_NAME winpr2 DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/FreeRDP2 PACKAGE_NAME freerdp)
if(tools)
vcpkg_copy_tools(TOOL_NAMES ${tools} AUTO_CLEAN)
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/freerdp/build-config.h" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" ".")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/freerdp/build-config.h" "${CURRENT_PACKAGES_DIR}/" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/freerdp/build-config.h" "${CURRENT_PACKAGES_DIR}" "")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)