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

Package manager support #335

Open
10 of 11 tasks
ReallySnazzy opened this issue Mar 25, 2022 · 45 comments · Fixed by #1308
Open
10 of 11 tasks

Package manager support #335

ReallySnazzy opened this issue Mar 25, 2022 · 45 comments · Fixed by #1308
Labels
good first issue Good for newcomers help wanted Extra attention is needed packages Issue or Pull Request related to packaging project

Comments

@ReallySnazzy
Copy link

ReallySnazzy commented Mar 25, 2022

Is your feature request related to a problem? Please describe.
Vcpkg or conan support help alleviate the setup for multiple libraries in a project. They help to get started quickly with a framework while still allowing other libraries to be added quickly.

Describe the solution you'd like
Rather than premade build setups, I think that having vcpkg or conan support would enable more ambitious discord bots to be created faster.

Describe alternatives you've considered

Additional context

Tasks added by @braindigitalis

  • vcpkg
  • xmake
  • AUR
  • SW Network
  • Libhunt
  • gentoo emerge/GURU
  • void linux XBPS
  • FreeBSD Ports/Packages
  • apt, ppa
  • conan
  • brew
@braindigitalis braindigitalis added the help wanted Extra attention is needed label Mar 25, 2022
@SirLynix
Copy link

I added DPP to xmake repository (see xmake-io/xmake-repo#1222), with my changes it compiles fine on Windows, MinGW, Linux, macOS in both dynamic and static linking.

Since xmake is able to handle dependencies (will find libraries on the machine like cmake but is able to download and compile them if it doesn't find them), I managed to build the lib using a very short xmake.lua.

Usually, xmake packages use CMake to build CMake libraries, but the way dependencies are handled on DPP doesn't help much (mostly because they are embedded). Which is why I patched nlohmann/fmt out of the lib.

I also fixed the export.h header which made static linking impossible on Windows, here's the diff:

diff --git a/include/dpp/export.h b/include/dpp/export.h
index b7b35b5..838f79d 100644
--- a/include/dpp/export.h
+++ b/include/dpp/export.h
@@ -24,25 +24,29 @@
 // Investigate: MSVC doesn't like this
 //static_assert(__cplusplus >= 201703L, "D++ Requires a C++17 compatible compiler. Please ensure that you have enabled C++17 in your compiler flags.");
 
-#ifdef DPP_BUILD
+#ifndef DPP_STATIC
 
-	#ifdef _WIN32
-		#include <dpp/win32_safe_warnings.h>
-	#endif
+	#ifdef DPP_BUILD
+
+		#ifdef _WIN32
+			#include <dpp/win32_safe_warnings.h>
+		#endif
 
-	#ifdef _WIN32
-		#define DPP_EXPORT __declspec(dllexport)
+		#ifdef _WIN32
+			#define DPP_EXPORT __declspec(dllexport)
+		#else
+			#define DPP_EXPORT
+		#endif
 	#else
-		#define DPP_EXPORT
+		#ifdef _WIN32
+			#define DPP_EXPORT __declspec(dllimport)
+		#else
+			#define DPP_EXPORT
+		#endif
 	#endif
+
 #else
-	#ifdef _WIN32
-		#define DPP_EXPORT __declspec(dllimport)
-		/* This is required otherwise fmt::format requires additional file linkage to your project */
-		#define FMT_HEADER_ONLY
-	#else
-		#define DPP_EXPORT
-	#endif
+	#define DPP_EXPORT
 #endif
 
 #ifndef _WIN32

@braindigitalis
Copy link
Contributor

nlohmann and fmt are header only. it would be nicer if they weren't patched out, because we test with specific versions and not just whatever the latest is which could cause support issues

@SirLynix
Copy link

xmake can be instructed to use a specific version of nlohmann/fmt.
The main issue here is that by embedding a specific version of those libraries (and not putting them in a namespace), you conflict with the user nlohmann/fmt libs (obligating them to use the very same version you're using for API/ABI compatibility).

Since these libraries are very well tested, I think it would be better to not embed them to prevent such issues.

@braindigitalis
Copy link
Contributor

I added DPP to xmake repository (see xmake-io/xmake-repo#1222), with my changes it compiles fine on Windows, MinGW, Linux, macOS in both dynamic and static linking.

Since xmake is able to handle dependencies (will find libraries on the machine like cmake but is able to download and compile them if it doesn't find them), I managed to build the lib using a very short xmake.lua.

Usually, xmake packages use CMake to build CMake libraries, but the way dependencies are handled on DPP doesn't help much (mostly because they are embedded). Which is why I patched nlohmann/fmt out of the lib.

I also fixed the export.h header which made static linking impossible on Windows, here's the diff:

diff --git a/include/dpp/export.h b/include/dpp/export.h
index b7b35b5..838f79d 100644
--- a/include/dpp/export.h
+++ b/include/dpp/export.h
@@ -24,25 +24,29 @@
 // Investigate: MSVC doesn't like this
 //static_assert(__cplusplus >= 201703L, "D++ Requires a C++17 compatible compiler. Please ensure that you have enabled C++17 in your compiler flags.");
 
-#ifdef DPP_BUILD
+#ifndef DPP_STATIC
 
-	#ifdef _WIN32
-		#include <dpp/win32_safe_warnings.h>
-	#endif
+	#ifdef DPP_BUILD
+
+		#ifdef _WIN32
+			#include <dpp/win32_safe_warnings.h>
+		#endif
 
-	#ifdef _WIN32
-		#define DPP_EXPORT __declspec(dllexport)
+		#ifdef _WIN32
+			#define DPP_EXPORT __declspec(dllexport)
+		#else
+			#define DPP_EXPORT
+		#endif
 	#else
-		#define DPP_EXPORT
+		#ifdef _WIN32
+			#define DPP_EXPORT __declspec(dllimport)
+		#else
+			#define DPP_EXPORT
+		#endif
 	#endif
+
 #else
-	#ifdef _WIN32
-		#define DPP_EXPORT __declspec(dllimport)
-		/* This is required otherwise fmt::format requires additional file linkage to your project */
-		#define FMT_HEADER_ONLY
-	#else
-		#define DPP_EXPORT
-	#endif
+	#define DPP_EXPORT
 #endif
 
 #ifndef _WIN32

with this diff applied does dpp still build ok outside of xmake?
the FMT_HEADER_ONLY was there for a reason and otherwise it would build but fail at runtime...

@SirLynix
Copy link

with this diff applied does dpp still build ok outside of xmake?

Yes, but DPP_STATIC should be handled in the cmakelists.

the FMT_HEADER_ONLY was there for a reason and otherwise it would build but fail at runtime...

It makes little sense to build the lib without FMT_HEADER_ONLY and use it with user code, the reason it was failing was because fmt has to be linked to the final executable without that flag, something a proper package manager guarantees.

@braindigitalis
Copy link
Contributor

xmake can be instructed to use a specific version of nlohmann/fmt. The main issue here is that by embedding a specific version of those libraries (and not putting them in a namespace), you conflict with the user nlohmann/fmt libs (obligating them to use the very same version you're using for API/ABI compatibility).

Since these libraries are very well tested, I think it would be better to not embed them to prevent such issues.

I see, I will consider moving dpp's copies to a namespace to prevent conflicts.

@braindigitalis
Copy link
Contributor

with this diff applied does dpp still build ok outside of xmake?

Yes, but DPP_STATIC should be handled in the cmakelists.

the FMT_HEADER_ONLY was there for a reason and otherwise it would build but fail at runtime...

It makes little sense to build the lib without FMT_HEADER_ONLY and use it with user code, the reason it was failing was because fmt has to be linked to the final executable without that flag, something a proper package manager guarantees.

thanks! can you please submit a pr of this diff against dev branch and I'll merge it in...

@SirLynix
Copy link

SirLynix commented May 18, 2022

I see, I will consider moving dpp's copies to a namespace to prevent conflicts.

Unfortunately this won't be enough, because of preprocessor defines (libs header guards), there's no proper way to embed fmt/nlohmann in a project headers.

thanks! can you please submit a pr of this diff against dev branch and I'll merge it in...

Someone else is working on this already, all my changes will only be applied when installing dpp through xmake.

If you wish to keep using CMake, xrepo-cmake may help you to handle dependencies in a better way.

@braindigitalis braindigitalis added the good first issue Good for newcomers label Jun 17, 2022
@M-U-X
Copy link

M-U-X commented Jun 23, 2022

Vcpkg support would be quite nice, is it coming anytime soon?

@braindigitalis
Copy link
Contributor

there's an open pr over there, ive not had time to work on it though...

@braindigitalis
Copy link
Contributor

Vcpkg support would be quite nice, is it coming anytime soon?

there is now a finalized pr in vcpkg thanks to @RealTimeChris - we should be in vcpkg very soon!

@egorpugin
Copy link

@braindigitalis
Copy link
Contributor

Nice, thanks! does this auto update from github releases?

@egorpugin
Copy link

No, not yet.
Such feature is on todo list, but won't be here soon enough.

@NexAdn
Copy link
Contributor

NexAdn commented Aug 29, 2022

Since I have already an ebuild for Gentoo, I might as well move it to ::guru (the AUR equivalent for Gentoo). DPP is probably not big enough (in terms of consumers) for the main repo, but ::guru should suffice.

However, since I had to patch the installation for DPP to work on my Gentoo machines (mainly to correct some paths and file names), I might submit a PR making some changes to the installation procedure first.

@braindigitalis
Copy link
Contributor

Since I have already an ebuild for Gentoo, I might as well move it to ::guru (the AUR equivalent for Gentoo). DPP is probably not big enough (in terms of consumers) for the main repo, but ::guru should suffice.

However, since I had to patch the installation for DPP to work on my Gentoo machines (mainly to correct some paths and file names), I might submit a PR making some changes to the installation procedure first.

thanks, i'd like to see this 😊

@github-actions github-actions bot added the Stale label Oct 29, 2022
@brainboxdotcc brainboxdotcc deleted a comment from github-actions bot Oct 29, 2022
@SirObby
Copy link
Contributor

SirObby commented Dec 3, 2022

Hey @NexAdn are you still going to move your ebuild for Gentoo to the GURU?
If not, would you mind if I do that?

@thenameisluk
Copy link
Contributor

bruh

@NexAdn
Copy link
Contributor

NexAdn commented Dec 4, 2022

@SirObby oh boy, I totally forgot that 😓 Feel free to move your ebuild. If you want, we can co-maintain it (you can use [email protected] as my email for metadata.xml).

NexAdn added a commit to NexAdn/DPP that referenced this issue Jan 4, 2023
The previous method of installation didn't respect the standard dirs,
leading to build tools not recognizing DPP correctly. This commit fixes
this by moving everything to the standard dirs. As a side effect, files
are no longer installed twice, due to CMake already placing some files
in the right spots.

Issue: brainboxdotcc#590
Issue: brainboxdotcc#335
NexAdn added a commit to NexAdn/DPP that referenced this issue Jan 4, 2023
The previous method of installation didn't respect the standard dirs,
leading to build tools not recognizing DPP correctly. This commit fixes
this by moving everything to the standard dirs. As a side effect, files
are no longer installed twice, due to CMake already placing some files
in the right spots.

Issue: brainboxdotcc#590
Issue: brainboxdotcc#335
@NexAdn
Copy link
Contributor

NexAdn commented Jan 4, 2023

The Gentoo package is now uploaded to GURU and should be available for the public soon. it is maintained by @SirObby and me

@RatTrap1337
Copy link

add openssl to vcpkg on linux its not present

@braindigitalis
Copy link
Contributor

add openssl to vcpkg on linux its not present

... who uses vcpkg on linux 😂
nah, PR welcome. vcpkg is broken right now, and needs redoing.

@braindigitalis
Copy link
Contributor

Is there interest in having conan support?

of course, is this something you have experience with?

@MikeRavenelle
Copy link
Contributor

Yes I do. I can look into writing a conan recipe.

@mrtuxa
Copy link
Contributor

mrtuxa commented Sep 25, 2023

i guess the best opiton is to push it into nixpkgs

@Jaskowicz1
Copy link
Contributor

AUR needs a new maintainer. The current maintainer (@Eremiell) hasn't been around in a while. If anyone knows how to do this, that'd be great!

@Jaskowicz1
Copy link
Contributor

I'm looking at creating a brew package for silicone Mac processors (Darwin). It's currently in the works right now and I'll be back with more information soon.

@Jaskowicz1
Copy link
Contributor

Jaskowicz1 commented Nov 13, 2023

Brew PR is up, we have to wait til next release for it to go anywhere as currently our unit test is broken on Mac. I launched a PR to fix this though!

Edit: Even though a PR was launched to fix the unit tests on Mac, we are no longer required to wait for the unit test and we should expect brew to accept the PR soon.

@Jaskowicz1
Copy link
Contributor

We are now on Brew!! 🥳

@razaqq
Copy link

razaqq commented Dec 6, 2023

any update on conan support?

@Jaskowicz1
Copy link
Contributor

any update on conan support?

We've had a couple of people say they want to do it but we've not heard anything since, sadly. Is this something you know how to do?

@MikeRavenelle
Copy link
Contributor

any update on conan support?

I have a PR that has a conan recipe. Some work is left to be done to finalize it as well as get it on the conan center.

@AA1999
Copy link
Contributor

AA1999 commented Jan 23, 2024

any update on conan support?

We've had a couple of people say they want to do it but we've not heard anything since, sadly. Is this something you know how to do?

tbf Emirell and I were going to do it, however, at that point, Conan 2.0 was still not fully supported

@Jaskowicz1 Jaskowicz1 pinned this issue Feb 19, 2024
@github-actions github-actions bot added the Stale label Mar 24, 2024
@brainboxdotcc brainboxdotcc deleted a comment from github-actions bot Mar 24, 2024
@github-actions github-actions bot added the Stale label May 24, 2024
@brainboxdotcc brainboxdotcc deleted a comment from github-actions bot May 24, 2024
@Jaskowicz1 Jaskowicz1 removed the Stale label May 24, 2024
@Jaskowicz1
Copy link
Contributor

No longer marked as stale

@github-actions github-actions bot added the Stale label Jul 24, 2024
@brainboxdotcc brainboxdotcc deleted a comment from github-actions bot Jul 24, 2024
@AA1999
Copy link
Contributor

AA1999 commented Jul 24, 2024

I can get working on conan if no one else has

@Jaskowicz1
Copy link
Contributor

I can get working on conan if no one else has

That would be wonderful! #1066 is the best place to pickup, there was some good progress made here.

Copy link
Contributor

This issue has had no activity and is being marked as stale. If you still wish to continue with this issue please comment to reopen it.

@github-actions github-actions bot added the Stale label Sep 23, 2024
@braindigitalis braindigitalis linked a pull request Oct 25, 2024 that will close this issue
5 tasks
@braindigitalis
Copy link
Contributor

the next release should be available on Conan 😀

@braindigitalis
Copy link
Contributor

we are now in Conan centre!

conan-io/conan-center-index#25745

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed packages Issue or Pull Request related to packaging project
Projects
None yet
Development

Successfully merging a pull request may close this issue.