| @@ -3,4 +3,5 @@ __pycache__/ | |||
| .vscode/ | |||
| .mypy_cache/ | |||
| _prebuilt/ | |||
| .pytest_cache | |||
| .pytest_cache/ | |||
| .vagrant/ | |||
| @@ -1,9 +1,12 @@ | |||
| .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: | |||
| echo "Specify a target name to execute" | |||
| exit 1 | |||
| docs: | |||
| sphinx-build -b html \ | |||
| @@ -27,3 +30,23 @@ docs-sync-server: | |||
| browser-sync start --server \ | |||
| --reload-delay 300 \ | |||
| --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 | |||
| @@ -0,0 +1,28 @@ | |||
| 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 | |||
| @@ -17,7 +17,7 @@ jobs: | |||
| - publish: _build/dds.exe | |||
| artifact: DDS Executable - Windows VS2019 | |||
| - job: Linux_GCC8 | |||
| - job: Linux_GCC9 | |||
| pool: | |||
| vmImage: ubuntu-18.04 | |||
| steps: | |||
| @@ -27,12 +27,12 @@ jobs: | |||
| sudo apt install -y python3-minimal g++-9 ccache | |||
| python3 -m pip install pytest pytest-xdist | |||
| 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 | |||
| - publish: _build/dds | |||
| artifact: DDS Executable - Linux | |||
| - job: macOS_GCC8 | |||
| - job: macOS_GCC9 | |||
| pool: | |||
| vmImage: macOS-10.14 | |||
| steps: | |||
| @@ -41,7 +41,7 @@ jobs: | |||
| - script: | | |||
| set -eu | |||
| 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 | |||
| - publish: _build/dds | |||
| artifact: DDS Executable - macOS | |||
| @@ -237,6 +237,12 @@ std::optional<toolchain> toolchain::get_builtin(std::string_view tc_id) noexcept | |||
| 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("cxx_compiler", opt_triple->cxx); | |||
| root_map.emplace("compiler_id", opt_triple->id); | |||
| @@ -1,4 +1,4 @@ | |||
| #ifdef __linux__ | |||
| #if __linux__ || __FreeBSD__ | |||
| #include "./paths.hpp" | |||
| @@ -3,4 +3,5 @@ | |||
| "cxx_version": 'c++17', | |||
| "cxx_compiler": 'g++-9', | |||
| "flags": '-DSPDLOG_COMPILED_LIB', | |||
| "link_flags": '-static-libgcc -static-libstdc++' | |||
| } | |||
| @@ -21,9 +21,9 @@ class BootstrapPhase(NamedTuple): | |||
| 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() | |||
| @@ -100,7 +100,7 @@ def _run_boot_phase(phase: BootstrapPhase) -> Path: | |||
| return _pull_executable(bts_dir) | |||
| def main(argv: Sequence[str]) -> int: | |||
| def main() -> int: | |||
| for idx, phase in enumerate(BOOTSTRAP_PHASES): | |||
| print(f'Bootstrap phase [{idx+1}/{len(BOOTSTRAP_PHASES)}]') | |||
| exe = _run_boot_phase(phase) | |||
| @@ -110,4 +110,4 @@ def main(argv: Sequence[str]) -> int: | |||
| if __name__ == "__main__": | |||
| sys.exit(main(sys.argv[1:])) | |||
| sys.exit(main()) | |||
| @@ -33,6 +33,8 @@ def main(argv: Sequence[str]) -> int: | |||
| print(f'Using previously built DDS executable: {dds_exe}') | |||
| if os.name == 'nt': | |||
| tc_fpath = ROOT / 'tools/msvc.dds' | |||
| elif sys.platform.startswith('freebsd'): | |||
| tc_fpath = ROOT / 'tools/freebsd-gcc-9.dds' | |||
| else: | |||
| tc_fpath = ROOT / 'tools/gcc-9.dds' | |||
| @@ -72,10 +72,18 @@ def main(argv: Sequence[str]) -> int: | |||
| '--toolchain-json5', | |||
| '-T2', | |||
| 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) | |||
| 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( | |||
| toolchain=args.toolchain, toolchain_json5=args.toolchain_json5) | |||
| @@ -111,6 +119,13 @@ def main(argv: Sequence[str]) -> int: | |||
| ('--repo-dir', ci_repo_dir), | |||
| ]) | |||
| 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 | |||
| # bootstrap executable was built | |||
| @@ -0,0 +1,9 @@ | |||
| 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 | |||
| @@ -0,0 +1,22 @@ | |||
| { | |||
| "$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" | |||
| } | |||