| - Operating System: [e.g. macOS, Linux, Windows] | - Operating System: [e.g. macOS, Linux, Windows] | ||||
| - Compiler: [e.g. MSVC, GCC, Clang] | - Compiler: [e.g. MSVC, GCC, Clang] | ||||
| - `dds` Version: [e.g. `0.1.0-alpha.2`] | |||||
| - `dds` Version: [e.g. `0.1.0-alpha.5`] | |||||
| **Additional context** | **Additional context** | ||||
| cd /vagrant && \ | cd /vagrant && \ | ||||
| python3.7 tools/ci.py \ | python3.7 tools/ci.py \ | ||||
| -B download \ | -B download \ | ||||
| -T tools/freebsd-gcc-9.jsonc \ | |||||
| -T tools/freebsd-gcc-10.jsonc \ | |||||
| ' | ' | ||||
| vagrant scp freebsd11:/vagrant/_build/dds _build/dds-freebsd-x64 | vagrant scp freebsd11:/vagrant/_build/dds _build/dds-freebsd-x64 | ||||
| vagrant halt | vagrant halt | ||||
| mkdir -p _site/ | mkdir -p _site/ | ||||
| cp site/index.html _site/ | cp site/index.html _site/ | ||||
| cp -r _build/docs _site/ | cp -r _build/docs _site/ | ||||
| echo "Site generated at _site/" | |||||
| echo "Site generated at _site/" | 
| freebsd11.vm.box = 'generic/freebsd11' | freebsd11.vm.box = 'generic/freebsd11' | ||||
| freebsd11.vm.provision 'shell', inline: <<-SHELL | freebsd11.vm.provision 'shell', inline: <<-SHELL | ||||
| set -eu | set -eu | ||||
| for package in python37 py37-pip ccache gcc9 gcc8 git; do | |||||
| for package in python37 py37-pip ccache gcc10 gcc9 gcc8 git; do | |||||
| echo "Installing $package" | echo "Installing $package" | ||||
| pkg install -qy $package | pkg install -qy $package | ||||
| done | done | 
| # The short X.Y version | # The short X.Y version | ||||
| version = '' | version = '' | ||||
| # The full version, including alpha/beta/rc tags | # The full version, including alpha/beta/rc tags | ||||
| release = '0.1.0-alpha.4' | |||||
| release = '0.1.0-alpha.5' | |||||
| # -- General configuration --------------------------------------------------- | # -- General configuration --------------------------------------------------- | ||||
| extensions = [] | extensions = [] | 
| A *source distribution* is ``dds``'s primary format for consuming and | A *source distribution* is ``dds``'s primary format for consuming and | ||||
| distributing packages. A source distribution, in essence, is a | distributing packages. A source distribution, in essence, is a | ||||
| :ref:`package root <pkgs.pkg-root>` directory that contains only the files | |||||
| :ref:`package root <pkgs.pkg-root>` archive that contains only the files | |||||
| necessary for ``dds`` to reproduce the full build of all libraries in the | necessary for ``dds`` to reproduce the full build of all libraries in the | ||||
| package. The source distribution retains the directory structure of every | package. The source distribution retains the directory structure of every | ||||
| :ref:`source root <pkgs.source-root>` of the original package, and thus retains | :ref:`source root <pkgs.source-root>` of the original package, and thus retains | ||||
| the header structure thereof. In this way, the ``#include`` directives to use | |||||
| a library in a source distribution are identical to if the libraries therein | |||||
| were directly part of the consuming project. | |||||
| the header structure thereof. In this way, the ``#include`` directives to use a | |||||
| library in a source distribution are identical to if the libraries therein were | |||||
| directly part of the consuming project. | |||||
| Generating a Source Distribution | Generating a Source Distribution | ||||
| > dds sdist create | > dds sdist create | ||||
| The above command can be executed within any package root, and the result will | |||||
| be a new directory that reproduces the package's filesystem structure, but | |||||
| only maintaining the files that are necessary for ``dds`` to reproduce the | |||||
| build of that package. | |||||
| The above command can be executed within a package root, and the result will be | |||||
| a gzip'd tar archive that reproduces the package's filesystem structure, but | |||||
| only maintaining the files that are necessary for ``dds`` to reproduce a build | |||||
| of that package. | |||||
| The ``--project=<dir>`` flag can be provided to override the directory that | The ``--project=<dir>`` flag can be provided to override the directory that | ||||
| ``dds`` will use as the package root. The default is the working directory of | ``dds`` will use as the package root. The default is the working directory of | ||||
| the project. | the project. | ||||
| The ``--out=<path>`` flag can be provided to override the destination path of | The ``--out=<path>`` flag can be provided to override the destination path of | ||||
| the resulting source distribution. The path should not name an existing file or | |||||
| directory. By default, ``dds`` will generate a source distribution in the | |||||
| working directory with the name ``project.dsd/`` (The output is itself a | |||||
| directory, not an archive). If the ``--replace`` flag is provided, then ``dds`` | |||||
| will overwrite the destination if it names an existing file or directory. | |||||
| the archive. The path should not name an existing file or directory. By default, | |||||
| ``dds`` will generate a source distribution in the working directory with the | |||||
| pattern ``<name>@<version>.tar.gz``. If the ``--replace`` flag is provided, | |||||
| then ``dds`` will overwrite the destination if it names an existing file or | |||||
| directory. | |||||
| Exporting a Package to the Local Repository | |||||
| ******************************************* | |||||
| Importing a Source Ditsribution | |||||
| ******************************* | |||||
| .. seealso:: :ref:`repo.export-local` | |||||
| Given a source distribution archive, one can import the package into the local | |||||
| repository with a single command:: | |||||
| > dds repo import some-package@1.2.3.tar.gz | 
| ``warning_flags`` | ``warning_flags`` | ||||
| ----------------- | ----------------- | ||||
| Provide *additional* compiler flags that should be used to enable warnings. This option is stored separately from ``flags``, as these options may be enabled/disabled separately depending on how ``dds`` is invoked. | |||||
| Provide *additional* compiler flags that should be used to enable warnings. This | |||||
| option is stored separately from ``flags``, as these options may be | |||||
| enabled/disabled separately depending on how ``dds`` is invoked. | |||||
| .. note:: | .. note:: | ||||
| If ``compiler_id`` is provided, a default set of warning flags will be provided when warnings are enabled. | |||||
| Adding flags to this toolchain option will *append* flags to the basis warning flag list rather than overwrite them. | |||||
| If ``compiler_id`` is provided, a default set of warning flags will be | |||||
| provided when warnings are enabled. | |||||
| Adding flags to this toolchain option will *append* flags to the basis | |||||
| warning flag list rather than overwrite them. | |||||
| .. seealso:: | .. seealso:: | ||||
| Select the language runtime/standard library options. Must be an object, and supports two keys: | Select the language runtime/standard library options. Must be an object, and supports two keys: | ||||
| ``static`` | ``static`` | ||||
| A boolean. If ``true``, the runtime and standard libraries will be static-linked into the generated binaries. If ``false``, they will be dynamically linked. Default is ``true`` with MSVC, and ``false`` with GCC and Clang. | |||||
| A boolean. If ``true``, the runtime and standard libraries will be | |||||
| static-linked into the generated binaries. If ``false``, they will be | |||||
| dynamically linked. Default is ``true`` with MSVC, and ``false`` with GCC | |||||
| and Clang. | |||||
| ``debug`` | ``debug`` | ||||
| A boolean. If ``true``, the debug versions of the runtime and standard library will be compiled and linked into the generated binaries. If ``false``, the default libraries will be used. | |||||
| A boolean. If ``true``, the debug versions of the runtime and standard | |||||
| library will be compiled and linked into the generated binaries. If | |||||
| ``false``, the default libraries will be used. | |||||
| **On MSVC** the default value depends on the top-level ``/debug`` option: If ``/debug`` is not ``false``, then ``/runtime/debug`` defaults to ``true``. | |||||
| **On MSVC** the default value depends on the top-level ``/debug`` option: If | |||||
| ``/debug`` is not ``false``, then ``/runtime/debug`` defaults to ``true``. | |||||
| **On GCC and Clang** the default value is ``false``. | **On GCC and Clang** the default value is ``false``. | ||||
| .. note:: | .. note:: | ||||
| On GNU-like compilers, ``static`` does not generate a static executable, it only statically links the runtime and standard library. To generate a static executable, the ``-static`` option should be added to ``link_flags``. | |||||
| On GNU-like compilers, ``static`` does not generate a static executable, it | |||||
| only statically links the runtime and standard library. To generate a static | |||||
| executable, the ``-static`` option should be added to ``link_flags``. | |||||
| .. note:: | .. note:: | ||||
| On GNU and Clang, setting ``/runtime/debug`` to ``true`` will compile all files with the ``_GLIBCXX_DEBUG`` and ``_LIBCPP_DEBUG=1`` preprocessor definitions set. **Translation units compiled with these macros are definitively ABI-incompatible with TUs that have been compiled without these options!!** | |||||
| If you link to a static or dynamic library that has not been compiled with the same runtime settings, generated programs will likely crash. | |||||
| On GNU and Clang, setting ``/runtime/debug`` to ``true`` will compile all | |||||
| files with the ``_GLIBCXX_DEBUG`` and ``_LIBCPP_DEBUG=1`` preprocessor | |||||
| definitions set. **Translation units compiled with these macros are | |||||
| definitively ABI-incompatible with TUs that have been compiled without these | |||||
| options!!** | |||||
| If you link to a static or dynamic library that has not been compiled with | |||||
| the same runtime settings, generated programs will likely crash. | |||||
| ``compiler_launcher`` | ``compiler_launcher`` | ||||
| // On GNU-like compilers (GCC, Clang): | // On GNU-like compilers (GCC, Clang): | ||||
| c_compile_file: "<compiler> -fPIC -pthread [flags] -c [in] -o[out]", | c_compile_file: "<compiler> -fPIC -pthread [flags] -c [in] -o[out]", | ||||
| cxx_compile_file: "<compiler> -fPIC -pthread [flags] -c [in] -o[out]", | cxx_compile_file: "<compiler> -fPIC -pthread [flags] -c [in] -o[out]", | ||||
| // When `optimize` is enabled, `-O2` is added as a flag | |||||
| // When `debug` is enabled, `-g` is added as a flag | |||||
| // On MSVC: | // On MSVC: | ||||
| c_compile_file: "cl.exe /MT /nologo /permissive- [flags] /c [in] /Fo[out]", | |||||
| cxx_compile_file: "cl.exe /MT /EHsc /nologo /permissive- [flags] /c [in] /Fo[out]", | |||||
| // When `optimize` is enabled, `/O2` is added as a flag | |||||
| // When `debug` is enabled, `/Z7` and `/DEBUG` are added, and `/MT` becomes `/MTd` | |||||
| c_compile_file: "cl.exe /nologo /permissive- [flags] /c [in] /Fo[out]", | |||||
| cxx_compile_file: "cl.exe /EHsc /nologo /permissive- [flags] /c [in] /Fo[out]", | |||||
| } | } | ||||
| Override the *command template* that is used to generate static library archive | Override the *command template* that is used to generate static library archive | ||||
| files. | files. | ||||
| This template expects three placeholders: | |||||
| This template expects two placeholders: | |||||
| - ``[in]`` is the a placeholder for the list of inputs. It must not be attached | - ``[in]`` is the a placeholder for the list of inputs. It must not be attached | ||||
| to any other arguments. The list of input paths will be inserted in place of | to any other arguments. The list of input paths will be inserted in place of | 
| { | { | ||||
| "$schema": "./res/package-schema.json", | "$schema": "./res/package-schema.json", | ||||
| "name": "dds", | "name": "dds", | ||||
| "version": "0.1.0-alpha.4", | |||||
| "version": "0.1.0-alpha.5", | |||||
| "namespace": "dds", | "namespace": "dds", | ||||
| "depends": [ | "depends": [ | ||||
| "spdlog@1.7.0", | "spdlog@1.7.0", | 
| This file will not be in the source distribution! | 
| assert not repo_content_path.is_dir() | assert not repo_content_path.is_dir() | ||||
| dds.repo_import(dds.build_dir / 'foo@1.2.3.tar.gz') | dds.repo_import(dds.build_dir / 'foo@1.2.3.tar.gz') | ||||
| assert repo_content_path.is_dir() | assert repo_content_path.is_dir() | ||||
| assert repo_content_path.joinpath('library.jsonc').is_file() | |||||
| # Excluded file will not be in the sdist: | |||||
| assert not repo_content_path.joinpath('other-file.txt').is_file() | 
| { | { | ||||
| "$schema": "../res/toolchain-schema.json", | "$schema": "../res/toolchain-schema.json", | ||||
| "compiler_id": "gnu", | "compiler_id": "gnu", | ||||
| "c_compiler": "gcc9", | |||||
| "cxx_compiler": "g++9", | |||||
| "c_compiler": "gcc10", | |||||
| "cxx_compiler": "g++10", | |||||
| "cxx_version": "c++20", | |||||
| "warning_flags": [ | "warning_flags": [ | ||||
| "-Werror", | "-Werror", | ||||
| ], | ], | ||||
| "cxx_flags": [ | |||||
| "-fconcepts", | |||||
| "-std=c++2a", | |||||
| ], | |||||
| "link_flags": [ | "link_flags": [ | ||||
| "-static-libgcc", | "-static-libgcc", | ||||
| "-static-libstdc++" | "-static-libstdc++" |