Pārlūkot izejas kodu

Clean up build script to just use a toolchain

default_compile_flags
vector-of-bool pirms 5 gadiem
vecāks
revīzija
d6fb2178b1
1 mainītis faili ar 11 papildinājumiem un 39 dzēšanām
  1. +11
    -39
      tools/build.py

+ 11
- 39
tools/build.py Parādīt failu

@@ -1,14 +1,11 @@
#!/usr/bin/env python3

import argparse
from contextlib import contextmanager
import os
from pathlib import Path
from typing import Sequence
import subprocess
import sys
import shutil
import tempfile

from dds_ci import paths
from self_build import self_build
@@ -19,40 +16,11 @@ ROOT = Path(__file__).parent.parent.absolute()
BUILD_DIR = ROOT / '_build'


@contextmanager
def _generate_toolchain(cxx: str):
with tempfile.NamedTemporaryFile(
suffix='-dds-toolchain.dds', mode='wb', delete=False) as f:
comp_id = 'GNU'
flags = ''
link_flags = ''
if cxx in ('cl', 'cl.exe'):
comp_id = 'MSVC'
flags += '/experimental:preprocessor '
link_flags += 'rpcrt4.lib '
else:
flags += '-fconcepts'
flags += ' -DSPDLOG_COMPILED_LIB'
content = f'''
Compiler-ID: {comp_id}
C++-Compiler: {cxx}
C++-Version: C++17
Debug: True
Flags: {flags}
Link-Flags: {link_flags}
'''
print('Using generated toolchain file: ' + content)
f.write(content.encode('utf-8'))
f.close()
yield Path(f.name)
os.unlink(f.name)


def main(argv: Sequence[str]) -> int:
# Prior versions of this script took a --cxx argument, but we don't care anymore
parser = argparse.ArgumentParser()
parser.add_argument(
'--cxx', help='Path/name of the C++ compiler to use.', required=True)
args = parser.parse_args(argv)
parser.add_argument('--cxx', help=argparse.SUPPRESS)
parser.parse_args(argv)

dds_bootstrap_env_key = 'DDS_BOOTSTRAP_PREV_EXE'
if dds_bootstrap_env_key not in os.environ:
@@ -67,10 +35,14 @@ def main(argv: Sequence[str]) -> int:
print(f'Using previously built DDS executable: {dds_exe}')
self_deps_get(dds_exe, paths.SELF_TEST_REPO_DIR)

with _generate_toolchain(args.cxx) as tc_fpath:
self_deps_build(dds_exe, tc_fpath, paths.SELF_TEST_REPO_DIR,
ROOT / 'remote.dds')
self_build(dds_exe, toolchain=tc_fpath, dds_flags=['--apps'])
if os.name == 'nt':
tc_fpath = ROOT / 'tools/msvc.dds'
else:
tc_fpath = ROOT / 'gcc-9.dds'

self_deps_build(dds_exe, str(tc_fpath), paths.SELF_TEST_REPO_DIR,
ROOT / 'remote.dds')
self_build(dds_exe, toolchain=str(tc_fpath), dds_flags=['--apps'])

return 0


Notiek ielāde…
Atcelt
Saglabāt