Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
790b1687
提交
790b1687
authored
12月 04, 2021
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweak `build.rs` to correctly cleanup build artifacts
上级
8c084458
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
41 行增加
和
22 行删除
+41
-22
build.rs
worker/build.rs
+41
-22
没有找到文件。
worker/build.rs
浏览文件 @
790b1687
...
@@ -16,6 +16,8 @@ fn main() {
...
@@ -16,6 +16,8 @@ fn main() {
};
};
let
out_dir
=
env
::
var
(
"OUT_DIR"
)
.unwrap
();
let
out_dir
=
env
::
var
(
"OUT_DIR"
)
.unwrap
();
// Force forward slashes on Windows too so that is plays well with our dumb `Makefile`
let
mediasoup_out_dir
=
format!
(
"{}/out"
,
out_dir
.replace
(
'\\'
,
"/"
));
// Add C++ std lib
// Add C++ std lib
#[cfg(target_os
=
"linux"
)]
#[cfg(target_os
=
"linux"
)]
...
@@ -78,12 +80,10 @@ fn main() {
...
@@ -78,12 +80,10 @@ fn main() {
// Nothing special is needed so far
// Nothing special is needed so far
}
}
{
// Build
// Build
if
!
Command
::
new
(
"make"
)
if
!
Command
::
new
(
"make"
)
.arg
(
"libmediasoup-worker"
)
.arg
(
"libmediasoup-worker"
)
// Force forward slashes on Windows too so that is plays well with our dumb `Makefile`
.env
(
"MEDIASOUP_OUT_DIR"
,
&
mediasoup_out_dir
)
.env
(
"MEDIASOUP_OUT_DIR"
,
&
out_dir
.replace
(
'\\'
,
"/"
))
.env
(
"MEDIASOUP_BUILDTYPE"
,
&
build_type
)
.env
(
"MEDIASOUP_BUILDTYPE"
,
&
build_type
)
.spawn
()
.spawn
()
.expect
(
"Failed to start"
)
.expect
(
"Failed to start"
)
...
@@ -94,36 +94,40 @@ fn main() {
...
@@ -94,36 +94,40 @@ fn main() {
panic!
(
"Failed to build libmediasoup-worker"
)
panic!
(
"Failed to build libmediasoup-worker"
)
}
}
if
env
::
var
(
"KEEP_BUILD_ARTIFACTS"
)
!=
Ok
(
"1"
.to_string
())
{
#[cfg(not(target_os
=
"windows"
))]
// Clean
if
!
Command
::
new
(
"make"
)
.arg
(
"clean-all"
)
.spawn
()
.expect
(
"Failed to start"
)
.wait
()
.expect
(
"Wasn't running"
)
.success
()
{
{
panic!
(
"Failed to clean libmediasoup-worker"
)
let
from
=
format!
(
"{}/{}/libmediasoup-worker.a"
,
mediasoup_out_dir
,
build_type
);
}
let
to
=
format!
(
"{}/libmediasoup-worker.a"
,
out_dir
);
}
std
::
fs
::
copy
(
&
from
,
&
to
)
.unwrap_or_else
(|
error
|
{
panic!
(
"Failed to copy static library from {} to {}: {}"
,
from
,
to
,
error
)
});
}
}
#[cfg(target_os
=
"windows"
)]
#[cfg(target_os
=
"windows"
)]
{
{
let
dot_a
=
format!
(
"{}/{}/libmediasoup-worker.a"
,
out_dir
,
build_type
);
let
dot_a
=
format!
(
"{}/{}/libmediasoup-worker.a"
,
mediasoup_out_dir
,
build_type
);
let
dot_lib
=
format!
(
"{}/{}/mediasoup-worker.lib"
,
out_dir
,
build_type
);
let
from
=
format!
(
"{}/{}/mediasoup-worker.lib"
,
mediasoup_out_dir
,
build_type
);
let
to
=
format!
(
"{}/mediasoup-worker.lib"
,
out_dir
);
// Meson builds `libmediasoup-worker.a` on Windows instead of `*.lib` file under MinGW
// Meson builds `libmediasoup-worker.a` on Windows instead of `*.lib` file under MinGW
if
std
::
path
::
Path
::
new
(
&
dot_a
)
.exists
()
{
if
std
::
path
::
Path
::
new
(
&
dot_a
)
.exists
()
{
std
::
fs
::
copy
(
&
dot_a
,
&
dot_lib
)
.unwrap_or_else
(|
_
|
{
std
::
fs
::
copy
(
&
dot_a
,
&
from
)
.unwrap_or_else
(|
error
|
{
panic!
(
panic!
(
"Failed to copy static library from {} to {}"
,
"Failed to copy static library from {} to {}
: {}
"
,
dot_a
,
dot_lib
,
dot_a
,
from
,
error
)
)
});
});
}
}
std
::
fs
::
copy
(
&
from
,
&
to
)
.unwrap_or_else
(|
error
|
{
panic!
(
"Failed to copy static library from {} to {}: {}"
,
from
,
to
,
error
)
});
// These are required by libuv on Windows
// These are required by libuv on Windows
println!
(
"cargo:rustc-link-lib=psapi"
);
println!
(
"cargo:rustc-link-lib=psapi"
);
println!
(
"cargo:rustc-link-lib=user32"
);
println!
(
"cargo:rustc-link-lib=user32"
);
...
@@ -140,6 +144,21 @@ fn main() {
...
@@ -140,6 +144,21 @@ fn main() {
println!
(
"cargo:rustc-link-lib=user32"
);
println!
(
"cargo:rustc-link-lib=user32"
);
}
}
if
env
::
var
(
"KEEP_BUILD_ARTIFACTS"
)
!=
Ok
(
"1"
.to_string
())
{
// Clean
if
!
Command
::
new
(
"make"
)
.arg
(
"clean-all"
)
.env
(
"MEDIASOUP_OUT_DIR"
,
&
mediasoup_out_dir
)
.spawn
()
.expect
(
"Failed to start"
)
.wait
()
.expect
(
"Wasn't running"
)
.success
()
{
panic!
(
"Failed to clean libmediasoup-worker"
)
}
}
println!
(
"cargo:rustc-link-lib=static=mediasoup-worker"
);
println!
(
"cargo:rustc-link-lib=static=mediasoup-worker"
);
println!
(
"cargo:rustc-link-search=native={}
/{}"
,
out_dir
,
build_type
);
println!
(
"cargo:rustc-link-search=native={}
"
,
out_dir
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论