Ask Your Question
2

Best/efficient development workflow?

asked Oct 11 '0

Aitik Gupta gravatar image

I've recently started open-source, contributing to OpenCV. I searched through the questions, never really found a good exhaustive development workflow. (Might be a rookie search)
My current workflow:

  1. Sync up everything with upstream, create a new branch.
  2. Run cmake-gui, configure and generate. [BUILD_opencv_world checked]
  3. Install OpenCV globally (via sudo make install -j12) <- This takes a huge, huge amount of time.
  4. Make changes in files. (actual contribution)
  5. Repeat 3)
  6. Create a directory in a separate location, use CMakeLists.txt to find OpenCV package, bind libs to arbitrary test.cpp
  7. Compile, check if changes were correct. Repeat 4) and 5) until the changes make sense.
  8. Push and create a PR.

The step 3) is very time consuming, if I were to shift from master to 3.4 or vice versa, or if I were to quickly check out another working branch. Is there any workaround to this? (Might be a rookie overview of the problem, any help would be much appreciated!)

Preview: (hide)

Comments

Install OpenCV globally (via sudo make install -j12)

This is not recommended to install globally. Instead, use CMAKE_INSTALL_PREFIX to point to something like opencv-build/install and use OpenCV_DIR environment variable to let CMake find OpenCV.

Eduardo gravatar imageEduardo (Oct 11 '0)edit

This is a good point, I'll make sure of this from next time.

Aitik Gupta gravatar imageAitik Gupta (Oct 11 '0)edit

1 answer

Sort by » oldest newest most voted
2

answered Oct 11 '0

berak gravatar image

updated Oct 11 '0

2 ideas here:

1: divide & conquer

if it's just a single small function, extract it from the library code into your test.cpp, hack it into submission there and only then put it back into the library code, if you're lucky, you only need a single pass of 3. then.

2: build only what you need for your change

don't rebuild the whole world ;)

in fact, disable the world module, and use a whitelist of only the nessecary modules, like

cmake -DBUILD_LIST=core,imgproc,imgcodecs

(a list of comma-seperated module names sans the "opencv_" prefix, builds in a few miutes here, like this ...)

this will also disable python/java bindings


sidenotes

  • they'll probably ask you to add a unit test for your changes, so getting somewhat familiar with google's test framework might be a good idea.
  • the github wiki has some nice info, e.g. here and here
  • gl, and no fear, devs there are very noob friendly / encouraging ;)
  • usually, there's a step 9. -- ppl will request changes, add those, squash commits (the fun part, vi.. !!) git rebase -i HEAD~2 and force-push again ;)
  • scan current issues/pr's e.g. like this: https://github.com/opencv/opencv/issu... , it will give you a good feel for how discussions there go, who's working on what and other ppl's workflows.
Preview: (hide)

Comments

note : you can do all precess with your browser after you forked opencv on github also see https://github.com/firstcontributions...

sturkmen gravatar imagesturkmen (Oct 11 '0)edit

no fear to create a PR OpenCV's build system will compile and you see if there is a problem.you can change the code (add new commits)

sturkmen gravatar imagesturkmen (Oct 11 '0)edit
2

Thanks for all the pointers! This is precisely what I needed @berak :)

Aitik Gupta gravatar imageAitik Gupta (Oct 11 '0)edit

@sturkmen I'm not sure I get you, this is what I understood: I can create multiple commits on the PR, OpenCV's build system will compile with every new commit in the PR. If this is what you mean, I understand. But if not, could you elaborate just a bit more? Thanks :)

Aitik Gupta gravatar imageAitik Gupta (Oct 11 '0)edit

You can create multiple commits on the PR, OpenCV's build system will compile with every new commit in the PR. this is what i mean :)

sturkmen gravatar imagesturkmen (Oct 11 '0)edit

did you pushed your local changes to your fork ? what is your github account ?

sturkmen gravatar imagesturkmen (Oct 11 '0)edit
1

Yeah I understand @sturkmen, I already have a merged PR in OpenCV - Problem was that it took long development times for a single issue (which I understand can be made much faster, thanks to this thread).
Anyway here's my github account: https://github.com/aitikgupta

Aitik Gupta gravatar imageAitik Gupta (Oct 11 '0)edit

there is a problem on https://github.com/opencv/opencv/blob... with python3 you can test creating a PR with your browser if you solve the issue

sturkmen gravatar imagesturkmen (Oct 11 '0)edit

Question Tools

1 follower

Stats

Asked: Oct 11 '0

Seen: 637 times

Last updated: Oct 11 '20