Installing#
C++#
For C++ developers, VisionFlow is simply a pre-compiled binary library that needs to be added as a dependency to your project. Different C++ developers may use different project build tools, so here are instructions for incorporating VisionFlow using several commonly used build tools:
Please copy the following code to the WORKSPACE file in your project and replace the URL and SHA256 with the link and SHA256 of the VisionFlow version you want to use:
http_archive(
name = "visionflow_windows",
url = "<VisionFlow_URL>",
sha256 = "<VisionFlow_SHA256>",
)
In the above code, replace <VisionFlow_URL> with the download link for the desired version of VisionFlow, and replace <VisionFlow_SHA256> with the corresponding version’s SHA256 digest. This will instruct the build system to download VisionFlow from the specified URL and verify it using the provided SHA256 digest.
Then you can use VisionFlow as a dependency library in your project’s Bazel target, as shown below:
cc_binary(
name = "main",
srcs = ["main.cpp"],
deps = select({
"@platforms//os:windows": ["@visionflow_windows//:visionflow"],
"//conditions:default": [], # Linux依赖库将会在后续版本中完善
}),
)
We recommend using CMake’s FetchContent to import VisionFlow. Create a find_visionflow.cmake file in your project and write the following content in it:
include(FetchContent)
FetchContent_Declare(
visionflow
URL <VisionFlow_URL>
UPDATE_DISCONNECTED
)
FetchContent_GetProperties(visionflow)
if(NOT visionflow_POPULATED)
FetchContent_Populate(visionflow)
add_library(VisionFlow SHARED IMPORTED)
set_target_properties(
VisionFlow
PROPERTIES
IMPORTED_IMPLIB
${visionflow_SOURCE_DIR}/lib/visionflow.if.lib
IMPORTED_IMPLIB_DEBUG
${visionflow_SOURCE_DIR}/lib/visionflow.if.lib
IMPORTED_IMPLIB_RELEASE
${visionflow_SOURCE_DIR}/lib/visionflow.if.lib
IMPORTED_LOCATION
${visionflow_SOURCE_DIR}/bin/visionflow.dll
IMPORTED_LOCATION_DEBUG
${visionflow_SOURCE_DIR}/bin/visionflow.dll
IMPORTED_LOCATION_RELEASE
${visionflow_SOURCE_DIR}/bin/visionflow.dll
INTERFACE_INCLUDE_DIRECTORIES
${visionflow_SOURCE_DIR}/include
)
install(
DIRECTORY
${visionflow_SOURCE_DIR}/bin/
DESTINATION release
)
endif()
Then you can include find_visionflow.cmake in your CMakeLists.txt file.
To add VisionFlow library to your C++ project in Visual Studio, follow these steps:
Download the prebuilt VisionFlow zip package from the link in release email.
Extract the contents of the VisionFlow zip package to a desired location on your computer.
Open your C++ project in Visual Studio.
Right-click on your project in the
Solution Explorer
and selectProperties
from the context menu.In the Property Pages window, navigate to
Configuration Properties
>VC++ Directories
.In the
Include Directories
field, add the path to theinclude
folder inside the extracted VisionFlow package. This folder contains the necessary header files. You can either type in the path manually or use the ellipsis button (…) to browse and select the folder.In the
Library Directories
field, add the path to thelib
folder inside the extracted VisionFlow package. This folder contains the necessary library files. Again, you can type in the path or use the ellipsis button to browse and select the folder.Go to
Configuration Properties
>Linker
>Input
.In the
Additional Dependencies
field, addvisionflow.if.lib
.Click
OK
to save the changes.
You have now added the prebuilt VisionFlow package to your C++ project in Visual Studio. Make sure to include the necessary VisionFlow headers in your source files and use the appropriate namespace for the VisionFlow functions and classes.
C##
For C# developers, VisionFlow is simply a pre-compiled binary library that needs to be added as a dependency to your project.
VisionFlow not only provides visionflow.cs
source code also provides a pre-compiled binary library csharp_visionflow.dll
based on .NET 6.0
.
To add VisionFlow library to your C# project in Visual Studio, follow these steps:
Download the prebuilt VisionFlow zip package from the link in release email.
Extract the contents of the VisionFlow zip package to a desired location on your computer.
Open your C# project in Visual Studio.
If you want to compile the source code yourself or are limited to the C# version, continue the following steps:
Copy
csharp/visionflow.cs
to the desired place within your C# project.Click
Show All Files
in the Solution Explorer. Findvisionflow.cs
and right-click on it to selectInclude in Project
.Copy all the files in the
bin
directory to the folder where.exe
is generated or addbin
to the environment variable.For C# project with a target framework of
.NET Framework
, additional configuration is required. Right-click on your project in theSolution Explorer
and selectProperties
from the context menu. SelectBuild
and make surePrefer 32-bit
is unchecked.
Note that C# version must be above .NET 6.0
.
Right-click on your project in the
Solution Explorer
and selectAdd
>Project Reference
from the context menu.Click on
Browse
and selectBrowse
below to addcsharp_visionflow.dll
in thebin
directory.Select
csharp_visionflow.dll
and clickOK
below.Copy all the files in the
bin
directory to the folder where.exe
is generated or addbin
to the environment variable.
You have now added the prebuilt VisionFlow package to your C# project in Visual Studio.