mirror of
https://github.com/transmission/transmission.git
synced 2026-04-02 00:27:38 +01:00
build(cmake): support building with (almost) all system 3rd-party libraries (#7554)
* build: overhaul tr_add_external_auto_library * build: use package-provided CMake config file libevent * build: use package-provided CMake config file miniupnpc * build: update libutp find module * build: make LIBNAME an optional parameter * build: use package-provided CMake config file libdeflate * build: update libb64 find module * build: update libnatpmp find module * build: update libpsl find module * build: support system fast_float library * chore: reformat long brew commands * build: support system fmt library * build: support system rapidjson library * build: support system small library * build: support system library utf8cpp * build: support system library WideInteger * build: support system library gtest * fix: incorrectly labeled test suites * build: remove unused parameters from tr_add_external_auto_library * build: update crc32c cmake script * fix: dht system library * fix: add libutp interface target * code review: move TrGtest.cmake * code review: move tr_get_fmt_version into Findfmt.cmake * code review: use option() for gtest * code review: move find_package(PkgConfig) out of loop * build: delete FindCrc32c.cmake Impossible to parse package version from distributed source files. * code review: Finddht.cmake * build: delete FindFastFloat.cmake Impossible to parse package version from distributed source files. * code review: Findfmt.cmake * code review: Findlibb64.cmake * code review: Findlibdeflate.cmake * code review: Findlibevent.cmake * code review: Findlibnatpmp.cmake * code review: Findlibpsl.cmake * code review: Findlibutp.cmake * code review: Findlibminiupnpc.cmake * code review: FindRapidJSON.cmake * build: delete FindSmall.cmake Impossible to parse package version from distributed source files. * build: only accept cmake config package for utf8cpp Impossible to parse package version from distributed source files. * build: delete FindWideInteger.cmake Impossible to parse package version from distributed source files. * build: add `USE_SYSTEM_DEFAULT` * ci: drop Fedora 40 and adopt Fedora 43 * ci: try to silence system header warnings * ci: use `cmake --install` * Revert "build: only accept cmake config package for utf8cpp" This reverts commit2158d631fd. * build: harden utf8cpp find module * chore: bump wide-integer Pick upbf9398f9daandbcc726a30f* refactor: gtest should be included with angled brackets Now that gtest is built as a system library, it should be included with angled brackets instead of quotes. * code review: fixup libutp variables before `find_package_handle_standard_args` * code review: define `WIDE_INTEGER_HAS_LIMB_TYPE_UINT64` only for targets depending on WideInteger * chore: bump wide-integer Pickup4b2258acacso that wide-integer tests won't run in Transmission project.
This commit is contained in:
293
.github/workflows/actions.yml
vendored
293
.github/workflows/actions.yml
vendored
@@ -122,7 +122,7 @@ jobs:
|
||||
exit 1
|
||||
|
||||
sanitizer-tests-ubuntu:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [ what-to-make ]
|
||||
if: ${{ needs.what-to-make.outputs.make-tests == 'true' }}
|
||||
steps:
|
||||
@@ -140,15 +140,19 @@ jobs:
|
||||
clang \
|
||||
cmake \
|
||||
gettext \
|
||||
libb64-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdeflate-dev \
|
||||
libevent-dev \
|
||||
libfast-float-dev \
|
||||
libfmt-dev \
|
||||
libminiupnpc-dev \
|
||||
libnatpmp-dev \
|
||||
libpsl-dev \
|
||||
libssl-dev \
|
||||
ninja-build
|
||||
libutfcpp-dev \
|
||||
ninja-build \
|
||||
rapidjson-dev
|
||||
- name: Get Source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -174,7 +178,13 @@ jobs:
|
||||
-DENABLE_TESTS=ON \
|
||||
-DENABLE_UTILS=ON \
|
||||
-DREBUILD_WEB=OFF \
|
||||
-DRUN_CLANG_TIDY=OFF
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_CRC32C=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Ubuntu`
|
||||
- name: Make
|
||||
run: cmake --build obj --config Debug --target libtransmission-test transmission-show
|
||||
- name: Test with sanitizers
|
||||
@@ -191,7 +201,24 @@ jobs:
|
||||
echo '${{ toJSON(runner) }}'
|
||||
sw_vers
|
||||
- name: Get Dependencies
|
||||
run: brew install --formulae cmake gettext libdeflate libevent libpsl miniupnpc ninja node pkgconf
|
||||
run: |
|
||||
brew install --formulae \
|
||||
cmake \
|
||||
crc32c \
|
||||
fast_float \
|
||||
fmt \
|
||||
gettext \
|
||||
libb64 \
|
||||
libdeflate \
|
||||
libevent \
|
||||
libnatpmp \
|
||||
libpsl \
|
||||
miniupnpc \
|
||||
ninja \
|
||||
node \
|
||||
pkgconf \
|
||||
rapidjson \
|
||||
utf8cpp
|
||||
- name: Get Source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -215,7 +242,12 @@ jobs:
|
||||
-DENABLE_TESTS=ON \
|
||||
-DENABLE_UTILS=ON \
|
||||
-DREBUILD_WEB=OFF \
|
||||
-DRUN_CLANG_TIDY=OFF
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Homebrew` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Homebrew` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Homebrew` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Homebrew`
|
||||
- name: Make
|
||||
run: cmake --build obj --config Debug --target libtransmission-test transmission-show
|
||||
- name: Test with sanitizers
|
||||
@@ -243,15 +275,19 @@ jobs:
|
||||
clang-tidy-20 \
|
||||
cmake \
|
||||
gettext \
|
||||
libb64-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdeflate-dev \
|
||||
libevent-dev \
|
||||
libfast-float-dev \
|
||||
libfmt-dev \
|
||||
libminiupnpc-dev \
|
||||
libnatpmp-dev \
|
||||
libpsl-dev \
|
||||
libssl-dev \
|
||||
ninja-build
|
||||
libutfcpp-dev \
|
||||
ninja-build \
|
||||
rapidjson-dev
|
||||
- name: Get Source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -268,7 +304,13 @@ jobs:
|
||||
-DCMAKE_C_COMPILER='clang' \
|
||||
-DCMAKE_INSTALL_PREFIX=pfx \
|
||||
-DENABLE_TESTS=${{ (needs.what-to-make.outputs.make-tests == 'true') && 'ON' || 'OFF' }} \
|
||||
-DRUN_CLANG_TIDY=ON
|
||||
-DRUN_CLANG_TIDY=ON \
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_CRC32C=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Ubuntu`
|
||||
- name: Make (Core)
|
||||
run: cmake --build obj --config Debug --target transmission 2>&1 | tee makelog
|
||||
- name: Make (Tests)
|
||||
@@ -377,7 +419,24 @@ jobs:
|
||||
echo '${{ toJSON(runner) }}'
|
||||
sw_vers
|
||||
- name: Get Dependencies
|
||||
run: brew install --formulae cmake gettext libdeflate libevent libpsl miniupnpc ninja node pkgconf crc32c
|
||||
run: |
|
||||
brew install --formulae \
|
||||
cmake \
|
||||
crc32c \
|
||||
fast_float \
|
||||
fmt \
|
||||
gettext \
|
||||
libb64 \
|
||||
libdeflate \
|
||||
libevent \
|
||||
libnatpmp \
|
||||
libpsl \
|
||||
miniupnpc \
|
||||
ninja \
|
||||
node \
|
||||
pkgconf \
|
||||
rapidjson \
|
||||
utf8cpp
|
||||
- name: Get Dependencies (GTK)
|
||||
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
|
||||
run: brew install --formula gtkmm3
|
||||
@@ -398,6 +457,8 @@ jobs:
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_INSTALL_PREFIX=pfx \
|
||||
-DCMAKE_PREFIX_PATH=`brew --prefix`/opt/qt \
|
||||
-DCMAKE_CXX_FLAGS='--system-header-prefix=fmt/' `# Needed to supress system header warnings in macos-15-intel` \
|
||||
-DCMAKE_C_FLAGS='--system-header-prefix=fmt/' `# Needed to supress system header warnings in macos-15-intel` \
|
||||
-DENABLE_CLI=${{ (needs.what-to-make.outputs.make-cli == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_DAEMON=${{ (needs.what-to-make.outputs.make-daemon == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_GTK=${{ (needs.what-to-make.outputs.make-gtk == 'true') && 'ON' || 'OFF' }} \
|
||||
@@ -408,7 +469,11 @@ jobs:
|
||||
-DREBUILD_WEB=${{ (needs.what-to-make.outputs.make-web == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_WERROR=ON \
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_Crc32c=ON
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Homebrew` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Homebrew` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Homebrew` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Homebrew`
|
||||
- name: Make
|
||||
run: cmake --build obj --config RelWithDebInfo
|
||||
- name: Test
|
||||
@@ -417,7 +482,7 @@ jobs:
|
||||
TMPDIR: /private/tmp
|
||||
run: cmake -E chdir obj ctest -j $(sysctl -n hw.logicalcpu) --build-config RelWithDebInfo --output-on-failure
|
||||
- name: Install
|
||||
run: cmake --build obj --config RelWithDebInfo --target install/strip
|
||||
run: cmake --install obj --config RelWithDebInfo --strip
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ matrix.os }}-cmake-universal
|
||||
@@ -425,7 +490,7 @@ jobs:
|
||||
|
||||
alpine-musl:
|
||||
needs: [ what-to-make ]
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: alpine:latest
|
||||
if: ${{ needs.what-to-make.outputs.make-cli == 'true' || needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-gtk == 'true' || needs.what-to-make.outputs.make-qt == 'true' || needs.what-to-make.outputs.make-tests == 'true' || needs.what-to-make.outputs.make-utils == 'true' }}
|
||||
@@ -445,16 +510,22 @@ jobs:
|
||||
cmake \
|
||||
crc32c-dev \
|
||||
curl-dev \
|
||||
fast_float \
|
||||
fmt-dev \
|
||||
gettext-dev \
|
||||
git \
|
||||
libdeflate-dev \
|
||||
libdeflate-static \
|
||||
libevent-dev \
|
||||
libpsl \
|
||||
libnatpmp-dev \
|
||||
libpsl-dev \
|
||||
linux-headers \
|
||||
miniupnpc-dev \
|
||||
ninja \
|
||||
npm \
|
||||
pkgconfig \
|
||||
rapidjson-dev \
|
||||
utfcpp \
|
||||
xz
|
||||
- name: Get Dependencies (GTK)
|
||||
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
|
||||
@@ -487,7 +558,12 @@ jobs:
|
||||
-DREBUILD_WEB=${{ (needs.what-to-make.outputs.make-web == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_WERROR=ON \
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_CRC32C=ON
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_B64=OFF `# Not packaged in Alpine` \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Alpine` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Alpine` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Alpine` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Alpine`
|
||||
- name: Make
|
||||
run: cmake --build obj --config RelWithDebInfo
|
||||
- name: Test
|
||||
@@ -497,7 +573,7 @@ jobs:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
|
||||
- name: Install
|
||||
run: cmake --build obj --config RelWithDebInfo --target install/strip
|
||||
run: cmake --install obj --config RelWithDebInfo --strip
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ github.job }}
|
||||
@@ -560,7 +636,7 @@ jobs:
|
||||
if: ${{ needs.what-to-make.outputs.make-tests == 'true' }}
|
||||
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure --timeout 600
|
||||
- name: Install
|
||||
run: cmake --build obj --config RelWithDebInfo --target install
|
||||
run: cmake --install obj --config RelWithDebInfo
|
||||
- name: Package
|
||||
if: ${{ needs.what-to-make.outputs.make-dist == 'true' || (needs.what-to-make.outputs.make-daemon == 'true' && needs.what-to-make.outputs.make-qt == 'true') }}
|
||||
run: |
|
||||
@@ -674,14 +750,7 @@ jobs:
|
||||
-DREBUILD_WEB=${{ (needs.what-to-make.outputs.make-web == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_WERROR=ON \
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_EVENT2=OFF \
|
||||
-DUSE_SYSTEM_DEFLATE=OFF \
|
||||
-DUSE_SYSTEM_DHT=OFF \
|
||||
-DUSE_SYSTEM_MINIUPNPC=OFF \
|
||||
-DUSE_SYSTEM_NATPMP=OFF \
|
||||
-DUSE_SYSTEM_UTP=OFF \
|
||||
-DUSE_SYSTEM_B64=OFF \
|
||||
-DUSE_SYSTEM_PSL=OFF
|
||||
-DUSE_SYSTEM_DEFAULT=OFF
|
||||
- name: Make
|
||||
run: cmake --build obj --config RelWithDebInfo
|
||||
- name: Test
|
||||
@@ -690,7 +759,7 @@ jobs:
|
||||
TMPDIR: /private/tmp
|
||||
run: cmake -E chdir obj ctest -j $(sysctl -n hw.logicalcpu) --build-config RelWithDebInfo --output-on-failure
|
||||
- name: Install
|
||||
run: cmake --build obj --config RelWithDebInfo --target install/strip
|
||||
run: cmake --install obj --config RelWithDebInfo --strip
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ matrix.os }}-from-tarball
|
||||
@@ -699,7 +768,7 @@ jobs:
|
||||
debian-11-from-tarball:
|
||||
needs: [ make-source-tarball, what-to-make ]
|
||||
if: ${{ needs.what-to-make.outputs.make-cli == 'true' || needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-gtk == 'true' || needs.what-to-make.outputs.make-qt == 'true' || needs.what-to-make.outputs.make-tests == 'true' || needs.what-to-make.outputs.make-utils == 'true' }}
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: debian:11-slim
|
||||
steps:
|
||||
@@ -717,16 +786,18 @@ jobs:
|
||||
cmake \
|
||||
g++ \
|
||||
gettext \
|
||||
libb64-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdeflate-dev \
|
||||
libevent-dev \
|
||||
libfmt-dev \
|
||||
libgtest-dev \
|
||||
libminiupnpc-dev \
|
||||
libnatpmp-dev \
|
||||
libpsl-dev \
|
||||
libssl-dev \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
rapidjson-dev \
|
||||
xz-utils
|
||||
- name: Get NPM
|
||||
uses: actions/setup-node@v4
|
||||
@@ -761,7 +832,17 @@ jobs:
|
||||
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
|
||||
-DREBUILD_WEB=${{ (needs.what-to-make.outputs.make-web == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_WERROR=ON \
|
||||
-DRUN_CLANG_TIDY=OFF
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_GTEST=ON \
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_CRC32C=OFF `# Not packaged in Debian 11` \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Debian 11` \
|
||||
-DUSE_SYSTEM_FAST_FLOAT=OFF `# Not packaged in Debian 11` \
|
||||
-DUSE_SYSTEM_FMT=OFF `# Debian 11 package too old` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Debian 11` \
|
||||
-DUSE_SYSTEM_UTF8CPP=OFF `# Debian 11 package too old` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Debian 11` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Debian 11`
|
||||
- name: Build
|
||||
run: cmake --build obj --config RelWithDebInfo
|
||||
- name: Test
|
||||
@@ -770,18 +851,116 @@ jobs:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
|
||||
- name: Install
|
||||
run: cmake --build obj --config RelWithDebInfo --target install/strip
|
||||
run: cmake --install obj --config RelWithDebInfo --strip
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ github.job }}
|
||||
path: pfx/**/*
|
||||
|
||||
fedora-39-from-tarball:
|
||||
debian-from-tarball:
|
||||
needs: [ make-source-tarball, what-to-make ]
|
||||
if: ${{ needs.what-to-make.outputs.make-cli == 'true' || needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-gtk == 'true' || needs.what-to-make.outputs.make-qt == 'true' || needs.what-to-make.outputs.make-tests == 'true' || needs.what-to-make.outputs.make-utils == 'true' }}
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version: [stable, testing]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: fedora:39
|
||||
image: debian:${{ matrix.version }}-slim
|
||||
steps:
|
||||
- name: Show Configuration
|
||||
run: |
|
||||
echo '${{ toJSON(needs) }}'
|
||||
echo '${{ toJSON(runner) }}'
|
||||
cat /etc/os-release
|
||||
- name: Get Dependencies
|
||||
run: |
|
||||
set -ex
|
||||
apt update
|
||||
apt install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
g++ \
|
||||
gettext \
|
||||
libb64-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdeflate-dev \
|
||||
libevent-dev \
|
||||
libfast-float-dev \
|
||||
libfmt-dev \
|
||||
libgtest-dev \
|
||||
libminiupnpc-dev \
|
||||
libnatpmp-dev \
|
||||
libpsl-dev \
|
||||
libssl-dev \
|
||||
libutfcpp-dev \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
rapidjson-dev \
|
||||
xz-utils
|
||||
- name: Get NPM
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
- name: Get Dependencies (GTK3)
|
||||
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
|
||||
run: apt install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev
|
||||
- name: Get Dependencies (Qt6)
|
||||
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
|
||||
run: apt install -y --no-install-recommends qt6-svg-dev qt6-tools-dev
|
||||
- name: Get Source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: source-tarball
|
||||
- name: Extract Source
|
||||
run: mkdir src && tar xf transmission*.tar.* -C src --strip-components 1
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake \
|
||||
-S src \
|
||||
-B obj \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_INSTALL_PREFIX=pfx \
|
||||
-DENABLE_CLI=${{ (needs.what-to-make.outputs.make-cli == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_DAEMON=${{ (needs.what-to-make.outputs.make-daemon == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_GTK=${{ (needs.what-to-make.outputs.make-gtk == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_MAC=OFF \
|
||||
-DENABLE_QT=${{ (needs.what-to-make.outputs.make-qt == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_TESTS=${{ (needs.what-to-make.outputs.make-tests == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
|
||||
-DREBUILD_WEB=${{ (needs.what-to-make.outputs.make-web == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_WERROR=ON \
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_GTEST=ON \
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_CRC32C=OFF `# Not packaged in Debian` \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Debian` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Debian` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Debian` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Debian`
|
||||
- name: Build
|
||||
run: cmake --build obj --config RelWithDebInfo
|
||||
- name: Test
|
||||
if: ${{ needs.what-to-make.outputs.make-tests == 'true' }}
|
||||
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
|
||||
- name: Install
|
||||
run: cmake --install obj --config RelWithDebInfo --strip
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ github.job }}-${{ matrix.version }}
|
||||
path: pfx/**/*
|
||||
|
||||
fedora-from-tarball:
|
||||
needs: [ make-source-tarball, what-to-make ]
|
||||
if: ${{ needs.what-to-make.outputs.make-cli == 'true' || needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-gtk == 'true' || needs.what-to-make.outputs.make-qt == 'true' || needs.what-to-make.outputs.make-tests == 'true' || needs.what-to-make.outputs.make-utils == 'true' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version: [41, 42, 43]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: fedora:${{ matrix.version }}
|
||||
steps:
|
||||
- name: Show Configuration
|
||||
run: |
|
||||
@@ -794,10 +973,12 @@ jobs:
|
||||
dnf install -y \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
fast_float-devel \
|
||||
fmt-devel \
|
||||
gcc-c++ \
|
||||
gettext \
|
||||
google-crc32c-devel \
|
||||
libb64-devel \
|
||||
libcurl-devel \
|
||||
libdeflate-devel \
|
||||
libevent-devel \
|
||||
@@ -807,12 +988,14 @@ jobs:
|
||||
ninja-build \
|
||||
openssl-devel \
|
||||
pkgconf-pkg-config \
|
||||
rapidjson-devel \
|
||||
utf8cpp-devel \
|
||||
xz
|
||||
- name: Get NPM
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
- name: Get Dependencies (GTK)
|
||||
- name: Get Dependencies (GTK4)
|
||||
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
|
||||
run: dnf install -y glibmm2.68-devel gtkmm4.0-devel
|
||||
- name: Get Dependencies (Qt6)
|
||||
@@ -843,7 +1026,11 @@ jobs:
|
||||
-DENABLE_DEPRECATED=ON \
|
||||
-DENABLE_WERROR=OFF \
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_Crc32c=ON
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Fedora` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Fedora` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Fedora` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Fedora`
|
||||
- name: Build
|
||||
run: cmake --build obj --config RelWithDebInfo
|
||||
- name: Test
|
||||
@@ -852,16 +1039,16 @@ jobs:
|
||||
QT_QPA_PLATFORM: offscreen
|
||||
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
|
||||
- name: Install
|
||||
run: cmake --build obj --config RelWithDebInfo --target install/strip
|
||||
run: cmake --install obj --config RelWithDebInfo --strip
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ github.job }}
|
||||
name: binaries-${{ github.job }}-${{ matrix.version }}
|
||||
path: pfx/**/*
|
||||
|
||||
ubuntu-22-04-from-tarball:
|
||||
ubuntu-24-04-from-tarball:
|
||||
needs: [ make-source-tarball, what-to-make ]
|
||||
if: ${{ needs.what-to-make.outputs.make-cli == 'true' || needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-gtk == 'true' || needs.what-to-make.outputs.make-qt == 'true' || needs.what-to-make.outputs.make-tests == 'true' || needs.what-to-make.outputs.make-utils == 'true' }}
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Show Configuration
|
||||
run: |
|
||||
@@ -878,15 +1065,19 @@ jobs:
|
||||
clang \
|
||||
cmake \
|
||||
gettext \
|
||||
libb64-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdeflate-dev \
|
||||
libevent-dev \
|
||||
libfast-float-dev \
|
||||
libfmt-dev \
|
||||
libminiupnpc-dev \
|
||||
libnatpmp-dev \
|
||||
libpsl-dev \
|
||||
libssl-dev \
|
||||
ninja-build
|
||||
libutfcpp-dev \
|
||||
ninja-build \
|
||||
rapidjson-dev
|
||||
- name: Get NPM
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -920,7 +1111,13 @@ jobs:
|
||||
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
|
||||
-DREBUILD_WEB=${{ (needs.what-to-make.outputs.make-web == 'true') && 'ON' || 'OFF' }} \
|
||||
-DENABLE_WERROR=ON \
|
||||
-DRUN_CLANG_TIDY=OFF
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_CRC32C=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Ubuntu`
|
||||
- name: Make
|
||||
run: cmake --build obj --config RelWithDebInfo
|
||||
- name: Test
|
||||
@@ -929,7 +1126,7 @@ jobs:
|
||||
TMPDIR: /private/tmp
|
||||
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
|
||||
- name: Install
|
||||
run: cmake --build obj --config RelWithDebInfo --target install/strip
|
||||
run: cmake --install obj --config RelWithDebInfo --strip
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ github.job }}
|
||||
@@ -959,7 +1156,7 @@ jobs:
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v3
|
||||
with:
|
||||
@@ -1005,15 +1202,19 @@ jobs:
|
||||
clang \
|
||||
cmake \
|
||||
gettext \
|
||||
libb64-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdeflate-dev \
|
||||
libevent-dev \
|
||||
libfast-float-dev \
|
||||
libfmt-dev \
|
||||
libminiupnpc-dev \
|
||||
libnatpmp-dev \
|
||||
libpsl-dev \
|
||||
libssl-dev \
|
||||
ninja-build
|
||||
libutfcpp-dev \
|
||||
ninja-build \
|
||||
rapidjson-dev
|
||||
- name: Get Dependencies (GTK)
|
||||
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
|
||||
run: sudo apt-get install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev
|
||||
@@ -1045,6 +1246,12 @@ jobs:
|
||||
-DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} \
|
||||
-DREBUILD_WEB=OFF \
|
||||
-DENABLE_WERROR=ON \
|
||||
-DRUN_CLANG_TIDY=OFF
|
||||
-DRUN_CLANG_TIDY=OFF \
|
||||
-DUSE_SYSTEM_DEFAULT=ON \
|
||||
-DUSE_SYSTEM_CRC32C=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_DHT=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_SMALL=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_UTP=OFF `# Not packaged in Ubuntu` \
|
||||
-DUSE_SYSTEM_WIDE_INTEGER=OFF `# Not packaged in Ubuntu`
|
||||
- name: Make
|
||||
run: cmake --build obj --config RelWithDebInfo -- "-k 0"
|
||||
|
||||
157
CMakeLists.txt
157
CMakeLists.txt
@@ -24,8 +24,8 @@ endif()
|
||||
project(transmission)
|
||||
|
||||
set(TR_THIRD_PARTY_DIR_NAME third-party)
|
||||
set(TR_THIRD_PARTY_SOURCE_DIR ${PROJECT_SOURCE_DIR}/${TR_THIRD_PARTY_DIR_NAME})
|
||||
set(TR_THIRD_PARTY_BINARY_DIR ${PROJECT_BINARY_DIR}/${TR_THIRD_PARTY_DIR_NAME})
|
||||
set(TR_THIRD_PARTY_SOURCE_DIR "${PROJECT_SOURCE_DIR}/${TR_THIRD_PARTY_DIR_NAME}")
|
||||
set(TR_THIRD_PARTY_BINARY_DIR "${PROJECT_BINARY_DIR}/${TR_THIRD_PARTY_DIR_NAME}")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
"${PROJECT_SOURCE_DIR}/cmake"
|
||||
@@ -43,17 +43,28 @@ include(TrMacros)
|
||||
|
||||
set(CURL_MINIMUM 7.28.0)
|
||||
set(WOLFSSL_MINIMUM 3.4)
|
||||
set(CRC32C_MINIMUM 1.1.0)
|
||||
set(DEFLATE_MINIMUM 1.7)
|
||||
set(EVENT2_MINIMUM 2.1.0)
|
||||
set(FMT_MINIMUM 8.0.1)
|
||||
# fast_float's version file is configured with `COMPATIBILITY SameMajorVersion`
|
||||
# The version range currently distributed varies greatly (e.g. Debian Trixie -> 8.0.0, Ubuntu 24.04 -> 3.9.0)
|
||||
# set(FAST_FLOAT_MINIMUM 3...8)
|
||||
set(GIOMM_MINIMUM 2.26.0)
|
||||
set(GLIBMM_MINIMUM 2.60.0)
|
||||
set(GTKMM3_MINIMUM 3.24.0)
|
||||
set(GTKMM4_MINIMUM 4.11.1)
|
||||
set(OPENSSL_MINIMUM 1.1.0)
|
||||
set(MBEDTLS_MINIMUM 2.7)
|
||||
set(MINIUPNPC_MINIMUM 2.2.1)
|
||||
set(NPM_MINIMUM 10.2.3) # Node.js 20.10 (eslint-plugin-unicorn)
|
||||
set(PSL_MINIMUM 0.21.1)
|
||||
set(PSL_MINIMUM 0.21.0)
|
||||
set(QT_MINIMUM 5.15)
|
||||
set(RAPIDJSON_MINIMUM 1.1.0)
|
||||
set(SMALL_MINIMUM 0.2.2)
|
||||
# utf8cpp v4's version file is configured with `COMPATIBILITY SameMajorVersion`
|
||||
# and does not support version range.
|
||||
# set(UTF8CPP_MINIMUM 3.1...4)
|
||||
|
||||
option(ENABLE_DAEMON "Build daemon" ON)
|
||||
tr_auto_option(ENABLE_GTK "Build GTK client" AUTO)
|
||||
@@ -71,15 +82,22 @@ option(INSTALL_DOC "Build/install documentation" ON)
|
||||
option(INSTALL_LIB "Install the library" OFF)
|
||||
tr_auto_option(ENABLE_DEPRECATED "Allow deprecated API use of upstream packages, e.g. GTK" AUTO)
|
||||
tr_auto_option(RUN_CLANG_TIDY "Run clang-tidy on the code" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_EVENT2 "Use system event2 library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_DEFLATE "Use system deflate library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_DHT "Use system dht library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_MINIUPNPC "Use system miniupnpc library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_NATPMP "Use system natpmp library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_UTP "Use system utp library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_B64 "Use system b64 library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_PSL "Use system psl library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_CRC32C "Use system crc32c library" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_DEFAULT "Default value for USE_SYSTEM_* options" AUTO)
|
||||
tr_auto_option(USE_SYSTEM_EVENT2 "Use system event2 library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_DEFLATE "Use system deflate library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_DHT "Use system dht library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_FAST_FLOAT "Use system fast_float library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_FMT "Use system fmt library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_MINIUPNPC "Use system miniupnpc library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_NATPMP "Use system natpmp library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_RAPIDJSON "Use system RapidJSON library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_SMALL "Use system small library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_UTF8CPP "Use system uft8cpp library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_WIDE_INTEGER "Use system WideInteger library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_UTP "Use system utp library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_B64 "Use system b64 library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_PSL "Use system psl library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_auto_option(USE_SYSTEM_CRC32C "Use system crc32c library" ${USE_SYSTEM_DEFAULT})
|
||||
tr_list_option(USE_GTK_VERSION "Use specific GTK version" AUTO 3 4)
|
||||
tr_list_option(USE_QT_VERSION "Use specific Qt version" AUTO 5 6)
|
||||
tr_list_option(WITH_CRYPTO "Use specified crypto library" AUTO ccrypto mbedtls openssl wolfssl)
|
||||
@@ -240,13 +258,6 @@ set(CMAKE_FOLDER "${TR_THIRD_PARTY_DIR_NAME}")
|
||||
|
||||
set(SOURCE_ICONS_DIR "${PROJECT_SOURCE_DIR}/icons")
|
||||
|
||||
find_package(FastFloat)
|
||||
find_package(Fmt)
|
||||
find_package(RapidJSON)
|
||||
find_package(Small)
|
||||
find_package(UtfCpp)
|
||||
find_package(WideInteger)
|
||||
|
||||
find_package(Threads)
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
@@ -497,19 +508,24 @@ if(ENABLE_MAC)
|
||||
tr_fixup_auto_option(ENABLE_MAC MAC_FOUND MAC_IS_REQUIRED)
|
||||
endif()
|
||||
|
||||
# Don't build libdeflate as subdirectory as its CMakeLists.txt
|
||||
# messes with global CMAKE_* variables and global compiler options
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(DEFLATE_LIB_NAME deflatestatic)
|
||||
else()
|
||||
set(DEFLATE_LIB_NAME deflate)
|
||||
endif()
|
||||
tr_add_external_auto_library(DEFLATE libdeflate ${DEFLATE_LIB_NAME}
|
||||
TARGET deflate::deflate
|
||||
tr_add_external_auto_library(DEFLATE libdeflate
|
||||
LIBNAME ${DEFLATE_LIB_NAME}
|
||||
TARGET libdeflate::libdeflate
|
||||
CMAKE_ARGS
|
||||
-DLIBDEFLATE_BUILD_SHARED_LIB=OFF
|
||||
-DLIBDEFLATE_BUILD_GZIP=OFF)
|
||||
|
||||
tr_add_external_auto_library(EVENT2 libevent event
|
||||
TARGET libevent::event
|
||||
tr_add_external_auto_library(EVENT2 Libevent
|
||||
SUBPROJECT
|
||||
SOURCE_DIR libevent
|
||||
COMPONENTS core extra
|
||||
CMAKE_ARGS
|
||||
-DEVENT__DISABLE_OPENSSL:BOOL=ON
|
||||
-DEVENT__DISABLE_BENCHMARK:BOOL=ON
|
||||
@@ -517,8 +533,14 @@ tr_add_external_auto_library(EVENT2 libevent event
|
||||
-DEVENT__DISABLE_REGRESS:BOOL=ON
|
||||
-DEVENT__DISABLE_SAMPLES:BOOL=ON
|
||||
-DEVENT__LIBRARY_TYPE:STRING=STATIC)
|
||||
# Workaround, perm fix: https://github.com/libevent/libevent/pull/1791
|
||||
if(NOT TARGET libevent::core)
|
||||
add_library(libevent::core ALIAS event_core)
|
||||
add_library(libevent::extra ALIAS event_extra)
|
||||
endif()
|
||||
|
||||
tr_add_external_auto_library(NATPMP libnatpmp natpmp
|
||||
tr_add_external_auto_library(NATPMP libnatpmp
|
||||
LIBNAME natpmp
|
||||
TARGET natpmp::natpmp
|
||||
CMAKE_ARGS
|
||||
-DBUILD_SHARED_LIBS=OFF)
|
||||
@@ -534,14 +556,16 @@ if(WIN32)
|
||||
else()
|
||||
set(TR_MINIUPNPC_LIBNAME miniupnpc)
|
||||
endif()
|
||||
tr_add_external_auto_library(MINIUPNPC miniupnp/miniupnpc ${TR_MINIUPNPC_LIBNAME}
|
||||
TARGET miniupnpc::libminiupnpc
|
||||
tr_add_external_auto_library(MINIUPNPC miniupnpc
|
||||
LIBNAME ${TR_MINIUPNPC_LIBNAME}
|
||||
SOURCE_DIR miniupnp/miniupnpc
|
||||
TARGET miniupnpc::miniupnpc
|
||||
CMAKE_ARGS
|
||||
-DUPNPC_BUILD_STATIC=ON
|
||||
-DUPNPC_BUILD_SHARED=OFF
|
||||
-DUPNPC_BUILD_TESTS=OFF)
|
||||
if(NOT USE_SYSTEM_MINIUPNPC)
|
||||
target_compile_definitions(miniupnpc::libminiupnpc
|
||||
target_compile_definitions(miniupnpc::miniupnpc
|
||||
INTERFACE
|
||||
MINIUPNP_STATICLIB)
|
||||
endif()
|
||||
@@ -549,34 +573,99 @@ unset(TR_MINIUPNPC_LIBNAME)
|
||||
|
||||
add_subdirectory(${TR_THIRD_PARTY_SOURCE_DIR}/wildmat)
|
||||
|
||||
tr_add_external_auto_library(DHT dht dht
|
||||
tr_add_external_auto_library(DHT dht
|
||||
LIBNAME dht
|
||||
TARGET dht::dht)
|
||||
|
||||
tr_add_external_auto_library(PSL libpsl psl
|
||||
tr_add_external_auto_library(PSL libpsl
|
||||
LIBNAME psl
|
||||
TARGET psl::psl)
|
||||
|
||||
if(ENABLE_UTP)
|
||||
tr_add_external_auto_library(UTP libutp utp
|
||||
tr_add_external_auto_library(UTP libutp
|
||||
SUBPROJECT
|
||||
TARGET libutp::libutp
|
||||
CMAKE_ARGS
|
||||
-DLIBUTP_SHARED:BOOL=OFF)
|
||||
endif()
|
||||
|
||||
tr_add_external_auto_library(B64 libb64 b64
|
||||
tr_add_external_auto_library(B64 libb64
|
||||
SUBPROJECT
|
||||
TARGET libb64::libb64
|
||||
CMAKE_ARGS
|
||||
-DLIBB64_SHARED:BOOL=OFF)
|
||||
|
||||
tr_add_external_auto_library(CRC32C crc32c crc32c
|
||||
# Don't build crc32c as subdirectory as its CMakeLists.txt
|
||||
# messes with global CMAKE_* variables and global compiler options
|
||||
tr_add_external_auto_library(CRC32C Crc32c
|
||||
TARGET Crc32c::crc32c
|
||||
LIBNAME crc32c
|
||||
SOURCE_DIR crc32c
|
||||
CMAKE_ARGS
|
||||
-DCRC32C_BUILD_TESTS=OFF
|
||||
-DCRC32C_BUILD_BENCHMARKS=OFF
|
||||
-DCRC32C_USE_GLOG=OFF
|
||||
-DCRC32C_INSTALL=ON)
|
||||
|
||||
tr_add_external_auto_library(FAST_FLOAT FastFloat
|
||||
SUBPROJECT
|
||||
SOURCE_DIR fast_float
|
||||
CMAKE_ARGS
|
||||
-DFASTFLOAT_INSTALL=OFF
|
||||
-DFASTFLOAT_TEST=OFF
|
||||
-DFASTFLOAT_SANITIZE=OFF
|
||||
-DFASTFLOAT_CXX_STANDARD=${CMAKE_CXX_STANDARD})
|
||||
|
||||
tr_add_external_auto_library(FMT fmt
|
||||
SUBPROJECT
|
||||
CMAKE_ARGS
|
||||
-DFMT_INSTALL=OFF
|
||||
-DFMT_SYSTEM_HEADERS=ON)
|
||||
|
||||
# RapidJSON's CMakeLists.txt messes with global
|
||||
# CMAKE_* variables, so don't build as subproject
|
||||
tr_add_external_auto_library(RAPIDJSON RapidJSON
|
||||
LIBNAME RapidJSON
|
||||
SOURCE_DIR rapidjson
|
||||
TARGET RapidJSON
|
||||
HEADER_ONLY
|
||||
CMAKE_ARGS
|
||||
-DRAPIDJSON_BUILD_DOC=OFF
|
||||
-DRAPIDJSON_BUILD_EXAMPLES=OFF
|
||||
-DRAPIDJSON_BUILD_TESTS=OFF
|
||||
-DRAPIDJSON_BUILD_CXX11=OFF
|
||||
-DRAPIDJSON_BUILD_CXX17=OFF
|
||||
-DCMAKE_INSTALL_DIR=OFF)
|
||||
|
||||
tr_add_external_auto_library(SMALL small
|
||||
SUBPROJECT
|
||||
CMAKE_ARGS
|
||||
-DSMALL_BUILD_WITH_EXCEPTIONS=OFF)
|
||||
|
||||
tr_add_external_auto_library(UTF8CPP utf8cpp
|
||||
SUBPROJECT
|
||||
SOURCE_DIR utfcpp)
|
||||
if (NOT TARGET utf8::cpp)
|
||||
add_library(utf8::cpp ALIAS utf8cpp)
|
||||
endif()
|
||||
|
||||
tr_add_external_auto_library(WIDE_INTEGER WideInteger
|
||||
SUBPROJECT
|
||||
SOURCE_DIR wide-integer)
|
||||
add_library(transmission::WideInteger INTERFACE IMPORTED)
|
||||
target_link_libraries(transmission::WideInteger
|
||||
INTERFACE
|
||||
WideInteger::WideInteger)
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles(
|
||||
"int main()
|
||||
{
|
||||
unsigned __int128 u;
|
||||
signed __int128 i;
|
||||
return 0;
|
||||
}" TR_HAVE_INT128)
|
||||
target_compile_definitions(transmission::WideInteger
|
||||
INTERFACE
|
||||
$<$<BOOL:${TR_HAVE_INT128}>:WIDE_INTEGER_HAS_LIMB_TYPE_UINT64>)
|
||||
|
||||
set(TR_WEB_ASSETS ${PROJECT_SOURCE_DIR}/web/public_html)
|
||||
if(REBUILD_WEB)
|
||||
tr_get_required_flag(REBUILD_WEB NPM_IS_REQUIRED)
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
if(B64_PREFER_STATIC_LIB)
|
||||
set(B64_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_B64 QUIET libb64)
|
||||
endif()
|
||||
|
||||
find_path(B64_INCLUDE_DIR
|
||||
NAMES
|
||||
b64/cdecode.h
|
||||
b64/cencode.h
|
||||
HINTS ${_B64_INCLUDEDIR})
|
||||
find_library(B64_LIBRARY
|
||||
NAMES b64
|
||||
HINTS ${_B64_LIBDIR})
|
||||
|
||||
set(B64_INCLUDE_DIRS ${B64_INCLUDE_DIR})
|
||||
set(B64_LIBRARIES ${B64_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(B64
|
||||
REQUIRED_VARS
|
||||
B64_LIBRARY
|
||||
B64_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(B64_INCLUDE_DIR B64_LIBRARY)
|
||||
|
||||
if(B64_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${B64_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(B64_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,30 +0,0 @@
|
||||
if(CRC32C_PREFER_STATIC_LIB)
|
||||
set(CRC32C_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(CRC32C_INCLUDE_DIR
|
||||
NAMES crc32c/crc32c.h)
|
||||
find_library(CRC32C_LIBRARY
|
||||
NAMES crc32c)
|
||||
|
||||
set(CRC32C_INCLUDE_DIRS ${CRC32C_INCLUDE_DIR})
|
||||
set(CRC32C_LIBRARIES ${CRC32C_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(CRC32C
|
||||
REQUIRED_VARS
|
||||
CRC32C_INCLUDE_DIR
|
||||
CRC32C_LIBRARY)
|
||||
|
||||
mark_as_advanced(CRC32C_INCLUDE_DIR CRC32C_LIBRARY)
|
||||
|
||||
if(CRC32C_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CRC32C_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(CRC32C_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,49 +0,0 @@
|
||||
if(DEFLATE_PREFER_STATIC_LIB)
|
||||
set(DEFLATE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
# pkg-config support added in libdeflate v1.9
|
||||
pkg_check_modules(_DEFLATE QUIET libdeflate)
|
||||
endif()
|
||||
|
||||
find_path(DEFLATE_INCLUDE_DIR
|
||||
NAMES libdeflate.h
|
||||
HINTS ${_DEFLATE_INCLUDEDIR})
|
||||
find_library(DEFLATE_LIBRARY
|
||||
NAMES deflate
|
||||
HINTS ${_DEFLATE_LIBDIR})
|
||||
|
||||
set(DEFLATE_INCLUDE_DIRS ${DEFLATE_INCLUDE_DIR})
|
||||
set(DEFLATE_LIBRARIES ${DEFLATE_LIBRARY})
|
||||
|
||||
if(_DEFLATE_VERSION)
|
||||
set(DEFLATE_VERSION ${_DEFLATE_VERSION})
|
||||
elseif(DEFLATE_INCLUDE_DIR)
|
||||
file(STRINGS "${DEFLATE_INCLUDE_DIR}/libdeflate.h" DEFLATE_VERSION_STR
|
||||
REGEX "^#define[\t ]+LIBDEFLATE_VERSION_STRING[\t ]+\"[^\"]+\"")
|
||||
if(DEFLATE_VERSION_STR MATCHES "\"([^\"]+)\"")
|
||||
set(DEFLATE_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(DEFLATE
|
||||
REQUIRED_VARS
|
||||
DEFLATE_INCLUDE_DIR
|
||||
DEFLATE_LIBRARY
|
||||
VERSION_VAR DEFLATE_VERSION)
|
||||
|
||||
mark_as_advanced(DEFLATE_INCLUDE_DIR DEFLATE_LIBRARY)
|
||||
|
||||
if(DEFLATE_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${DEFLATE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(DEFLATE_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,37 +0,0 @@
|
||||
if(DHT_PREFER_STATIC_LIB)
|
||||
set(DHT_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_DHT QUIET libdht)
|
||||
endif()
|
||||
|
||||
find_path(DHT_INCLUDE_DIR
|
||||
NAMES dht/dht.h
|
||||
HINTS ${_DHT_INCLUDEDIR})
|
||||
find_library(DHT_LIBRARY
|
||||
NAMES dht
|
||||
HINTS ${_DHT_LIBDIR})
|
||||
|
||||
set(DHT_INCLUDE_DIRS ${DHT_INCLUDE_DIR})
|
||||
set(DHT_LIBRARIES ${DHT_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(DHT
|
||||
REQUIRED_VARS
|
||||
DHT_LIBRARY
|
||||
DHT_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(DHT_INCLUDE_DIR DHT_LIBRARY)
|
||||
|
||||
if(DHT_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${DHT_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(DHT_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,52 +0,0 @@
|
||||
if(EVENT2_PREFER_STATIC_LIB)
|
||||
set(EVENT2_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_EVENT2 QUIET libevent)
|
||||
endif()
|
||||
|
||||
find_path(EVENT2_INCLUDE_DIR
|
||||
NAMES event2/event.h
|
||||
HINTS ${_EVENT2_INCLUDEDIR})
|
||||
find_library(EVENT2_LIBRARY
|
||||
NAMES
|
||||
event-2.1
|
||||
event
|
||||
HINTS ${_EVENT2_LIBDIR})
|
||||
|
||||
if(EVENT2_INCLUDE_DIR)
|
||||
if(_EVENT2_VERSION)
|
||||
set(EVENT2_VERSION ${_EVENT2_VERSION})
|
||||
else()
|
||||
file(STRINGS "${EVENT2_INCLUDE_DIR}/event2/event-config.h" EVENT2_VERSION_STR
|
||||
REGEX "^#define[\t ]+_EVENT_VERSION[\t ]+\"[^\"]+\"")
|
||||
if(EVENT2_VERSION_STR MATCHES "\"([^\"]+)\"")
|
||||
set(EVENT2_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(EVENT2_INCLUDE_DIRS ${EVENT2_INCLUDE_DIR})
|
||||
set(EVENT2_LIBRARIES ${EVENT2_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(EVENT2
|
||||
REQUIRED_VARS
|
||||
EVENT2_LIBRARY
|
||||
EVENT2_INCLUDE_DIR
|
||||
VERSION_VAR EVENT2_VERSION)
|
||||
|
||||
mark_as_advanced(EVENT2_INCLUDE_DIR EVENT2_LIBRARY)
|
||||
|
||||
if(EVENT2_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${EVENT2_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(EVENT2_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,5 +0,0 @@
|
||||
add_library(FastFloat::fast_float INTERFACE IMPORTED)
|
||||
|
||||
target_include_directories(FastFloat::fast_float
|
||||
INTERFACE
|
||||
${TR_THIRD_PARTY_SOURCE_DIR}/fast_float/include)
|
||||
@@ -1,26 +0,0 @@
|
||||
add_library(fmt::fmt-header-only INTERFACE IMPORTED)
|
||||
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE "${TR_THIRD_PARTY_SOURCE_DIR}/fmt/include")
|
||||
|
||||
target_include_directories(fmt::fmt-header-only
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE})
|
||||
|
||||
set(_FMT_VERSION_H_PATH "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE}/fmt/base.h")
|
||||
if(NOT EXISTS "${_FMT_VERSION_H_PATH}")
|
||||
# fmt < 11
|
||||
set(_FMT_VERSION_H_PATH "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE}/fmt/core.h")
|
||||
endif()
|
||||
file(READ "${_FMT_VERSION_H_PATH}" _FMT_VERSION_H)
|
||||
if(_FMT_VERSION_H MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])")
|
||||
# Use math to skip leading zeros if any.
|
||||
math(EXPR _FMT_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
math(EXPR _FMT_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
math(EXPR _FMT_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "${_FMT_VERSION_MAJOR}.${_FMT_VERSION_MINOR}.${_FMT_VERSION_PATCH}")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(fmt::fmt-header-only
|
||||
INTERFACE
|
||||
$<IF:$<VERSION_GREATER_EQUAL:${${CMAKE_FIND_PACKAGE_NAME}_VERSION},11.2.0>,FMT_USE_EXCEPTIONS,FMT_EXCEPTIONS>=0
|
||||
FMT_HEADER_ONLY=1)
|
||||
89
cmake/FindLibevent.cmake
Normal file
89
cmake/FindLibevent.cmake
Normal file
@@ -0,0 +1,89 @@
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(LIBEVENT_STATIC_LINK TRUE)
|
||||
endif()
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} QUIET NO_MODULE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE HANDLE_COMPONENTS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
endif()
|
||||
|
||||
foreach(_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
|
||||
if(UNIX)
|
||||
pkg_check_modules(_EVENT2_${_comp} QUIET libevent-${_comp})
|
||||
|
||||
if(_EVENT2_${_comp}_VERSION AND NOT ${CMAKE_FIND_PACKAGE_NAME}_VERSION)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION ${_EVENT2_${_comp}_VERSION})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# All components share the same include directory
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES event2/event.h
|
||||
HINTS ${_EVENT2_${_comp}_INCLUDEDIR})
|
||||
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_${_comp}_LIBRARY
|
||||
NAMES "event_${_comp}"
|
||||
HINTS ${_EVENT2_${_comp}_LIBDIR})
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_${_comp}_LIBRARY)
|
||||
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_${_comp}_FOUND FALSE)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_${_comp}_LIBRARY)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_${_comp}_FOUND TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_VERSION AND ${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
file(STRINGS "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}/event2/event-config.h" _EVENT_VERSION_STR
|
||||
REGEX "^#define[\t ]+EVENT__VERSION[\t ]+\"[^\"]+\"")
|
||||
if(_EVENT_VERSION_STR MATCHES "\"([^\"]+)\"")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
HANDLE_COMPONENTS
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
VERSION_VAR ${CMAKE_FIND_PACKAGE_NAME}_VERSION)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES)
|
||||
foreach(_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
|
||||
if(NOT TARGET libevent::${_comp})
|
||||
add_library(libevent::${_comp} INTERFACE IMPORTED)
|
||||
target_include_directories(libevent::${_comp}
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
target_link_libraries(libevent::${_comp}
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_${_comp}_LIBRARY})
|
||||
endif()
|
||||
|
||||
list(APPEND ${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES libevent::${_comp})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,39 +0,0 @@
|
||||
if(MINIUPNPC_PREFER_STATIC_LIB)
|
||||
set(MINIUPNPC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_MINIUPNPC QUIET libminiupnpc)
|
||||
endif()
|
||||
|
||||
find_path(MINIUPNPC_INCLUDE_DIR
|
||||
NAMES miniupnpc/miniupnpc.h
|
||||
HINTS ${_MINIUPNPC_INCLUDEDIR})
|
||||
find_library(MINIUPNPC_LIBRARY
|
||||
NAMES
|
||||
miniupnpc
|
||||
libminiupnpc
|
||||
HINTS ${_MINIUPNPC_LIBDIR})
|
||||
|
||||
set(MINIUPNPC_INCLUDE_DIRS ${MINIUPNPC_INCLUDE_DIR})
|
||||
set(MINIUPNPC_LIBRARIES ${MINIUPNPC_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(MINIUPNPC
|
||||
REQUIRED_VARS
|
||||
MINIUPNPC_LIBRARY
|
||||
MINIUPNPC_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY)
|
||||
|
||||
if(MINIUPNPC_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${MINIUPNPC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(MINIUPNPC_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,37 +0,0 @@
|
||||
if(NATPMP_PREFER_STATIC_LIB)
|
||||
set(NATPMP_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_NATPMP QUIET libnatpmp)
|
||||
endif()
|
||||
|
||||
find_path(NATPMP_INCLUDE_DIR
|
||||
NAMES natpmp.h
|
||||
HINTS ${_NATPMP_INCLUDEDIR})
|
||||
find_library(NATPMP_LIBRARY
|
||||
NAMES natpmp
|
||||
HINTS ${_NATPMP_LIBDIR})
|
||||
|
||||
set(NATPMP_INCLUDE_DIRS ${NATPMP_INCLUDE_DIR})
|
||||
set(NATPMP_LIBRARIES ${NATPMP_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(NATPMP
|
||||
REQUIRED_VARS
|
||||
NATPMP_LIBRARY
|
||||
NATPMP_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(NATPMP_INCLUDE_DIR NATPMP_LIBRARY)
|
||||
|
||||
if(NATPMP_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${NATPMP_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(NATPMP_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,37 +0,0 @@
|
||||
if(PSL_PREFER_STATIC_LIB)
|
||||
set(PSL_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_PSL QUIET libpsl)
|
||||
endif()
|
||||
|
||||
find_path(PSL_INCLUDE_DIR
|
||||
NAMES libpsl.h
|
||||
HINTS ${_PSL_INCLUDEDIR})
|
||||
find_library(PSL_LIBRARY
|
||||
NAMES psl
|
||||
HINTS ${_PSL_LIBDIR})
|
||||
|
||||
set(PSL_INCLUDE_DIRS ${PSL_INCLUDE_DIR})
|
||||
set(PSL_LIBRARIES ${PSL_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(PSL
|
||||
REQUIRED_VARS
|
||||
PSL_LIBRARY
|
||||
PSL_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(PSL_INCLUDE_DIR PSL_LIBRARY)
|
||||
|
||||
if(PSL_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${PSL_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(PSL_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,9 +1,37 @@
|
||||
add_library(RapidJSON INTERFACE IMPORTED)
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} QUIET NO_MODULE)
|
||||
|
||||
target_include_directories(RapidJSON
|
||||
INTERFACE
|
||||
${TR_THIRD_PARTY_SOURCE_DIR}/rapidjson/include)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
target_compile_definitions(RapidJSON
|
||||
INTERFACE
|
||||
RAPIDJSON_HAS_STDSTRING=1)
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_RAPIDJSON QUIET RapidJSON)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES rapidjson/rapidjson.h
|
||||
HINTS ${_RAPIDJSON_INCLUDEDIR})
|
||||
|
||||
if(_RAPIDJSON_VERSION)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION ${_RAPIDJSON_VERSION})
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS ${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
VERSION_VAR ${CMAKE_FIND_PACKAGE_NAME}_VERSION)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET RapidJSON)
|
||||
add_library(RapidJSON INTERFACE IMPORTED)
|
||||
target_include_directories(RapidJSON
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
add_library(small::small INTERFACE IMPORTED)
|
||||
|
||||
target_include_directories(small::small
|
||||
INTERFACE
|
||||
${TR_THIRD_PARTY_SOURCE_DIR}/small/include)
|
||||
|
||||
target_compile_definitions(small::small
|
||||
INTERFACE
|
||||
SMALL_DISABLE_EXCEPTIONS=1)
|
||||
@@ -1,84 +0,0 @@
|
||||
if(UTP_PREFER_STATIC_LIB)
|
||||
set(UTP_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_UTP QUIET libutp)
|
||||
endif()
|
||||
|
||||
find_path(UTP_INCLUDE_DIR
|
||||
NAMES libutp/utp.h
|
||||
HINTS ${_UTP_INCLUDEDIR})
|
||||
find_library(UTP_LIBRARY
|
||||
NAMES utp
|
||||
HINTS ${_UTP_LIBDIR})
|
||||
|
||||
if(UTP_INCLUDE_DIR AND UTP_LIBRARY)
|
||||
include(CheckCXXSymbolExists)
|
||||
|
||||
set(_UTP_FUNCS
|
||||
utp_check_timeouts
|
||||
utp_close
|
||||
utp_connect
|
||||
utp_context_get_userdata
|
||||
utp_context_set_option
|
||||
utp_context_set_userdata
|
||||
utp_create_socket
|
||||
utp_destroy
|
||||
utp_getpeername
|
||||
utp_get_userdata
|
||||
utp_init
|
||||
utp_issue_deferred_acks
|
||||
utp_process_udp
|
||||
utp_read_drained
|
||||
utp_set_callback
|
||||
utp_set_userdata
|
||||
utp_write
|
||||
utp_writev)
|
||||
|
||||
set(_UTP_OLD_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
|
||||
set(_UTP_OLD_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(_UTP_OLD_CMAKE_REQUIRED_QUIET "${CMAKE_REQUIRED_QUIET}")
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES "${UTP_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${UTP_LIBRARY}")
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
|
||||
foreach(_UTP_FUNC IN LISTS _UTP_FUNCS)
|
||||
string(MAKE_C_IDENTIFIER "HAVE_${_UTP_FUNC}" _UTP_FUNC_VAR)
|
||||
string(TOUPPER "${_UTP_FUNC_VAR}" _UTP_FUNC_VAR)
|
||||
check_cxx_symbol_exists(${_UTP_FUNC} libutp/utp.h ${_UTP_FUNC_VAR})
|
||||
if(NOT ${_UTP_FUNC_VAR})
|
||||
unset(UTP_INCLUDE_DIR CACHE)
|
||||
unset(UTP_LIBRARY CACHE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES "${_UTP_OLD_CMAKE_REQUIRED_INCLUDES}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${_UTP_OLD_CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_QUIET "${_UTP_OLD_CMAKE_REQUIRED_QUIET}")
|
||||
endif()
|
||||
|
||||
set(UTP_INCLUDE_DIRS ${UTP_INCLUDE_DIR})
|
||||
set(UTP_LIBRARIES ${UTP_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(UTP
|
||||
REQUIRED_VARS
|
||||
UTP_LIBRARY
|
||||
UTP_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(UTP_INCLUDE_DIR UTP_LIBRARY)
|
||||
|
||||
if(UTP_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${UTP_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(UTP_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
@@ -1,5 +0,0 @@
|
||||
add_library(utf8::cpp INTERFACE IMPORTED)
|
||||
|
||||
target_include_directories(utf8::cpp
|
||||
INTERFACE
|
||||
${TR_THIRD_PARTY_SOURCE_DIR}/utfcpp/source)
|
||||
@@ -1,21 +0,0 @@
|
||||
add_library(WideInteger::WideInteger INTERFACE IMPORTED)
|
||||
|
||||
target_include_directories(WideInteger::WideInteger
|
||||
INTERFACE
|
||||
${TR_THIRD_PARTY_SOURCE_DIR}/wide-integer)
|
||||
|
||||
set(_INT128_TEST_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckInt128.c)
|
||||
file(WRITE ${_INT128_TEST_FILE}
|
||||
"int main()
|
||||
{
|
||||
unsigned __int128 u;
|
||||
signed __int128 i;
|
||||
return 0;
|
||||
}")
|
||||
try_compile(_HAVE_INT128
|
||||
${CMAKE_BINARY_DIR}
|
||||
${_INT128_TEST_FILE})
|
||||
target_compile_definitions(WideInteger::WideInteger
|
||||
INTERFACE
|
||||
$<$<BOOL:${_HAVE_INT128}>:WIDE_INTEGER_HAS_LIMB_TYPE_UINT64>
|
||||
)
|
||||
39
cmake/Finddht.cmake
Normal file
39
cmake/Finddht.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_DHT QUIET libdht)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES dht/dht.h
|
||||
HINTS ${_DHT_INCLUDEDIR})
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
NAMES dht
|
||||
HINTS ${_DHT_LIBDIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
71
cmake/Findfmt.cmake
Normal file
71
cmake/Findfmt.cmake
Normal file
@@ -0,0 +1,71 @@
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} QUIET NO_MODULE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_FMT QUIET fmt)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES fmt/core.h
|
||||
HINTS ${_FMT_INCLUDEDIR})
|
||||
|
||||
if(_FMT_VERSION)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION ${_FMT_VERSION})
|
||||
elseif(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
set(_FMT_VERSION_H_PATH "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}/fmt/base.h")
|
||||
if(NOT EXISTS "${_FMT_VERSION_H_PATH}")
|
||||
# fmt < 11
|
||||
set(_FMT_VERSION_H_PATH "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}/fmt/core.h")
|
||||
endif()
|
||||
file(READ "${_FMT_VERSION_H_PATH}" _FMT_VERSION_H)
|
||||
if(_FMT_VERSION_H MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])")
|
||||
# Use math to skip leading zeros if any.
|
||||
math(EXPR _FMT_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
math(EXPR _FMT_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
math(EXPR _FMT_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "${_FMT_VERSION_MAJOR}.${_FMT_VERSION_MINOR}.${_FMT_VERSION_PATCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
VERSION_VAR ${CMAKE_FIND_PACKAGE_NAME}_VERSION)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET fmt::fmt-header-only)
|
||||
add_library(fmt::fmt-header-only INTERFACE IMPORTED)
|
||||
target_compile_definitions(fmt::fmt-header-only-only INTERFACE FMT_HEADER_ONLY=1)
|
||||
target_compile_features(fmt::fmt-header-only-only INTERFACE cxx_std_11)
|
||||
target_include_directories(fmt::fmt-header-only
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
if(MSVC)
|
||||
target_compile_options(fmt::fmt-header-only INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/utf-8>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
51
cmake/Findlibb64.cmake
Normal file
51
cmake/Findlibb64.cmake
Normal file
@@ -0,0 +1,51 @@
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_B64 QUIET libb64)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES
|
||||
b64/cdecode.h
|
||||
b64/cencode.h
|
||||
HINTS ${_B64_INCLUDEDIR})
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
NAMES b64
|
||||
HINTS ${_B64_LIBDIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
|
||||
if(NOT TARGET libb64::libb64)
|
||||
add_library(libb64::libb64 INTERFACE IMPORTED)
|
||||
target_include_directories(libb64::libb64
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
target_link_libraries(libb64::libb64
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
73
cmake/Findlibdeflate.cmake
Normal file
73
cmake/Findlibdeflate.cmake
Normal file
@@ -0,0 +1,73 @@
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} QUIET NO_MODULE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
if(TARGET libdeflate::libdeflate_static AND (${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB OR NOT TARGET libdeflate::libdeflate_shared))
|
||||
add_library(libdeflate::libdeflate ALIAS libdeflate::libdeflate_static)
|
||||
else()
|
||||
add_library(libdeflate::libdeflate ALIAS libdeflate::libdeflate_shared)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
# pkg-config support added in libdeflate v1.9
|
||||
pkg_check_modules(_DEFLATE QUIET libdeflate)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES libdeflate.h
|
||||
HINTS ${_DEFLATE_INCLUDEDIR})
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
NAMES deflate
|
||||
HINTS ${_DEFLATE_LIBDIR})
|
||||
|
||||
if(_DEFLATE_VERSION)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION ${_DEFLATE_VERSION})
|
||||
elseif(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
file(STRINGS "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}/libdeflate.h" ${CMAKE_FIND_PACKAGE_NAME}_VERSION_STR
|
||||
REGEX "^#define[\t ]+LIBDEFLATE_VERSION_STRING[\t ]+\"[^\"]+\"")
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_VERSION_STR MATCHES "\"([^\"]+)\"")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
VERSION_VAR ${CMAKE_FIND_PACKAGE_NAME}_VERSION)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
|
||||
if(NOT TARGET libdeflate::libdeflate)
|
||||
add_library(libdeflate::libdeflate INTERFACE IMPORTED)
|
||||
target_include_directories(libdeflate::libdeflate
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
target_link_libraries(libdeflate::libdeflate
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
39
cmake/Findlibnatpmp.cmake
Normal file
39
cmake/Findlibnatpmp.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_NATPMP QUIET libnatpmp)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES natpmp.h
|
||||
HINTS ${_NATPMP_INCLUDEDIR})
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
NAMES natpmp
|
||||
HINTS ${_NATPMP_LIBDIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
49
cmake/Findlibpsl.cmake
Normal file
49
cmake/Findlibpsl.cmake
Normal file
@@ -0,0 +1,49 @@
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_PSL QUIET libpsl)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES libpsl.h
|
||||
HINTS ${_PSL_INCLUDEDIR})
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
NAMES psl
|
||||
HINTS ${_PSL_LIBDIR})
|
||||
|
||||
if(_PSL_VERSION)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION ${_PSL_VERSION})
|
||||
elseif(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
file(STRINGS "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}/libpsl.h" _PSL_VERSION_STR
|
||||
REGEX "^#define[\t ]+PSL_VERSION[\t ]+\"[^\"]+\"")
|
||||
if(_PSL_VERSION_STR MATCHES "\"([^\"]+)\"")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
VERSION_VAR ${CMAKE_FIND_PACKAGE_NAME}_VERSION)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
94
cmake/Findlibutp.cmake
Normal file
94
cmake/Findlibutp.cmake
Normal file
@@ -0,0 +1,94 @@
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_UTP QUIET libutp)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES libutp/utp.h
|
||||
HINTS ${_UTP_INCLUDEDIR})
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
NAMES utp
|
||||
HINTS ${_UTP_LIBDIR})
|
||||
|
||||
include(CheckCXXSymbolExists)
|
||||
|
||||
set(_UTP_FUNCS
|
||||
utp_check_timeouts
|
||||
utp_close
|
||||
utp_connect
|
||||
utp_context_get_userdata
|
||||
utp_context_set_option
|
||||
utp_context_set_userdata
|
||||
utp_create_socket
|
||||
utp_destroy
|
||||
utp_getpeername
|
||||
utp_get_userdata
|
||||
utp_init
|
||||
utp_issue_deferred_acks
|
||||
utp_process_udp
|
||||
utp_read_drained
|
||||
utp_set_callback
|
||||
utp_set_userdata
|
||||
utp_write
|
||||
utp_writev)
|
||||
|
||||
set(_UTP_OLD_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
|
||||
set(_UTP_OLD_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(_UTP_OLD_CMAKE_REQUIRED_QUIET "${CMAKE_REQUIRED_QUIET}")
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY}")
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
|
||||
foreach(_UTP_FUNC IN LISTS _UTP_FUNCS)
|
||||
string(MAKE_C_IDENTIFIER "HAVE_${_UTP_FUNC}" _UTP_FUNC_VAR)
|
||||
string(TOUPPER "${_UTP_FUNC_VAR}" _UTP_FUNC_VAR)
|
||||
check_cxx_symbol_exists(${_UTP_FUNC} libutp/utp.h ${_UTP_FUNC_VAR})
|
||||
if(NOT ${_UTP_FUNC_VAR})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR CACHE)
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY CACHE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES "${_UTP_OLD_CMAKE_REQUIRED_INCLUDES}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${_UTP_OLD_CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_QUIET "${_UTP_OLD_CMAKE_REQUIRED_QUIET}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
|
||||
if(NOT TARGET libutp::libutp)
|
||||
add_library(libutp::libutp INTERFACE IMPORTED)
|
||||
target_include_directories(libutp::libutp
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
target_link_libraries(libutp::libutp
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
68
cmake/Findminiupnpc.cmake
Normal file
68
cmake/Findminiupnpc.cmake
Normal file
@@ -0,0 +1,68 @@
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} QUIET NO_MODULE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_MINIUPNPC QUIET libminiupnpc)
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES miniupnpc/miniupnpc.h
|
||||
HINTS ${_MINIUPNPC_INCLUDEDIR})
|
||||
find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
NAMES
|
||||
miniupnpc
|
||||
libminiupnpc
|
||||
HINTS ${_MINIUPNPC_LIBDIR})
|
||||
|
||||
if(_MINIUPNPC_VERSION)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION ${_MINIUPNPC_VERSION})
|
||||
elseif(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
file(STRINGS "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}/miniupnpc/miniupnpc.h" _MINIUPNPC_VERSION_STR
|
||||
REGEX "^#define[\t ]+MINIUPNPC_VERSION[\t ]+\"[^\"]+\"")
|
||||
if(_MINIUPNPC_VERSION_STR MATCHES "\"([^\"]+)\"")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS
|
||||
${CMAKE_FIND_PACKAGE_NAME}_LIBRARY
|
||||
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
VERSION_VAR ${CMAKE_FIND_PACKAGE_NAME}_VERSION)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
|
||||
if(NOT TARGET miniupnpc::miniupnpc)
|
||||
add_library(miniupnpc::miniupnpc INTERFACE IMPORTED)
|
||||
target_include_directories(miniupnpc::miniupnpc
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
target_link_libraries(miniupnpc::miniupnpc
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_PREFER_STATIC_LIB)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(${CMAKE_FIND_PACKAGE_NAME}_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
34
cmake/Findutf8cpp.cmake
Normal file
34
cmake/Findutf8cpp.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} QUIET NO_MODULE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_VERSION VERSION_LESS 4.0.0)
|
||||
# Before 4.0.0, some compiler options from their tests leaked into the
|
||||
# main target. We workaround by clearing them here.
|
||||
set_property(TARGET utf8cpp PROPERTY INTERFACE_COMPILE_OPTIONS)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
|
||||
NAMES utf8.h
|
||||
PATH_SUFFIXES utf8cpp)
|
||||
|
||||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
|
||||
REQUIRED_VARS ${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET utf8::cpp)
|
||||
add_library(utf8::cpp INTERFACE IMPORTED)
|
||||
|
||||
target_include_directories(utf8::cpp
|
||||
INTERFACE
|
||||
${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
|
||||
16
cmake/TrGTest.cmake
Normal file
16
cmake/TrGTest.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
include(TrMacros)
|
||||
|
||||
option(USE_SYSTEM_GTEST "Use system GTest library" OFF)
|
||||
|
||||
tr_add_external_auto_library(GTEST GTest
|
||||
SUBPROJECT
|
||||
SOURCE_DIR googletest
|
||||
CMAKE_ARGS
|
||||
-DBUILD_GMOCK=OFF
|
||||
-DINSTALL_GTEST=OFF
|
||||
-DBUILD_SHARED_LIBS=ON)
|
||||
|
||||
# The GTest::gtest_main target is new in CMake 3.20
|
||||
if(NOT TARGET GTest::gtest_main)
|
||||
add_library(GTest::gtest_main ALIAS GTest::Main)
|
||||
endif()
|
||||
@@ -128,48 +128,78 @@ function(tr_process_list_conditions VAR_PREFIX)
|
||||
set(${VAR_PREFIX}_DISALLOWED "${DISALLOWED_ITEMS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
macro(tr_add_external_auto_library ID DIRNAME LIBNAME)
|
||||
cmake_parse_arguments(_TAEAL_ARG "SUBPROJECT" "TARGET" "CMAKE_ARGS" ${ARGN})
|
||||
macro(tr_add_external_auto_library ID PACKAGENAME)
|
||||
cmake_parse_arguments(_TAEAL_ARG
|
||||
"SUBPROJECT;HEADER_ONLY"
|
||||
"LIBNAME;SOURCE_DIR;TARGET"
|
||||
"CMAKE_ARGS;COMPONENTS"
|
||||
${ARGN})
|
||||
|
||||
if(USE_SYSTEM_${ID})
|
||||
tr_get_required_flag(USE_SYSTEM_${ID} SYSTEM_${ID}_IS_REQUIRED)
|
||||
find_package(${ID} ${${ID}_MINIMUM} ${SYSTEM_${ID}_IS_REQUIRED})
|
||||
tr_fixup_auto_option(USE_SYSTEM_${ID} ${ID}_FOUND SYSTEM_${ID}_IS_REQUIRED)
|
||||
set(_TAEAL_SOURCE_DIR "${TR_THIRD_PARTY_SOURCE_DIR}")
|
||||
set(_TAEAL_BINARY_DIR "${TR_THIRD_PARTY_BINARY_DIR}")
|
||||
if (_TAEAL_ARG_SOURCE_DIR)
|
||||
string(APPEND _TAEAL_SOURCE_DIR "/${_TAEAL_ARG_SOURCE_DIR}")
|
||||
string(APPEND _TAEAL_BINARY_DIR "/${_TAEAL_ARG_SOURCE_DIR}.bld")
|
||||
else()
|
||||
string(APPEND _TAEAL_SOURCE_DIR "/${PACKAGENAME}")
|
||||
string(APPEND _TAEAL_BINARY_DIR "/${PACKAGENAME}.bld")
|
||||
endif()
|
||||
|
||||
if(USE_SYSTEM_${ID})
|
||||
unset(${ID}_UPSTREAM_TARGET)
|
||||
tr_get_required_flag(USE_SYSTEM_${ID} SYSTEM_${ID}_IS_REQUIRED)
|
||||
set(_TAEAL_QUIET)
|
||||
if(NOT SYSTEM_${ID}_IS_REQUIRED)
|
||||
set(_TAEAL_QUIET QUIET)
|
||||
endif()
|
||||
find_package(${PACKAGENAME} ${${ID}_MINIMUM} ${SYSTEM_${ID}_IS_REQUIRED} ${_TAEAL_QUIET}
|
||||
COMPONENTS ${_TAEAL_ARG_COMPONENTS})
|
||||
tr_fixup_auto_option(USE_SYSTEM_${ID} ${PACKAGENAME}_FOUND SYSTEM_${ID}_IS_REQUIRED)
|
||||
endif()
|
||||
|
||||
if(USE_SYSTEM_${ID})
|
||||
unset(${PACKAGENAME}_UPSTREAM_TARGET)
|
||||
elseif(_TAEAL_ARG_SUBPROJECT)
|
||||
foreach(ARG IN LISTS _TAEAL_ARG_CMAKE_ARGS)
|
||||
if(ARG MATCHES "^-D([^=: ]+)(:[^= ]+)?=(.*)$")
|
||||
set(${CMAKE_MATCH_1} ${CMAKE_MATCH_3} CACHE INTERNAL "")
|
||||
endif()
|
||||
endforeach()
|
||||
add_subdirectory("${TR_THIRD_PARTY_SOURCE_DIR}/${DIRNAME}" "${TR_THIRD_PARTY_BINARY_DIR}/${DIRNAME}.bld")
|
||||
|
||||
set(_TAEAL_SUBDIR_SYSTEM)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25)
|
||||
set(_TAEAL_SUBDIR_SYSTEM SYSTEM)
|
||||
endif()
|
||||
add_subdirectory("${_TAEAL_SOURCE_DIR}" "${_TAEAL_BINARY_DIR}" EXCLUDE_FROM_ALL ${_TAEAL_SUBDIR_SYSTEM})
|
||||
else()
|
||||
set(${ID}_UPSTREAM_TARGET ${LIBNAME})
|
||||
set(${ID}_PREFIX "${TR_THIRD_PARTY_BINARY_DIR}/${DIRNAME}.bld/pfx")
|
||||
if(NOT _TAEAL_ARG_LIBNAME)
|
||||
message(FATAL_ERROR "LIBNAME must be specified if not SUBPROJECT")
|
||||
endif ()
|
||||
|
||||
set(${ID}_INCLUDE_DIR "${${ID}_PREFIX}/include"
|
||||
CACHE INTERNAL "")
|
||||
set(${ID}_LIBRARY "${${ID}_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${LIBNAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
set(${PACKAGENAME}_UPSTREAM_TARGET "_${_TAEAL_ARG_LIBNAME}")
|
||||
set(${PACKAGENAME}_PREFIX "${_TAEAL_BINARY_DIR}/pfx")
|
||||
|
||||
set(${PACKAGENAME}_INCLUDE_DIR "${${PACKAGENAME}_PREFIX}/include"
|
||||
CACHE INTERNAL "")
|
||||
set(${PACKAGENAME}_INCLUDE_DIRS ${${PACKAGENAME}_INCLUDE_DIR})
|
||||
|
||||
set(${ID}_INCLUDE_DIRS ${${ID}_INCLUDE_DIR})
|
||||
set(${ID}_LIBRARIES ${${ID}_LIBRARY})
|
||||
if(NOT _TAEAL_ARG_HEADER_ONLY)
|
||||
set(${PACKAGENAME}_LIBRARY "${${PACKAGENAME}_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${_TAEAL_ARG_LIBNAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
CACHE INTERNAL "")
|
||||
set(${PACKAGENAME}_LIBRARIES ${${PACKAGENAME}_LIBRARY})
|
||||
endif()
|
||||
|
||||
set(${ID}_EXT_PROJ_CMAKE_ARGS)
|
||||
set(${PACKAGENAME}_EXT_PROJ_CMAKE_ARGS)
|
||||
|
||||
if(APPLE)
|
||||
string(REPLACE ";" "$<SEMICOLON>" ${ID}_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
|
||||
list(APPEND ${ID}_EXT_PROJ_CMAKE_ARGS
|
||||
"-DCMAKE_OSX_ARCHITECTURES:STRING=${${ID}_CMAKE_OSX_ARCHITECTURES}"
|
||||
string(REPLACE ";" "$<SEMICOLON>" ${PACKAGENAME}_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
|
||||
list(APPEND ${PACKAGENAME}_EXT_PROJ_CMAKE_ARGS
|
||||
"-DCMAKE_OSX_ARCHITECTURES:STRING=${${PACKAGENAME}_CMAKE_OSX_ARCHITECTURES}"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
"-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
list(APPEND ${ID}_EXT_PROJ_CMAKE_ARGS
|
||||
list(APPEND ${PACKAGENAME}_EXT_PROJ_CMAKE_ARGS
|
||||
"-DANDROID_PLATFORM=${ANDROID_PLATFORM}"
|
||||
"-DANDROID_NDK=${ANDROID_NDK}"
|
||||
"-DANDROID_ABI=${ANDROID_ABI}"
|
||||
@@ -179,15 +209,15 @@ macro(tr_add_external_auto_library ID DIRNAME LIBNAME)
|
||||
endif()
|
||||
|
||||
if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
|
||||
list(APPEND ${ID}_EXT_PROJ_CMAKE_ARGS
|
||||
list(APPEND ${PACKAGENAME}_EXT_PROJ_CMAKE_ARGS
|
||||
"-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
${${ID}_UPSTREAM_TARGET}
|
||||
PREFIX "${TR_THIRD_PARTY_BINARY_DIR}/${DIRNAME}.bld"
|
||||
SOURCE_DIR "${TR_THIRD_PARTY_SOURCE_DIR}/${DIRNAME}"
|
||||
INSTALL_DIR "${${ID}_PREFIX}"
|
||||
${${PACKAGENAME}_UPSTREAM_TARGET}
|
||||
PREFIX "${_TAEAL_BINARY_DIR}"
|
||||
SOURCE_DIR "${_TAEAL_SOURCE_DIR}"
|
||||
INSTALL_DIR "${${PACKAGENAME}_PREFIX}"
|
||||
CMAKE_ARGS
|
||||
-Wno-dev # We don't want to be warned over unused variables
|
||||
--no-warn-unused-cli
|
||||
@@ -200,29 +230,31 @@ macro(tr_add_external_auto_library ID DIRNAME LIBNAME)
|
||||
"-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>"
|
||||
"-DCMAKE_INSTALL_LIBDIR:STRING=lib"
|
||||
${${ID}_EXT_PROJ_CMAKE_ARGS}
|
||||
${${PACKAGENAME}_EXT_PROJ_CMAKE_ARGS}
|
||||
${_TAEAL_ARG_CMAKE_ARGS}
|
||||
BUILD_BYPRODUCTS "${${ID}_LIBRARY}")
|
||||
BUILD_BYPRODUCTS "${${PACKAGENAME}_LIBRARY}")
|
||||
|
||||
set_property(TARGET ${${ID}_UPSTREAM_TARGET} PROPERTY FOLDER "${TR_THIRD_PARTY_DIR_NAME}")
|
||||
set_property(TARGET ${${PACKAGENAME}_UPSTREAM_TARGET} PROPERTY FOLDER "${TR_THIRD_PARTY_DIR_NAME}")
|
||||
|
||||
# Imported target (below) requires include directories to be present at configuration time
|
||||
file(MAKE_DIRECTORY ${${ID}_INCLUDE_DIRS})
|
||||
file(MAKE_DIRECTORY ${${PACKAGENAME}_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(_TAEAL_ARG_TARGET AND (USE_SYSTEM_${ID} OR NOT _TAEAL_ARG_SUBPROJECT))
|
||||
if(NOT _TAEAL_ARG_SUBPROJECT AND _TAEAL_ARG_TARGET AND NOT TARGET ${_TAEAL_ARG_TARGET})
|
||||
add_library(${_TAEAL_ARG_TARGET} INTERFACE IMPORTED)
|
||||
|
||||
target_include_directories(${_TAEAL_ARG_TARGET}
|
||||
INTERFACE
|
||||
${${ID}_INCLUDE_DIRS})
|
||||
${${PACKAGENAME}_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(${_TAEAL_ARG_TARGET}
|
||||
INTERFACE
|
||||
${${ID}_LIBRARIES})
|
||||
if(NOT _TAEAL_ARG_HEADER_ONLY)
|
||||
target_link_libraries(${_TAEAL_ARG_TARGET}
|
||||
INTERFACE
|
||||
${${PACKAGENAME}_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(${ID}_UPSTREAM_TARGET)
|
||||
add_dependencies(${_TAEAL_ARG_TARGET} ${${ID}_UPSTREAM_TARGET})
|
||||
if(${PACKAGENAME}_UPSTREAM_TARGET)
|
||||
add_dependencies(${_TAEAL_ARG_TARGET} ${${PACKAGENAME}_UPSTREAM_TARGET})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ target_include_directories(${TR_NAME}-daemon SYSTEM
|
||||
target_link_libraries(${TR_NAME}-daemon
|
||||
PRIVATE
|
||||
${TR_NAME}
|
||||
libevent::event
|
||||
libevent::core
|
||||
fmt::fmt-header-only
|
||||
$<$<BOOL:${WITH_SYSTEMD}>:${SYSTEMD_LIBRARIES}>)
|
||||
|
||||
|
||||
@@ -218,6 +218,7 @@ tr_allow_compile_if(
|
||||
target_compile_definitions(${TR_NAME}
|
||||
PRIVATE
|
||||
__TRANSMISSION__
|
||||
RAPIDJSON_HAS_STDSTRING=1
|
||||
WIDE_INTEGER_DISABLE_FLOAT_INTEROP
|
||||
WIDE_INTEGER_DISABLE_IOSTREAM
|
||||
PACKAGE_DATA_DIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}"
|
||||
@@ -227,6 +228,9 @@ target_compile_definitions(${TR_NAME}
|
||||
$<$<BOOL:${USE_SYSTEM_B64}>:USE_SYSTEM_B64>
|
||||
$<$<BOOL:${HAVE_SO_REUSEPORT}>:HAVE_SO_REUSEPORT=1>
|
||||
PUBLIC
|
||||
FMT_USE_EXCEPTIONS=0 # {fmt} >= 11.2.0
|
||||
FMT_EXCEPTIONS=0 # {fmt} < 11.2.0
|
||||
SMALL_DISABLE_EXCEPTIONS=1 # Workaround, perm fix at https://github.com/alandefreitas/small/pull/52
|
||||
$<$<STREQUAL:${CRYPTO_PKG},ccrypto>:WITH_CCRYPTO>
|
||||
$<$<STREQUAL:${CRYPTO_PKG},mbedtls>:WITH_MBEDTLS>
|
||||
$<$<STREQUAL:${CRYPTO_PKG},openssl>:WITH_OPENSSL>
|
||||
@@ -269,12 +273,12 @@ endif()
|
||||
target_link_libraries(${TR_NAME}
|
||||
PRIVATE
|
||||
Threads::Threads
|
||||
deflate::deflate
|
||||
libdeflate::libdeflate
|
||||
CURL::libcurl
|
||||
FastFloat::fast_float
|
||||
psl::psl
|
||||
natpmp::natpmp
|
||||
miniupnpc::libminiupnpc
|
||||
miniupnpc::miniupnpc
|
||||
dht::dht
|
||||
libutp::libutp
|
||||
libb64::libb64
|
||||
@@ -285,7 +289,7 @@ target_link_libraries(${TR_NAME}
|
||||
RapidJSON
|
||||
utf8::cpp
|
||||
wildmat
|
||||
WideInteger::WideInteger
|
||||
transmission::WideInteger
|
||||
Crc32c::crc32c
|
||||
$<$<BOOL:${WIN32}>:crypt32>
|
||||
$<$<BOOL:${WIN32}>:shlwapi>
|
||||
@@ -296,7 +300,8 @@ target_link_libraries(${TR_NAME}
|
||||
transmission::crypto_impl
|
||||
fmt::fmt-header-only
|
||||
small::small
|
||||
libevent::event)
|
||||
libevent::core
|
||||
libevent::extra)
|
||||
|
||||
if(INSTALL_LIB)
|
||||
install(
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "libtransmission/utils.h" // for _(), tr_strerror()
|
||||
|
||||
#ifndef MINIUPNPC_API_VERSION
|
||||
#error miniupnpc >= 1.7 is required
|
||||
#error "MINIUPNPC_API_VERSION macro not defined"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
add_subdirectory(gtest)
|
||||
include(TrGTest)
|
||||
|
||||
add_subdirectory(libtransmission)
|
||||
if(ENABLE_UTILS)
|
||||
add_subdirectory(utils)
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
set(GTEST_ROOT_DIR ${TR_THIRD_PARTY_SOURCE_DIR}/googletest/googletest)
|
||||
|
||||
add_library(gtestall STATIC)
|
||||
|
||||
# GTest 1.12 triggers nullptr warnings in gcc 13
|
||||
set(CACHE_ID "${CMAKE_CXX_COMPILER_ID}_CXX_HAS-Wnull-dereference")
|
||||
string(TOLOWER "${CACHE_ID}" CACHE_ID)
|
||||
check_c_compiler_flag(-Wnull-dereference ${CACHE_ID})
|
||||
if(${CACHE_ID})
|
||||
target_compile_options(gtestall PRIVATE -Wno-null-dereference)
|
||||
endif()
|
||||
|
||||
target_sources(gtestall
|
||||
PRIVATE
|
||||
${GTEST_ROOT_DIR}/src/gtest-all.cc
|
||||
${GTEST_ROOT_DIR}/src/gtest_main.cc)
|
||||
|
||||
set_property(
|
||||
TARGET gtestall
|
||||
PROPERTY FOLDER "${TR_THIRD_PARTY_DIR_NAME}")
|
||||
|
||||
target_include_directories(gtestall SYSTEM
|
||||
PRIVATE
|
||||
${GTEST_ROOT_DIR}
|
||||
PUBLIC
|
||||
${GTEST_ROOT_DIR}/include)
|
||||
@@ -75,11 +75,28 @@ target_compile_options(libtransmission-test
|
||||
target_link_libraries(libtransmission-test
|
||||
PRIVATE
|
||||
${TR_NAME}
|
||||
gtestall
|
||||
GTest::gtest_main
|
||||
dht::dht
|
||||
fmt::fmt-header-only
|
||||
libevent::event
|
||||
WideInteger::WideInteger)
|
||||
libevent::core
|
||||
transmission::WideInteger)
|
||||
|
||||
if (WIN32)
|
||||
cmake_policy(PUSH)
|
||||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||
|
||||
add_custom_command(
|
||||
TARGET libtransmission-test POST_BUILD
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
-E copy_if_different
|
||||
$<TARGET_RUNTIME_DLLS:libtransmission-test>
|
||||
$<TARGET_FILE_DIR:libtransmission-test>
|
||||
COMMAND_EXPAND_LISTS
|
||||
)
|
||||
|
||||
cmake_policy(POP)
|
||||
endif ()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
|
||||
gtest_discover_tests(libtransmission-test
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/announce-list.h>
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include <event2/event.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#define LIBTRANSMISSION_ANNOUNCER_MODULE
|
||||
|
||||
#include <libtransmission/announcer.h>
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/api-compat.h>
|
||||
#include <libtransmission/quark.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using ApiCompatTest = ::libtransmission::test::TransmissionTest;
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
#include <libtransmission/bitfield.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(Bitfield, count)
|
||||
{
|
||||
auto constexpr IterCount = size_t{ 10000U };
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/net.h>
|
||||
#include <libtransmission/session.h> // tr_session.addressIsBlocked()
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
namespace libtransmission::test
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
#include <cstddef> // size_t
|
||||
#include <string_view>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h> // tr_rand_obj()
|
||||
#include <libtransmission/clients.h>
|
||||
#include <libtransmission/tr-macros.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
TEST(Client, clientForId)
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
#include <libtransmission/error.h>
|
||||
#include <libtransmission/file.h>
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
namespace libtransmission::test
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/peer-mse.h>
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
#include <libtransmission/tr-macros.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
namespace
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h> // tr_rand_obj
|
||||
@@ -48,7 +50,6 @@
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/error.h>
|
||||
|
||||
#include "test-fixtures.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
TEST(Error, errorSet)
|
||||
|
||||
@@ -25,12 +25,13 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/error.h>
|
||||
#include <libtransmission/file.h>
|
||||
#include <libtransmission/tr-macros.h>
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
#if !defined(__OpenBSD__)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <event2/util.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h> // tr_sha1_to_string, tr_base...
|
||||
@@ -37,7 +39,6 @@
|
||||
#include <libtransmission/tr-macros.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <libtransmission/history.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <libtransmission/history.h>
|
||||
|
||||
TEST(History, recentHistory)
|
||||
{
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
#include <libtransmission/quark.h>
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
class JSONTest : public ::testing::TestWithParam<char const*>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h> // tr_torrent_activity
|
||||
|
||||
#include <libtransmission/crypto-utils.h> // tr_rand_obj()
|
||||
@@ -20,7 +22,6 @@
|
||||
#include <libtransmission/tr-lpd.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/announce-list.h>
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
#include <libtransmission/file.h>
|
||||
@@ -23,7 +25,6 @@
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/block-info.h>
|
||||
@@ -20,7 +22,6 @@
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/error.h>
|
||||
@@ -19,7 +21,6 @@
|
||||
#include <libtransmission/open-files.h>
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// or any future license endorsed by Mnemosyne LLC.
|
||||
// License text can be found in the licenses/ folder.
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(PeerMsgs, placeholder)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/file.h>
|
||||
@@ -15,7 +17,6 @@
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/file.h>
|
||||
#include <libtransmission/torrent-files.h>
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
@@ -21,7 +23,6 @@
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
struct tr_ctor;
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/quark.h>
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/rpcimpl.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "libtransmission/quark.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
struct tr_session;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
@@ -21,7 +23,6 @@
|
||||
#include <libtransmission/variant.h>
|
||||
#include <libtransmission/version.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/error.h>
|
||||
#include <libtransmission/file.h>
|
||||
#include <libtransmission/subprocess.h>
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <event2/event.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h> // tr_base64_decode()
|
||||
#include <libtransmission/error.h>
|
||||
#include <libtransmission/file.h> // tr_sys_file_*()
|
||||
@@ -27,8 +29,6 @@
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, tr_error const& err)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <event2/event.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/timer.h>
|
||||
#include <libtransmission/timer-ev.h>
|
||||
#include <libtransmission/utils-ev.h>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/file.h>
|
||||
@@ -18,7 +20,6 @@
|
||||
#include "libtransmission/tr-macros.h"
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
#include <future>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/error.h>
|
||||
#include <libtransmission/torrent-magnet.h>
|
||||
#include <libtransmission/torrent-metainfo.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
namespace libtransmission::test
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
@@ -20,7 +22,6 @@
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/torrent-queue.h>
|
||||
#include <libtransmission/torrent.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/torrent.h>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <libtransmission/crypto-utils.h> // tr_rand_int()
|
||||
@@ -29,7 +31,6 @@
|
||||
#include <libtransmission/tr-strbuf.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test-fixtures.h"
|
||||
|
||||
using UtilsTest = ::libtransmission::test::TransmissionTest;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#define LIBTRANSMISSION_VARIANT_MODULE
|
||||
|
||||
#include <libtransmission/benc.h>
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include <event2/event.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#define LIBTRANSMISSION_WATCHDIR_MODULE
|
||||
|
||||
#include <libtransmission/file.h>
|
||||
|
||||
2
third-party/small
vendored
2
third-party/small
vendored
Submodule third-party/small updated: 46bb00342b...d5e268f484
2
third-party/wide-integer
vendored
2
third-party/wide-integer
vendored
Submodule third-party/wide-integer updated: c725651dd2...aed8a39b39
@@ -10,7 +10,7 @@ foreach(P create edit remote show)
|
||||
${TR_NAME}
|
||||
CURL::libcurl
|
||||
fmt::fmt-header-only
|
||||
libevent::event)
|
||||
libevent::core)
|
||||
|
||||
tr_win32_app_info(${TR_NAME}-${P}
|
||||
"Transmission Utility ('${P}')"
|
||||
|
||||
Reference in New Issue
Block a user