13
0

Do not create clang-db when cross-compiling w/mingw

This breaks windows builds, since apparently build(bld) is
evaluated twice (once to write compile_commands.json and once
to compile), even though `obj` is reset.

eg. in libs/pbd/wscript

```
if bld.env['build_target'] == 'mingw':
  obj.source += [ 'windows_special_dirs.cc' ]
```

results in

[  65/1159] Compiling libs/pbd/windows_special_dirs.cc
[  69/1159] Compiling libs/pbd/windows_special_dirs.cc

which then produces an error when linking:
```
/usr/bin/x86_64-w64-mingw32-ld: libs/pbd/windows_special_dirs.cc.2.o:libs/pbd/windows_special_dirs.cc:28: multiple definition of `PBD::get_win_special_folder_path[abi:cxx11](int)'; libs/pbd/windows_special_dirs.cc.2.o:libs/pbd/windows_special_dirs.cc:28: first defined here
```
This commit is contained in:
Robin Gareus 2022-01-10 17:09:11 +01:00
parent 16511974e2
commit af69061644
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -933,9 +933,10 @@ def sub_config_and_use(conf, name, has_objects = True):
def configure(conf):
conf.load('compiler_c')
conf.load('compiler_cxx')
conf.load('clang_compilation_database')
if Options.options.dist_target == 'mingw':
conf.load('winres')
else:
conf.load('clang_compilation_database')
if Options.options.dist_target == 'msvc':
conf.env['MSVC_VERSIONS'] = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', ]