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

Reduce number of dependencies #54

Closed
Ealrann opened this issue Jul 31, 2018 · 7 comments
Closed

Reduce number of dependencies #54

Ealrann opened this issue Jul 31, 2018 · 7 comments

Comments

@Ealrann
Copy link

Ealrann commented Jul 31, 2018

Hello,

I'm questioning about how to reduce the size of my build, and now I'm looking about this imgui port. I use it with vulkan, so I have to call getDrawData(), and make the draw myself.

In my context, is that possible to reduce the number of dependencies ? Maybe I don't really need all the LWJGL-3.1.7-SNAPSHOT stuff needed by imgui.

@Ealrann Ealrann changed the title Reduce dependances Reduce dependancies Jul 31, 2018
@Ealrann Ealrann changed the title Reduce dependancies Reduce number of dependancies Jul 31, 2018
@Ealrann Ealrann changed the title Reduce number of dependancies Reduce number of dependencies Jul 31, 2018
@elect86
Copy link
Collaborator

elect86 commented Aug 1, 2018

Hi Aurélien,

yeah, sure, it's possible, if you are doing everything yourself, theoretically we could get rid of:

  • lwjgl glfw, openal and opengl (I guess core and stb are mandatory, not sure about jemalloc)
  • jogl in whole

Also, a similar stuff came out few days ago..

We could create a branch for this purpose, since I guess this might benefit also other people..

would you be maybe available to take care of it? :)

@Ealrann
Copy link
Author

Ealrann commented Aug 1, 2018

I just gave a try, here what I found:

  • I saw that even if I remove some lwjgl dependencies here, they are still needed by UNO. So not sure how could this be managed properly.
  • I guess that the Test_lwjgl.java could be put in other project, to remove some dependencies in the main project.
  • Last but not least, the font looks really heavy, but maybe you needed this one?

@elect86
Copy link
Collaborator

elect86 commented Aug 2, 2018

Uh, yeah, uno is using them..

Well, one way for sure would be to manually replace all the uno imports

I guess that the Test_lwjgl.java could be put in other project, to remove some dependencies in the main project.

Honestly I don't like the idea of having the tests in another project, they are quite important as a play ground to try the library features and to fix bugs.

Last but not least, the font looks really heavy, but maybe you needed this one?

Yeah, the whole folder weights 22.6 MB, but one font itselft, ArialUni, is 22.1 MB. It included for the japanese ideograms.

With a potential vk-tiny branch, it would be just a matter of merging from time to time from the master one into that, to keep up with the changes and the updates.

Ps: in your app are you using lwjgl anyway, don't you?

@Ealrann
Copy link
Author

Ealrann commented Aug 2, 2018

Sorry, I will not maintain that branch myself, my need is not high enough for that, and now I will have to focus on some other project. Just sad that my zip of 40Mo contains 30Mo of UI;
But whatever, I'm still very grateful you made this port !!

Yeah, I use lwjgl, but only the minimal vulkan part. I don't use opengl, nor openal.

@chrjen
Copy link
Collaborator

chrjen commented Aug 3, 2018

Hi, @Ealrann

If you don't need OpenGL and you don't use any part of this library that depends on it you should be able to simple delete the lwjgl-opengl.jar file and not include it in your project. Of course it will then crash if you call any method in the library which in turn relies on any code inside the lwjgl-opengl.jar file. If you are using gradle instead of manually doing it you should be able to do something like this.

implementation('com.github.kotlin-graphics:imgui:v1.63-beta-00') {
    exclude group: 'org.lwjgl', id: 'lwjgl-opengl'
}

You can do this for e.g. OpenAL as well.

However you seemed mostly concerned about file size. There is also a new alternative version of the library without the extra fonts and should be a lot smaller (~1 MB). It's not part of any release yet, though you can still try it, just add :light behind the version number, again assuming you are using gradle.

Currently only the latest commit has this version, but example.

implementation 'com.github.kotlin-graphics:imgui:383579e83b:light'

@Ealrann
Copy link
Author

Ealrann commented Aug 3, 2018

Hi @chrjen ,

Oh my god, it's way better with the light branch, and with the "exclude group". Thank you.. Here the one I use for now :

api('com.github.kotlin-graphics:imgui:383579e83b:light'){
	exclude group: 'org.lwjgl', module: 'lwjgl-opengl'
	exclude group: 'org.lwjgl', module: 'lwjgl-openal'
	exclude group: 'graphics.scenery', module: 'spirvcrossj'
}

You seems to focus a lot on the size of the font (and yes, it's important), but don't forget the dependencies. Even in the Windows build, you seems to link to many unneeded jars like openal-linux (??), spirv, armv6hf or macos natives... It's not a big deal, but for the lightweight projects, it's something.

But whatever, your solution totally fit to me, so thank you again :)

@chrjen
Copy link
Collaborator

chrjen commented Aug 3, 2018

Thank you for the feedback, we'll take that under consideration. If it solved your issue consider closing it.

@Ealrann Ealrann closed this as completed Aug 3, 2018
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

3 participants