From 25b138f06ff8e95ec5c05a717a6124be43e4eaf3 Mon Sep 17 00:00:00 2001 From: li_junsong Date: Thu, 29 Feb 2024 11:20:09 +0800 Subject: [PATCH] =?UTF-8?q?BUILD.gn=E4=B8=AD=E5=88=87=E6=8D=A2ffrt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li_junsong --- bundle.json | 1 + test/BUILD.gn | 16 ++++++++++++++++ ylong_ffrt/BUILD.gn | 27 +++++++++++++++++++++++++++ ylong_runtime/BUILD.gn | 11 +++++++++++ 4 files changed, 55 insertions(+) create mode 100644 ylong_ffrt/BUILD.gn diff --git a/bundle.json b/bundle.json index 4a14d87..981a72c 100644 --- a/bundle.json +++ b/bundle.json @@ -33,6 +33,7 @@ "build": { "sub_component": [ "//commonlibrary/rust/ylong_runtime/ylong_io:ylong_io", + "//commonlibrary/rust/ylong_runtime/ylong_ffrt:ylong_ffrt", "//commonlibrary/rust/ylong_runtime/ylong_signal:ylong_signal" ], "inner_kits": [ diff --git a/test/BUILD.gn b/test/BUILD.gn index 1d96d52..534f50c 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -26,6 +26,10 @@ ohos_rust_unittest("rust_ylong_runtime_test_ut") { "--cfg=feature=\"time\"", ] + if (is_linux) { + rustflags += [ "--cfg=feature=\"ffrt\"" ] + } + sources = [ "../ylong_runtime/src/lib.rs" ] deps = [ "../ylong_io:ylong_io", @@ -33,6 +37,10 @@ ohos_rust_unittest("rust_ylong_runtime_test_ut") { "../ylong_signal:ylong_signal", "//third_party/rust/crates/libc:lib", ] + + if (is_linux) { + deps += [ "../ylong_ffrt:ylong_ffrt" ] + } } ohos_rust_systemtest("rust_ylong_runtime_test_sdv") { @@ -49,11 +57,19 @@ ohos_rust_systemtest("rust_ylong_runtime_test_sdv") { "--cfg=feature=\"time\"", ] + if (is_linux) { + rustflags += [ "--cfg=feature=\"ffrt\"" ] + } + sources = [ "../ylong_runtime/tests/entry.rs" ] deps = [ "../ylong_runtime:ylong_runtime", "//third_party/rust/crates/libc:lib", ] + + if (is_linux) { + deps += [ "../ylong_ffrt:ylong_ffrt" ] + } } ohos_rust_systemtest("rust_ylong_signal_test_sdv") { diff --git a/ylong_ffrt/BUILD.gn b/ylong_ffrt/BUILD.gn new file mode 100644 index 0000000..8d3f00c --- /dev/null +++ b/ylong_ffrt/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +ohos_rust_static_library("ylong_ffrt") { + part_name = "ylong_runtime" + subsystem_name = "commonlibrary" + + crate_name = "ylong_ffrt" + edition = "2021" + + sources = [ "src/lib.rs" ] + deps = [ "//third_party/rust/crates/libc:lib" ] + + external_deps = [ "ffrt:libffrt" ] +} diff --git a/ylong_runtime/BUILD.gn b/ylong_runtime/BUILD.gn index 448e6f5..0fe32f6 100644 --- a/ylong_runtime/BUILD.gn +++ b/ylong_runtime/BUILD.gn @@ -30,11 +30,22 @@ ohos_rust_shared_library("ylong_runtime") { "time", ] + if (is_linux) { + features += [ "ffrt" ] + } + sources = [ "src/lib.rs" ] deps = [ + "../ylong_ffrt:ylong_ffrt", "../ylong_io:ylong_io", "../ylong_runtime_macros:ylong_runtime_macros(${host_toolchain})", "../ylong_signal:ylong_signal", "//third_party/rust/crates/libc:lib", ] + + if (is_linux) { + deps += [ "../ylong_ffrt:ylong_ffrt" ] + } + + external_deps = [ "ffrt:libffrt" ] } -- Gitee