Skip to content

Commit 2dc5552

Browse files
committed
Update to Chrome 130. CEF 130.1.16+g5a7e5ed+chromium-130.0.6723.117.
Change default configuration to Release. Treat compile warnings as errors. Log versions at startup. Improve main.mm logic, copy from cefclient/cefsimple. To enable logging to terminal add switch in settings.json: "enable-logging": "stderr". This will remove file logging.
1 parent 3366127 commit 2dc5552

File tree

8 files changed

+33
-9
lines changed

8 files changed

+33
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ build/
22
downloads/
33
php/
44
.DS_STORE
5+
.vscode/

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Versions
2-
set(PHPDESKTOP_VERSION "127.0")
3-
set(CEF_VERSION "127.3.2+gf1af617+chromium-127.0.6533.100")
2+
set(PHPDESKTOP_VERSION "130.0")
3+
set(CEF_VERSION "130.1.16+g5a7e5ed+chromium-130.0.6723.117")
44
cmake_minimum_required(VERSION 3.21)
55

66
# Project and general options
@@ -11,6 +11,7 @@ add_definitions(-DPHPDESKTOP_VERSION="${PHPDESKTOP_VERSION}")
1111
set(CMAKE_CXX_FLAGS "-std=c++20 -Wfatal-errors")
1212
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
1313
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG_CONFIGURATION")
14+
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
1415
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
1516
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
1617

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PHP Desktop Chrome v127 for Mac
1+
# PHP Desktop Chrome 130 for Mac
22

33
## Build instructions
44

app.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// All rights reserved. Licensed under BSD 3-clause license.
33
// Project website: https://github.com/cztomczak/phpdesktop
44

5+
#include <stdlib.h>
6+
57
#include "app.h"
68
#include "client.h"
79
#include "mongoose_server.h"
@@ -63,6 +65,9 @@ void App::OnBeforeCommandLineProcessing(const CefString& process_type,
6365
if (process_type.empty())
6466
{
6567
// Browser process type is an empty string
68+
if (getenv("PHPDESKTOP_ENABLE_LOGGING_STDERR")) {
69+
command_line->AppendSwitchWithValue("enable-logging", "stderr");
70+
}
6671
json_value* app_settings = Settings();
6772
json_value switches =(*app_settings)["chrome"]["command_line_switches"];
6873
if (switches.type == json_object) {

buildandrun.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ retval=$?
88
if [ $retval -ne 0 ]; then
99
echo "ninja FAILED with error code $retval"
1010
exit $retval
11+
else
12+
export PHPDESKTOP_ENABLE_LOGGING_STDERR=1
13+
open -W --stdout $(tty) --stderr $(tty) "./Release/PHP Desktop.app"
1114
fi
12-
open -W --stdout $(tty) --stderr $(tty) "./Debug/PHP Desktop.app"

cleanbuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ if [[ $(uname -m) == "arm64" ]]; then
1212
elif [[ $(uname -m) == "x86_64" ]]; then
1313
PHPDESKTOP_ARCH="x86_64"
1414
fi
15-
cmake -G "Ninja" -DPROJECT_ARCH="$PHPDESKTOP_ARCH" -DCMAKE_BUILD_TYPE=Debug $ROOTDIR
15+
cmake -G "Ninja" -DPROJECT_ARCH="$PHPDESKTOP_ARCH" -DCMAKE_BUILD_TYPE=Release $ROOTDIR
1616
ninja -j 8 phpdesktop

client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ void Client::OnBeforeClose(CefRefPtr<CefBrowser> browser)
176176

177177
if (browser_list_.empty()) {
178178
// All browser windows have closed. Quit the application message loop.
179+
LOG(INFO) << "Quit message loop";
179180
CefQuitMessageLoop();
180181
}
181182
}

main.mm

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "settings.h"
1212

1313
#include "include/cef_application_mac.h"
14+
#include "include/cef_version.h"
1415
#include "include/base/cef_logging.h"
1516
#include "include/wrapper/cef_helpers.h"
1617
#import "include/wrapper/cef_library_loader.h"
@@ -76,6 +77,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:
7677
(NSApplication*)sender {
7778
return NSTerminateNow;
7879
}
80+
// applicationShouldHandleReopen TODO?
7981
@end
8082

8183
int main(int argc, char **argv) {
@@ -88,6 +90,9 @@ int main(int argc, char **argv) {
8890

8991
@autoreleasepool {
9092

93+
[SharedApplication sharedApplication];
94+
CHECK([NSApp isKindOfClass:[SharedApplication class]]);
95+
9196
// Passing ENV variables to PHP using the --cgi-environment
9297
// command line arg passed to app.
9398
if (argv) {
@@ -112,6 +117,8 @@ int main(int argc, char **argv) {
112117
// Log what process type is launching
113118
if (!cmdline->HasSwitch("type")) {
114119
// If there is no --type flag then this is main process
120+
LOG(INFO) << "PHP Desktop version: " << PHPDESKTOP_VERSION;
121+
LOG(INFO) << "Chrome version: " << CEF_VERSION;
115122
LOG(INFO) << "Launching Browser process (main process)\n";
116123
} else {
117124
const std::string& process_type = cmdline->GetSwitchValue("type");
@@ -238,19 +245,20 @@ int remote_debugging_port(
238245
// App implements application-level callbacks for the browser process.
239246
CefRefPtr<App> app(new App);
240247

241-
[SharedApplication sharedApplication];
242-
243248
// Log messages created by LOG() macro will be written to debug.log
244249
// file only after CEF was initialized. Before CEF is initialized
245250
// all logs are only printed to console.
246251
LOG(INFO) << "Initialize CEF";
252+
LOG(INFO) << "Note that logging to terminal doesn't work from this point on, "
253+
<< "unless you add --enable-logging=stderr switch to settings.json";
247254
if (!CefInitialize(main_args, cef_settings, app.get(), nullptr)) {
248255
LOG(ERROR) << "Failed to initialize CEF";
249-
return 1;
256+
return CefGetExitCode();;
250257
}
251258

252259
// Create the application delegate.
253-
NSObject* delegate = [[SharedAppDelegate alloc] init];
260+
SharedAppDelegate* delegate = [[SharedAppDelegate alloc] init];
261+
NSApp.delegate = delegate;
254262
[delegate performSelectorOnMainThread:@selector(createApplication:)
255263
withObject:nil
256264
waitUntilDone:NO];
@@ -264,6 +272,12 @@ int remote_debugging_port(
264272
LOG(INFO) << "Shutdown CEF";
265273
CefShutdown();
266274

275+
// Release the delegate.
276+
#if !__has_feature(objc_arc)
277+
[delegate release];
278+
#endif // !__has_feature(objc_arc)
279+
delegate = nil;
280+
267281
} // end @autoreleasepool
268282

269283
return 0;

0 commit comments

Comments
 (0)