genome / bam-readcount

Count bases in BAM/CRAM files
MIT License
298 stars 95 forks source link

pre-build dependency handling #23

Closed tabbott closed 9 years ago

tabbott commented 9 years ago

hiyo ernfrid.

You asked if I had an example of the predepends cmake hackery I was scheming about some time ago. Here it is. The basic idea is outlined in build-common/cmake/PreDepends.cmake. This gets rid of the deps target and makes parallel builds just work (fixing issue #22).

The catch is: it really wants CMake v3.2. Specifically, the Ninja generator will succeed at generating the project but fail to compile it on anything less. The makefile generator works on 2.8.12+ for me. I added conditional logic to fail with a message like "use make instead" at configure time if you're using ninja on an old cmake.

Don't merge or reject this right away. This is me providing the example you asked about. I'll be back to refine it later on :)

ernfrid commented 9 years ago

Seems pretty straightforwards to me. I'm not a huge fan of xadd_* as a function name, but I don't think I have a better suggestion (external_add_*?). I still need to test on my machines.

ernfrid commented 9 years ago

Had to update the minimum version, but once doing that I have success on both Ubuntu 10.0.4 (cmake 2.8.3) and OS X 10.10.3 (cmake 3.0.2). Default cmake no longer works for Ubuntu 10.0.4 as it is cmake version 2.8.1.

ernfrid commented 9 years ago

And docs updated. Let me know if this all looks ok with you @tabbott and I'll merge.

tabbott commented 9 years ago

@ernfrid - looks good. I did, however, just rebase and force push in order to make pushing back to build-common easier. I accidentally touched build-common and bam-readcount in the second commit. Now, those changes are isolated (git subtree wheeee).

tabbott commented 9 years ago

also synced with upstream build-common. merge when you're happy :)

ernfrid commented 9 years ago

Works well for me! As always, you are the man.