1# Copyright (c) 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") 15import("//foundation/graphic/graphic_3d/lume/lume_config.gni") 16 17declare_args() { 18 CAM_PREVIEW_EMBEDDED_ASSETS_ENABLED = true 19 CAM_PREVIEW_ROFS = "campreviewrofs" 20} 21 22config("campreview_api") { 23 include_dirs = [ "api" ] 24 25 defines = [] 26 27 if (BUILDTYPE == "Release") { 28 defines += [ "PLUGIN_LOG_NO_DEBUG=0" ] 29 } 30 31 if (BUILDTYPE == "MinSizeRel") { 32 defines += [ "PLUGIN_LOG_NO_DEBUG=0" ] 33 } 34 35 if (BUILDTYPE == "RelWithDebInfo") { 36 defines += [ "PLUGIN_LOG_NO_DEBUG=0" ] 37 } 38 39 if (LUME_OHOS_BUILD) { 40 defines += [ "__OHOS_PLATFORM__" ] 41 } 42 43 cflags = [ 44 "-Wno-nullability-completeness", 45 "-Wno-ignored-qualifiers", 46 "-Wno-switch", 47 ] 48} 49 50config("campreview_config") { 51 if (CAM_PREVIEW_EMBEDDED_ASSETS_ENABLED) { 52 defines = [ 53 "CAM_PREVIEW_EMBEDDED_ASSETS_ENABLED=1", 54 "CORE_PLUGIN=1", 55 ] 56 } 57 58 cflags = [ 59 "-Wno-nullability-completeness", 60 "-Wno-ignored-qualifiers", 61 "-Wno-switch", 62 ] 63 64 defines += [ 65 "RENDER_HAS_GLES_BACKEND=1", 66 "RENDER_HAS_VULKAN_BACKEND=1", 67 "VMA_STATS_STRING_ENABLED=0", 68 "VMA_STATIC_VULKAN_FUNCTIONS=0", 69 ] 70} 71 72lume_compile_shader("cam_preview_compile_shader") { 73 script = "${LUME_CORE_PATH}/tools/CompilerShader.sh" 74 outputs = [ "$target_gen_dir" ] 75 tool_path = "$target_gen_dir/../lume/LumeBinaryCompile/LumeShaderCompiler" 76 dest_gen_path = "$target_gen_dir/assets" 77 asset_path = rebase_path("./assets", root_build_dir) 78 shader_path = "${dest_gen_path}/shaders" 79 include_path = rebase_path("${LUME_CORE3D_PATH}/api", root_build_dir) 80 render_include_path = "${LUME_PATH}/${RENDER_DIR_NAME}/api/" 81 compileShader_deps = 82 [ "${LUME_BINARY_PATH}/LumeShaderCompiler:lume_binary_shader_compile" ] 83} 84 85lume_rofs("CAM_PREVIEW_ROFS") { 86 output_obj = "" 87 if (target_cpu == "arm") { 88 output_obj = "${CAM_PREVIEW_ROFS}_32.o" 89 } 90 91 if (target_cpu == "arm64") { 92 output_obj = "${CAM_PREVIEW_ROFS}_64.o" 93 } 94 95 outputs = "${target_gen_dir}/assets/${output_obj}" 96 97 tool_path = "$target_gen_dir/../lume/LumeBinaryCompile/lumeassetcompiler" 98 root = "/" 99 bin_name = "CAM_PREVIEW_BIN" 100 size_name = "CAM_PREVIEW_BIN_SIZE" 101 base_name = CAM_PREVIEW_ROFS 102 script = "${LUME_CORE_PATH}/tools/CompilerAsset.sh" 103 copy_path = "$target_gen_dir/assets" 104 compileShader_deps = [ 105 ":cam_preview_compile_shader", 106 "${LUME_BINARY_PATH}/lumeassetcompiler:lume_binary_assets_compile", 107 ] 108 file_extension = "\".spv;.json;.lsb;.shader;.shadergs;.shadervid;.shaderpl;.rng;.gl;.gles\"" 109} 110 111source_set("campreview_rofs_obj") { 112 output_obj = "" 113 if (target_cpu == "arm") { 114 output_obj = "${CAM_PREVIEW_ROFS}_32.o" 115 } 116 117 if (target_cpu == "arm64") { 118 output_obj = "${CAM_PREVIEW_ROFS}_64.o" 119 } 120 121 sources = [ "${target_gen_dir}/assets/${output_obj}" ] 122 deps = [ ":CAM_PREVIEW_ROFS" ] 123} 124 125ohos_source_set("campreview_src") { 126 sources = [ "src/component_dll.cpp" ] 127 include_dirs = [ "api" ] 128 129 configs = [ 130 ":campreview_api", 131 ":campreview_config", 132 "${LUME_CORE3D_PATH}:lume_3d_api", 133 "${LUME_RENDER_PATH}:lume_render_api", 134 "${LUME_CORE_PATH}:lume_base_api", 135 "${LUME_CORE_PATH}:lume_engine_api", 136 "${LUME_CORE_PATH}:lume_default", 137 "${LUME_CORE_PATH}:lume_component_help_config", 138 ] 139 140 deps = [] 141 142 external_deps = [ 143 "c_utils:utils", 144 "hilog:libhilog", 145 "hitrace:hitrace_meter", 146 ] 147 148 part_name = "graphic_3d" 149 subsystem_name = "graphic" 150} 151 152ohos_static_library("libCamPreview") { 153 public_deps = [ 154 ":campreview_src", 155 "${LUME_CORE_PATH}:lume_component_help_src", 156 ] 157 158 if (CAM_PREVIEW_EMBEDDED_ASSETS_ENABLED) { 159 deps = [ ":campreview_rofs_obj" ] 160 } 161 part_name = "graphic_3d" 162 subsystem_name = "graphic" 163} 164 165ohos_shared_library(LIB_CAM_PREVIEW) { 166 public_deps = [ ":libCamPreview" ] 167 relative_install_dir = "graphics3d" 168 part_name = "graphic_3d" 169 subsystem_name = "graphic" 170} 171