Lecrapouille / gdcef

[Plugin][Version 0.10.0][Functional] Chromium Embedded Framework Webview for Godot 3 and 4
https://discord.gg/EckEwy7S5U
MIT License
222 stars 26 forks source link

Compile the add-on with Godot #36

Closed PiCode9560 closed 8 months ago

PiCode9560 commented 9 months ago

Is it possible if you compile this add-on with Godot as a module, so that I can use it without installing external programs?

Lecrapouille commented 8 months ago

@PiCode9560 sorry for the long delay GitHub did not notice me about your ticket ;(

To be sure: by module do you mean: forking Godot and adding code inside the module folder, right ?

Yes you can do that, but I do not recommend you to go this way. I initially tried what you said before switching development with a second CEF process. I wrote a note concerning this https://github.com/stigmee/doc-internal/blob/master/doc/tuto_modif_godot_fr.md (in French sorry). It worked for Linux but I do not recommend it because:

PiCode9560 commented 8 months ago

Other than adding it directly into godot. User need to compile the add-on to use it. Is it possible for you to give the compiled version, so that anyone it without installing external programs?

Lecrapouille commented 8 months ago

@PiCode9560 do you mean artefacts (the build folder ?). With the CI I can, I guess, but artefacts size are ~1 GB

PiCode9560 commented 8 months ago

But if the user build it themself, the total project size are 1GB anyway.

I'm not an expert on gdnative/c++/cef, but is it necessary for the user to build it themself?

Lecrapouille commented 8 months ago

Yes the build.py will compile and create some artifacts that are needed. My CI is already testing the compilation so I have to extend the script to store them somewhere

PiCode9560 commented 8 months ago

Sorry but I don't really understand what you are saying.

Yes the build.py will compile and create some artifacts that are needed.

So it is necessary for the user to build it themself?

My CI is already testing the compilation so I have to extend the script to store them somewhere

Are you doing something right now?

Lecrapouille commented 8 months ago

@PiCode9560 do not worry I'll create what you want, just give me a couple of days

Lecrapouille commented 8 months ago

@PiCode9560 yesterday I made what you wanted. I've not tested on demo yet

PiCode9560 commented 8 months ago

I tested the Windows version on the 2d demo. Just drop the build folder into the project folder and run the project, it worked well as expected.

Thanks!

PiCode9560 commented 8 months ago

Hmm, the cef didn't load on Windows exported version. I export it like you would normally do with other Godot project.

Lecrapouille commented 8 months ago

@PiCode9560 I'm not sure to understand your two messages that seem to contradict themselves.

PiCode9560 commented 8 months ago

Well, it only worked in the editor, but when I exported it to Windows executable file the cef didn't load. Any idea why?

Lecrapouille commented 8 months ago

Ah ok I understand now! It used to work when I worked for the main project using CEF ~1 year ago. So it should work normally (expect if merge requests made it no longer working). The Windows portage was made by my coworker. I'm not a Windows user, but I'll give a try

Lecrapouille commented 8 months ago

@PiCode9560 where have you exported your application binary ? For Linux you have to place it in the same folder holding CEF artifacts. I do not remember why I have made like this.

Lecrapouille commented 8 months ago

Remembering now: paths are configurable. See in .gd files comments in func _ready()::

resource_path := {"artifacts", CEF_ARTIFACTS_FOLDER}
resource_path := {"exported_artifacts", application_real_path()}

When running, you have logs. In my case:

[GDCEF][GDCEF::initialize] Launching CEF from your executable
[GDCEF][GDCEF::initialize] Path where your application files shall be located:"/home/Lecrapouille/gdcef/addons/gdcef/demos/2D"

In case artifacts are not in the correct folder, you'll see:

[GDCEF] [are_valid_files] File "/home/Lecrapouille/gdcef/addons/gdcef/demos/2D/gdcefSubProcess" does not exist and is needed for CEF
PiCode9560 commented 8 months ago

@Lecrapouille I drop all the things from the build folder into the folder that contain the exported executable file. Now it worked! That's all I need to do, right?

Lecrapouille commented 8 months ago

@PiCode9560 cool! You can update the gd script to indicate the path you want.

Lecrapouille commented 8 months ago

I'll release the godot-4 you'll have the assets too. I'll create a ticket for Godot assets lib