|
|
|
|
|
|
|
|
from typing import Sequence, Iterable, Dict, Tuple, List, NamedTuple |
|
|
from typing import Sequence, Iterable, Dict, Tuple, List, NamedTuple |
|
|
import subprocess |
|
|
import subprocess |
|
|
import time |
|
|
import time |
|
|
|
|
|
import re |
|
|
import sys |
|
|
import sys |
|
|
|
|
|
|
|
|
ROOT = Path(__file__).parent.parent.absolute() |
|
|
ROOT = Path(__file__).parent.parent.absolute() |
|
|
|
|
|
|
|
|
'/permissive-', |
|
|
'/permissive-', |
|
|
'/experimental:preprocessor', |
|
|
'/experimental:preprocessor', |
|
|
'/wd5105', # winbase.h |
|
|
'/wd5105', # winbase.h |
|
|
|
|
|
'/wd4459', # Shadowing |
|
|
'/DWIN32_LEAN_AND_MEAN', |
|
|
'/DWIN32_LEAN_AND_MEAN', |
|
|
'/DNOMINMAX', |
|
|
'/DNOMINMAX', |
|
|
'/DFMT_HEADER_ONLY=1', |
|
|
'/DFMT_HEADER_ONLY=1', |
|
|
'/D_CRT_SECURE_NO_WARNINGS', |
|
|
'/D_CRT_SECURE_NO_WARNINGS', |
|
|
'/diagnostics:caret', |
|
|
'/diagnostics:caret', |
|
|
|
|
|
'/experimental:external', |
|
|
f'/I{ROOT / "src"}', |
|
|
f'/I{ROOT / "src"}', |
|
|
str(cpp_file), |
|
|
str(cpp_file), |
|
|
'/c', |
|
|
'/c', |
|
|
|
|
|
|
|
|
] |
|
|
] |
|
|
if have_ccache(): |
|
|
if have_ccache(): |
|
|
cmd.insert(0, 'ccache') |
|
|
cmd.insert(0, 'ccache') |
|
|
elif have_sccache(): |
|
|
|
|
|
cmd.insert(0, 'sccache') |
|
|
|
|
|
if opts.debug: |
|
|
if opts.debug: |
|
|
cmd.extend(('/Od', '/DEBUG', '/Z7')) |
|
|
cmd.extend(('/Od', '/DEBUG', '/Z7')) |
|
|
else: |
|
|
else: |
|
|
|
|
|
|
|
|
cmd.append('/MT') |
|
|
cmd.append('/MT') |
|
|
else: |
|
|
else: |
|
|
cmd.append('/MD') |
|
|
cmd.append('/MD') |
|
|
cmd.extend(f'/I{ROOT / subdir}' for subdir in INCLUDE_DIRS) |
|
|
|
|
|
|
|
|
cmd.extend(f'/external:I{ROOT / subdir}' for subdir in INCLUDE_DIRS) |
|
|
return cmd |
|
|
return cmd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f'Compile command ({cmd}) failed for {cpp_file}:\n{res.stdout.decode()}' |
|
|
f'Compile command ({cmd}) failed for {cpp_file}:\n{res.stdout.decode()}' |
|
|
) |
|
|
) |
|
|
stdout: str = res.stdout.decode() |
|
|
stdout: str = res.stdout.decode() |
|
|
fname_head = f'{cpp_file.name}\n' |
|
|
|
|
|
if stdout.startswith(fname_head): |
|
|
|
|
|
stdout = stdout[len(fname_head):] |
|
|
|
|
|
|
|
|
stdout = re.sub(r'^{cpp_file.name}\r?\n', stdout, '') |
|
|
|
|
|
fname_head = f'{cpp_file.name}\r\n' |
|
|
if stdout: |
|
|
if stdout: |
|
|
print(stdout, end='') |
|
|
print(stdout, end='') |
|
|
end = time.time() |
|
|
end = time.time() |
|
|
|
|
|
|
|
|
'/nologo', |
|
|
'/nologo', |
|
|
'/W4', |
|
|
'/W4', |
|
|
'/WX', |
|
|
'/WX', |
|
|
'/MT', |
|
|
|
|
|
'/Z7', |
|
|
'/Z7', |
|
|
'/DEBUG', |
|
|
'/DEBUG', |
|
|
|
|
|
'rpcrt4.lib', |
|
|
f'/Fe{out}', |
|
|
f'/Fe{out}', |
|
|
str(lib), |
|
|
str(lib), |
|
|
str(obj), |
|
|
str(obj), |
|
|
|
|
|
|
|
|
static=args.static, |
|
|
static=args.static, |
|
|
debug=args.debug) |
|
|
debug=args.debug) |
|
|
|
|
|
|
|
|
objects = compile_sources(build_opts, all_sources) |
|
|
|
|
|
|
|
|
objects = compile_sources(build_opts, sorted(all_sources)) |
|
|
|
|
|
|
|
|
lib = make_library(build_opts, (objects[p] for p in lib_sources)) |
|
|
lib = make_library(build_opts, (objects[p] for p in lib_sources)) |
|
|
|
|
|
|