1. cmake and make the project to create pre-compiled .a files.
2. Find all the header files in the project packages. Usually they're included in folders named with "include". A command to find all "include" folders.
3. Create a new git repository on github.com. Check in all the .a and header files to the repository. The repository can be 'projectname'-'version'-precompiled, e.g. opencv-3.1.0-precompiled. Also, a BUILD file should be checked in with them. An example of the BUILD file: https://github.com/zoukyle/opencv-3.1.0-precompiled/blob/master/BUILD
find . -iname include
4. Then the project can be depended by your own project. In your Bazel WORKSPACE file, you'll need to add:
git_repository(name = "precompiled_opencv_git",
commit = "cac2317cde1d4c9b68c6c4425d7171322d52aaed", # The latest commit id
remote = "https://github.com/zoukyle/opencv-3.1.0-precompiled.git"
)
bind(
name = "opencv",
actual = "@precompiled_opencv_git//:opencv_lib",
)
5. Say you want to bazel build a binary. In the BUILD file, you can add the dependency:
deps = ["//external:opencv",
],
2 comments:
Hi Liang,
The link to the BUILD file is broken: https://github.com/zoukyle/opencv-3.1.0-precompiled/blob/master/BUILD
Do you still have the repo anywhere or have you deleted it? Could you maybe just write out the BUILD file if its not too long?
Thanks!
- Nathan
git Restored.
Post a Comment