Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ClausKlein opened this issue Oct 23, 2024 · 13 comments

Comments

@ClausKlein
Copy link

ClausKlein commented Oct 23, 2024

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
Copy link
Contributor

camio commented Oct 30, 2024

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

@ClausKlein
Copy link
Author

ClausKlein commented Oct 30, 2024

Sure, I would like to help.

@camio
Copy link
Contributor

camio commented Oct 31, 2024

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
Copy link
Author

ClausKlein commented Nov 1, 2024

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
Copy link
Contributor

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
Copy link
Contributor

camio commented Nov 1, 2024

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
Copy link
Contributor

camio commented Nov 1, 2024

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
Copy link
Author

ClausKlein commented Nov 1, 2024

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
Copy link
Contributor

camio commented Nov 1, 2024

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

image

@camio
Copy link
Contributor

camio commented Nov 1, 2024

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
Copy link
Contributor

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
Copy link
Member

wusatosi commented Nov 13, 2024

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
Copy link
Author

ClausKlein commented Nov 13, 2024

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:

  • is a library that builds static and shared
  • export only public symbols
  • as at least on link dependency
  • is exported as cmake config packege
  • this exported package has to be checked if it is usable
  • check the usability as a subproject with FetchContent or with ctest --test-and-build
  • has ci files for all supported OS
  • ...

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants