mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-28 07:39:36 +08:00
Merge pull request #6325 from basilgello/vcpkg-deps
Fixes for vcpkg-deps
This commit is contained in:
commit
529c075fe1
2
.github/workflows/flutter-build.yml
vendored
2
.github/workflows/flutter-build.yml
vendored
@ -401,6 +401,8 @@ jobs:
|
||||
- name: Codesign app and create signed dmg
|
||||
if: env.MACOS_P12_BASE64 != null
|
||||
run: |
|
||||
# Patch create-dmg to give more attempts to unmount image
|
||||
sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' $(command -v create-dmg)
|
||||
security default-keychain -s rustdesk.keychain
|
||||
security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain
|
||||
# start sign the rustdesk.app and dmg
|
||||
|
22
.github/workflows/flutter-tag.yml
vendored
22
.github/workflows/flutter-tag.yml
vendored
@ -15,4 +15,24 @@ jobs:
|
||||
secrets: inherit
|
||||
with:
|
||||
upload-artifact: true
|
||||
upload-tag: "1.2.4"
|
||||
upload-tag: ${{ env.GITHUB_REF_NAME }}
|
||||
|
||||
update-fdroid-version-file:
|
||||
name: Publish Rustdesk version file for F-Droid updater
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate Rustdesk version file
|
||||
run: |
|
||||
UPSTREAM_VERNAME="$GITHUB_REF_NAME"
|
||||
UPSTREAM_VERCODE="$(echo "$UPSTREAM_VERNAME" | tr -d '.')"
|
||||
echo "versionName=$UPSTREAM_VERNAME" > rustdesk-version.txt
|
||||
echo "versionCode=$UPSTREAM_VERCODE" >> rustdesk-version.txt
|
||||
shell: bash
|
||||
|
||||
- name: Publish Rustdesk version file
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
prerelease: true
|
||||
tag_name: "fdroid-version"
|
||||
files: |
|
||||
./rustdesk-version.txt
|
||||
|
1
build.rs
1
build.rs
@ -70,6 +70,7 @@ fn install_android_deps() {
|
||||
);
|
||||
println!("cargo:rustc-link-lib=ndk_compat");
|
||||
println!("cargo:rustc-link-lib=oboe");
|
||||
println!("cargo:rustc-link-lib=oboe_wrapper");
|
||||
println!("cargo:rustc-link-lib=c++");
|
||||
println!("cargo:rustc-link-lib=OpenSLES");
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
ANDROID_ABI=$1
|
||||
|
||||
# Build RustDesk dependencies for Android using vcpkg.json
|
||||
|
@ -165,6 +165,16 @@ else()
|
||||
message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE}")
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
|
||||
# Set environment variables for configure
|
||||
set(ENV{CC} ${VCPKG_DETECTED_CMAKE_C_COMPILER})
|
||||
set(ENV{CXX} ${VCPKG_DETECTED_CMAKE_CXX_COMPILER})
|
||||
set(ENV{AR} ${VCPKG_DETECTED_CMAKE_AR})
|
||||
set(ENV{LD} ${VCPKG_DETECTED_CMAKE_LINKER})
|
||||
set(ENV{RANLIB} ${VCPKG_DETECTED_CMAKE_RANLIB})
|
||||
|
||||
if(VCPKG_TARGET_IS_MINGW)
|
||||
if(LIBVPX_TARGET_ARCH STREQUAL "x86")
|
||||
set(LIBVPX_TARGET "x86-win32-gcc")
|
||||
@ -173,21 +183,12 @@ else()
|
||||
endif()
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-linux-gcc")
|
||||
include($ENV{VCPKG_ROOT}/buildtrees/detect_compiler/${VCPKG_TARGET_ARCHITECTURE}-linux-rel/CMakeFiles/${CMAKE_VERSION}/CMakeCCompiler.cmake)
|
||||
set(ENV{CROSS} "${CMAKE_LIBRARY_ARCHITECTURE}-")
|
||||
elseif(VCPKG_TARGET_IS_ANDROID)
|
||||
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-android-gcc")
|
||||
set(ANDROID_API 21)
|
||||
# From ndk android.toolchsin.cmake
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
|
||||
set(ANDROID_HOST_TAG linux-x86_64)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
|
||||
set(ANDROID_HOST_TAG darwin-x86_64)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
||||
set(ANDROID_HOST_TAG windows-x86_64)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm AND NOT VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL arm)
|
||||
message(STATUS "Cross-building for arm-linux with arm-linux-gnueabihf")
|
||||
set(ENV{CROSS} "arm-linux-gnueabihf-")
|
||||
endif()
|
||||
set(ANDROID_TOOLCHAIN_ROOT
|
||||
"$ENV{ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/${ANDROID_HOST_TAG}")
|
||||
elseif(VCPKG_TARGET_IS_ANDROID)
|
||||
set(LIBVPX_TARGET "generic-gnu")
|
||||
# Settings
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
||||
set(ANDROID_TARGET_TRIPLET i686-linux-android)
|
||||
@ -200,16 +201,13 @@ else()
|
||||
set(OPTIONS "${OPTIONS} --enable-thumb --disable-neon")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(ANDROID_TARGET_TRIPLET aarch64-linux-android)
|
||||
set(OPTIONS "${OPTIONS} --enable-thumb --disable-neon")
|
||||
set(OPTIONS "${OPTIONS} --enable-thumb")
|
||||
endif()
|
||||
# Set environment variables for configure
|
||||
set(ENV{CC} "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TARGET_TRIPLET}${ANDROID_API}-clang")
|
||||
set(ENV{CXX} "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TARGET_TRIPLET}${ANDROID_API}-clang++")
|
||||
set(ENV{AR} "${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-ar")
|
||||
set(ENV{AS} "${CMAKE_C_COMPILER}")
|
||||
set(ENV{LD} "${ANDROID_TOOLCHAIN_ROOT}/bin/ld")
|
||||
set(ENV{RANLIB} "${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-ranlib")
|
||||
set(ENV{STRIP} "${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-strip")
|
||||
set(ENV{AS} ${VCPKG_DETECTED_CMAKE_C_COMPILER})
|
||||
set(ENV{LDFLAGS} "${LDFLAGS} --target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET}")
|
||||
# Set clang target
|
||||
set(OPTIONS "${OPTIONS} --extra-cflags=--target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET} --extra-cxxflags=--target=${VCPKG_DETECTED_CMAKE_CXX_COMPILER_TARGET}")
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
set(LIBVPX_TARGET "arm64-darwin20-gcc")
|
||||
|
@ -9,6 +9,10 @@
|
||||
"name": "vcpkg-msbuild",
|
||||
"host": true,
|
||||
"platform": "windows"
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-get-vars",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
|
15
res/vcpkg/oboe-wrapper/CMakeLists.txt
Normal file
15
res/vcpkg/oboe-wrapper/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(oboe_wrapper CXX)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
add_library(oboe_wrapper STATIC
|
||||
oboe.cc
|
||||
)
|
||||
|
||||
target_include_directories(oboe_wrapper PRIVATE "${CURRENT_INSTALLED_DIR}/include")
|
||||
|
||||
install(TARGETS oboe_wrapper
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
8
res/vcpkg/oboe-wrapper/portfile.cmake
Normal file
8
res/vcpkg/oboe-wrapper/portfile.cmake
Normal file
@ -0,0 +1,8 @@
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}"
|
||||
OPTIONS
|
||||
-DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}
|
||||
PREFER_NINJA
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
19
res/vcpkg/oboe-wrapper/vcpkg.json
Normal file
19
res/vcpkg/oboe-wrapper/vcpkg.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "oboe-wrapper",
|
||||
"version": "0",
|
||||
"description": "None",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "oboe",
|
||||
"host": false
|
||||
}
|
||||
]
|
||||
}
|
147
src/oboe.patch
147
src/oboe.patch
@ -1,147 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 51a45b2..75be96a 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -60,7 +60,7 @@ set (oboe_sources
|
||||
src/common/Version.cpp
|
||||
)
|
||||
|
||||
-add_library(oboe ${oboe_sources})
|
||||
+ add_library(oboe STATIC ${oboe_sources})
|
||||
|
||||
# Specify directories which the compiler should look for headers
|
||||
target_include_directories(oboe
|
||||
@@ -91,4 +91,4 @@ install(TARGETS oboe
|
||||
ARCHIVE DESTINATION lib/${ANDROID_ABI})
|
||||
|
||||
# Also install the headers
|
||||
-install(DIRECTORY include/oboe DESTINATION include)
|
||||
\ No newline at end of file
|
||||
+install(DIRECTORY include/oboe DESTINATION include)
|
||||
diff --git a/src/common/AudioStreamBuilder.cpp b/src/common/AudioStreamBuilder.cpp
|
||||
index dffcd75..79984a4 100644
|
||||
--- a/src/common/AudioStreamBuilder.cpp
|
||||
+++ b/src/common/AudioStreamBuilder.cpp
|
||||
@@ -215,3 +215,122 @@ Result AudioStreamBuilder::openStream(std::shared_ptr<AudioStream> &sharedStream
|
||||
}
|
||||
|
||||
} // namespace oboe
|
||||
+
|
||||
+#include <oboe/Oboe.h>
|
||||
+#include <math.h>
|
||||
+#include <deque>
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+// I got link problem with std::mutex, so use pthread instead
|
||||
+class CThreadLock
|
||||
+{
|
||||
+public:
|
||||
+ CThreadLock();
|
||||
+ virtual ~CThreadLock();
|
||||
+
|
||||
+ void Lock();
|
||||
+ void Unlock();
|
||||
+
|
||||
+private:
|
||||
+ pthread_mutex_t mutexlock;
|
||||
+};
|
||||
+
|
||||
+CThreadLock::CThreadLock()
|
||||
+{
|
||||
+ // init lock here
|
||||
+ pthread_mutex_init(&mutexlock, 0);
|
||||
+}
|
||||
+
|
||||
+CThreadLock::~CThreadLock()
|
||||
+{
|
||||
+ // deinit lock here
|
||||
+ pthread_mutex_destroy(&mutexlock);
|
||||
+}
|
||||
+void CThreadLock::Lock()
|
||||
+{
|
||||
+ // lock
|
||||
+ pthread_mutex_lock(&mutexlock);
|
||||
+}
|
||||
+void CThreadLock::Unlock()
|
||||
+{
|
||||
+ // unlock
|
||||
+ pthread_mutex_unlock(&mutexlock);
|
||||
+}
|
||||
+
|
||||
+class Player : public oboe::AudioStreamDataCallback
|
||||
+{
|
||||
+public:
|
||||
+ ~Player() {
|
||||
+ outStream->requestStop();
|
||||
+ }
|
||||
+
|
||||
+ Player(int channels, int sample_rate)
|
||||
+ {
|
||||
+ this->channels = channels;
|
||||
+ oboe::AudioStreamBuilder builder;
|
||||
+ // The builder set methods can be chained for convenience.
|
||||
+ builder.setSharingMode(oboe::SharingMode::Exclusive)
|
||||
+ ->setPerformanceMode(oboe::PerformanceMode::LowLatency)
|
||||
+ ->setChannelCount(channels)
|
||||
+ ->setSampleRate(sample_rate)
|
||||
+ ->setFormat(oboe::AudioFormat::Float)
|
||||
+ ->setDataCallback(this)
|
||||
+ ->openManagedStream(outStream);
|
||||
+ // Typically, start the stream after querying some stream information, as well as some input from the user
|
||||
+ outStream->requestStart();
|
||||
+ }
|
||||
+
|
||||
+ oboe::DataCallbackResult onAudioReady(oboe::AudioStream *oboeStream, void *audioData, int32_t numFrames) override
|
||||
+ {
|
||||
+ float *floatData = (float *)audioData;
|
||||
+ int i = 0;
|
||||
+ mtx.Lock();
|
||||
+ auto n = channels * numFrames;
|
||||
+ for (; i < n && i < (int)buffer.size(); ++i, ++floatData)
|
||||
+ {
|
||||
+ *floatData = buffer.front();
|
||||
+ buffer.pop_front();
|
||||
+ }
|
||||
+ mtx.Unlock();
|
||||
+ for (; i < n; ++i, ++floatData)
|
||||
+ {
|
||||
+ *floatData = 0;
|
||||
+ }
|
||||
+ return oboe::DataCallbackResult::Continue;
|
||||
+ }
|
||||
+
|
||||
+ void push(const float *v, int n)
|
||||
+ {
|
||||
+ mtx.Lock();
|
||||
+ for (auto i = 0; i < n; ++i, ++v)
|
||||
+ buffer.push_back(*v);
|
||||
+ // in case memory overuse
|
||||
+ if (buffer.size() > 48 * 1024 * 120)
|
||||
+ buffer.clear();
|
||||
+ mtx.Unlock();
|
||||
+ }
|
||||
+
|
||||
+private:
|
||||
+ oboe::ManagedStream outStream;
|
||||
+ int channels;
|
||||
+ std::deque<float> buffer;
|
||||
+ CThreadLock mtx;
|
||||
+};
|
||||
+
|
||||
+extern "C"
|
||||
+{
|
||||
+ void *create_oboe_player(int channels, int sample_rate)
|
||||
+ {
|
||||
+ return new Player(channels, sample_rate);
|
||||
+ }
|
||||
+
|
||||
+ void push_oboe_data(void *player, const float* v, int n)
|
||||
+ {
|
||||
+ static_cast<Player *>(player)->push(v, n);
|
||||
+ }
|
||||
+
|
||||
+ void destroy_oboe_player(void *player)
|
||||
+ {
|
||||
+ delete static_cast<Player *>(player);
|
||||
+ }
|
||||
+}
|
@ -24,6 +24,10 @@
|
||||
"name": "oboe",
|
||||
"platform": "android"
|
||||
},
|
||||
{
|
||||
"name": "oboe-wrapper",
|
||||
"platform": "android"
|
||||
},
|
||||
{
|
||||
"name": "opus",
|
||||
"host": true
|
||||
|
Loading…
Reference in New Issue
Block a user