Skip to content

Commit

Permalink
nwjs master
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwang committed Aug 31, 2018
1 parent aae2791 commit 4ef5ae4
Show file tree
Hide file tree
Showing 31 changed files with 4,647 additions and 42 deletions.
37 changes: 29 additions & 8 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ config("internal_config") {

defines = []

if (is_component_build) {
if (true) {
defines += [ "BUILDING_V8_SHARED" ]
}
}
Expand All @@ -229,14 +229,14 @@ config("internal_config_base") {
# This config should be applied to code using the libplatform.
config("libplatform_config") {
include_dirs = [ "include" ]
if (is_component_build) {
if (false) {
defines = [ "USING_V8_PLATFORM_SHARED" ]
}
}

# This config should be applied to code using the libbase.
config("libbase_config") {
if (is_component_build) {
if (false) {
defines = [ "USING_V8_BASE_SHARED" ]
}
libs = []
Expand All @@ -255,7 +255,9 @@ config("libsampler_config") {
config("external_config") {
defines = []
if (is_component_build) {
defines += [ "USING_V8_SHARED" ]
defines += [ "USING_V8_SHARED", "V8_SHARED", "USING_V8_PLATFORM_SHARED" ]
} else {
defines += [ "V8_SHARED" ]
}
if (v8_enable_v8_checks) {
defines += [ "V8_ENABLE_CHECKS" ] # Used in "include/v8.h".
Expand Down Expand Up @@ -2847,7 +2849,8 @@ v8_source_set("v8_base") {
}
}

v8_component("v8_libbase") {
v8_static_lib("v8_libbase") {

sources = [
"src/base/adapters.h",
"src/base/atomic-utils.h",
Expand Down Expand Up @@ -2925,7 +2928,7 @@ v8_component("v8_libbase") {

defines = []

if (is_component_build) {
if (false) {
defines = [ "BUILDING_V8_BASE_SHARED" ]
}

Expand Down Expand Up @@ -3022,7 +3025,7 @@ v8_component("v8_libbase") {
# TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris.
}

v8_component("v8_libplatform") {
v8_static_lib("v8_libplatform") {
sources = [
"//base/trace_event/common/trace_event_common.h",
"include/libplatform/libplatform-export.h",
Expand All @@ -3049,7 +3052,7 @@ v8_component("v8_libplatform") {

configs = [ ":internal_config_base" ]

if (is_component_build) {
if (true) {
defines = [ "BUILDING_V8_PLATFORM_SHARED" ]
}

Expand Down Expand Up @@ -3125,6 +3128,24 @@ if (v8_monolithic) {
###############################################################################
# Executables
#
v8_executable("nwjc") {

sources = [
"src/nwjc.cc",
]

configs = [
":internal_config",
]

deps = [
":v8_base",
":v8_init",
":v8_libplatform",
":v8_nosnapshot",
"//build/win:default_exe_manifest",
]
}

if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
v8_executable("mksnapshot") {
Expand Down
9 changes: 9 additions & 0 deletions gni/v8.gni
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ template("v8_header_set") {
}
}

template("v8_static_lib") {
static_library(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
}
}

template("v8_executable") {
executable(target_name) {
forward_variables_from(invoker,
Expand Down
47 changes: 47 additions & 0 deletions gypfiles/detect_host_arch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Outputs host CPU architecture in format recognized by gyp."""

import platform
import re
import sys


def HostArch():
"""Returns the host architecture with a predictable string."""
host_arch = platform.machine()

# Convert machine type to format recognized by gyp.
if re.match(r'i.86', host_arch) or host_arch == 'i86pc':
host_arch = 'ia32'
elif host_arch in ['x86_64', 'amd64']:
host_arch = 'x64'
elif host_arch.startswith('arm'):
host_arch = 'arm'
elif host_arch.startswith('mips'):
host_arch = 'mips'
elif host_arch.startswith('ppc'):
host_arch = 'ppc'
elif host_arch.startswith('s390'):
host_arch = 's390'


# platform.machine is based on running kernel. It's possible to use 64-bit
# kernel with 32-bit userland, e.g. to give linker slightly more memory.
# Distinguish between different userland bitness by querying
# the python binary.
if host_arch == 'x64' and platform.architecture()[0] == '32bit':
host_arch = 'ia32'

return host_arch

def DoMain(_):
"""Hook to be called from gyp without starting a separate python
interpreter."""
return HostArch()

if __name__ == '__main__':
print DoMain([])
Loading

0 comments on commit 4ef5ae4

Please sign in to comment.