Skip to content

Commit

Permalink
Disable Linux WebView in Dynamic Version
Browse files Browse the repository at this point in the history
  • Loading branch information
hassandraga committed Jul 12, 2024
1 parent 0826a2c commit 9c07d87
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ endif
@cd "$(BUILD_DIR)/debug" \
&& echo "Build WebUI library ($(CC) $(TARGET)debug dynamic)..." \
&& $(CC) $(TARGET) $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS) -g -fPIC \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) -g -fPIC -DWEBUI_LOG \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) -g -fPIC -DWEBUI_LOG -DWEBUI_DYNAMIC \
&& $(CC) $(TARGET) -shared -o $(LIB_DYN_OUT) webui.o civetweb.o $(WEBKIT_OBJ) -g -L"$(WEBUI_TLS_LIB)" $(TLS_LDFLAG_DYNAMIC) $(LWS2_OPT) $(WKWEBKIT_LINK_FLAGS)
ifeq ($(PLATFORM),windows)
@cd "$(BUILD_DIR)/debug" && del *.o >nul 2>&1
Expand Down Expand Up @@ -151,7 +151,7 @@ endif
@cd "$(BUILD_DIR)" \
&& echo "Build WebUI library ($(CC) $(TARGET)release dynamic)..." \
&& $(CC) $(TARGET) $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS) -Os -fPIC \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE) -O3 -fPIC \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE) -O3 -fPIC -DWEBUI_DYNAMIC \
&& $(CC) $(TARGET) -shared -o $(LIB_DYN_OUT) webui.o civetweb.o $(WEBKIT_OBJ) -L"$(WEBUI_TLS_LIB)" $(TLS_LDFLAG_DYNAMIC) $(LWS2_OPT) $(WKWEBKIT_LINK_FLAGS)
# Clean
ifeq ($(PLATFORM),windows)
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ debug:
# Dynamic with Debug info
@echo Build WebUI Library (MSVC Debug Dynamic)...
@cl /Zi $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS)
@cl /Zi $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) /D WEBUI_LOG
@cl /Zi $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) /D WEBUI_LOG /D WEBUI_DYNAMIC
@link $(LIB_DYN_OUT)
# Clean
@- del *.obj >nul 2>&1
Expand All @@ -72,7 +72,7 @@ release:
# Dynamic Release
@echo Build WebUI Library (MSVC Release Dynamic)...
@cl $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS)
@cl $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE)
@cl $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE) /D WEBUI_DYNAMIC
@link $(LIB_DYN_OUT)
# Clean
@- del *.pdb >nul 2>&1
Expand Down
16 changes: 15 additions & 1 deletion src/webui.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@
#define WEBUI_WS_PROTOCOL "ws://"
#endif

#ifdef WEBUI_DYNAMIC
#define WEBUI_LIB_TYPE "Dynamic"
#else
#define WEBUI_LIB_TYPE "Static"
#endif

#ifdef _WIN32
#define WEBUI_OS "Microsoft Windows"
#elif __APPLE__
Expand Down Expand Up @@ -3741,7 +3747,7 @@ static void * _webui_malloc(size_t size) {
static _webui_window_t* _webui_dereference_win_ptr(void * ptr) {

#ifdef WEBUI_LOG_VERBOSE
printf("[Core]\t\t_webui_dereference_win_ptr()\n");
//printf("[Core]\t\t_webui_dereference_win_ptr()\n");
#endif

if (_webui_mutex_is_exit_now(WEBUI_MUTEX_NONE))
Expand Down Expand Up @@ -7395,6 +7401,7 @@ static void _webui_init(void) {
WEBUI_VERSION " ("
WEBUI_OS ", "
WEBUI_COMPILER ", "
WEBUI_LIB_TYPE ", "
WEBUI_SECURE ")\n");
printf("[Core]\t\t_webui_init()\n");
#endif
Expand Down Expand Up @@ -10762,6 +10769,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {

// Linux GTK WebView

#ifdef WEBUI_DYNAMIC
#ifdef WEBUI_LOG
printf("[Core]\t\t_webui_wv_show() -> WebUI dynamic version does not support Linux WebView\n");
#endif
return false;
#endif

if (_webui.is_browser_main_run)
return false;

Expand Down

0 comments on commit 9c07d87

Please sign in to comment.