Package: qutechopenql
OpenQL FrameworkOpenQL is a framework for high-level quantum programming in C++/Python. The
framework provides a compiler for compiling and optimizing quantum code. The
compiler produces the intermediate quantum assembly language and the compiled
micro-code for various target platforms. While the microcode is
platform-specific, the quantum assembly code
(incQASMformat) is hardware-agnostic and
can be simulated on the QX simulator.OpenQL's source code is released under the Apache 2.0 license.For detailed user and contributor documentation, please visit theReadTheDocspage.DependenciesThe following utilities are required to compile OpenQL from sources:C++ compiler with C++23 support (gcc 11, clang 14, msvc 17)CMake>= 3.12gitPython3.x pluspip, with the following package:conan>= 2.0Python build specific dependenciesSWIG(Linux: >= 3.0.12, Windows: >= 4.0.0)Optionally:Documentation generation:doxygenConvert graphs fromdottopdf,png, etc:Graphviz DotutilityVisualize generated graphs indotformat:XDotUse the visualizer in MacOS:XQuartzAnd the following Python packages:plumbumqxelaratorsetuptoolswheelOptionally:Testing:numpy, andpytestDocumentation generation:m2r2,sphinx==7.0.0, andsphinx-rtd-themeARM specific dependenciesWe are having problems when using them4andzulu-opendjkConan packages on an ARMv8 architecture.m4is required by Flex/Bison andzulu-openjdkprovides the Java JRE required by the ANTLR generator.
So, for the time being, we are installing Flex/Bison and Java manually for this platform.Flex>= 2.6.4Bison>= 3.0Java JRE>= 11BuildThis version of OpenQL can only be compiled via theconanpackage manager.
You'll need to create a default profile before using it for the first time.The installation ofOpenQLdependencies, as well as the compilation, can be done in one go.git clone https://github.com/QuTech-Delft/OpenQL.git
cd OpenQL
conan profile detect
conan build . -pr=conan/profiles/tests-debug -b missingNotice:theconan profilecommand only has to be run only once, and not before every build.theconan buildcommand is buildingOpenQLin Debug mode with tests using thetests-debugprofile.the-b missingparameter asksconanto build packages from sources
in case it cannot find the binary packages for the current configuration (platform, OS, compiler, build type...).Build profilesA group of predefined profiles is provided under theconan/profilesfolder.
They follow the[tests-](debug|release)[-unitary]naming convention. For example:releaseis a Release build without tests and unitary decomposition disabled.tests-debug-unitaryis a Debug build with tests and unitary decomposition enabled.All the profiles set the C++ standard to 23.Build optionsProfiles are a shorthand for command line options. The command above could be written as well as:conan build . -s:h compiler.cppstd=23 -s:h openql/*:build_type=Debug -o openql/*:build_tests=True -o openql/*:disable_unitary=True -b missingThese are the list of options that could be specified whether in a profile or in the command line:openql/*:build_type: defaulted toRelease, set toDebugif you want Debug builds.openql/*:build_tests: defaulted toFalse, set toTrueif you want to build tests.openql/*:disable_unitary: defaulted toFalse, set toTrueif you want to disable unitary decomposition.openql/*:shared: defaulted toFalse, set toTrueif you want OpenQL to be built as a shared library.
The default option is mandatory on Windows.InstallFrom PythonInstall from the project root directory as follows:python3 -m pip install -v .You can test if it works by running:python3 -m pytest -vFrom C++TheCMakeLists.txtfile in the root directory includes install targets:conan create --version 0.11.2 . tests-debug -b missingYou can test if it works by doing:cd test/Debug
ctest -C Debug --output-on-failureUse from another projectFrom PythonAfter installation, you should be able to use the bindings for the original API by justimport openql as ql.
The new API doesn't have Python bindings yet.From C++The easiest way to use OpenQL in a CMake project is to fetch the library and then link against it.include(FetchContent)
FetchContent_Declare(OpenQL
    GIT_REPOSITORY https://github.com/QuTech-Delft/OpenQL.git
    GIT_TAG "<a given cqasm git tag>"
)
FetchContent_MakeAvailable(OpenQL)
target_include_directories(<your target> SYSTEM PRIVATE "${OpenQL_SOURCE_DIR}/include")
target_link_libraries(<your target> PUBLIC ql)Note that the following dependencies are required forOpenQLto build:Flex>= 2.6.4Bison>= 3.0Java JRE>= 11