HODLR
HODLR copied to clipboard
CMake overhaul
This is the start of a CMake overhaul for HODLR (see #40) The goal is to make the library more usable from a user standpoint and to reduce built time.
It would probably be better to also handle the dependencies of HODLR (OpenMP ...) in a more CMake-like fashion.
Mainly, using find_package
would make it more clear what dependencies exist and would help depending libraries like the code I'm writing as well.
I haven't made these changes yet though.
I would love any feedback on this and am happy to make/revert any changes.
I see that some CI tests are failing, I'll get that fixed as soon as I can!
I have made some quite drastic changes to the CMake code. In particular, the way dependencies are handled is cleaned up. Eigen can be downloaded automatically now if it isn't found (Eigen3_DIR environment variable can be set to point to an Eigen install). I believe this makes the install.sh script largely obsolete, but I have left it in for now.
I also just noticed that I added a lot of unintentional whitespace changes when I was modifying the include structure. Rest assured that I did not actually make any actual changes to the C++ code.
The test runs now, but fails with
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
/home/travis/.travis/functions: line 109: 5280 Aborted (core dumped) ./test/test_HODLR
The same happens on all machines I tested on - I assume it is an issue with the test itself.
that's probably because of HOLDR_PATH: https://github.com/sivaramambikasaran/HODLR/blob/master/src/HODLR.cpp#L190 just drop the getenv and set it via a cmake compile definition:
target_compile_definition(HODLR PRIVATE HODLR_PATH="${PROJECT_SOURCE_DIR}/src")
or something like that