staq is a full-stack quantum processing toolkit that uses CMake as its build/install system. staq is platform-independent, supporting UNIX (including macOS) and UNIX-like operating systems (e.g., Linux), as well as Windows.
-
Optional, GNU MP library for building the grid synth tools
staq_grid_synth
andstaq_qasm_synth
To build both tool suite and the staq executable, execute (in a terminal/console/command prompt) under the project's root directory
cmake -B build
To be able to install staq's source code in addition to the binaries, configure the system with
cmake -B build -DINSTALL_SOURCES=ON
Important: If you want to build the grid synth tools staq_grid_synth
and
staq_qasm_synth
, install the GNU MP library; cmake
will take care of the rest. If cmake
cannot detect GNU MP, then the grid
synth tools will not be part of the build. To install GNU MP on Windows
systems, please follow the platform-specific instructions below.
For more details about how to install and configure GNU MP on various platforms, see the GitHub Actions configuration file.
Next, build the staq system by executing
cmake --build build --parallel 8
The --parallel 8
flag instructs CMake to build in parallel using 8 threads,
modify accordingly.
To build only the staq tool suite, execute
cmake --build build --target tools --parallel 8
To build only the staq executable, execute
cmake --build build --target staq --parallel 8
Unit tests can be built with the command
cmake --build build/unit_tests --target unit_tests --parallel 8
and run with
ctest --test-dir build
To (un)install, execute in a terminal/console (UNIX/UNIX-like systems)
sudo cmake --build build --target (un)install
or in an Administrator Command Prompt (Windows)
cmake --build build --target (un)install
If you configured the system with -DINSTALL_SOURCES=ON
, staq's source
code will be installed in /usr/local/include/staq
(UNIX/UNIX-like systems), or
in C:\Program Files (x86)\staq
on Windows systems. The paths may differ on
your system. To use staq's source code, precede all include paths by staq
in your own code, i.e.,
#include <staq/qasmtools/parser/parser.hpp>
Third party header-only libraries used internally by staq need to be
preceded by third_party
when including their corresponding header file(s),
i.e.,
#include <staq/third_party/CLI/CLI.hpp>
See the standalone example for more details.
If you are running macOS or Linux, you can install staq via Homebrew with
brew install staq
On Windows, we recommend to install GNU MP via vcpkg and pkgconf. Install vcpkg according to the instructions from https://vcpkg.io/en/getting-started by executing in a Command Prompt
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
Next, install pkgconf and GNU MP by executing
.\vcpkg\vcpkg install pkgconf:x64-windows gmp:x64-windows
This may take a while...
Finally, configure the system with the additional flag
-DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake
, e.g.,
cmake -B build -DCMAKE_TOOLCHAIN_FILE=./vckpg/scripts/buildsystems/vcpkg.cmake -DINSTALL_SOURCES=ON
followed by building the system as usual.
pystaq is a
Python 3 wrapper for staq. pystaq can be installed using pip
pip install git+https://github.com/softwareQinc/staq
For more details, please see pystaq/README.md.