diff --git a/BUILD.gn b/BUILD.gn index adca900093e8eda57425fc9b583aa67403692bf9..d8e0947839369bf87c21b5cdc0651f9a46373b28 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -17,7 +17,6 @@ group("ohos") { if (ohos_build_target == "") { # Step 1: Read product configuration profile. product_cfg = read_file("${product_path}/config.json", "json") - kernel = product_cfg.kernel_type # Step 2: Loop subsystems configured by product. foreach(product_configed_subsystem, product_cfg.subsystems) { @@ -54,14 +53,15 @@ group("ohos") { if (component.component == product_configed_component.component) { # Step 6.1.1: Loop OS components adapted kernel type. foreach(component_adapted_kernel, component.adapted_kernel) { - if (component_adapted_kernel == kernel && kernel_valid == false) { + if (component_adapted_kernel == product_cfg.kernel_type && + kernel_valid == false) { kernel_valid = true } } assert( kernel_valid, - "Invalid component configed, ${subsystem_name}:${product_configed_component.component} " + "not available for kernel: $kernel!") + "Invalid component configed, ${subsystem_name}:${product_configed_component.component} " + "not available for kernel: ${product_cfg.kernel_type}!") # Step 6.1.2: Add valid component for compiling. foreach(component_target, component.targets) { @@ -71,10 +71,12 @@ group("ohos") { } } } + # Step 7: Add device and product target by default. - deps += [ + deps += [ "${device_path}/../", - "${product_path}" ] + "${product_path}" + ] } else { deps += string_split(ohos_build_target, "&&") } diff --git a/config/BUILD.gn b/config/BUILD.gn index 948864338fa7a50329d89f8c582b95c6d267981e..6aa8e364bbca1291a76f644042d5946833cd530d 100755 --- a/config/BUILD.gn +++ b/config/BUILD.gn @@ -172,6 +172,7 @@ config("board_config") { cflags_cc = [] ldflags = [] include_dirs = [] + defines = [] cflags += board_cflags if (board_configed_sysroot != "") { cflags += [ "--sysroot=${board_configed_sysroot}" ] @@ -181,4 +182,14 @@ config("board_config") { cflags_cc += board_cxx_flags ldflags += board_ld_flags include_dirs += board_include_dirs + if (defined(board_macro_defines)) { + defines += board_macro_defines + } } + +config("board_exe_ld_flags") { + ldflags = [] + if (defined(board_exe_ld_flags)) { + ldflags += board_exe_ld_flags + } +} \ No newline at end of file diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn index e776ae03e7745d4bf59076eb3af38d1a030278e2..6de3cbd6e830b66c907095832e9a6459338aa8c7 100755 --- a/config/BUILDCONFIG.gn +++ b/config/BUILDCONFIG.gn @@ -54,7 +54,6 @@ if (board_toolchain != "" && use_board_toolchain) { ohos_current_as_command = ohos_current_cc_command ohos_current_ld_command = ohos_current_cc_command ohos_current_strip_command = "$compile_prefix/llvm-objcopy --strip-all" - default_target_configs = [ "//build/lite/config:clang" ] default_target_configs += [ "//build/lite/config:clang_opt" ] } } else { @@ -116,6 +115,7 @@ default_executable_configs = default_static_library_configs + set_defaults("executable") { configs = default_executable_configs + configs += [ "//build/lite/config:board_exe_ld_flags" ] } set_defaults("static_library") {