Skip to content

A sample OpenCV project built with Bazel on Windows

Notifications You must be signed in to change notification settings

jcju/opencv_bazel_win

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Build OpenCV of C++ with Bazel on Windows

A sample OpenCV C++ project demo built with Bazel on Windows.

Dependencies

Install

  1. Make sure OpenCV path is in your System Environment Variables.
  2. In the WORKSPACE file, change the value of "path" to the OpenCV install path. For example:
new_local_repository(
    name = "opencv_install_path",
    path = "C:\\opencv\\build",         # add your OpenCV path here
    build_file = "opencv.BUILD",
)
  1. In the opencv.BUILD file, locate the OpenCV libraries in "srcs" according to your C++ complier version:
  • vc16 = Visual Studio 2019
  • vc15 = Visual Studio 2017
  • vc14 = Visual Studio 2015
  • vc12 = Visual Studio 2013
  cc_library(
    name = "opencv_rule",
    srcs = glob(["x64/vc14/lib/*.lib"]),  # the lib location, under your OpenCV path
    hdrs = glob(["include/**/*.hpp",
                 "include/**/*.h"]),
    includes = ["include"],
    visibility = ["//visibility:public"], 
    linkstatic = 1,
)

Usage

Build the project:

bazel build //src:main

Run the binary:

\bazel-bin\src\main.exe

About

A sample OpenCV project built with Bazel on Windows

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published