beman-project / exemplar

Example Beman project
Other
10 stars 16 forks source link

The library should have at least one runtime dependency to be really helpful #59

Open ClausKlein opened 3 weeks ago

ClausKlein commented 3 weeks ago

An STATIC, SHARED buildable library should be created, not only a simple header only (INTERFACE).

It should also export only it public interface!

See too https://crascit.com/2019/10/16/cppcon-2019-deep-cmake-for-library-authors/

camio commented 2 weeks ago

This would be great. @ClausKlein would you be willing to contribute something like this?

ClausKlein commented 2 weeks ago

Sure, I would like to help.

camio commented 2 weeks ago

Thanks! Feel free to create a PR or throw some ideas here. Let me know if there's anything I can do to help.

ClausKlein commented 2 weeks ago

Do you know the WindowsToolchain? I would like to use them for windows CI build with ninja.

This builds quite faster and makes it even more easy to setup a cmake workflow preset for windows.

bretbrownjr commented 2 weeks ago

Why does this project need a runtime dependency? I think I need to hear some more concrete situations where runtime dependencies are required or at least clearly superior to other options.

Note that this project is intentionally not an educational project to teach CMake [1]. It is intended to assist a reasonably experienced C++ engineer to start developing a standard library proposal.

I would expect the typical proposal would have a fairly modest dependency list, frequently an empty one, but maybe I am too optimistic.

[1] Jason Turner's https://github.com/cpp-best-practices/cmake_template is more in line for those goals.

camio commented 2 weeks ago

Why does this project need a runtime dependency? I think I need to hear some more concrete situations where runtime dependencies are required or at least clearly superior to other options.

This is a fair question. I would imagine something the linear algebra proposal would have a runtime dependency on blas. The, now defunct, 2d graphics proposal would have a runtime dependency on cairo IIRC.

camio commented 2 weeks ago

Do you know the WindowsToolchain?

I was unfamiliar with that. Thanks for pointing it out!

My understanding is that most professional Windows developers use Visual Studio, but I could be out-of-date.

ClausKlein commented 2 weeks ago

My understanding is that most professional Windows developers use Visual Studio, but I could be out-of-date.

Yes and No, many developers I know use also qt-creator, or clion, but not on CI, it is to slow.

This toolchain also supports clang-cl with ninja. (clang-19 is included in Visual Studio 2023, and cmake workflows are supported too)

camio commented 2 weeks ago

I took a look at the ISO Cpp 2024 developer survey and this is the breakdown for primary IDE/Editor used:

image

camio commented 2 weeks ago

I created this thread to start a conversation on what our preset list should be.

I think to support most Windows C++ developers, we need a Visual Studio preset which is tested as part of CI. That doesn't preclude using WindowsToolchain in addition in our CI matrix that surfaces windows issues on PRs more quickly.

bretbrownjr commented 2 weeks ago

I would imagine something the linear algebra proposal would have a runtime dependency on blas. The, now defunct, 2d graphics proposal would have a runtime dependency on cairo IIRC.

Sure, but this library doesn't need a runtime dependency. I would think less is more when it comes to getting started on a new library.

Of course, I would support someone documenting the relevant steps to add a dynamic dependency. Or better yet, someone working on a proposal that benefits from a dynamic dependency.

wusatosi commented 5 days ago

Maybe a fmt vcpkg dependency for testing just because?

I forgot gtest is a test dependency.

I actually don't really think we need package manager, besides Google Test, all current projects are dependency-free.

ClausKlein commented 5 days ago

all current projects are dependency-free No, that is not true. See https://github.com/beman-project/net29/blob/cb731f8bda0d964011eab0cb0c5e21ee2bbd7928/CMakeLists.txt#L17

To show all aspect of an library, the example template should:

ctest --test-and-build usage example. ;-)