Skip to content

Commit 270c884

Browse files
committed
[cef] copy CEF locales to 'Frameworks/cef/locales' subdir
Frameworks directory already created and installed on the Mac Reuse same name to put extra files from CEF and do not pollute "bin/" or "lib/" directory
1 parent dfaa6c7 commit 270c884

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_INSTALL_PREFIX)
646646
if(http)
647647
install(DIRECTORY js/ DESTINATION ${CMAKE_INSTALL_JSROOTDIR} ${DIR_PERMISSIONS})
648648
endif()
649-
if(cefweb AND APPLE AND TARGET ROOTCefDisplay)
649+
if(cefweb AND TARGET ROOTCefDisplay)
650650
install(DIRECTORY ${CMAKE_BINARY_DIR}/Frameworks/ DESTINATION ${CMAKE_INSTALL_FRAMEWORKSDIR} ${DIR_PERMISSIONS})
651651
endif()
652652
if(webgui)

gui/cefdisplay/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ elseif(MSVC)
3535
set(CEF_LIBRARY ${CEF_RELEASE_DIR}/libcef.lib)
3636
set(CEF_DLL_WRAPPER ${CEF_root}/build/libcef_dll_wrapper/Release/libcef_dll_wrapper.lib)
3737
file(COPY ${CEF_RELEASE_DIR}/ DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
38-
file(COPY ${CEF_RESOURCES}/ DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
38+
# copy dlls plus some extras to binary directory to let CEF find them without extra configuration
39+
file(COPY ${CEF_RESOURCES}/ DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} PATTERN "locales" EXCLUDE)
40+
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Frameworks/cef/locales)
41+
file(COPY ${CEF_RESOURCES}/locales/ DESTINATION ${CMAKE_BINARY_DIR}/Frameworks/cef/locales)
3942
else()
4043
set(CEF_platform src/gui_handler_linux.cxx)
4144
set(CEF_RESOURCES ${CEF_root}/Resources)
@@ -44,7 +47,10 @@ else()
4447
set(CEF_DLL_WRAPPER ${CEF_root}/build/libcef_dll_wrapper/libcef_dll_wrapper.a)
4548
set(CEF_LIB_DEPENDENCY ${X11_LIBRARIES})
4649
file(COPY ${CEF_RELEASE_DIR}/ DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
47-
file(COPY ${CEF_RESOURCES}/ DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
50+
# copy shared libraries plus some extras to library directory to let CEF find them without extra configuration
51+
file(COPY ${CEF_RESOURCES}/ DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} PATTERN "locales" EXCLUDE)
52+
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Frameworks/cef/locales)
53+
file(COPY ${CEF_RESOURCES}/locales/ DESTINATION ${CMAKE_BINARY_DIR}/Frameworks/cef/locales)
4854
if(EXISTS ${CEF_RELEASE_DIR}/swiftshader)
4955
file(COPY ${CEF_RELEASE_DIR}/swiftshader DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
5056
endif()

gui/cefdisplay/src/RCefWebDisplayHandle.cxx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -206,35 +206,33 @@ std::unique_ptr<ROOT::RWebDisplayHandle> RCefWebDisplayHandle::CefCreator::Displ
206206
TString cef_main = TROOT::GetBinDir() + "/cef_main";
207207
cef_string_ascii_to_utf16(cef_main.Data(), cef_main.Length(), &settings.browser_subprocess_path);
208208

209-
#ifdef OS_LINUX
210-
// on linux resource directory copied to lib/
211-
TString path2 = TROOT::GetLibDir() + "/locales";
212-
cef_string_ascii_to_utf16(path2.Data(), path2.Length(), &settings.locales_dir_path);
213-
TString path3 = TROOT::GetLibDir();
214-
cef_string_ascii_to_utf16(path3.Data(), path3.Length(), &settings.resources_dir_path);
215-
#endif
216-
217-
#ifdef OS_WIN
218-
// on windows resource directory copied to bin/
219-
TString path2 = TROOT::GetBinDir() + "/locales";
220-
cef_string_ascii_to_utf16(path2.Data(), path2.Length(), &settings.locales_dir_path);
221-
TString path3 = TROOT::GetBinDir();
222-
cef_string_ascii_to_utf16(path3.Data(), path3.Length(), &settings.resources_dir_path);
223-
#endif
224-
225209
#ifdef OS_MACOSX
226210
// on mac there is framework directory, where resources and libs are combined together
227211
TString path = TROOT::GetDataDir() + "/Frameworks/Chromium Embedded Framework.framework";
228212
cef_string_ascii_to_utf16(path.Data(), path.Length(), &settings.framework_dir_path);
229213

230-
214+
// add CEF libraries to DYLD library path
231215
TString dypath = gSystem->Getenv("DYLD_LIBRARY_PATH");
232216
if (dypath.Length() > 0)
233217
dypath.Append(":");
234218
dypath.Append(path + "/Libraries/");
235219
gSystem->Setenv("DYLD_LIBRARY_PATH", dypath);
236220
#endif
237221

222+
#ifdef OS_WIN
223+
TString resource_dir = TROOT::GetBinDir();
224+
cef_string_ascii_to_utf16(resource_dir.Data(), resource_dir.Length(), &settings.resources_dir_path);
225+
TString locales_dir = TROOT::GetDataDir() + "/Frameworks/cef/locales";
226+
cef_string_ascii_to_utf16(locales_dir.Data(), locales_dir.Length(), &settings.locales_dir_path);
227+
#endif
228+
229+
#ifdef OS_LINUX
230+
TString resource_dir = TROOT::GetLibDir();
231+
cef_string_ascii_to_utf16(resource_dir.Data(), resource_dir.Length(), &settings.resources_dir_path);
232+
TString locales_dir = TROOT::GetDataDir() + "/Frameworks/cef/locales";
233+
cef_string_ascii_to_utf16(locales_dir.Data(), locales_dir.Length(), &settings.locales_dir_path);
234+
#endif
235+
238236
settings.no_sandbox = true;
239237
// if (gROOT->IsWebDisplayBatch()) settings.single_process = true;
240238

0 commit comments

Comments
 (0)