1# Copyright (C) 2023-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15 16src_path = "//third_party/liburing" 17out_dir = root_out_dir + "/third_party_liburing" 18code_dir = out_dir + "/liburing" 19 20liburing_source = [ 21 "src/queue.c", 22 "src/register.c", 23 "src/setup.c", 24 "src/syscall.c", 25] 26 27config("liburing_config") { 28 visibility = [ ":*" ] 29 30 include_dirs = [ 31 "$code_dir", 32 "$code_dir/src", 33 "$code_dir/src/include", 34 "$code_dir/src/include/liburing", 35 "$code_dir/src/arch", 36 ] 37} 38 39action("liburing_configure") { 40 script = "install.sh" 41 args = [ 42 rebase_path(src_path), 43 rebase_path(out_dir), 44 ] 45 inputs = [ src_path ] 46 outputs = [] 47 foreach(src, liburing_source) { 48 outputs += [ "$code_dir/" + src ] 49 } 50} 51 52ohos_shared_library("liburing") { 53 public_configs = [ ":liburing_config" ] 54 sources = [] 55 foreach(src, liburing_source) { 56 sources += [ "$code_dir/" + src ] 57 } 58 deps = [ ":liburing_configure" ] 59 subsystem_name = "thirdparty" 60 part_name = "liburing" 61 innerapi_tags = [ "platformsdk" ] 62 output_name = "liburing" 63 output_extension = "so" 64 install_images = [ "system" ] 65} 66 67## build for liburing test ## 68ohos_executable("liburing_example_io_uring") { 69 sources = [ "examples/io_uring-test.c" ] 70 configs = [ ":liburing_config" ] 71 deps = [ ":liburing" ] 72 73 install_enable = false 74 subsystem_name = "thirdparty" 75 part_name = "liburing" 76} 77 78ohos_executable("liburing_example_io_uring_close") { 79 sources = [ "examples/io_uring-close-test.c" ] 80 include_dirs = [ "test" ] 81 configs = [ ":liburing_config" ] 82 deps = [ ":liburing" ] 83 84 install_enable = false 85 subsystem_name = "thirdparty" 86 part_name = "liburing" 87} 88 89group("uring_test") { 90 deps = [ 91 ":liburing_example_io_uring", 92 ":liburing_example_io_uring_close", 93 ] 94} 95