-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,403 changed files
with
1,005,258 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import("//build/ten_runtime/options.gni") | ||
|
||
template("ten_prebuilt_library") { | ||
assert(defined(invoker.url), "Must provide dist url") | ||
|
||
_dir_path = "prebuilt/${invoker.name}/lib" | ||
_zip_path = "${_dir_path}/${invoker.name}.zip" | ||
|
||
_download_target = "${target_name}_lib_download" | ||
action(_download_target) { | ||
script = "//build/ten_common/scripts/download.py" | ||
|
||
_source_file = "${invoker.url}" | ||
_dest_file = "${root_out_dir}/${_zip_path}" | ||
|
||
args = [ | ||
_source_file, | ||
rebase_path(_dest_file), | ||
] | ||
|
||
inputs = [ "//build/ten_common/scripts/download.py" ] | ||
outputs = [ _dest_file ] | ||
} | ||
|
||
_is_shared_library = | ||
defined(invoker.is_shared_library) && invoker.is_shared_library | ||
|
||
_lib_prefix = "lib" | ||
_lib_postfix = "" | ||
if (_is_shared_library) { | ||
if (is_linux) { | ||
_lib_postfix = ".so" | ||
} else if (is_win) { | ||
_lib_postfix = ".dll" | ||
} else if (is_mac) { | ||
_lib_postfix = ".dylib" | ||
} else { | ||
assert(0, "Unsupported platform.") | ||
} | ||
} else { | ||
_lib_postfix = ".a" | ||
} | ||
|
||
# Construct the actual library file name. | ||
_lib_file_paths = [] | ||
foreach(lib, invoker.libs) { | ||
_lib_file_paths += | ||
[ "${root_out_dir}/${_dir_path}/${_lib_prefix}${lib}${_lib_postfix}" ] | ||
} | ||
|
||
_unzip_target = "${target_name}_lib_unzip" | ||
action(_unzip_target) { | ||
script = "//build/ten_common/scripts/unzip.py" | ||
|
||
_source_file = "${root_out_dir}/${_zip_path}" | ||
|
||
args = [ | ||
rebase_path(_source_file), | ||
rebase_path(_dir_path), | ||
] | ||
|
||
inputs = [ | ||
_source_file, | ||
"//build/ten_common/scripts/unzip.py", | ||
] | ||
|
||
outputs = [ "${root_out_dir}/${_dir_path}" ] | ||
outputs += _lib_file_paths | ||
|
||
# Need to complete the downloading first. | ||
deps = [ ":${_download_target}" ] | ||
} | ||
|
||
config("${target_name}_config") { | ||
libs = invoker.libs | ||
lib_dirs = [ rebase_path("${root_out_dir}/${_dir_path}") ] | ||
|
||
if (defined(invoker.extra_ldflags) && invoker.extra_ldflags != []) { | ||
if (!defined(ldflags)) { | ||
ldflags = [] | ||
} | ||
|
||
ldflags += invoker.extra_ldflags | ||
} | ||
} | ||
|
||
group(target_name) { | ||
forward_variables_from(invoker, | ||
[ | ||
"deps", | ||
"public_deps", | ||
"data_deps", | ||
"testonly", | ||
"visibility", | ||
]) | ||
|
||
if (!defined(deps)) { | ||
deps = [] | ||
} | ||
|
||
# Need to complete the unzip. | ||
deps += [ | ||
# ":${_delete_zip_target}", | ||
":${_unzip_target}", | ||
] | ||
|
||
# To enable the caller to 'depends' on the prebuilt libraries. | ||
# public_deps = [ ":${_delete_zip_target}" ] | ||
public_deps = [ ":${_unzip_target}" ] | ||
|
||
# Inject the header file inclusion path into the caller. | ||
public_configs = [ ":${target_name}_config" ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import sys | ||
import requests | ||
|
||
|
||
def download_file(url, output_path): | ||
response = requests.get(url, stream=True) | ||
response.raise_for_status() | ||
with open(output_path, "wb") as file: | ||
for chunk in response.iter_content(chunk_size=8192): | ||
file.write(chunk) | ||
|
||
|
||
if __name__ == "__main__": | ||
download_file(sys.argv[1], sys.argv[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright © 2025 Agora | ||
# This file is part of TEN Framework, an open source project. | ||
# Licensed under the Apache License, Version 2.0, with certain conditions. | ||
# Refer to the "LICENSE" file in the root directory for more information. | ||
# | ||
import zipfile | ||
import sys | ||
import os | ||
|
||
|
||
def unzip_file(src_path, dest_path) -> int | None: | ||
if not os.path.exists(src_path): | ||
return -1 | ||
|
||
src_dir = os.path.dirname(src_path) | ||
dst_dir = src_dir if dest_path == "" else dest_path | ||
if not os.path.exists(dst_dir): | ||
os.makedirs(dst_dir) | ||
|
||
zip_ref = zipfile.ZipFile(src_path, "r") | ||
zip_ref.extractall(dst_dir) | ||
zip_ref.close() | ||
|
||
|
||
def main(argv): | ||
if len(argv) < 2: | ||
return -1 | ||
dest_path = "" if len(argv) < 3 else argv[2] | ||
return unzip_file(argv[0], dest_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main(sys.argv[1:])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.