mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 11:01:57 +00:00
Fix waf configure --variant=debug on Linux
This commit is contained in:
parent
78dc0c4341
commit
cef1559f6d
@ -123,7 +123,7 @@ void IncludeComplete::Rescan() {
|
|||||||
config_->includeCompletionBlacklist);
|
config_->includeCompletionBlacklist);
|
||||||
|
|
||||||
is_scanning = true;
|
is_scanning = true;
|
||||||
WorkThread::StartThread("include_scanner", [this]() {
|
WorkThread::StartThread("scan_includes", [this]() {
|
||||||
Timer timer;
|
Timer timer;
|
||||||
|
|
||||||
InsertStlIncludes();
|
InsertStlIncludes();
|
||||||
|
71
wscript
71
wscript
@ -137,39 +137,45 @@ def configure(ctx):
|
|||||||
ctx.resetenv(ctx.options.variant)
|
ctx.resetenv(ctx.options.variant)
|
||||||
|
|
||||||
ctx.load('compiler_cxx')
|
ctx.load('compiler_cxx')
|
||||||
cxxflags = ['-g', '-std=c++11', '-Wall', '-Wno-sign-compare', '-Werror']
|
|
||||||
if ctx.options.use_clang_cxx:
|
|
||||||
# include/clang/Format/Format.h error: multi-line comment
|
|
||||||
cxxflags.append('-Wno-comment')
|
|
||||||
# otherwise use of some Clang C++ functions may report `undefined references to typeinfo`
|
|
||||||
cxxflags.append('-fno-rtti')
|
|
||||||
ldflags = []
|
ldflags = []
|
||||||
# /Zi: -g, /WX: -Werror, /W3: roughly -Wall, there is no -std=c++11 equivalent in MSVC.
|
if ctx.env.CXX_NAME == 'msvc':
|
||||||
# /wd4722: ignores warning C4722 (destructor never returns) in loguru
|
# /Zi: -g, /WX: -Werror, /W3: roughly -Wall, there is no -std=c++11 equivalent in MSVC.
|
||||||
# /wd4267: ignores warning C4267 (conversion from 'size_t' to 'type'), roughly -Wno-sign-compare
|
# /wd4722: ignores warning C4722 (destructor never returns) in loguru
|
||||||
# /MD: use multithread c library from DLL
|
# /wd4267: ignores warning C4267 (conversion from 'size_t' to 'type'), roughly -Wno-sign-compare
|
||||||
msvcflags = ['/nologo', '/FS', '/EHsc', '/Zi', '/W3', '/WX', '/wd4996', '/wd4722', '/wd4267', '/wd4800', '/MD']
|
# /MD: use multithread c library from DLL
|
||||||
|
cxxflags = ['/nologo', '/FS', '/EHsc', '/Zi', '/W3', '/WX', '/wd4996', '/wd4722', '/wd4267', '/wd4800', '/MD']
|
||||||
|
if ctx.options.variant == 'debug':
|
||||||
|
cxxflags += ['/Zi', '/FS']
|
||||||
|
ldflags += ['/DEBUG']
|
||||||
|
else:
|
||||||
|
cxxflags.append('/O2') # There is no O3
|
||||||
|
else:
|
||||||
|
if ctx.env.CXXFLAGS:
|
||||||
|
cxxflags = ctx.env.CXXFLAGS
|
||||||
|
else:
|
||||||
|
cxxflags = ['-g', '-Wall', '-Wno-sign-compare', '-Werror']
|
||||||
|
|
||||||
if ctx.options.variant == 'asan':
|
if all(not x.startswith('-std=') for x in ctx.env.CXXFLAGS):
|
||||||
cxxflags.append('-fsanitize=address,undefined')
|
cxxflags.append('-std=c++11')
|
||||||
cxxflags.append('-O')
|
|
||||||
ldflags.append('-fsanitize=address,undefined')
|
if ctx.options.use_clang_cxx:
|
||||||
elif ctx.options.variant == 'debug':
|
# include/clang/Format/Format.h error: multi-line comment
|
||||||
msvcflags += ['/Zi', '/FS']
|
cxxflags.append('-Wno-comment')
|
||||||
ldflags += ['/DEBUG']
|
# Without -fno-rtti, some Clang C++ functions may report `undefined references to typeinfo`
|
||||||
else:
|
cxxflags.append('-fno-rtti')
|
||||||
cxxflags.append('-O3')
|
|
||||||
msvcflags.append('/O2') # There is no O3
|
if ctx.options.variant == 'asan':
|
||||||
if ctx.env.CXX_NAME != 'msvc':
|
cxxflags.append('-fsanitize=address,undefined')
|
||||||
# If environment variable CXXFLAGS is unset, provide a sane default.
|
cxxflags.append('-O')
|
||||||
if not ctx.env.CXXFLAGS:
|
ldflags.append('-fsanitize=address,undefined')
|
||||||
ctx.env.CXXFLAGS = cxxflags
|
elif ctx.options.variant == 'debug':
|
||||||
elif all(not x.startswith('-std=') for x in ctx.env.CXXFLAGS):
|
pass
|
||||||
ctx.env.CXXFLAGS.append('-std=c++11')
|
else:
|
||||||
if not ctx.env.LDFLAGS:
|
cxxflags.append('-O3')
|
||||||
ctx.env.LDFLAGS = ldflags
|
|
||||||
else:
|
ctx.env.CXXFLAGS = cxxflags
|
||||||
ctx.env.CXXFLAGS = msvcflags
|
if not ctx.env.LDFLAGS:
|
||||||
|
ctx.env.LDFLAGS = ldflags
|
||||||
|
|
||||||
ctx.check(header_name='stdio.h', features='cxx cxxprogram', mandatory=True)
|
ctx.check(header_name='stdio.h', features='cxx cxxprogram', mandatory=True)
|
||||||
|
|
||||||
@ -370,8 +376,9 @@ def build(bld):
|
|||||||
'third_party/sparsepp/'] +
|
'third_party/sparsepp/'] +
|
||||||
(['libclang'] if bld.env['use_clang_cxx'] else []),
|
(['libclang'] if bld.env['use_clang_cxx'] else []),
|
||||||
defines=[
|
defines=[
|
||||||
#'_GLIBCXX_USE_CXX11_ABI=0', 'clang+llvm-$version-x86_64-linux-gnu-ubuntu-14.04' is pre CXX11_ABI
|
|
||||||
'LOGURU_WITH_STREAMS=1',
|
'LOGURU_WITH_STREAMS=1',
|
||||||
|
'LOGURU_FILENAME_WIDTH=18',
|
||||||
|
'LOGURU_THREADNAME_WIDTH=13',
|
||||||
'DEFAULT_RESOURCE_DIRECTORY="' + default_resource_directory + '"'] +
|
'DEFAULT_RESOURCE_DIRECTORY="' + default_resource_directory + '"'] +
|
||||||
(['USE_CLANG_CXX=1', 'LOGURU_RTTI=0']
|
(['USE_CLANG_CXX=1', 'LOGURU_RTTI=0']
|
||||||
if bld.env['use_clang_cxx']
|
if bld.env['use_clang_cxx']
|
||||||
|
Loading…
Reference in New Issue
Block a user