alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.11k stars 313 forks source link

Great library, but too much CMake Garbage in my directory. #307

Closed ianniculescu closed 1 year ago

ianniculescu commented 1 year ago

Feature category

The problem

Hello I'm new to c++, the library is amazing, it works great, but I just want to run "g++ main.cpp -o main -lmatplot" and for it to work without the garbage cmake files that I have no clue what is doing. The solution I'd like Make it work as a dynamic library, and make it possible to install it with "sudo apt install matplot-dev" Alternatives I've considered

Additional context

alandefreitas commented 1 year ago

You can link the library manually or via CMake. CMake will look for all dependencies you need and also link them for you. That includes external (such as libjpeg) and bundled (such as nodesoup) dependencies. These can also depend on the platform.

If you want to link it manually you have to determine all dependencies and link all of them

g++ main.cpp -o main -lmatplot -l<all other matplot dependencies ...>

CMake is there so you don't have to worry about that. Dependencies and config settings might change depending on the platform and from one version to the other. If you have no clue what CMake is doing, that doesn't make it garbage. It's still best practice even if you don't follow it.

To compile it as a dynamic library, you need to give CMake the -D BUILD_SHARED_LIBS=ON option. The library still has dependencies nonetheless.

The release section includes packages for a few platforms and some users have been contributing formulas for various package managers. This project attempts to be easily packageable to allow that to happen, and that includes CMake integration. But maintaining apt-get packages or any other specific formula for a specific package manager is out of the scope of this repository.

Completely refactoring the library to make it standalone, not providing build system integration, and deviating from best practices just to make the command to link it manually shorter is out of the question.