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

Packaging imtui for Linux distributions #17

Open
jubalh opened this issue Dec 15, 2020 · 18 comments
Open

Packaging imtui for Linux distributions #17

jubalh opened this issue Dec 15, 2020 · 18 comments
Labels
enhancement New feature or request

Comments

@jubalh
Copy link

jubalh commented Dec 15, 2020

I would like to build a package for this.

  • It would be great if you could tag and create releases in GitHub.
  • if there would be a make install to install the library.
  • if there could be a single tarball which doesn't need git to build.
  • Would be nice to have a pkgconfig (pc) file too.
@ggerganov
Copy link
Owner

Sounds great!

1, 2 and 3 will do very soon.
4 will probably take some time.

@ggerganov ggerganov added the enhancement New feature or request label Dec 15, 2020
@ggerganov
Copy link
Owner

Should the tar contain just a copy of the source + the submodules?

@jubalh
Copy link
Author

jubalh commented Dec 15, 2020

Should the tar contain just a copy of the source + the submodules?

Yep, if that is what is needed to build it. Many Linux distros have a build environment that doesn't allow network connections for their package building.

Being curious: what submodules are used?

@ggerganov
Copy link
Owner

It uses the Dear ImGui library.

I think I was able to modify the CMake configuration to properly install targets. You can try with this release:

https://github.com/ggerganov/imtui/releases/tag/v1.0.2

To build shared libs, use cmake -DBUILD_SHARED_LIBS=1. By default it builds static.

  • The release exports 2 C++ libraries: libimtui and libimtui-ncurses.
  • libimtui-ncurses depends on libncurses.

Let me know if something else is needed.

@jubalh
Copy link
Author

jubalh commented Dec 15, 2020

The release exports 2 C++ libraries: libimtui and libimtui-ncurses.

What's the difference? (I'm not yet familiar with the codebase. Only found the project today)

@ggerganov
Copy link
Owner

'libimtui' just renders the ImGui draw data into a memory buffer.

You now need a way display this buffer on the screen and also provide input from the keyboard and/or mouse. This is what 'libimtui-ncurses' does.

In theory, one can use some other lib X instead of ncurses and then ImTui would provide 'libimtui-X' or the user can directly use 'libimtui' with their I/O.

Hope that makes sense. This library separation is very similar to what Dear ImGui does - I'm simply following their example.

@carlosjoserg
Copy link

Hey, I'd be happy to help on this one.. ! We've been using this library for some months, building from a cmake Add_ExternalProject, but we'd like to treat it as a system dependency (so a deb package would be great!)

I recently synced our fork at master to test the install feature... but I wasn't able to build directly. I had to do a couple of not-so-elegant tweaks in the cmake to build my dependant projects as before, namely:

  1. Install ImGUI related files: beta-robots@94a43ad
  2. Install ImTUI headers into a imtui folder, so they can find each other: beta-robots@c71e1e9

Let me know if you need more user-side testing. And thanks for the library!

@ggerganov
Copy link
Owner

Hi @carlosjoserg . Thanks for the info.

I recently synced our fork at master to test the install feature... but I wasn't able to build directly.

Yes, I think I somehow messed up the CMake install commands at some point.
I'll take a look at your suggested changes and push proper CMakeLists to master.

Regarding the package:
I am not familiar with the process of publishing the package and making it available to various distros.
Do I need to make my own PPA? Or do I apply somewhere?
Any help/info on that would be much appreciated.

@jubalh
Copy link
Author

jubalh commented Mar 26, 2021

I am not familiar with the process of publishing the package and making it available to various distros.
Do I need to make my own PPA? Or do I apply somewhere?

No you don't. Packagers do this. What you basically need to do is what I mentioned in my first request: #17 (comment)

From there packagers will pick up your package if they are interested. One can also file requests for packaging in various distributions.

@ggerganov
Copy link
Owner

@carlosjoserg

I made a PR that should fix the CMake install targets: #26
Let me know if that works for you.

@jubalh

After we merge #26 I will make a new release that should satisfy the first 3 points in your comment.
Will post an update here when this is ready. Thanks!

@jubalh
Copy link
Author

jubalh commented Mar 26, 2021

@ggerganov that's great. I'll package imtui then for openSUSE.

@ggerganov
Copy link
Owner

@jubalh Just made the v1.0.4 release:

https://github.com/ggerganov/imtui/releases/tag/v1.0.4

There is also a tarball attached.

To build, use:

tar -zxvf imtui-1.0.4.tar.gz
cd imtui-1.0.4
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/some/path/to/install ..
make install

@carlosjoserg
Copy link

@carlosjoserg

I made a PR that should fix the CMake install targets: #26
Let me know if that works for you.

Yes, that worked. Thanks!

@jubalh
Copy link
Author

jubalh commented Apr 7, 2021

I made a test package at https://build.opensuse.org/package/show/home:jubalh/imtui now.
It seems imtui also installs imgui header files. We have an imgui test package too: https://build.opensuse.org/package/show/devel:libraries:c_c++/imgui
So I would like to rather depend on that one. So that not two packages install the same files.

Could you add an option so that we don't install the imgui files when building/installing imtui?

@ggerganov
Copy link
Owner

I added the option and made release v1.0.5:

https://github.com/ggerganov/imtui/releases/tag/v1.0.5

Use like this:

cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/some/path/to/install -DIMTUI_INSTALL_IMGUI_HEADERS=OFF ..

I am wondering if it would be better if I moved the imgui headers that imtui provides into a folder called imgui-for-imtui. This way, imtui can continue to distribute it's imgui headers and we will avoid the name clash.

@jubalh
Copy link
Author

jubalh commented Apr 13, 2021

@ggerganov thanks for this.
I now have the package moved to an official devel repo for openSUSE: https://build.opensuse.org/package/show/devel:libraries:c_c++/imtui

It would be really great if you could use library versioning: https://autotools.io/libtool/version.html
And a .pc file would also be nice but is not as important.

After adding library versioning I could push this into official repositories.

@ggerganov
Copy link
Owner

@jubalh Regarding the library versioning:
I also find this page and I think I now understand how it works:
https://www.sourceware.org/autobook/autobook/autobook_61.html

I should make a new release with version 0.0.0 and increment the numbers as explained.

Before I make the release: do I need to change my CMake to generate the .so files with the version number at the end?
For example:

  • libimtui.so -> libimtui.so.0.0.0
  • libimtui-ncurses.so -> libimtui-ncurses.so.0.0.0

@endgame
Copy link

endgame commented Nov 18, 2021

It looks like you do, but I haven't been in the C++ space for ages: https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html

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

4 participants