Skip to content

Commit

Permalink
[v8] Use clang instead gcc 6.0 version and higher
Browse files Browse the repository at this point in the history
  • Loading branch information
K0R0L committed Jun 22, 2020
1 parent 2ce4c7c commit 21056ec
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions scripts/core_common/modules/v8.py
Expand Up @@ -5,6 +5,7 @@
import config
import base
import os
import subprocess

def clean():
if base.is_dir("depot_tools"):
Expand Down Expand Up @@ -35,6 +36,27 @@ def is_xp_platform():
return True
return False

def is_use_clang():
get_gcc_version = "gcc -dumpfullversion -dumpversion"
popen = subprocess.Popen(get_gcc_version, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
gcc_version = 4
try:
stdout, stderr = popen.communicate()
popen.wait()
gcc_version_str = stdout.strip().decode("utf-8")
gcc_version_major = gcc_version_str.split(".")[0]
gcc_version = int(gcc_version_major)
finally:
popen.stdout.close()
popen.stderr.close()

is_clang = "false"
if (gcc_version >= 6):
is_clang = "true"

print("gcc major version: " + str(gcc_version) + ", use clang:" + is_clang)
return is_clang

def make():
if not is_main_platform():
make_xp()
Expand Down Expand Up @@ -118,11 +140,11 @@ def make():
base_args32 = "target_cpu=\\\"x86\\\" v8_target_cpu=\\\"x86\\\" v8_static_library=true is_component_build=false v8_use_snapshot=false"

if config.check_option("platform", "linux_64"):
base.cmd2("gn", ["gen", "out.gn/linux_64", "--args=\"is_debug=false " + base_args64 + " is_clang=false use_sysroot=false\""])
base.cmd2("gn", ["gen", "out.gn/linux_64", "--args=\"is_debug=false " + base_args64 + " is_clang=" + is_use_clang() + " use_sysroot=false treat_warnings_as_errors=false\""])
base.cmd("ninja", ["-C", "out.gn/linux_64"])

if config.check_option("platform", "linux_32"):
base.cmd2("gn", ["gen", "out.gn/linux_32", "--args=\"is_debug=false " + base_args32 + " is_clang=false use_sysroot=false\""])
base.cmd2("gn", ["gen", "out.gn/linux_32", "--args=\"is_debug=false " + base_args32 + " is_clang=" + is_use_clang() + " use_sysroot=false treat_warnings_as_errors=false\""])
base.cmd("ninja", ["-C", "out.gn/linux_32"])

if config.check_option("platform", "mac_64"):
Expand Down

0 comments on commit 21056ec

Please sign in to comment.