| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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/features.gni") | 5 import("//build/config/features.gni") |
| 6 | 6 |
| 7 assert(!is_android || enable_plugins, | 7 assert(!is_android || enable_plugins, |
| 8 "//ppapi should not be referenced when is_android && !enable_plugins") | 8 "//ppapi should not be referenced when is_android && !enable_plugins") |
| 9 | 9 |
| 10 if (is_mac) { | 10 if (is_mac) { |
| 11 import("//build/config/mac/rules.gni") | 11 import("//build/config/mac/rules.gni") |
| 12 } | 12 } |
| 13 | 13 |
| 14 copy("copy_test_files") { | 14 copy("copy_test_files") { |
| 15 visibility = [ ":*" ] | 15 visibility = [ ":*" ] |
| 16 sources = [ | 16 sources = [ |
| 17 # Keep "test_case.html.mock-http-headers" with "test_case.html". | 17 # Keep "test_case.html.mock-http-headers" with "test_case.html". |
| 18 "tests/ppapi_nacl_tests_newlib.nmf", | |
| 19 "tests/test_case.html", | 18 "tests/test_case.html", |
| 20 "tests/test_case.html.mock-http-headers", | 19 "tests/test_case.html.mock-http-headers", |
| 21 "tests/test_page.css", | 20 "tests/test_page.css", |
| 22 "tests/test_page.css.mock-http-headers", | 21 "tests/test_page.css.mock-http-headers", |
| 23 ] | 22 ] |
| 24 outputs = [ | 23 outputs = [ |
| 25 "$root_out_dir/{{source_file_part}}", | 24 "$root_out_dir/{{source_file_part}}", |
| 26 ] | 25 ] |
| 27 } | 26 } |
| 28 | 27 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 "lib/gl/gles2/gl2ext_ppapi.c", | 279 "lib/gl/gles2/gl2ext_ppapi.c", |
| 281 "lib/gl/gles2/gl2ext_ppapi.h", | 280 "lib/gl/gles2/gl2ext_ppapi.h", |
| 282 "lib/gl/gles2/gles2.c", | 281 "lib/gl/gles2/gles2.c", |
| 283 ] | 282 ] |
| 284 deps = [ | 283 deps = [ |
| 285 "//ppapi/cpp", | 284 "//ppapi/cpp", |
| 286 ] | 285 ] |
| 287 } | 286 } |
| 288 | 287 |
| 289 if (enable_nacl) { | 288 if (enable_nacl) { |
| 289 import("//ppapi/native_client/nacl_test_data.gni") |
| 290 |
| 290 if (is_nacl) { | 291 if (is_nacl) { |
| 291 executable("ppapi_nacl_tests_nexe") { | 292 nacl_test_data("ppapi_nacl_tests") { |
| 292 output_name = "ppapi_nacl_tests" | |
| 293 include_dirs = [ "lib/gl/include" ] | 293 include_dirs = [ "lib/gl/include" ] |
| 294 sources = ppapi_sources.test_common_source_files + | 294 sources = ppapi_sources.test_common_source_files + |
| 295 ppapi_sources.test_nacl_source_files | 295 ppapi_sources.test_nacl_source_files |
| 296 defines = [ | 296 defines = [ |
| 297 "GL_GLEXT_PROTOTYPES", | 297 "GL_GLEXT_PROTOTYPES", |
| 298 "PPAPI_TEST_IMPLEMENTATION", | 298 "PPAPI_TEST_IMPLEMENTATION", |
| 299 ] | 299 ] |
| 300 ldflags = [ "-pthread" ] | |
| 301 deps = [ | 300 deps = [ |
| 302 ":ppapi_cpp_lib", | 301 ":ppapi_cpp_lib", |
| 303 "//build/config/nacl:nacl_base", | |
| 304 "//ppapi/native_client:ppapi_lib", | |
| 305 ] | |
| 306 } | |
| 307 | |
| 308 if (current_cpu == "pnacl") { | |
| 309 action("translate_pexe_to_nexe") { | |
| 310 # We specify the toolchain explicitly because in the Non-SFI case, we | |
| 311 # still want to use the pexe built using the newlib_pnacl toolchain. | |
| 312 tests = ":ppapi_nacl_tests_nexe(//build/toolchain/nacl:newlib_pnacl)" | |
| 313 | |
| 314 pexe = get_label_info(tests, "root_out_dir") + "/ppapi_nacl_tests.pexe" | |
| 315 nexe = "${root_out_dir}/ppapi_nacl_tests.nexe" | |
| 316 | |
| 317 script = "${nacl_toolchain_bindir}/pydir/loader.py" | |
| 318 sources = [ | |
| 319 pexe, | |
| 320 ] | |
| 321 outputs = [ | |
| 322 nexe, | |
| 323 ] | |
| 324 | |
| 325 if (is_nacl_nonsfi) { | |
| 326 if (target_cpu == "x86" || target_cpu == "x64") { | |
| 327 arch = "x86-32-nonsfi" | |
| 328 } else if (target_cpu == "arm") { | |
| 329 arch = "arm-nonsfi" | |
| 330 } | |
| 331 } else { | |
| 332 # TODO(phosek): remove the following once change 1360243003 is rolled | |
| 333 # into Chrome and use $target_cpu directly. | |
| 334 if (target_cpu == "x86") { | |
| 335 arch = "i686" | |
| 336 } else if (target_cpu == "x64") { | |
| 337 arch = "x86-64" | |
| 338 } else if (target_cpu == "arm") { | |
| 339 arch = "armv7" | |
| 340 } | |
| 341 } | |
| 342 | |
| 343 # The pre-translated object file has to be linked with an IRT shim to | |
| 344 # get a runnable nexe. This is handled by pnacl-translate, which passes | |
| 345 # -l:libpnacl_irt_shim.a to native linker, and we need to ensure the | |
| 346 # linker can find the correct library. | |
| 347 if (is_nacl_nonsfi) { | |
| 348 pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:a
ot(//build/toolchain/nacl:newlib_pnacl_nonsfi)" | |
| 349 } else { | |
| 350 pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:a
ot(//build/toolchain/nacl:clang_newlib_${target_cpu})" | |
| 351 } | |
| 352 | |
| 353 args = [ | |
| 354 "pnacl-translate", | |
| 355 rebase_path(pexe, root_build_dir), | |
| 356 "-o", | |
| 357 rebase_path(nexe, root_build_dir), | |
| 358 "-arch", | |
| 359 arch, | |
| 360 "-Wl,-L" + | |
| 361 rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir")), | |
| 362 ] | |
| 363 deps = [ | |
| 364 tests, | |
| 365 ] | |
| 366 data_deps = [ | |
| 367 pnacl_irt_shim, | |
| 368 ] | |
| 369 } | |
| 370 } | |
| 371 | |
| 372 copy("ppapi_nacl_tests_copy") { | |
| 373 sources = [ | |
| 374 "${root_out_dir}/ppapi_nacl_tests.nexe", | |
| 375 ] | |
| 376 | |
| 377 # The CPU names used in tests/ppapi_nacl_tests_newlib.nmf | |
| 378 # are the ones used in GYP (x32 for x86). | |
| 379 if (target_cpu == "x86" || | |
| 380 (is_nacl_nonsfi && (target_cpu == "x86" || target_cpu == "x64"))) { | |
| 381 nmf_cpu = "x32" | |
| 382 } else { | |
| 383 nmf_cpu = target_cpu | |
| 384 } | |
| 385 if (current_cpu == "pnacl") { | |
| 386 if (is_nacl_nonsfi) { | |
| 387 suffix = "pnacl_newlib_${nmf_cpu}_nonsfi" | |
| 388 } else { | |
| 389 suffix = "pnacl_newlib_${nmf_cpu}" | |
| 390 } | |
| 391 } else if (is_nacl_glibc) { | |
| 392 suffix = "glibc_${nmf_cpu}" | |
| 393 } else { | |
| 394 suffix = "newlib_${nmf_cpu}" | |
| 395 } | |
| 396 outputs = [ | |
| 397 "${root_build_dir}/{{source_name_part}}_${suffix}.nexe", | |
| 398 ] | 302 ] |
| 399 if (current_cpu == "pnacl") { | 303 if (current_cpu == "pnacl") { |
| 400 deps = [ | 304 pretranslate_pexe = true |
| 401 ":translate_pexe_to_nexe", | |
| 402 ] | |
| 403 } else { | |
| 404 deps = [ | |
| 405 ":ppapi_nacl_tests_nexe", | |
| 406 ] | |
| 407 } | 305 } |
| 408 } | 306 } |
| 409 | |
| 410 if (is_nacl_nonsfi) { | |
| 411 generate_nonsfi_test_nmf("ppapi_nacl_tests_nmf") { | |
| 412 nmf = "${root_build_dir}/ppapi_nacl_tests_pnacl_nonsfi.nmf" | |
| 413 files = get_target_outputs(":ppapi_nacl_tests_copy") | |
| 414 executable = files[0] | |
| 415 deps = [ | |
| 416 ":ppapi_nacl_tests_copy", | |
| 417 ] | |
| 418 } | |
| 419 } else { | |
| 420 generate_nmf("ppapi_nacl_tests_nmf") { | |
| 421 if (is_nacl_glibc) { | |
| 422 nmf = "${root_build_dir}/ppapi_nacl_tests_glibc.nmf" | |
| 423 stage_dependencies = root_build_dir | |
| 424 } else if (current_cpu == "pnacl") { | |
| 425 nmf = "${root_build_dir}/ppapi_nacl_tests_pnacl.nmf" | |
| 426 } else { | |
| 427 nmf = "${root_build_dir}/ppapi_nacl_tests_newlib.nmf" | |
| 428 } | |
| 429 executables = get_target_outputs(":ppapi_nacl_tests_copy") | |
| 430 deps = [ | |
| 431 ":ppapi_nacl_tests_copy", | |
| 432 ] | |
| 433 } | |
| 434 } | |
| 435 | |
| 436 group("ppapi_nacl_tests") { | |
| 437 data_deps = [ | |
| 438 ":ppapi_nacl_tests_copy", | |
| 439 ":ppapi_nacl_tests_nmf", | |
| 440 ] | |
| 441 } | |
| 442 } | 307 } |
| 443 | 308 |
| 444 group("ppapi_nacl_tests_all") { | 309 group("ppapi_nacl_tests_all") { |
| 445 data_deps = [ | 310 data_deps = [ |
| 446 ":copy_test_files", | 311 ":copy_test_files", |
| 447 ":ppapi_nacl_tests_copy(//build/toolchain/nacl:clang_newlib_${target_cpu})
", | 312 ":ppapi_nacl_tests(//build/toolchain/nacl:clang_newlib_${target_cpu})", |
| 448 ":ppapi_nacl_tests(//build/toolchain/nacl:glibc_${target_cpu})", | 313 ":ppapi_nacl_tests(//build/toolchain/nacl:glibc_${target_cpu})", |
| 449 ":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl)", | 314 ":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl)", |
| 450 ":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl_nonsfi)", | 315 ":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl_nonsfi)", |
| 451 ] | 316 ] |
| 452 } | 317 } |
| 453 } | 318 } |
| OLD | NEW |