Skip to content

Commit

Permalink
[Mac/GN] Get //ppapi tests and examples working.
Browse files Browse the repository at this point in the history
BUG=431177

Review URL: https://codereview.chromium.org/1903623002

Cr-Commit-Position: refs/heads/master@{#388372}
  • Loading branch information
rsesek authored and Commit bot committed Apr 20, 2016
1 parent 79c079b commit 4a73557
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 15 deletions.
14 changes: 11 additions & 3 deletions build/config/mac/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ template("mac_plugin_bundle") {
_loadable_module_target = _target_name + "_loadable_module"
_loadable_module_bundle_data = _loadable_module_target + "_bundle_data"

_output_name = _target_name
if (defined(invoker.output_name)) {
_output_name = invoker.output_name
}

loadable_module(_loadable_module_target) {
visibility = [ ":$_loadable_module_bundle_data" ]
forward_variables_from(invoker,
Expand All @@ -389,15 +394,18 @@ template("mac_plugin_bundle") {
"output_name",
"visibility",
])
output_dir = "$target_out_dir"
output_name = _output_name
}

bundle_data(_loadable_module_bundle_data) {
forward_variables_from(invoker, [ "testonly" ])
visibility = [ ":$_target_name" ]
sources = [
"$root_out_dir/${_loadable_module_target}.so",
"$target_out_dir/${_output_name}.so",
]
outputs = [
"{{bundle_executable_dir}}/$_target_name",
"{{bundle_executable_dir}}/$_output_name",
]
public_deps = [
":$_loadable_module_target",
Expand All @@ -418,7 +426,7 @@ template("mac_plugin_bundle") {
}
deps += [ ":$_loadable_module_bundle_data" ]

bundle_root_dir = "$root_out_dir/$_target_name.plugin/Contents"
bundle_root_dir = "$root_out_dir/$_output_name.plugin/Contents"
bundle_executable_dir = "$bundle_root_dir/MacOS"
}
}
32 changes: 30 additions & 2 deletions ppapi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import("//build/config/nacl/rules.gni")
import("//ppapi/ppapi_sources.gni")
import("//testing/test.gni")

shared_library("ppapi_tests") {
source_set("ppapi_tests_sources") {
sources = ppapi_sources.test_common_source_files +
ppapi_sources.test_trusted_source_files

Expand All @@ -63,7 +63,21 @@ shared_library("ppapi_tests") {
]
}

shared_library("power_saver_test_plugin") {
if (!is_mac) {
shared_library("ppapi_tests") {
deps = [
":ppapi_tests_sources",
]
}
} else {
mac_plugin_bundle("ppapi_tests") {
deps = [
":ppapi_tests_sources",
]
}
}

source_set("power_saver_test_plugin_sources") {
sources = [
"tests/power_saver_test_plugin.cc",
"tests/test_utils.cc",
Expand All @@ -76,6 +90,20 @@ shared_library("power_saver_test_plugin") {
]
}

if (!is_mac) {
shared_library("power_saver_test_plugin") {
deps = [
":power_saver_test_plugin_sources",
]
}
} else {
mac_plugin_bundle("power_saver_test_plugin") {
deps = [
":power_saver_test_plugin_sources",
]
}
}

source_set("blink_deprecated_test_plugin_sources") {
sources = [
"tests/blink_deprecated_test_plugin.cc",
Expand Down
34 changes: 24 additions & 10 deletions ppapi/examples/ppapi_example.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,35 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

if (is_mac) {
import("//build/config/mac/rules.gni")
}

# Declares a PPAPI example target of the correct type for the current platform
# and with the right linker flags.
template("ppapi_example") {
# TODO(GYP) on Mac this should be loadable_module.
shared_library(target_name) {
testonly = true
if (defined(invoker.output_name)) {
output_name = invoker.output_name
if (!is_mac) {
shared_library(target_name) {
testonly = true

if (defined(invoker.output_name)) {
output_name = invoker.output_name
}

sources = invoker.sources
deps = invoker.deps
}
sources = invoker.sources
deps = invoker.deps
} else {
mac_plugin_bundle(target_name) {
testonly = true

if (defined(invoker.output_name)) {
output_name = invoker.output_name
}

sources = invoker.sources
deps = invoker.deps

if (is_mac) {
# TODO(GYP) this should be a mac bundle
output_extension = "plugin"
ldflags = [
# Not to strip important symbols by -Wl,-dead_strip.
"-Wl,-exported_symbol,_PPP_GetInterface",
Expand Down

0 comments on commit 4a73557

Please sign in to comment.