output clang compile database with test build

pull/2764/head
Adeeb Shihadeh 4 years ago
parent 15ae9d714f
commit b92eb543ca
  1. 23
      SConstruct

@ -2,9 +2,9 @@ import os
import shutil import shutil
import subprocess import subprocess
import sys import sys
import sysconfig
import platform import platform
import numpy as np import numpy as np
from sysconfig import get_paths
TICI = os.path.isfile('/TICI') TICI = os.path.isfile('/TICI')
Decider('MD5-timestamp') Decider('MD5-timestamp')
@ -124,10 +124,6 @@ else:
# change pythonpath to this # change pythonpath to this
lenv["PYTHONPATH"] = Dir("#").path lenv["PYTHONPATH"] = Dir("#").path
#Get the path for Python.h for cython linking
python_path = get_paths()['include']
numpy_path = np.get_include()
env = Environment( env = Environment(
ENV=lenv, ENV=lenv,
CCFLAGS=[ CCFLAGS=[
@ -188,9 +184,13 @@ env = Environment(
"#selfdrive/common", "#selfdrive/common",
], ],
CYTHONCFILESUFFIX=".cpp", CYTHONCFILESUFFIX=".cpp",
tools=["default", "cython"] COMPILATIONDB_USE_ABSPATH=True,
tools=["default", "cython", "compilation_db"],
) )
if GetOption('test'):
env.CompilationDatabase('compile_commands.json')
if os.environ.get('SCONS_CACHE'): if os.environ.get('SCONS_CACHE'):
cache_dir = '/tmp/scons_cache' cache_dir = '/tmp/scons_cache'
@ -231,22 +231,20 @@ def abspath(x):
return x[0].path.rsplit("/", 1)[1][:-3] return x[0].path.rsplit("/", 1)[1][:-3]
# Cython build enviroment # Cython build enviroment
py_include = sysconfig.get_paths()['include']
envCython = env.Clone() envCython = env.Clone()
envCython["CPPPATH"] += [python_path, numpy_path] envCython["CPPPATH"] += [py_include, np.get_include()]
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-deprecated-declarations"] envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-deprecated-declarations"]
python_libs = [] envCython["LIBS"] = []
if arch == "Darwin": if arch == "Darwin":
envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"] envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"]
elif arch == "aarch64": elif arch == "aarch64":
envCython["LINKFLAGS"] = ["-shared"] envCython["LINKFLAGS"] = ["-shared"]
envCython["LIBS"] = os.path.basename(py_include)
python_libs.append(os.path.basename(python_path))
else: else:
envCython["LINKFLAGS"] = ["-pthread", "-shared"] envCython["LINKFLAGS"] = ["-pthread", "-shared"]
envCython["LIBS"] = python_libs
Export('envCython') Export('envCython')
# still needed for apks # still needed for apks
@ -306,3 +304,4 @@ if arch != "Darwin":
if arch == "x86_64": if arch == "x86_64":
SConscript(['tools/lib/index_log/SConscript']) SConscript(['tools/lib/index_log/SConscript'])

Loading…
Cancel
Save