.vscode/ | .vscode/ | ||||
.mypy_cache/ | .mypy_cache/ | ||||
_prebuilt/ | _prebuilt/ | ||||
.pytest_cache | |||||
.pytest_cache/ | |||||
.vagrant/ |
.SILENT: | .SILENT: | ||||
.PHONY: docs docs-server docs-watch docs-sync-server | |||||
.PHONY: \ | |||||
docs docs-server docs-watch docs-sync-server nix-ci linux-ci macos-ci \ | |||||
vagrant-freebsd-ci | |||||
_invalid: | _invalid: | ||||
echo "Specify a target name to execute" | echo "Specify a target name to execute" | ||||
exit 1 | |||||
docs: | docs: | ||||
sphinx-build -b html \ | sphinx-build -b html \ | ||||
browser-sync start --server \ | browser-sync start --server \ | ||||
--reload-delay 300 \ | --reload-delay 300 \ | ||||
--watch **/*.html | --watch **/*.html | ||||
macos-ci: nix-ci | |||||
linux-ci: nix-ci | |||||
nix-ci: | |||||
python3 -u tools/ci.py \ | |||||
-B download \ | |||||
-T tools/gcc-9.dds \ | |||||
-T2 tools/gcc-9.jsonc | |||||
vagrant-freebsd-ci: | |||||
vagrant up freebsd11 | |||||
vagrant ssh freebsd11 -c '\ | |||||
cd /vagrant && \ | |||||
python3.7 tools/ci.py \ | |||||
-B build \ | |||||
-T tools/freebsd-gcc-9.dds \ | |||||
-T2 tools/freebsd-gcc-9.jsonc \ | |||||
' | |||||
vagrant scp freebsd11:/vagrant/_build/dds _build/dds-freebsd-x64 |
Vagrant.configure("2") do |config| | |||||
# Refer: https://docs.vagrantup.com. | |||||
config.vm.synced_folder ".", "/vagrant", | |||||
type: 'rsync', | |||||
rsync__exclude: ['_build/', '.mypy_cache/', '.pytest_cache/', '_prebuilt/'] | |||||
config.vm.define 'freebsd11' do |freebsd11| | |||||
freebsd11.vm.box = 'generic/freebsd11' | |||||
freebsd11.vm.provision 'shell', inline: <<-SHELL | |||||
set -eu | |||||
for package in python37 py37-pip ccache gcc9 gcc8 git; do | |||||
echo "Installing $package" | |||||
pkg install -qy $package | |||||
done | |||||
ln -fs g++9 /usr/local/bin/g++-9 | |||||
ln -fs gcc9 /usr/local/bin/gcc-9 | |||||
ln -fs g++8 /usr/local/bin/g++-8 | |||||
ln -fs gcc8 /usr/local/bin/gcc-8 | |||||
sudo -u vagrant pip install -q --user pytest pytest-xdist | |||||
SHELL | |||||
end | |||||
config.vm.provider 'virtualbox' do |vbox| | |||||
vbox.memory = 1024 * 4 | |||||
vbox.cpus = 8 | |||||
end | |||||
end |
- publish: _build/dds.exe | - publish: _build/dds.exe | ||||
artifact: DDS Executable - Windows VS2019 | artifact: DDS Executable - Windows VS2019 | ||||
- job: Linux_GCC8 | |||||
- job: Linux_GCC9 | |||||
pool: | pool: | ||||
vmImage: ubuntu-18.04 | vmImage: ubuntu-18.04 | ||||
steps: | steps: | ||||
sudo apt install -y python3-minimal g++-9 ccache | sudo apt install -y python3-minimal g++-9 ccache | ||||
python3 -m pip install pytest pytest-xdist | python3 -m pip install pytest pytest-xdist | ||||
displayName: Prepare System | displayName: Prepare System | ||||
- script: python3 -u tools/ci.py -B download -T tools/gcc-9.dds -T2 tools/gcc-9.jsonc | |||||
- script: make linux-ci | |||||
displayName: Full CI | displayName: Full CI | ||||
- publish: _build/dds | - publish: _build/dds | ||||
artifact: DDS Executable - Linux | artifact: DDS Executable - Linux | ||||
- job: macOS_GCC8 | |||||
- job: macOS_GCC9 | |||||
pool: | pool: | ||||
vmImage: macOS-10.14 | vmImage: macOS-10.14 | ||||
steps: | steps: | ||||
- script: | | - script: | | ||||
set -eu | set -eu | ||||
python3 -m pip install pytest pytest-xdist | python3 -m pip install pytest pytest-xdist | ||||
python3 -u tools/ci.py -B download -T tools/gcc-9.dds -T2 tools/gcc-9.jsonc | |||||
make macos-ci | |||||
displayName: Build and Run Unit Tests | displayName: Build and Run Unit Tests | ||||
- publish: _build/dds | - publish: _build/dds | ||||
artifact: DDS Executable - macOS | artifact: DDS Executable - macOS |
return std::nullopt; | return std::nullopt; | ||||
} | } | ||||
if (starts_with(tc_id, "gcc") || starts_with(tc_id, "clang")) { | |||||
json5::data& arr = root_map.emplace("link_flags", json5::data::array_type()).first->second; | |||||
arr.as_array().emplace_back("-static-libgcc"); | |||||
arr.as_array().emplace_back("-static-libstdc++"); | |||||
} | |||||
root_map.emplace("c_compiler", opt_triple->c); | root_map.emplace("c_compiler", opt_triple->c); | ||||
root_map.emplace("cxx_compiler", opt_triple->cxx); | root_map.emplace("cxx_compiler", opt_triple->cxx); | ||||
root_map.emplace("compiler_id", opt_triple->id); | root_map.emplace("compiler_id", opt_triple->id); |
#ifdef __linux__ | |||||
#if __linux__ || __FreeBSD__ | |||||
#include "./paths.hpp" | #include "./paths.hpp" | ||||
"cxx_version": 'c++17', | "cxx_version": 'c++17', | ||||
"cxx_compiler": 'g++-9', | "cxx_compiler": 'g++-9', | ||||
"flags": '-DSPDLOG_COMPILED_LIB', | "flags": '-DSPDLOG_COMPILED_LIB', | ||||
"link_flags": '-static-libgcc -static-libstdc++' | |||||
} | } |
BOOTSTRAP_PHASES = [ | BOOTSTRAP_PHASES = [ | ||||
BootstrapPhase('bootstrap-p1', 'g++-8', 'cl.exe'), | |||||
BootstrapPhase('bootstrap-p4', 'g++-8', 'cl.exe'), | |||||
BootstrapPhase('bootstrap-p5.1', 'g++-9', 'cl.exe'), | |||||
BootstrapPhase('bootstrap-p1.1', 'g++-8', 'cl.exe'), | |||||
BootstrapPhase('bootstrap-p4.2', 'g++-8', 'cl.exe'), | |||||
BootstrapPhase('bootstrap-p5.2', 'g++-9', 'cl.exe'), | |||||
] | ] | ||||
HERE = Path(__file__).parent.absolute() | HERE = Path(__file__).parent.absolute() | ||||
return _pull_executable(bts_dir) | return _pull_executable(bts_dir) | ||||
def main(argv: Sequence[str]) -> int: | |||||
def main() -> int: | |||||
for idx, phase in enumerate(BOOTSTRAP_PHASES): | for idx, phase in enumerate(BOOTSTRAP_PHASES): | ||||
print(f'Bootstrap phase [{idx+1}/{len(BOOTSTRAP_PHASES)}]') | print(f'Bootstrap phase [{idx+1}/{len(BOOTSTRAP_PHASES)}]') | ||||
exe = _run_boot_phase(phase) | exe = _run_boot_phase(phase) | ||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
sys.exit(main(sys.argv[1:])) | |||||
sys.exit(main()) |
print(f'Using previously built DDS executable: {dds_exe}') | print(f'Using previously built DDS executable: {dds_exe}') | ||||
if os.name == 'nt': | if os.name == 'nt': | ||||
tc_fpath = ROOT / 'tools/msvc.dds' | tc_fpath = ROOT / 'tools/msvc.dds' | ||||
elif sys.platform.startswith('freebsd'): | |||||
tc_fpath = ROOT / 'tools/freebsd-gcc-9.dds' | |||||
else: | else: | ||||
tc_fpath = ROOT / 'tools/gcc-9.dds' | tc_fpath = ROOT / 'tools/gcc-9.dds' | ||||
'--toolchain-json5', | '--toolchain-json5', | ||||
'-T2', | '-T2', | ||||
help='The toolchain JSON to use with the bootstrapped executable', | help='The toolchain JSON to use with the bootstrapped executable', | ||||
required=True, | |||||
) | ) | ||||
parser.add_argument( | |||||
'--build-only', | |||||
action='store_true', | |||||
help='Only build the `dds` executable. Skip second-phase and tests.') | |||||
args = parser.parse_args(argv) | args = parser.parse_args(argv) | ||||
if not args.build_only and not args.toolchain_json5: | |||||
raise RuntimeError( | |||||
'The --toolchain-json5/-T2 argument is required (unless using --build-only)' | |||||
) | |||||
opts = CIOptions( | opts = CIOptions( | ||||
toolchain=args.toolchain, toolchain_json5=args.toolchain_json5) | toolchain=args.toolchain, toolchain_json5=args.toolchain_json5) | ||||
('--repo-dir', ci_repo_dir), | ('--repo-dir', ci_repo_dir), | ||||
]) | ]) | ||||
print('Main build PASSED!') | print('Main build PASSED!') | ||||
print(f'A `dds` executable has been generated: {paths.CUR_BUILT_DDS}') | |||||
if args.build_only: | |||||
print( | |||||
f'`--build-only` was given, so second phase and tests will not execute' | |||||
) | |||||
return 0 | |||||
# Delete the catalog database, since there may be schema changes since the | # Delete the catalog database, since there may be schema changes since the | ||||
# bootstrap executable was built | # bootstrap executable was built |
Compiler-ID: GNU | |||||
C-Compiler: gcc9 | |||||
C++-Compiler: g++9 | |||||
# Range-v3 0.10.0 contains an accidental conversion warning | |||||
Flags: -D SPDLOG_COMPILED_LIB -Werror=return-type -Wno-conversion | |||||
C++-Flags: -std=c++2a -fconcepts | |||||
Link-Flags: -static-libgcc -static-libstdc++ | |||||
Debug: True | |||||
Compiler-Launcher: ccache |
{ | |||||
"$schema": "../res/toolchain-schema.json", | |||||
"compiler_id": "gnu", | |||||
"c_compiler": "gcc9", | |||||
"cxx_compiler": "g++9", | |||||
// "cxx_version": "c++17", | |||||
"flags": [ | |||||
"-DSPDLOG_COMPILED_LIB", // Required to use a compiled spdlog | |||||
"-Werror=return-type", | |||||
], | |||||
"cxx_flags": [ | |||||
"-fconcepts", | |||||
"-std=c++2a", | |||||
], | |||||
"link_flags": [ | |||||
"-static-libgcc", | |||||
"-static-libstdc++", | |||||
], | |||||
// "debug": true, | |||||
"optimize": true, | |||||
"compiler_launcher": "ccache" | |||||
} |