tqdm.cpp icon indicating copy to clipboard operation
tqdm.cpp copied to clipboard

CMake support

Open tdegeus opened this issue 5 years ago • 11 comments

Nice library!

I wonder though, do you provide CMake support / would you be willing to consider this (I'm happy to open a PR)?

tdegeus avatar Jan 28 '21 08:01 tdegeus

What exactly do you mean by CMake support?

ashok-arora avatar Feb 02 '21 17:02 ashok-arora

I mean that it would be great if a CMake target be defined that contains the path where the header is installed. This way one can use CMake to configure, for example as follows:

cmake_minimum_required(VERSION 3.1)
project(example)
find_package(tqdm.cpp REQUIRED)
add_executable(example example.cpp)
target_link_libraries(example PRIVATE tqdm.cpp)

tdegeus avatar Feb 02 '21 19:02 tdegeus

It's really not hard, and on top of that I would be willing to provide a PR

tdegeus avatar Feb 02 '21 19:02 tdegeus

I am not a member of the tqdm org but looking at the commit history and their delayed/no response to PRs/issues tells me that they aren't interested in this C++ port of tqdm which is a pity.

I would love to see a similar scoped library for C++.

ashok-arora avatar Feb 02 '21 20:02 ashok-arora

Hi; would be happy to accept a PR.

The library itself is really basic compared to the Python version and I'm unlikely to personally work on it more until I have a personal project which needs it (as with all my unpaid open source efforts :P).

I spend most of my time now wrapping CUDA/C/C++ in Python so happily get to use the latter for progress monitoring.

Also in simple cases you could always pipe the stderr or stdout of a C/C++/etc program to tqdm's CLI interface:

seq 10000 | python -m tqdm --null --total 10000

casperdcl avatar Feb 03 '21 11:02 casperdcl

Alright, then I'll make a PR in the coming days. Would you be willing to create a release thereafter, such that I can add the library to conda-forge?

Thanks for the pipe suggestion, that is in fact really nice!

tdegeus avatar Feb 03 '21 12:02 tdegeus

Yes, sure.

casperdcl avatar Feb 04 '21 13:02 casperdcl

@casperdcl The lines under this if statement cause all kinds of problems on my system. What do they do? Are they really needed?

https://github.com/tqdm/tqdm.cpp/blob/669d6354a279afd2177d66703d7405722ea627ca/CMakeLists.txt#L127

tdegeus avatar Feb 07 '21 10:02 tdegeus

@tdegeus What OS are you on?

ashok-arora avatar Feb 07 '21 11:02 ashok-arora

@ashok-arora OSx

tdegeus avatar Feb 07 '21 13:02 tdegeus

not super necessary - it's possible that maybe we should even leave out precompiled header logic altogether (leaving it as an optimisation for users to implement in case they want).

If it doesn't work on fruit, maybe try changing to:

if(UNIX AND NOT APPLE)

casperdcl avatar Feb 08 '21 20:02 casperdcl