shish / rosettaboy

A gameboy emulator in several different languages
MIT License
469 stars 22 forks source link

[cpp] use {fmt} library #123

Closed ImanSeyed closed 1 year ago

ImanSeyed commented 1 year ago

Instead of using plain C functions, we can use the {fmt} library. Currently, there's no implementation of std::format(), so we have to use {fmt} instead. It's a more C++-ish thing to do.

shish commented 1 year ago

That does look pretty nice :O I've not used fmt before and don't know how widely installed it is, but if it builds on github and builds on my laptop, then I'll go ahead and merge :)

(It's coming up to 2am here though, so probably after sleeping ^^;; )

shish commented 1 year ago

Looks like fmt is a third-party library, so it needs adding to the list of dependencies to install before building?

ImanSeyed commented 1 year ago

Looks like fmt is a third-party library, so it needs adding to the list of dependencies to install before building?

Yes.

rrbutani commented 1 year ago

For Ubuntu I think this is fmtlib-dev, for nixpkgs it's fmt.


Needs to be added here (apt packages): https://github.com/shish/rosettaboy/blob/b12ea45743ea844eb9a2e7697455ff516fe6d632/.github/workflows/cpp.yml#L23

And here (nixpkgs): https://github.com/shish/rosettaboy/blob/b12ea45743ea844eb9a2e7697455ff516fe6d632/cpp/shell.nix#L2-L6

ImanSeyed commented 1 year ago

For Ubuntu I think this is fmtlib-dev, for nixpkgs it's fmt.

Needs to be added here (apt packages):

https://github.com/shish/rosettaboy/blob/b12ea45743ea844eb9a2e7697455ff516fe6d632/.github/workflows/cpp.yml#L23

And here (nixpkgs):

https://github.com/shish/rosettaboy/blob/b12ea45743ea844eb9a2e7697455ff516fe6d632/cpp/shell.nix#L2-L6

Done.

ImanSeyed commented 1 year ago

Alright, I think we're all set. Looks like I had to use something called "header-only" mode to fix the linking of the {fmt} library according to this. Also, the package name for Ubuntu was libfmt-dev, my bad.

shish commented 1 year ago

Success \o/ Merging now, thank you <3