Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
ff4108bf
提交
ff4108bf
authored
8月 31, 2021
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Windows support in Rust library
上级
f0ebd809
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
50 行增加
和
8 行删除
+50
-8
mediasoup-rust.yaml
.github/workflows/mediasoup-rust.yaml
+12
-0
CHANGELOG.md
rust/CHANGELOG.md
+1
-0
build.rs
worker/build.rs
+37
-8
没有找到文件。
.github/workflows/mediasoup-rust.yaml
浏览文件 @
ff4108bf
...
...
@@ -12,6 +12,7 @@ jobs:
os
:
-
ubuntu-20.04
-
macos-10.15
-
windows-2019
rust
:
-
stable
# - nightly
...
...
@@ -19,6 +20,17 @@ jobs:
runs-on
:
${{ matrix.os }}
steps
:
-
name
:
Add MSVC compiler
uses
:
ilammy/msvc-dev-cmd@v1
if
:
runner.os == 'Windows'
# This is needed as a workaround for GNU linker being first in PATH and thus preventing Meson from finding MSVC
# linker.
-
name
:
Remove GNU linker for MSVC
shell
:
bash
run
:
rm /usr/bin/link
if
:
runner.os == 'Windows'
-
name
:
Checkout
uses
:
actions/checkout@v2
...
...
rust/CHANGELOG.md
浏览文件 @
ff4108bf
...
...
@@ -8,6 +8,7 @@
*
Switch from file descriptors to function calls when communicating with worker
*
Various optimizations that caused minor breaking changes to public API
*
Requests no longer have internal timeout, but they can now be cancelled, add your own timeouts on top if needed
*
Windows support
# 0.8.5
...
...
worker/build.rs
浏览文件 @
ff4108bf
...
...
@@ -7,7 +7,9 @@ fn main() {
return
;
}
let
build_type
=
if
cfg!
(
debug_assertions
)
{
// On Windows Rust always links against release version of MSVC runtime, thus requires Release
// build here.
let
build_type
=
if
cfg!
(
all
(
debug_assertions
,
not
(
windows
)))
{
"Debug"
}
else
{
"Release"
...
...
@@ -73,19 +75,15 @@ fn main() {
}
#[cfg(target_os
=
"windows"
)]
{
panic!
(
"Building on Windows is not currently supported"
);
// TODO: Didn't bother, feel free to PR
// Nothing special is needed so far
}
// The build here is a bit awkward since we can't just specify custom target directory as
// openssl will fail to build with `make[1]: /bin/sh: Argument list too long` due to large
// number of files. So instead we build in place, copy files to out directory and then clean
// after ourselves
{
// Build
if
!
Command
::
new
(
"make"
)
.arg
(
"libmediasoup-worker"
)
.env
(
"MEDIASOUP_OUT_DIR"
,
&
out_dir
)
// Force forward slashes on Windows too so that is plays well with our dumb `Makefile`
.env
(
"MEDIASOUP_OUT_DIR"
,
&
out_dir
.replace
(
'\\'
,
"/"
))
.env
(
"MEDIASOUP_BUILDTYPE"
,
&
build_type
)
.spawn
()
.expect
(
"Failed to start"
)
...
...
@@ -111,6 +109,37 @@ fn main() {
}
}
#[cfg(target_os
=
"windows"
)]
{
let
dot_a
=
format!
(
"{}/{}/libmediasoup-worker.a"
,
out_dir
,
build_type
);
let
dot_lib
=
format!
(
"{}/{}/mediasoup-worker.lib"
,
out_dir
,
build_type
);
// Meson builds `libmediasoup-worker.a` on Windows instead of `*.lib` file under MinGW
if
std
::
path
::
Path
::
new
(
&
dot_a
)
.exists
()
{
std
::
fs
::
copy
(
&
dot_a
,
&
dot_lib
)
.unwrap_or_else
(|
_
|
{
panic!
(
"Failed to copy static library from {} to {}"
,
dot_a
,
dot_lib
,
)
});
}
// These are required by libuv on Windows
println!
(
"cargo:rustc-link-lib=psapi"
);
println!
(
"cargo:rustc-link-lib=user32"
);
println!
(
"cargo:rustc-link-lib=advapi32"
);
println!
(
"cargo:rustc-link-lib=iphlpapi"
);
println!
(
"cargo:rustc-link-lib=userenv"
);
println!
(
"cargo:rustc-link-lib=ws2_32"
);
// These are required by OpenSSL on Windows
println!
(
"cargo:rustc-link-lib=ws2_32"
);
println!
(
"cargo:rustc-link-lib=gdi32"
);
println!
(
"cargo:rustc-link-lib=advapi32"
);
println!
(
"cargo:rustc-link-lib=crypt32"
);
println!
(
"cargo:rustc-link-lib=user32"
);
}
println!
(
"cargo:rustc-link-lib=static=mediasoup-worker"
);
println!
(
"cargo:rustc-link-search=native={}/{}"
,
out_dir
,
build_type
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论