Created
September 26, 2024 16:41
-
-
Save SteffenL/b01eae55a75dd9bf2242c8894870bf27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cmake/internal.cmake b/cmake/internal.cmake | |
index fe613db..b1a655f 100644 | |
--- a/cmake/internal.cmake | |
+++ b/cmake/internal.cmake | |
@@ -116,7 +116,7 @@ macro(webview_init) | |
COMMENT "Reformatting files with clang-format..." | |
VERBATIM) | |
else() | |
- message(WARNING "Skipping clang-format checks as clang-format was not found: ${WEBVIEW_CLANG_FORMAT_EXE_HINT}") | |
+ message(WARNING "Skipping clang-format checks as clang-format was not found") | |
endif() | |
endif() | |
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt | |
index adfdc91..611eb2d 100644 | |
--- a/core/CMakeLists.txt | |
+++ b/core/CMakeLists.txt | |
@@ -57,29 +57,36 @@ if(WEBVIEW_BUILD_TESTS) | |
endif() | |
if(WEBVIEW_BUILD_AMALGAMATION) | |
- webview_find_clang_format(REQUIRED) | |
- find_package(Python3 REQUIRED) | |
+ find_package(Python3) | |
+ if(Python3_FOUND) | |
+ webview_find_clang_format() | |
+ if(WEBVIEW_CLANG_FORMAT_EXE) | |
+ file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS include/**) | |
+ set(AMALGAMATION_STAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/amalgamation/webview.h.stamp") | |
- file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS include/**) | |
- set(AMALGAMATION_STAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/amalgamation/webview.h.stamp") | |
+ add_custom_command( | |
+ OUTPUT "${AMALGAMATION_STAMP_FILE}" | |
+ COMMAND "${CMAKE_COMMAND}" -E touch "${AMALGAMATION_STAMP_FILE}" | |
+ COMMAND ${Python3_EXECUTABLE} | |
+ "${PROJECT_SOURCE_DIR}/scripts/amalgamate.py" | |
+ --base "${CMAKE_CURRENT_SOURCE_DIR}/include/webview" | |
+ --clang-format-exe "${WEBVIEW_CLANG_FORMAT_EXE}" | |
+ --output "${CMAKE_CURRENT_BINARY_DIR}/amalgamation/webview.h" | |
+ "${CMAKE_CURRENT_SOURCE_DIR}/include/webview/webview.h" | |
+ DEPENDS ${HEADER_FILES} | |
+ COMMENT "Building amalgamation..." | |
+ VERBATIM) | |
- add_custom_command( | |
- OUTPUT "${AMALGAMATION_STAMP_FILE}" | |
- COMMAND "${CMAKE_COMMAND}" -E touch "${AMALGAMATION_STAMP_FILE}" | |
- COMMAND ${Python3_EXECUTABLE} | |
- "${PROJECT_SOURCE_DIR}/scripts/amalgamate.py" | |
- --base "${CMAKE_CURRENT_SOURCE_DIR}/include/webview" | |
- --clang-format-exe "${WEBVIEW_CLANG_FORMAT_EXE}" | |
- --output "${CMAKE_CURRENT_BINARY_DIR}/amalgamation/webview.h" | |
- "${CMAKE_CURRENT_SOURCE_DIR}/include/webview/webview.h" | |
- DEPENDS ${HEADER_FILES} | |
- COMMENT "Building amalgamation..." | |
- VERBATIM) | |
+ add_custom_target(webview_amalgamate ALL | |
+ DEPENDS "${AMALGAMATION_STAMP_FILE}") | |
- add_custom_target(webview_amalgamate ALL | |
- DEPENDS "${AMALGAMATION_STAMP_FILE}") | |
- | |
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/amalgamation/webview.h" | |
- DESTINATION . | |
- COMPONENT webview_amalgamation) | |
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/amalgamation/webview.h" | |
+ DESTINATION . | |
+ COMPONENT webview_amalgamation) | |
+ else() | |
+ message(WARNING "Skipping amalgamation as clang-format was not found") | |
+ endif() | |
+ else() | |
+ message(WARNING "Skipping amalgamation as Python 3 was not found") | |
+ endif() | |
endif() | |
diff --git a/core/include/webview/detail/engine_base.hh b/core/include/webview/detail/engine_base.hh | |
index 6cdc787..2533eac 100644 | |
--- a/core/include/webview/detail/engine_base.hh | |
+++ b/core/include/webview/detail/engine_base.hh | |
@@ -248,7 +248,7 @@ protected: | |
}\n\ | |
};\n\ | |
Webview_.prototype.onBind = function(name) {\n\ | |
- if (Object.hasOwn(window, name)) {\n\ | |
+ if (window.hasOwnProperty(name)) {\n\ | |
throw new Error('Property \"' + name + '\" already exists');\n\ | |
}\n\ | |
window[name] = (function() {\n\ | |
@@ -257,7 +257,7 @@ protected: | |
}).bind(this);\n\ | |
};\n\ | |
Webview_.prototype.onUnbind = function(name) {\n\ | |
- if (!Object.hasOwn(window, name)) {\n\ | |
+ if (!window.hasOwnProperty(name)) {\n\ | |
throw new Error('Property \"' + name + '\" does not exist');\n\ | |
}\n\ | |
delete window[name];\n\ | |
diff --git a/docs/api/CMakeLists.txt b/docs/api/CMakeLists.txt | |
index 086df4b..981aea9 100644 | |
--- a/docs/api/CMakeLists.txt | |
+++ b/docs/api/CMakeLists.txt | |
@@ -1,4 +1,9 @@ | |
-find_package(Doxygen REQUIRED dot) | |
+find_package(Doxygen COMPONENTS dot) | |
+ | |
+if(NOT Doxygen_FOUND) | |
+ message(WARNING "Skipping docs as Doxygen was not found") | |
+ return() | |
+endif() | |
# We can set this to "-$<CONFIG>" if we need per-config documentation | |
set(CONFIG_SUFFIX "") | |
diff --git a/examples/bind.cc b/examples/bind.cc | |
index 1b5f558..7a57b9d 100644 | |
--- a/examples/bind.cc | |
+++ b/examples/bind.cc | |
@@ -47,7 +47,7 @@ int main() { | |
try { | |
long count = 0; | |
- webview::webview w(true, nullptr); | |
+ webview::webview w(false, nullptr); | |
w.set_title("Bind Example"); | |
w.set_size(480, 320, WEBVIEW_HINT_NONE); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment