1# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. 2 3import("//build/ohos.gni") 4 5if (target_cpu == "arm") { 6 config("ffi_config") { 7 visibility = [ ":*" ] 8 9 include_dirs = [ 10 ".", 11 "./include", 12 "./src/arm", 13 ] 14 15 cflags = [ 16 "-DTARGET=ARM", 17 "-Wno-sign-compare", 18 "-Wno-implicit-function-declaration", 19 "-Wno-extern-initializer", 20 ] 21 } 22 23 ohos_source_set("ffi_source") { 24 sources = [ 25 "src/arm/ffi.c", 26 "src/arm/sysv.S", 27 "src/closures.c", 28 "src/java_raw_api.c", 29 "src/prep_cif.c", 30 "src/raw_api.c", 31 "src/types.c", 32 ] 33 34 configs = [ ":ffi_config" ] 35 } 36} else if (target_cpu == "x86_64") { 37 config("ffi_config") { 38 visibility = [ ":*" ] 39 40 include_dirs = [ 41 ".", 42 "./include", 43 "./src/x86", 44 ] 45 46 cflags = [ 47 "-DTARGET=X86_64", 48 "-Wno-sign-compare", 49 "-Wno-implicit-function-declaration", 50 "-Wno-extern-initializer", 51 ] 52 } 53 54 ohos_source_set("ffi_source") { 55 sources = [ 56 "src/closures.c", 57 "src/java_raw_api.c", 58 "src/prep_cif.c", 59 "src/raw_api.c", 60 "src/types.c", 61 "src/x86/ffi64.c", 62 "src/x86/unix64.S", 63 ] 64 65 configs = [ ":ffi_config" ] 66 } 67} else { 68 config("ffi_config") { 69 visibility = [ ":*" ] 70 71 include_dirs = [ 72 ".", 73 "./include", 74 "./src/aarch64", 75 ] 76 77 cflags = [ 78 "-DTARGET=AARCH64", 79 "-Wno-sign-compare", 80 "-Wno-implicit-function-declaration", 81 "-Wno-extern-initializer", 82 ] 83 } 84 85 ohos_source_set("ffi_source") { 86 sources = [ 87 "src/aarch64/ffi.c", 88 "src/aarch64/sysv.S", 89 "src/closures.c", 90 "src/java_raw_api.c", 91 "src/prep_cif.c", 92 "src/raw_api.c", 93 "src/types.c", 94 ] 95 96 configs = [ ":ffi_config" ] 97 } 98} 99 100config("ffi_public_config") { 101 include_dirs = [ "include" ] 102} 103 104ohos_shared_library("ffi") { 105 deps = [ ":ffi_source" ] 106 107 public_configs = [ ":ffi_public_config" ] 108 109 part_name = "libffi" 110 subsystem_name = "thirdparty" 111} 112