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

Sharing Framework and Resoure files #65

Closed
PaulANormanNZ opened this Issue Jan 17, 2018 · 4 comments

Comments

2 participants
@PaulANormanNZ

PaulANormanNZ commented Jan 17, 2018

Hi,

Over on the FP Lazarus Forum under the thread:
http://forum.lazarus.freepascal.org/index.php/topic,39381.msg273259.html#msg273259

There's been a discussion: fpCef3: cef3lib.pas: set CefResourcesDirPath/CefFrameworkDirPath in FormCreate?

Altagur proposed a very workable solution in a discourse with PaulANormanNZ (this writer) there.

The purpose was to discover a way to share the CEF3 binaries and resources on a target machine when there will be two or more projects using fpCEF3.

Considerable disk usage savings were envisaged.
(Previously even running the fpCEF3 Examples' folders posed its own hefty disk load or folder maintenance for a developer.)

The current result of that discussion thread for working under Windows is:

1. making a small alteration to a projects .lpr pin pointing the shared location(s) on disk.

2. and presently making a small alteration to cef3api.pas

3. placing CEF3 locale folder and all resources and framework binaries and files in a shared local disk location

4. but placing chrome_elf.dll in Each project's .exe folder (the additional presence of chrome_elf.dll in the new CEF3 shared folder is redundant, but apparently harmless)

For completeness: it might be worth looking at whether exposing a setting for chrome_elf.dll similar to that done for cef3api.CefLibrary := cefpath + 'libcef.dll'; is worth the time and effort in fpCEF3, its my current opinion that working with placing a mere 543Kb file in the projects .exe folder is very liveable when compared with where we were before.

Once this is stabilised, would it be worth updating the Lazarus Wiki entry for fpCEF3 to reflect whatever is finally settled upon by the fpCEF3 maintainers?

Notes

Point 1. .lpr made to look something like:

uses
...
{ you can add units after this }
cef3lcl, cef3intf, cef3types, cef3lib, cef3gui, cef3api;

{$R *.res}

Const
cefPath = 'C:\cef3\win64-cef3-3029';

begin

RequireDerivedFormResource:=True;
cef3lib.CefFrameworkDirPath := cefPath;
cef3api.CefLibrary := cefpath + 'libcef.dll';
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
`

Point 2. cef3api.pas, is as such:-

Changing :

Implementation

Const
CefLibrary: String =
{$IFDEF WINDOWS}'libcef.dll'{$ENDIF}
{$IFDEF LINUX}'libcef.so'{$ENDIF}
{$IFDEF DARWIN}'Chromium Embedded Framework'{$ENDIF};

To:

Var
CefLibrary: String =
{$IFDEF WINDOWS}'libcef.dll'{$ENDIF}
{$IFDEF LINUX}'libcef.so'{$ENDIF}
{$IFDEF DARWIN}'Chromium Embedded Framework'{$ENDIF};

Implementation

Point 3. After downloading from either https://cefbuilds.com or http://www.magpcss.net/cef_downloads
extract and copy the complete CEF3 directory "Resources" and the contents of the CEF3 directory "Release" into the directory you're going to share them from.
Move chrome_elf.dll into a folder for_project_directory for copying to your project(s) as you need it (see Point 4 notes below).

The shared framework (Release) and Resource' folder might then look like this:

(00-cef_version_3029-1619.txt is developer written to keep track of things)

C:\cef3\win64-cef3-3029>
for_project_directory -- DIR contains: chrome_elf.dll 543kb
locales -- DIR
00-cef_version_3029-1619.txt
cef.pak
cef_100_percent.pak
cef_200_percent.pak
cef_extensions.pak
cef_sandbox.lib
d3dcompiler_43.dll
d3dcompiler_47.dll
devtools_resources.pak
icudtl.dat
libcef.dll
libcef.lib
libEGL.dll
libGLESv2.dll
natives_blob.bin
snapshot_blob.bin
widevinecdmadapter.dll

a) Potentially this all lends itself to version control.
b) The actual placement and directory structure is entirely up to the developer, as is the install routine.

Point 4. chrome_elf.dll placed in Each Project's .exe directory - this is done as Altagur suspects this is called from a compiled library and we can find no access in FP to detailing it's location at run time at present.

@dliw dliw added the enhancement label Jan 17, 2018

@dliw

This comment has been minimized.

Show comment
Hide comment
@dliw

dliw Jan 17, 2018

Owner

Hi,
thanks for this detailed feature request.

by the fpCEF3 maintainers

Well, it's only me...

Some general considerations:

  • In the Lazarus forum thread you wrote "Release directory alone contains 416 MB".
    You don't need the *.pdb files, which are only for debugging (with Visual Studio). It should be no more than 150MB for CEF.

  • "It might be worth looking at whether exposing a setting for chrome_elf.dll"
    I can only expose what CEF offers and fpCEF is an complete header translation. So everything possible is already there.

  • CEF still has an very unstable API. As you can see from #63 even minor builds may be incompatible. Sharing CEF only works if every application uses exactly the same CEF build. This is not very realistic and also raises the question, how to maintain such an shared folder (removing old builds, etc.)?

I think I will expose a new variable like CefLibraryDirPath, which overwrites the default library location. This should enable you to share CEF between programs. One more thing one my ever growing TODO list.

Generally I don't think fpCEF should enforce an usage pattern in any way.

Owner

dliw commented Jan 17, 2018

Hi,
thanks for this detailed feature request.

by the fpCEF3 maintainers

Well, it's only me...

Some general considerations:

  • In the Lazarus forum thread you wrote "Release directory alone contains 416 MB".
    You don't need the *.pdb files, which are only for debugging (with Visual Studio). It should be no more than 150MB for CEF.

  • "It might be worth looking at whether exposing a setting for chrome_elf.dll"
    I can only expose what CEF offers and fpCEF is an complete header translation. So everything possible is already there.

  • CEF still has an very unstable API. As you can see from #63 even minor builds may be incompatible. Sharing CEF only works if every application uses exactly the same CEF build. This is not very realistic and also raises the question, how to maintain such an shared folder (removing old builds, etc.)?

I think I will expose a new variable like CefLibraryDirPath, which overwrites the default library location. This should enable you to share CEF between programs. One more thing one my ever growing TODO list.

Generally I don't think fpCEF should enforce an usage pattern in any way.

@PaulANormanNZ

This comment has been minimized.

Show comment
Hide comment
@PaulANormanNZ

PaulANormanNZ Jan 19, 2018

Thank you very much for your work on this, Lazarus having Chromium available in this form is a very big thing.

In the Lazarus forum thread you wrote "Release directory alone contains 416 MB".
You don't need the *.pdb files, which are only for debugging (with Visual Studio). It should be no more than 150MB for CEF.

Great news, when you look at the Lazarus Forum entry ---

Download Framework CEF3

You can now download the framework and made the libraries available for a particular project. You can download it from the following pages:
https://cefbuilds.com
http://www.magpcss.net/cef_downloads
...
Windows

The CEF libraries are needed for loading, so it makes sense to create a new project folder, to save the project and the libraries in it together.

Create a new directory for the project to a location of your choice such as C:\SimpleBrowser
Copy the complete CEF3 directory Resources to C:\SimpleBrowser
Copy the contents of the CEF3 directory Release in the directory C:\SimpleBrowser

Its not clear from that, nor at CEFbuilds or previously magpcss (now closed?) what to download...

▶ Standard Distribution
▶ Minimal Distribution
▶ Sample Application
▶ Debug Symbols
▶ Release Symbols

So I'm guessing from what you have written it is either of ...?

▶ Standard Distribution
▶ Minimal Distribution

Which one is best please?

"It might be worth looking at whether exposing a setting for chrome_elf.dll"
I can only expose what CEF offers and fpCEF is an complete header translation. So everything possible is already there.

Thank you for that.

CEF still has an very unstable API. As you can see from #63 even minor builds may be incompatible. Sharing CEF only works if every application uses exactly the same CEF build. This is not very realistic and also raises the question, how to maintain such an shared folder (removing old builds, etc.)?

I find its worth sticking at a series point on these sorts of library / IDE component releases, and using it for applications for a period of time - can make updates of an existing project more straight forward where the cef3 is not needing itself to be updated. - componenets remain the same in the IDE.

--- Only changing if there is a serious security issue flagged, or a major fix, or necessary new feature added. This keeps Lazarus IDE stable, and development more straight forward.

Actually a separate install / manager for versioning shared/controlled binary libraries and resources is useful in such situations, and I have explored such approaches in the past - and will look at it again if necessary for this.

I think I will expose a new variable like CefLibraryDirPath, which overwrites the default library location. This should enable you to share CEF between programs. One more thing one my ever growing TODO list.

That sounds wonderful! For myself, I was quite prepared to live with the current workaround, but that would help people greatly, and would avoid developers needing to edit cef3api.pas on each new release.

Generally I don't think fpCEF should enforce an usage pattern in any way.

Really appreciate that, and gratefully acknowledge how your release empowered Altagur and I to find a solution - you soundly have exposed everything we needed for something that you may not have actually planned for yourself, and that is extremely freeing on other developers.
Very much appreciated here!

Is the Lazarus Forum, or here, the best place to seek answers on questions on things like the correct usage of VisitDomProc() and things like document.getElementById() ?

PaulANormanNZ commented Jan 19, 2018

Thank you very much for your work on this, Lazarus having Chromium available in this form is a very big thing.

In the Lazarus forum thread you wrote "Release directory alone contains 416 MB".
You don't need the *.pdb files, which are only for debugging (with Visual Studio). It should be no more than 150MB for CEF.

Great news, when you look at the Lazarus Forum entry ---

Download Framework CEF3

You can now download the framework and made the libraries available for a particular project. You can download it from the following pages:
https://cefbuilds.com
http://www.magpcss.net/cef_downloads
...
Windows

The CEF libraries are needed for loading, so it makes sense to create a new project folder, to save the project and the libraries in it together.

Create a new directory for the project to a location of your choice such as C:\SimpleBrowser
Copy the complete CEF3 directory Resources to C:\SimpleBrowser
Copy the contents of the CEF3 directory Release in the directory C:\SimpleBrowser

Its not clear from that, nor at CEFbuilds or previously magpcss (now closed?) what to download...

▶ Standard Distribution
▶ Minimal Distribution
▶ Sample Application
▶ Debug Symbols
▶ Release Symbols

So I'm guessing from what you have written it is either of ...?

▶ Standard Distribution
▶ Minimal Distribution

Which one is best please?

"It might be worth looking at whether exposing a setting for chrome_elf.dll"
I can only expose what CEF offers and fpCEF is an complete header translation. So everything possible is already there.

Thank you for that.

CEF still has an very unstable API. As you can see from #63 even minor builds may be incompatible. Sharing CEF only works if every application uses exactly the same CEF build. This is not very realistic and also raises the question, how to maintain such an shared folder (removing old builds, etc.)?

I find its worth sticking at a series point on these sorts of library / IDE component releases, and using it for applications for a period of time - can make updates of an existing project more straight forward where the cef3 is not needing itself to be updated. - componenets remain the same in the IDE.

--- Only changing if there is a serious security issue flagged, or a major fix, or necessary new feature added. This keeps Lazarus IDE stable, and development more straight forward.

Actually a separate install / manager for versioning shared/controlled binary libraries and resources is useful in such situations, and I have explored such approaches in the past - and will look at it again if necessary for this.

I think I will expose a new variable like CefLibraryDirPath, which overwrites the default library location. This should enable you to share CEF between programs. One more thing one my ever growing TODO list.

That sounds wonderful! For myself, I was quite prepared to live with the current workaround, but that would help people greatly, and would avoid developers needing to edit cef3api.pas on each new release.

Generally I don't think fpCEF should enforce an usage pattern in any way.

Really appreciate that, and gratefully acknowledge how your release empowered Altagur and I to find a solution - you soundly have exposed everything we needed for something that you may not have actually planned for yourself, and that is extremely freeing on other developers.
Very much appreciated here!

Is the Lazarus Forum, or here, the best place to seek answers on questions on things like the correct usage of VisitDomProc() and things like document.getElementById() ?

@dliw

This comment has been minimized.

Show comment
Hide comment
@dliw

dliw Jan 19, 2018

Owner

Minimal Distribution is all you usually need. Standard Distribution also contains the debug version of CEF.

Actually a separate install / manager for versioning shared/controlled binary libraries and resources is useful in such situations, and I have explored such approaches in the past

Ok - but this is not something fpCEF will do.

That sounds wonderful!

Unfortunately, it will take at least one month until I have time to work on fpCEF again.

Is the Lazarus Forum, or here, the best place to seek answers on questions on things like the correct usage of VisitDomProc() and things like document.getElementById() ?

Some basic usage patterns are in the examples, also search for answers on the CEF forum. As fpCEF is a header translation, the usage pattern does not change, whether you use C or Pascal.

I just enabled notifications for the Networking and Web Programming board on the Lazarus Forum, so you can post your questions there. Of course you also can create an issue here, flag it as "question". I will try to answer as good as I can.

Owner

dliw commented Jan 19, 2018

Minimal Distribution is all you usually need. Standard Distribution also contains the debug version of CEF.

Actually a separate install / manager for versioning shared/controlled binary libraries and resources is useful in such situations, and I have explored such approaches in the past

Ok - but this is not something fpCEF will do.

That sounds wonderful!

Unfortunately, it will take at least one month until I have time to work on fpCEF again.

Is the Lazarus Forum, or here, the best place to seek answers on questions on things like the correct usage of VisitDomProc() and things like document.getElementById() ?

Some basic usage patterns are in the examples, also search for answers on the CEF forum. As fpCEF is a header translation, the usage pattern does not change, whether you use C or Pascal.

I just enabled notifications for the Networking and Web Programming board on the Lazarus Forum, so you can post your questions there. Of course you also can create an issue here, flag it as "question". I will try to answer as good as I can.

@PaulANormanNZ

This comment has been minimized.

Show comment
Hide comment
@PaulANormanNZ

PaulANormanNZ Jan 21, 2018

Many thanks, Very helpful information.

Having a look at..

http://magpcss.org/ceforum/index.php

http://magpcss.org/ceforum/apidocs3/

Paul

PaulANormanNZ commented Jan 21, 2018

Many thanks, Very helpful information.

Having a look at..

http://magpcss.org/ceforum/index.php

http://magpcss.org/ceforum/apidocs3/

Paul

@dliw dliw closed this in d02a96d May 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment