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

Adding a "zug_" prefix to target names and some other enhancements #26

Open
haras-unicorn opened this issue Apr 10, 2021 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@haras-unicorn
Copy link

Hello!

I was trying to link zug and Boost.Hana in a project of mine and ran into issues with target names, so I decided to make a fork and add a zug_ prefix to all targets, variables, and functions where one is missing and add a log function which adds a [zug::${PROJECT_NAME}]: prefix to every status message from zug (when CCache has been or hasn't been found and when adding test targets).
I ran the check target (its name is "zug_check" in my fork) and every test is passing.

I also noticed that when I include the sequence header I get an error saying boost::mpl is not present (there has been an issue discussing this, but I don't know if this was fixed), so I was thinking of adding a metafunction that does the same thing in the meta namespace.

Are you interested in a pull requests that do this? If not, I will just keep using my fork and merge from master from time to time to keep things updated, so it's not a problem on my part if you don't want this.
I would like to add a pull request that does this for immer as well if you are interested.

PS: I dig the idea of making C++ more functional and declarative coming from React, so thank you for all the great libraries 😄

@arximboldi
Copy link
Owner

Hmmm, if you use find_package(Immer) I don't think you have this issue, do you? I think the ergonomics of having to do zug_ all the time are not great, and I like the Makefile targets to follow GNU-ish convetions like make check to check the project, etc.

@arximboldi
Copy link
Owner

Also glad that you are finding the libraries useful or interesting!! ❤️

@haras-unicorn
Copy link
Author

I'm using CMake's FetchContent module for dependencies. This is something I also picked up from the Javascript ecosystem.
I was trying to use Conan for dependencies but getting it to work for multiple compilers in one project using CMake is really hard and depends on the dependencies you are using.
FindPackage is ok but it demands that users of my projects have all the dependencies preinstalled, so I tend to avoid those kinds of options.
I really wish C++ had a nice standardized package manager and build system like other languages now...

I don't like the zug_ ergonomics either, but I found it was the only way to have something like "namespaces" in CMake and avoid name collision since most projects add or try to add targets like test, check, benchmark, and so on. I don't know if this is a problem if you manage your dependencies with FindPackage, though.
As for the GNU-ish conventions, I could add the check target if it doesn't exist and add zug_check as a dependency.

@haras-unicorn
Copy link
Author

I also discovered a bug on MSVC concerning inline constexpr variables and was able to fix it. MSVC doesn't allow constexpr variables being extern, so you have to pass in the compiler flag /Zc:externConstexpr to enable that .
Relevant links:
https://docs.microsoft.com/en-us/cpp/build/reference/zc-externconstexpr?view=msvc-160
https://docs.microsoft.com/en-us/cpp/cpp/selectany?view=msvc-160

@tusooa
Copy link
Contributor

tusooa commented May 25, 2023

Yes it's the problem of FetchContent. You can instead have them as submodules in your git repo and just specify target_include_directories

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

No branches or pull requests

3 participants