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 select “Properties” from the context menu.
In the Property Pages window, navigate to “Configuration Properties” > “VC++ Directories”.
In the “Include Directories” field, add the path to the “include” 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 the “lib” 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, add “visionflow.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.