SquidTasks/documentation/StandaloneIntegrationGuide.md
2022-03-19 20:15:52 -07:00

1.8 KiB

This guide will show you how to integrate Squid::Tasks into a standalone Visual Studio-based C++ project.

Including the Headers

To integrate the Squid::Tasks library into your project, we recommend first copying the entire include Squid::Tasks include directory into your project.

You must then add the path of the include directory to the list of include directories in your project. In Visual Studio, this is done by right-clicking your project and selecting Properties. Then navigate to Configuration Properties -> C/C++ -> General, and add the the path to the include directory to “Additional Include Directories”.

Include Directory Settings in Visual Studio

Enabling Coroutines for C++14/17 (skip this step if using C++20)

C++ coroutines were only formally added to the standard with C++20. In order to use them with earlier standards (C++14 or C++17), you must enable coroutines using a special compiler-specific compile flag.

In Visual Studio, this is done by right-clicking your project and selecting Properties. Then navigate to Configuration Properties -> C/C++ -> Command Line, and add /await:strict to “Additional Options”.

(IMPORTANT NOTE: If you are using VS 16.10 or earlier, you should instead add /await to "Additional Options", as shown below.)

Enabling Coroutines in Visual Studio

If you are using Clang, you will need to add -fcoroutines-ts to your compiler command-line compilation parameters.

If you are using the Clang Platform Toolset from within Visual Studio, you will need to add -Xclang -fcoroutines-ts to your compiler command-line compilation parameters.