Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/nacl/rules.gni") | 5 import("//build/config/nacl/rules.gni") |
| 6 | 6 |
| 7 assert(enable_nacl) | 7 assert(enable_nacl) |
| 8 | 8 |
| 9 if (current_cpu == "pnacl") { | 9 if (current_cpu == "pnacl") { |
| 10 if (is_nacl_nonsfi) { | 10 if (is_nacl_nonsfi) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 # | 22 # |
| 23 # Build a Native Client based test, including any additional support files | 23 # Build a Native Client based test, including any additional support files |
| 24 # and copy them over to a toolchain-specific target directory. | 24 # and copy them over to a toolchain-specific target directory. |
| 25 # | 25 # |
| 26 # Variables: | 26 # Variables: |
| 27 # output_name: name of the ouput file other than the default | 27 # output_name: name of the ouput file other than the default |
| 28 # sources: source files for a target | 28 # sources: source files for a target |
| 29 # generate_nmf: whether to generate a manifest (default true) | 29 # generate_nmf: whether to generate a manifest (default true) |
| 30 # nonstable_pexe: use non-finalized pexe | 30 # nonstable_pexe: use non-finalized pexe |
| 31 # debug_pexe: copy both non-finalized and finalized pexe | 31 # debug_pexe: copy both non-finalized and finalized pexe |
| 32 # destination_dir: the output directory relative to the $root_build_dir | 32 # destination_dir: the output directory relative to the $root_build_dir |
|
Roland McGrath
2016/05/06 23:07:23
Say that it's optional and what omitting it means.
Petr Hosek
2016/05/06 23:21:06
Done.
| |
| 33 # test_files: additional test files to copy to $destination_dir | 33 # test_files: additional test files to copy to $destination_dir |
| 34 # nmfflags: additional flags for the nmf generator | 34 # nmfflags: additional flags for the nmf generator |
| 35 template("nacl_test_data") { | 35 template("nacl_test_data") { |
| 36 assert(defined(invoker.sources)) | 36 assert(defined(invoker.sources)) |
| 37 assert(defined(invoker.destination_dir)) | |
| 38 forward_variables_from(invoker, [ "destination_dir" ]) | 37 forward_variables_from(invoker, [ "destination_dir" ]) |
| 39 | 38 |
| 40 if (defined(invoker.output_name)) { | 39 if (defined(invoker.output_name)) { |
| 41 output_name = invoker.output_name | 40 output_name = invoker.output_name |
| 42 } else { | 41 } else { |
| 43 output_name = target_name | 42 output_name = target_name |
| 44 } | 43 } |
| 45 | 44 |
| 45 if (defined(invoker.destination_dir)) { | |
|
Roland McGrath
2016/05/06 23:07:23
This needs a comment about why the cases differ.
Petr Hosek
2016/05/06 23:21:06
Done.
| |
| 46 target_dir = | |
| 47 "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}" | |
| 48 } else { | |
| 49 target_dir = root_build_dir | |
| 50 } | |
| 51 | |
| 46 if (current_cpu == "x64") { | 52 if (current_cpu == "x64") { |
| 47 nmf_cpu = "x86_64" | 53 nmf_cpu = "x86_64" |
| 48 } else if (current_cpu == "x86") { | 54 } else if (current_cpu == "x86") { |
| 49 nmf_cpu = "x86_32" | 55 nmf_cpu = "x86_32" |
| 50 } else { | 56 } else { |
| 51 nmf_cpu = current_cpu | 57 nmf_cpu = current_cpu |
| 52 } | 58 } |
| 53 if (is_nacl_glibc) { | 59 if (is_nacl_glibc) { |
| 54 suffix = "glibc_${nmf_cpu}" | 60 suffix = "glibc_${nmf_cpu}" |
| 55 } else { | 61 } else { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 66 pexe_translate_target_name = target_name + "_translate_pexe" | 72 pexe_translate_target_name = target_name + "_translate_pexe" |
| 67 } | 73 } |
| 68 nexe_copy_target_name = target_name + "_copy_nexe" | 74 nexe_copy_target_name = target_name + "_copy_nexe" |
| 69 if (current_cpu == "pnacl" && !is_nacl_nonsfi) { | 75 if (current_cpu == "pnacl" && !is_nacl_nonsfi) { |
| 70 if (defined(invoker.debug_pexe) && invoker.debug_pexe) { | 76 if (defined(invoker.debug_pexe) && invoker.debug_pexe) { |
| 71 pexe_copy_debug_target_name = target_name + "_copy_pexe_debug" | 77 pexe_copy_debug_target_name = target_name + "_copy_pexe_debug" |
| 72 } | 78 } |
| 73 } | 79 } |
| 74 if (generate_nmf) { | 80 if (generate_nmf) { |
| 75 nmf_target_name = target_name + "_nmf" | 81 nmf_target_name = target_name + "_nmf" |
| 82 if (defined(invoker.destination_dir)) { | |
|
Roland McGrath
2016/05/06 23:07:23
It would be cleaner if this can be moved up to joi
Petr Hosek
2016/05/06 23:21:06
Done.
| |
| 83 nmf_name = output_name | |
| 84 } else { | |
| 85 if (is_nacl_nonsfi) { | |
| 86 nacl_toolchain_name = "pnacl_${nacl_toolchain_variant}" | |
| 87 } else { | |
| 88 nacl_toolchain_name = nacl_toolchain_variant | |
| 89 } | |
| 90 nmf_name = "${output_name}_${nacl_toolchain_name}" | |
| 91 } | |
| 76 } | 92 } |
| 77 if (defined(invoker.test_files)) { | 93 if (defined(invoker.test_files)) { |
| 78 test_files_target_name = target_name + "_test_files" | 94 test_files_target_name = target_name + "_test_files" |
| 79 } | 95 } |
| 80 final_target_name = target_name | 96 final_target_name = target_name |
| 81 | 97 |
| 82 executable(nexe_target_name) { | 98 executable(nexe_target_name) { |
| 83 visibility = [ ":*" ] | 99 visibility = [ ":*" ] |
| 84 output_name = suffixed_output_name | 100 output_name = suffixed_output_name |
| 85 sources = invoker.sources | 101 sources = invoker.sources |
| 86 forward_variables_from(invoker, | 102 forward_variables_from(invoker, |
| 87 [ | 103 [ |
| 104 "defines", | |
|
Roland McGrath
2016/05/06 23:07:23
alphasort the list
Petr Hosek
2016/05/06 23:21:06
Done.
| |
| 105 "include_dirs", | |
| 88 "cflags", | 106 "cflags", |
| 89 "ldflags", | 107 "ldflags", |
| 90 "libs", | 108 "libs", |
| 91 ]) | 109 ]) |
| 92 deps = [ | 110 deps = [ |
| 93 "//build/config/nacl:nacl_base", | 111 "//build/config/nacl:nacl_base", |
| 94 "//ppapi/native_client:ppapi_lib", | 112 "//ppapi/native_client:ppapi_lib", |
| 95 ] | 113 ] |
| 96 ldflags = [ "-pthread" ] | 114 ldflags = [ "-pthread" ] |
| 97 if (defined(invoker.deps)) { | 115 if (defined(invoker.deps)) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 ] | 186 ] |
| 169 } | 187 } |
| 170 } else if (is_nacl_nonsfi) { | 188 } else if (is_nacl_nonsfi) { |
| 171 sources = get_target_outputs(":${pexe_translate_target_name}") | 189 sources = get_target_outputs(":${pexe_translate_target_name}") |
| 172 } else { | 190 } else { |
| 173 sources = [ | 191 sources = [ |
| 174 "${root_out_dir}/${suffixed_output_name}.nexe", | 192 "${root_out_dir}/${suffixed_output_name}.nexe", |
| 175 ] | 193 ] |
| 176 } | 194 } |
| 177 outputs = [ | 195 outputs = [ |
| 178 "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/{{source_f ile_part}}", | 196 "${target_dir}/{{source_file_part}}", |
| 179 ] | 197 ] |
| 180 if (is_nacl_nonsfi) { | 198 if (is_nacl_nonsfi) { |
| 181 deps = [ | 199 deps = [ |
| 182 ":$pexe_translate_target_name", | 200 ":$pexe_translate_target_name", |
| 183 ] | 201 ] |
| 184 } else { | 202 } else { |
| 185 deps = [ | 203 deps = [ |
| 186 ":$nexe_target_name", | 204 ":$nexe_target_name", |
| 187 ] | 205 ] |
| 188 } | 206 } |
| 189 } | 207 } |
| 190 | 208 |
| 191 if (current_cpu == "pnacl" && !is_nacl_nonsfi) { | 209 if (current_cpu == "pnacl" && !is_nacl_nonsfi) { |
| 192 if (defined(invoker.debug_pexe) && invoker.debug_pexe) { | 210 if (defined(invoker.debug_pexe) && invoker.debug_pexe) { |
| 193 copy(pexe_copy_debug_target_name) { | 211 copy(pexe_copy_debug_target_name) { |
| 194 visibility = [ ":$final_target_name" ] | 212 visibility = [ ":$final_target_name" ] |
| 195 sources = [ | 213 sources = [ |
| 196 "${root_out_dir}/exe.unstripped/${suffixed_output_name}.pexe", | 214 "${root_out_dir}/exe.unstripped/${suffixed_output_name}.pexe", |
| 197 ] | 215 ] |
| 198 outputs = [ | 216 outputs = [ |
| 199 "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/{{sour ce_name_part}}.pexe.debug", | 217 "${target_dir}/{{source_name_part}}.pexe.debug", |
| 200 ] | 218 ] |
| 201 deps = [ | 219 deps = [ |
| 202 ":$nexe_target_name", | 220 ":$nexe_target_name", |
| 203 ] | 221 ] |
| 204 } | 222 } |
| 205 } | 223 } |
| 206 } | 224 } |
| 207 | 225 |
| 208 if (generate_nmf) { | 226 if (generate_nmf) { |
| 209 if (is_nacl_nonsfi) { | 227 if (is_nacl_nonsfi) { |
| 210 generate_nonsfi_test_nmf(nmf_target_name) { | 228 generate_nonsfi_test_nmf(nmf_target_name) { |
| 211 visibility = [ ":$final_target_name" ] | 229 visibility = [ ":$final_target_name" ] |
| 212 forward_variables_from(invoker, [ "nmfflags" ]) | 230 forward_variables_from(invoker, [ "nmfflags" ]) |
| 213 nmf = "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/${ output_name}.nmf" | 231 nmf = "${target_dir}/${nmf_name}.nmf" |
| 214 files = get_target_outputs(":$nexe_copy_target_name") | 232 files = get_target_outputs(":$nexe_copy_target_name") |
| 215 executable = files[0] | 233 executable = files[0] |
| 216 deps = [ | 234 deps = [ |
| 217 ":$nexe_copy_target_name", | 235 ":$nexe_copy_target_name", |
| 218 ] | 236 ] |
| 219 } | 237 } |
| 220 } else { | 238 } else { |
| 221 generate_nmf(nmf_target_name) { | 239 generate_nmf(nmf_target_name) { |
| 222 visibility = [ ":$final_target_name" ] | 240 visibility = [ ":$final_target_name" ] |
| 223 forward_variables_from(invoker, [ "nmfflags" ]) | 241 forward_variables_from(invoker, [ "nmfflags" ]) |
| 224 nmf = "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/${ output_name}.nmf" | 242 nmf = "${target_dir}/${nmf_name}.nmf" |
| 225 executables = get_target_outputs(":$nexe_copy_target_name") | 243 executables = get_target_outputs(":$nexe_copy_target_name") |
| 226 if (is_nacl_glibc) { | 244 if (is_nacl_glibc) { |
| 227 lib_prefix = "${output_name}_libs" | 245 lib_prefix = "${output_name}_libs" |
| 228 stage_dependencies = | 246 stage_dependencies = target_dir |
| 229 "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}" | |
| 230 } | 247 } |
| 231 deps = [ | 248 deps = [ |
| 232 ":$nexe_copy_target_name", | 249 ":$nexe_copy_target_name", |
| 233 ] | 250 ] |
| 234 } | 251 } |
| 235 } | 252 } |
| 236 } | 253 } |
| 237 | 254 |
| 238 if (defined(invoker.test_files)) { | 255 if (defined(invoker.test_files)) { |
| 239 copy(test_files_target_name) { | 256 copy(test_files_target_name) { |
| 240 visibility = [ ":$final_target_name" ] | 257 visibility = [ ":$final_target_name" ] |
| 241 sources = invoker.test_files | 258 sources = invoker.test_files |
| 242 outputs = [ | 259 outputs = [ |
| 243 "${root_build_dir}/${destination_dir}/${nacl_toolchain_variant}/{{source _file_part}}", | 260 "${target_dir}/{{source_file_part}}", |
| 244 ] | 261 ] |
| 245 } | 262 } |
| 246 } | 263 } |
| 247 | 264 |
| 248 group(final_target_name) { | 265 group(final_target_name) { |
| 249 data_deps = [ | 266 data_deps = [ |
| 250 ":$nexe_copy_target_name", | 267 ":$nexe_copy_target_name", |
| 251 ] | 268 ] |
| 252 if (current_cpu == "pnacl" && !is_nacl_nonsfi) { | 269 if (current_cpu == "pnacl" && !is_nacl_nonsfi) { |
| 253 if (defined(invoker.debug_pexe) && invoker.debug_pexe) { | 270 if (defined(invoker.debug_pexe) && invoker.debug_pexe) { |
| 254 data_deps += [ ":$pexe_copy_debug_target_name" ] | 271 data_deps += [ ":$pexe_copy_debug_target_name" ] |
| 255 } | 272 } |
| 256 } | 273 } |
| 257 if (generate_nmf) { | 274 if (generate_nmf) { |
| 258 data_deps += [ ":$nmf_target_name" ] | 275 data_deps += [ ":$nmf_target_name" ] |
| 259 } | 276 } |
| 260 if (defined(invoker.test_files)) { | 277 if (defined(invoker.test_files)) { |
| 261 data_deps += [ ":$test_files_target_name" ] | 278 data_deps += [ ":$test_files_target_name" ] |
| 262 } | 279 } |
| 263 } | 280 } |
| 264 } | 281 } |
| OLD | NEW |