From 1618e04d63ebcc2fbc19e14e552c7e43f3dcaa5d Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 11:20:32 +0200 Subject: [PATCH 1/8] Fix compilation on a windows target. --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 119440982..5866dd888 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,13 @@ set(SOURCE_FILES src/civetweb/civetweb.c src/webui.c ) + +if (MSVC) + set(SOURCE_FILES ${SOURCE_FILES} + src/webview/win32_wv2.cpp + ) +endif() + if (APPLE) # enable macos webview enable_language(OBJC) @@ -118,4 +125,4 @@ if (WEBUI_BUILD_EXAMPLES) if (MSVC) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT call_js_from_cpp) endif() -endif() \ No newline at end of file +endif() From aeeb11d13b569e0e691e1f33c7c25c959c053a03 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 11:43:33 +0200 Subject: [PATCH 2/8] Gnu target stdc++? --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5866dd888..3da94094c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,10 +38,13 @@ set(SOURCE_FILES src/webui.c ) -if (MSVC) +if (WIN32) set(SOURCE_FILES ${SOURCE_FILES} src/webview/win32_wv2.cpp ) + if (CMAKE_CXX_COMPILER STREQUAL "GNU") + target_link_libraries(webui stdc++) + endif() endif() if (APPLE) @@ -70,6 +73,7 @@ endif() if (WIN32) target_link_libraries(webui PRIVATE ws2_32 user32 shell32 ole32) + if ( elseif (APPLE) # link required frameworks find_library(COCOA_FRAMEWORK Cocoa REQUIRED) From c6af6282bf6bb9aacfb7ce684b8a594dfee2719a Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 11:52:06 +0200 Subject: [PATCH 3/8] Small fix in CMakefile. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3da94094c..9954dbb2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,6 @@ endif() if (WIN32) target_link_libraries(webui PRIVATE ws2_32 user32 shell32 ole32) - if ( elseif (APPLE) # link required frameworks find_library(COCOA_FRAMEWORK Cocoa REQUIRED) From 4ebc7be5375f113ec08369c6f7d4231366e25bf3 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 11:57:18 +0200 Subject: [PATCH 4/8] Some messages to see what's going on in the automatich compilation factory. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9954dbb2b..549e817fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,10 @@ if (WIN32) src/webview/win32_wv2.cpp ) if (CMAKE_CXX_COMPILER STREQUAL "GNU") + message("Adding stdc++ as library") target_link_libraries(webui stdc++) + else() + message("Not a windows GNU target") endif() endif() From f4dd7ed6717fc876dccf90a91178d90762bf3282 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 21:54:44 +0200 Subject: [PATCH 5/8] Another attempt to add -lstdc++ --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 549e817fb..139122afb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ if (WIN32) set(SOURCE_FILES ${SOURCE_FILES} src/webview/win32_wv2.cpp ) - if (CMAKE_CXX_COMPILER STREQUAL "GNU") + if ("${CMAKE_CXX_COMPILER}" STREQUAL "GNU") message("Adding stdc++ as library") target_link_libraries(webui stdc++) else() From 81cc0a67a0ac385b560cdadb3351772967005c52 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 21:57:56 +0200 Subject: [PATCH 6/8] Just adding -lstdc++ --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 139122afb..df9ec4922 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,12 @@ if (WIN32) set(SOURCE_FILES ${SOURCE_FILES} src/webview/win32_wv2.cpp ) - if ("${CMAKE_CXX_COMPILER}" STREQUAL "GNU") + #if ("${CMAKE_CXX_COMPILER}" STREQUAL "GNU") message("Adding stdc++ as library") target_link_libraries(webui stdc++) - else() - message("Not a windows GNU target") - endif() + #else() + # message("Not a windows GNU target") + #endif() endif() if (APPLE) From 85955ec33f6b91a4ebd09748a2dc36dd9f610be5 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 22:00:38 +0200 Subject: [PATCH 7/8] One other go at adding -lstdc++ --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df9ec4922..be5590378 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,6 @@ if (WIN32) set(SOURCE_FILES ${SOURCE_FILES} src/webview/win32_wv2.cpp ) - #if ("${CMAKE_CXX_COMPILER}" STREQUAL "GNU") - message("Adding stdc++ as library") - target_link_libraries(webui stdc++) - #else() - # message("Not a windows GNU target") - #endif() endif() if (APPLE) @@ -76,6 +70,14 @@ endif() if (WIN32) target_link_libraries(webui PRIVATE ws2_32 user32 shell32 ole32) + + #if ("${CMAKE_CXX_COMPILER}" STREQUAL "GNU") + message("Adding stdc++ as library") + target_link_libraries(webui stdc++) + #else() + # message("Not a windows GNU target") + #endif() + elseif (APPLE) # link required frameworks find_library(COCOA_FRAMEWORK Cocoa REQUIRED) From b3634ea8c48f50a30a7b0f058282045b750c8dfd Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 18 Oct 2025 22:06:51 +0200 Subject: [PATCH 8/8] It somehow needs to link against stdc++, but it doesn't, or maybe g++ needs to run. Also the MSVC does not seem to be able to find the openssl library. I'll just leave it for now. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be5590378..e24a9882e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,12 +71,12 @@ endif() if (WIN32) target_link_libraries(webui PRIVATE ws2_32 user32 shell32 ole32) - #if ("${CMAKE_CXX_COMPILER}" STREQUAL "GNU") + if ("${CMAKE_CXX_COMPILER}" STREQUAL "GNU") message("Adding stdc++ as library") target_link_libraries(webui stdc++) - #else() - # message("Not a windows GNU target") - #endif() + else() + message("Not a windows GNU target") + endif() elseif (APPLE) # link required frameworks