Xtra-Computing / thundersvm

ThunderSVM: A Fast SVM Library on GPUs and CPUs
Apache License 2.0
1.56k stars 217 forks source link

Added support for `make install` #184

Closed ankane closed 4 years ago

ankane commented 4 years ago

Adds support for make install.

Note: I haven't written any cmake before, so feel free to rewrite if there's a better way to do it. This follows examples I found and works on my machine.

Edit: Please hold off on merging. It only works when installed into /usr/local. Still digging into it.

shijiashuai commented 4 years ago

I think the purpose of installation is to use the library in c++ project right? But ThunderSVM doesn’t have a C++ interface (public header file) yet, so we need to write a public header file. I’ve noted that some issues also mentioned C++ interfaces.

ankane commented 4 years ago

@shijiashuai it's for both the CLI and C++ libraries. Typically on Linux and Mac, make install installs binaries into /usr/local/bin and libraries into /usr/local/lib. These locations are typically in the path/rpath, so users can run thundersvm-train without needing to use the full path or add the specific project to the path.

Unfortunately, when CMAKE_INSTALL_PREFIX specifies a different location, this PR errors with:

dyld: Library not loaded: @rpath/libthundersvm.dylib
  Referenced from: /tmp/bin/thundersvm-train
  Reason: image not found
emmenlau commented 4 years ago

I'm sorry that I did not see this PR before, and instead created #195 .

I did not compare the code but hope that #195 can be useful. We have used a similar approach in many libraries and the install target is well tested. It is based on modern cmake principles and creates a cmake package configuration and cmake package version.

With the installed headers and library we can use thundersvm successfully in our project from C++. I think this may be useful to many users already.

zeyiwen commented 4 years ago

make install has been supported with the other PR, so I would like to close this one. Thanks all.

ankane commented 4 years ago

Hey @emmenlau, thanks for pushing this across the finish line. It looks like the the binaries (thundersvm-train and thundersvm-predict) aren't installed with https://github.com/Xtra-Computing/thundersvm/pull/195. Is there a reason for that, or is it something we can add?

emmenlau commented 4 years ago

Sorry I did not see this, you're right! We're just using the library. I'll add the binary installer right away.

Also, I saw that config.h is not in the right directory. I will fix that immediately too.