DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
228 stars 50 forks source link

Add Travis CI #33

Closed slokhorst closed 5 years ago

slokhorst commented 5 years ago

This adds basic Travis CI testing. The current setup runs cmake, make and make check on Ubuntu Xenial Xerus 16.04 on both GCC and Clang. It should be easy to extend this to Mac and Windows builds and other compilers, but I think this is a good start.

The second commit adds a build status badge to the README and is optional. It will look like this. If you think it is too gimmicky I can remove this commit.

Before merging this, you should first enable Travis. Do this by going to https://travis-ci.com/ , logging in with your GitHub account, and make sure you give it access to the DIPlib organization and this repository.

slokhorst commented 5 years ago

It looks like you already authorized Travis in the past (it built!) so you can skip that step.

crisluengo commented 5 years ago

Thank you so much!

Yes, I was looking at Travis a little bit last night, I thought I'd start with making an account. But then I got stuck reading documentation.

Strange though that the test with clang failed, but it shows as success.

I think I've found a workaround for this.

slokhorst commented 5 years ago

Ah I think it's because I put make check in the after_success step. That makes it "optional".

If we move make check to the script step, it will be mandatory and the entire build will "fail" if the check fails.

crisluengo commented 5 years ago

OK, I can do that. Makes sense. Thanks!

I've also found out how to install the FreeGLUT dependency the Python development stuff so those components get build too. Though there are no automated tests for them yet.

slokhorst commented 5 years ago

Nice! Testing just the build is already a good start.

I also gave building on macOS a try, but it seems to be failing on some apparently non-standard GNU stuff. If I can find some time I'll look into it!

crisluengo commented 5 years ago

Seems like they fixed that in Apple Clang 10, which doesn't complain about it. That build is using 9.1.

modification of object of const-qualified type 'const dip::sint8' (aka 'const signed char') is not allowed in a constant expression power_[ static_cast< dip::uint >( bu ) ] = power;

Is a weird error message. This is happening in the constructor...

Getting the dip::Units class to be constexpr was quite hard. That happened in this commit. I don't remember why I needed this, but it allows the compiler to fail to compile arithmetic operations and comparisons between physical quantities with incompatible units.