Make cef_process_helper build under MSW too and comment it more

Define WinMain() instead of main() under MSW, as we need to pass an
HINSTANCE and not argc/argv to CefMainArgs ctor there.

Also explain how to build this file.
This commit is contained in:
Vadim Zeitlin 2023-09-21 21:52:05 +02:00
parent 4816448cff
commit 48a97439d1

View file

@ -1,19 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: samples/webview_chromium/mac/process_helper_mac.cpp
// Purpose: webview_chromium launch helper
// Name: samples/webview/cef_process_helper.cpp
// Purpose: Simplest possible CEF helper.
// Author: Haojian Wu <hokein.wu@gmail.com>
// Created: 2014-06-22
// Copyright: (c) 2014 - 2015 wxWidgets development team
// Copyright: (c) 2014 - 2023 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// This application doesn't use wxWidgets at all but does require CEF and its
// wrapper DLL.
//
// To build it using MSVC under MSW use
//
// > cl /Fewebview_cef_helper /MD /DNDEBUG /EHsc /I../../3rdparty/cef cef_process_helper.cpp ../../3rdparty/cef/Release/libcef.lib ../../3rdparty/cef/Release/libcef_dll_wrapper.lib
//
// in release mode and
//
// > cl /Fewebview_cef_helper /MDd /D_DEBUG /EHsc /I../../3rdparty/cef cef_process_helper.cpp ../../3rdparty/cef/Debug/libcef.lib ../../3rdparty/cef/Debug/libcef_dll_wrapper.lib
//
// in debug.
//
// Under Unix use
//
// $ c++ -o webview_cef_helper -I../../3rdparty/cef cef_process_helper.cpp -L../../3rdparty/cef/Release -lcef -L../../3rdparty/cef/libcef_dll_wrapper -lcef_dll_wrapper
//
// and under macOS see the commands executed by the sample makefile.
#include "include/cef_app.h"
#include "include/cef_version.h"
// Process entry point.
int main(int argc, char* argv[]) {
CefMainArgs main_args(argc, argv);
// Define simplest possible process entry point just forwarding to CEF.
#if defined(_WIN32)
// Execute the secondary process.
return CefExecuteProcess(main_args, nullptr, nullptr);
extern "C" int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE, char*, int)
{
CefMainArgs cefArgs(hInstance);
return CefExecuteProcess(cefArgs, nullptr, nullptr);
}
#else // !Windows
int main(int argc, char* argv[])
{
CefMainArgs cefArgs(argc, argv);
return CefExecuteProcess(cefArgs, nullptr, nullptr);
}
#endif // Windows/!Windows