Xtra-Computing / thundersvm

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

CMakeLists.txt: Added install target #195

Closed emmenlau closed 4 years ago

emmenlau commented 4 years ago

This PR adds an install target so that thundersvm can be used from downstream projects. It also exports the cmake configuration for thundersvm.

Users can perform an installation simply with make install like in:

cmake -DCMAKE_INSTALL_PREFIX="/data/builds/" . && \
make && \
make install

Downstream cmake projects can find and use thundersvm with:

find_package(thundersvm 0.1.0 REQUIRED)
...
target_link_libraries(${PROJECT_NAME} XComp::thundersvm)

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

emmenlau commented 4 years ago

This PR already works well for us. Please review and let me know what you think?

zeyiwen commented 4 years ago

Thanks @emmenlau

Similar to the PR of Eigen support, this PR also needs a configuration file. Would it be better to put the content of cmake/thundersvmConfig.cmake.in to thundersvm/include/thundersvm/config.h.in?

emmenlau commented 4 years ago

Similar to the PR of Eigen support, this PR also needs a configuration file. Would it be better to put the content of cmake/thundersvmConfig.cmake.in to thundersvm/include/thundersvm/config.h.in?

The generated file does not solve exactly the same need as a generated header. The generated file thundersvm/include/thundersvm/config.h.in will tell cmake of downstream projects whether they need Eigen or not, and whether they need OpenMP or not, etc. At compile time it is too late to find Eigen, but at configure time this configuration file can take the decision.

zeyiwen commented 4 years ago

Hmm. You are right. I will merge it. Thanks!

emmenlau commented 4 years ago

Thanks for all the nice work!