From 8760ff7813a23249f95ef48bbe6eda2a1394e720 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 4 Dec 2019 15:24:58 +0800 Subject: [PATCH 01/11] Use CMake with MSBuild. --- .gitignore | 1 + src/WebWindow.Native/CMakeLists.txt | 37 +++++++++++++++++++ src/WebWindow.Native/WebWindow.Native.cmproj | 3 ++ src/WebWindow.Native/WebWindow.Native.vcxproj | 19 ++++++---- .../WebWindow.Native.vcxproj.filters | 11 ++---- .../{ => include}/WebWindow.Mac.AppDelegate.h | 0 .../{ => include}/WebWindow.Mac.UiDelegate.h | 0 .../WebWindow.Mac.UrlSchemeHandler.h | 0 .../{ => include}/WebWindow.h | 0 src/WebWindow.Native/packages.config | 4 +- src/WebWindow.Native/{ => src}/Exports.cpp | 0 .../{ => src}/WebWindow.Linux.cpp | 4 +- .../{ => src}/WebWindow.Mac.AppDelegate.m | 0 .../{ => src}/WebWindow.Mac.UiDelegate.m | 0 .../WebWindow.Mac.UrlSchemeHandler.m | 0 .../{ => src}/WebWindow.Mac.mm | 3 -- .../{ => src}/WebWindow.Windows.cpp | 0 src/WebWindow/WebWindow.csproj | 13 ++----- 18 files changed, 63 insertions(+), 32 deletions(-) create mode 100644 src/WebWindow.Native/CMakeLists.txt create mode 100644 src/WebWindow.Native/WebWindow.Native.cmproj rename src/WebWindow.Native/{ => include}/WebWindow.Mac.AppDelegate.h (100%) rename src/WebWindow.Native/{ => include}/WebWindow.Mac.UiDelegate.h (100%) rename src/WebWindow.Native/{ => include}/WebWindow.Mac.UrlSchemeHandler.h (100%) rename src/WebWindow.Native/{ => include}/WebWindow.h (100%) rename src/WebWindow.Native/{ => src}/Exports.cpp (100%) rename src/WebWindow.Native/{ => src}/WebWindow.Linux.cpp (99%) rename src/WebWindow.Native/{ => src}/WebWindow.Mac.AppDelegate.m (100%) rename src/WebWindow.Native/{ => src}/WebWindow.Mac.UiDelegate.m (100%) rename src/WebWindow.Native/{ => src}/WebWindow.Mac.UrlSchemeHandler.m (100%) rename src/WebWindow.Native/{ => src}/WebWindow.Mac.mm (99%) rename src/WebWindow.Native/{ => src}/WebWindow.Windows.cpp (100%) diff --git a/.gitignore b/.gitignore index d32efda..c775ac4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .vs/ bin/ obj/ +builddir/ *.user Debug/ Release/ diff --git a/src/WebWindow.Native/CMakeLists.txt b/src/WebWindow.Native/CMakeLists.txt new file mode 100644 index 0000000..61b4313 --- /dev/null +++ b/src/WebWindow.Native/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) +project(WebWindow.Native) +include_directories(include) +set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_PREFIX_C "") +set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "") +set(CMAKE_SHARED_LIBRARY_PREFIX_OBJC "") +set(CMAKE_SHARED_LIBRARY_PREFIX_OBJCXX "") + +if(APPLE) +file(GLOB LIB_SOURCE "src/WebWindow.Mac.*") +else() +file(GLOB LIB_SOURCE "src/WebWindow.Linux.*") + +find_package(PkgConfig REQUIRED) + +pkg_check_modules(GTK3 REQUIRED gtk+-3.0) +include_directories(${GTK3_INCLUDE_DIRS}) +link_directories(${GTK3_LIBRARY_DIRS}) +add_definitions(${GTK3_CFLAGS_OTHER}) + +pkg_check_modules(WEBKIT4 REQUIRED webkit2gtk-4.0) +include_directories(${WEBKIT4_INCLUDE_DIRS}) +link_directories(${WEBKIT4_LIBRARY_DIRS}) +add_definitions(${WEBKIT4_CFLAGS_OTHER}) +endif() + +add_library(WebWindow.Native SHARED ${LIB_SOURCE}) + +if(APPLE) +target_link_libraries(WebWindow.Native stdc++) +target_link_libraries(WebWindow.Native "-framework Cocoa") +target_link_libraries(WebWindow.Native "-framework WebKit") +else() +target_link_libraries(WebWindow.Native ${GTK3_LIBRARIES}) +target_link_libraries(WebWindow.Native ${WEBKIT4_LIBRARIES}) +endif() diff --git a/src/WebWindow.Native/WebWindow.Native.cmproj b/src/WebWindow.Native/WebWindow.Native.cmproj new file mode 100644 index 0000000..1178f87 --- /dev/null +++ b/src/WebWindow.Native/WebWindow.Native.cmproj @@ -0,0 +1,3 @@ + + + diff --git a/src/WebWindow.Native/WebWindow.Native.vcxproj b/src/WebWindow.Native/WebWindow.Native.vcxproj index 3c5ef82..1123a2f 100644 --- a/src/WebWindow.Native/WebWindow.Native.vcxproj +++ b/src/WebWindow.Native/WebWindow.Native.vcxproj @@ -74,15 +74,19 @@ true + include;$(VC_IncludePath);$(WindowsSDK_IncludePath); true + include;$(VC_IncludePath);$(WindowsSDK_IncludePath); false + include;$(VC_IncludePath);$(WindowsSDK_IncludePath); false + include;$(VC_IncludePath);$(WindowsSDK_IncludePath); @@ -147,26 +151,25 @@ - - - + + - + - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/WebWindow.Native/WebWindow.Native.vcxproj.filters b/src/WebWindow.Native/WebWindow.Native.vcxproj.filters index eaf12b1..c5835a6 100644 --- a/src/WebWindow.Native/WebWindow.Native.vcxproj.filters +++ b/src/WebWindow.Native/WebWindow.Native.vcxproj.filters @@ -15,23 +15,20 @@ - + Source Files - - Source Files - - + Source Files - + Header Files - + \ No newline at end of file diff --git a/src/WebWindow.Native/WebWindow.Mac.AppDelegate.h b/src/WebWindow.Native/include/WebWindow.Mac.AppDelegate.h similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.AppDelegate.h rename to src/WebWindow.Native/include/WebWindow.Mac.AppDelegate.h diff --git a/src/WebWindow.Native/WebWindow.Mac.UiDelegate.h b/src/WebWindow.Native/include/WebWindow.Mac.UiDelegate.h similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.UiDelegate.h rename to src/WebWindow.Native/include/WebWindow.Mac.UiDelegate.h diff --git a/src/WebWindow.Native/WebWindow.Mac.UrlSchemeHandler.h b/src/WebWindow.Native/include/WebWindow.Mac.UrlSchemeHandler.h similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.UrlSchemeHandler.h rename to src/WebWindow.Native/include/WebWindow.Mac.UrlSchemeHandler.h diff --git a/src/WebWindow.Native/WebWindow.h b/src/WebWindow.Native/include/WebWindow.h similarity index 100% rename from src/WebWindow.Native/WebWindow.h rename to src/WebWindow.Native/include/WebWindow.h diff --git a/src/WebWindow.Native/packages.config b/src/WebWindow.Native/packages.config index 8137acf..59d72aa 100644 --- a/src/WebWindow.Native/packages.config +++ b/src/WebWindow.Native/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/src/WebWindow.Native/Exports.cpp b/src/WebWindow.Native/src/Exports.cpp similarity index 100% rename from src/WebWindow.Native/Exports.cpp rename to src/WebWindow.Native/src/Exports.cpp diff --git a/src/WebWindow.Native/WebWindow.Linux.cpp b/src/WebWindow.Native/src/WebWindow.Linux.cpp similarity index 99% rename from src/WebWindow.Native/WebWindow.Linux.cpp rename to src/WebWindow.Native/src/WebWindow.Linux.cpp index 9dd6416..fdc985a 100644 --- a/src/WebWindow.Native/WebWindow.Linux.cpp +++ b/src/WebWindow.Native/src/WebWindow.Linux.cpp @@ -1,6 +1,6 @@ // For this to build on WSL (Ubuntu 18.04) you need to: // sudo apt-get install libgtk-3-dev libwebkit2gtk-4.0-dev -#ifdef OS_LINUX + #include "WebWindow.h" #include #include @@ -214,5 +214,3 @@ void WebWindow::AddCustomScheme(UTF8String scheme, WebResourceRequestedCallback (WebKitURISchemeRequestCallback)HandleCustomSchemeRequest, (void*)requestHandler, NULL); } - -#endif diff --git a/src/WebWindow.Native/WebWindow.Mac.AppDelegate.m b/src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.m similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.AppDelegate.m rename to src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.m diff --git a/src/WebWindow.Native/WebWindow.Mac.UiDelegate.m b/src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.m similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.UiDelegate.m rename to src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.m diff --git a/src/WebWindow.Native/WebWindow.Mac.UrlSchemeHandler.m b/src/WebWindow.Native/src/WebWindow.Mac.UrlSchemeHandler.m similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.UrlSchemeHandler.m rename to src/WebWindow.Native/src/WebWindow.Mac.UrlSchemeHandler.m diff --git a/src/WebWindow.Native/WebWindow.Mac.mm b/src/WebWindow.Native/src/WebWindow.Mac.mm similarity index 99% rename from src/WebWindow.Native/WebWindow.Mac.mm rename to src/WebWindow.Native/src/WebWindow.Mac.mm index cec29ba..845cc73 100644 --- a/src/WebWindow.Native/WebWindow.Mac.mm +++ b/src/WebWindow.Native/src/WebWindow.Mac.mm @@ -1,4 +1,3 @@ -#ifdef OS_MAC #include "WebWindow.h" #import "WebWindow.Mac.AppDelegate.h" #import "WebWindow.Mac.UiDelegate.h" @@ -167,5 +166,3 @@ NSString* nsscheme = [NSString stringWithUTF8String:scheme]; [webviewConfiguration setURLSchemeHandler:schemeHandler forURLScheme:nsscheme]; } - -#endif diff --git a/src/WebWindow.Native/WebWindow.Windows.cpp b/src/WebWindow.Native/src/WebWindow.Windows.cpp similarity index 100% rename from src/WebWindow.Native/WebWindow.Windows.cpp rename to src/WebWindow.Native/src/WebWindow.Windows.cpp diff --git a/src/WebWindow/WebWindow.csproj b/src/WebWindow/WebWindow.csproj index d58a22f..adca06b 100644 --- a/src/WebWindow/WebWindow.csproj +++ b/src/WebWindow/WebWindow.csproj @@ -5,25 +5,20 @@ Open native OS windows hosting web UI on Windows, Mac, and Linux Apache-2.0 netstandard2.1 - ..\WebWindow.Native\x64\$(Configuration)\ + ..\WebWindow.Native\x64\$(Configuration)\ + ..\WebWindow.Native\builddir\$(Configuration)\x64\ $([MSBuild]::IsOsPlatform('OSX')) win-x64 linux-x64 osx-x64 - + - - - + From 4ec85380fb3e911fc5cde25db8134adcb97d2b68 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 4 Dec 2019 15:30:10 +0800 Subject: [PATCH 02/11] Add lost definitions. --- src/WebWindow.Native/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/WebWindow.Native/CMakeLists.txt b/src/WebWindow.Native/CMakeLists.txt index 61b4313..af5c43d 100644 --- a/src/WebWindow.Native/CMakeLists.txt +++ b/src/WebWindow.Native/CMakeLists.txt @@ -9,8 +9,10 @@ set(CMAKE_SHARED_LIBRARY_PREFIX_OBJCXX "") if(APPLE) file(GLOB LIB_SOURCE "src/WebWindow.Mac.*") +add_definitions(-DOS_MAC) else() file(GLOB LIB_SOURCE "src/WebWindow.Linux.*") +add_definitions(-DOS_LINUX) find_package(PkgConfig REQUIRED) From 4a2451054346fd229fc71bbd2cd90e68f08ac278 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 4 Dec 2019 15:35:53 +0800 Subject: [PATCH 03/11] Fix pack for Windows. --- src/WebWindow/WebWindow.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebWindow/WebWindow.csproj b/src/WebWindow/WebWindow.csproj index adca06b..198b650 100644 --- a/src/WebWindow/WebWindow.csproj +++ b/src/WebWindow/WebWindow.csproj @@ -13,7 +13,7 @@ osx-x64 - + From 2eb5d1c319ab555cbfbd2a5020c1e57812421d67 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Sat, 7 Dec 2019 01:03:51 +0800 Subject: [PATCH 04/11] Leave lib prefix --- src/WebWindow.Native/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/WebWindow.Native/CMakeLists.txt b/src/WebWindow.Native/CMakeLists.txt index af5c43d..02f85d6 100644 --- a/src/WebWindow.Native/CMakeLists.txt +++ b/src/WebWindow.Native/CMakeLists.txt @@ -1,11 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(WebWindow.Native) include_directories(include) -set(CMAKE_SHARED_LIBRARY_PREFIX "") -set(CMAKE_SHARED_LIBRARY_PREFIX_C "") -set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "") -set(CMAKE_SHARED_LIBRARY_PREFIX_OBJC "") -set(CMAKE_SHARED_LIBRARY_PREFIX_OBJCXX "") if(APPLE) file(GLOB LIB_SOURCE "src/WebWindow.Mac.*") From 90fa0268d65453a73eb40e7d428c80a15a40c75e Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 8 Jan 2020 11:17:07 +0800 Subject: [PATCH 05/11] Fix merge. --- src/WebWindow.Native/CMakeLists.txt | 39 ++++------ src/WebWindow.Native/src/WebWindow.Linux.cpp | 2 - .../src/WebWindow.Mac.AppDelegate.m | 21 ------ .../{ => src}/WebWindow.Mac.AppDelegate.mm | 0 .../src/WebWindow.Mac.UiDelegate.m | 74 ------------------- .../{ => src}/WebWindow.Mac.UiDelegate.mm | 0 6 files changed, 15 insertions(+), 121 deletions(-) delete mode 100644 src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.m rename src/WebWindow.Native/{ => src}/WebWindow.Mac.AppDelegate.mm (100%) delete mode 100644 src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.m rename src/WebWindow.Native/{ => src}/WebWindow.Mac.UiDelegate.mm (100%) diff --git a/src/WebWindow.Native/CMakeLists.txt b/src/WebWindow.Native/CMakeLists.txt index 02f85d6..2e1c574 100644 --- a/src/WebWindow.Native/CMakeLists.txt +++ b/src/WebWindow.Native/CMakeLists.txt @@ -1,34 +1,25 @@ -cmake_minimum_required(VERSION 3.1) -project(WebWindow.Native) -include_directories(include) +cmake_minimum_required(VERSION 3.7) +project(WebWindowNative CXX) if(APPLE) -file(GLOB LIB_SOURCE "src/WebWindow.Mac.*") -add_definitions(-DOS_MAC) + file(GLOB LIB_SOURCE "src/WebWindow.Mac.*") else() -file(GLOB LIB_SOURCE "src/WebWindow.Linux.*") -add_definitions(-DOS_LINUX) - -find_package(PkgConfig REQUIRED) - -pkg_check_modules(GTK3 REQUIRED gtk+-3.0) -include_directories(${GTK3_INCLUDE_DIRS}) -link_directories(${GTK3_LIBRARY_DIRS}) -add_definitions(${GTK3_CFLAGS_OTHER}) - -pkg_check_modules(WEBKIT4 REQUIRED webkit2gtk-4.0) -include_directories(${WEBKIT4_INCLUDE_DIRS}) -link_directories(${WEBKIT4_LIBRARY_DIRS}) -add_definitions(${WEBKIT4_CFLAGS_OTHER}) + file(GLOB LIB_SOURCE "src/WebWindow.Linux.*") endif() add_library(WebWindow.Native SHARED ${LIB_SOURCE}) +target_include_directories(WebWindow.Native PUBLIC include) if(APPLE) -target_link_libraries(WebWindow.Native stdc++) -target_link_libraries(WebWindow.Native "-framework Cocoa") -target_link_libraries(WebWindow.Native "-framework WebKit") + target_compile_definitions(WebWindow.Native PUBLIC "OS_MAC") + target_link_libraries(WebWindow.Native "-framework Cocoa" "-framework WebKit") else() -target_link_libraries(WebWindow.Native ${GTK3_LIBRARIES}) -target_link_libraries(WebWindow.Native ${WEBKIT4_LIBRARIES}) + find_package(PkgConfig REQUIRED) + pkg_check_modules(GTK3 REQUIRED gtk+-3.0) + pkg_check_modules(WEBKIT4 REQUIRED webkit2gtk-4.0) + + target_compile_definitions(WebWindow.Native PUBLIC "OS_LINUX" ${GTK3_CFLAGS_OTHER} ${WEBKIT4_CFLAGS_OTHER}) + target_include_directories(WebWindow.Native PUBLIC ${GTK3_INCLUDE_DIRS} ${WEBKIT4_INCLUDE_DIRS}) + target_link_directories(WebWindow.Native PUBLIC ${GTK3_LIBRARY_DIRS} ${WEBKIT4_LIBRARY_DIRS}) + target_link_libraries(WebWindow.Native ${GTK3_LIBRARIES} ${WEBKIT4_LIBRARIES}) endif() diff --git a/src/WebWindow.Native/src/WebWindow.Linux.cpp b/src/WebWindow.Native/src/WebWindow.Linux.cpp index 884884a..a6d989e 100644 --- a/src/WebWindow.Native/src/WebWindow.Linux.cpp +++ b/src/WebWindow.Native/src/WebWindow.Linux.cpp @@ -308,5 +308,3 @@ void WebWindow::SetIconFile(AutoString filename) { gtk_window_set_icon_from_file(GTK_WINDOW(_window), filename, NULL); } - -#endif diff --git a/src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.m b/src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.m deleted file mode 100644 index 57e881d..0000000 --- a/src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.m +++ /dev/null @@ -1,21 +0,0 @@ -#import "WebWindow.Mac.AppDelegate.h" - -@implementation MyApplicationDelegate : NSObject -- (id)init { - if (self = [super init]) { - // allocate and initialize window and stuff here .. - } - return self; -} - -- (void)applicationDidFinishLaunching:(NSNotification *)notification { - [window makeKeyAndOrderFront:nil]; - [NSApp activateIgnoringOtherApps:YES]; -} - -- (void)dealloc { - [window release]; - [super dealloc]; -} - -@end diff --git a/src/WebWindow.Native/WebWindow.Mac.AppDelegate.mm b/src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.mm similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.AppDelegate.mm rename to src/WebWindow.Native/src/WebWindow.Mac.AppDelegate.mm diff --git a/src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.m b/src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.m deleted file mode 100644 index 89eddd2..0000000 --- a/src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.m +++ /dev/null @@ -1,74 +0,0 @@ -#import "WebWindow.Mac.UiDelegate.h" - -@implementation MyUiDelegate : NSObject - -- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message -{ - char *messageUtf8 = (char *)[message.body UTF8String]; - webMessageReceivedCallback(messageUtf8); -} - -- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler -{ - NSAlert* alert = [[NSAlert alloc] init]; - - [alert setMessageText:[NSString stringWithFormat:@"Alert: %@.", [frame.request.URL absoluteString]]]; - [alert setInformativeText:message]; - [alert addButtonWithTitle:@"OK"]; - - [alert beginSheetModalForWindow:window completionHandler:^void (NSModalResponse response) { - completionHandler(); - [alert release]; - }]; -} - -- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler -{ - NSAlert* alert = [[NSAlert alloc] init]; - - [alert setMessageText:[NSString stringWithFormat:@"Confirm: %@.", [frame.request.URL absoluteString]]]; - [alert setInformativeText:message]; - - [alert addButtonWithTitle:@"OK"]; - [alert addButtonWithTitle:@"Cancel"]; - - [alert beginSheetModalForWindow:window completionHandler:^void (NSModalResponse response) { - completionHandler(response == NSAlertFirstButtonReturn); - [alert release]; - }]; -} - -- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString *result))completionHandler -{ - NSAlert* alert = [[NSAlert alloc] init]; - - [alert setMessageText:[NSString stringWithFormat:@"Prompt: %@.", [frame.request.URL absoluteString]]]; - [alert setInformativeText:prompt]; - - [alert addButtonWithTitle:@"OK"]; - [alert addButtonWithTitle:@"Cancel"]; - - NSTextField* input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)]; - [input setStringValue:defaultText]; - [alert setAccessoryView:input]; - - [alert beginSheetModalForWindow:window completionHandler:^void (NSModalResponse response) { - [input validateEditing]; - completionHandler(response == NSAlertFirstButtonReturn ? [input stringValue] : nil); - [alert release]; - }]; -} - -- (void)windowDidResize:(NSNotification *)notification { - int width, height; - webWindow->GetSize(&width, &height); - webWindow->InvokeResized(width, height); -} - -- (void)windowDidMove:(NSNotification *)notification { - int x, y; - webWindow->GetPosition(&x, &y); - webWindow->InvokeMoved(x, y); -} - -@end diff --git a/src/WebWindow.Native/WebWindow.Mac.UiDelegate.mm b/src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.mm similarity index 100% rename from src/WebWindow.Native/WebWindow.Mac.UiDelegate.mm rename to src/WebWindow.Native/src/WebWindow.Mac.UiDelegate.mm From bb1a430219aefd6d4f8343cd7d0afa38ef90f073 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 8 Jan 2020 11:18:41 +0800 Subject: [PATCH 06/11] Remove #endif. --- src/WebWindow.Native/src/WebWindow.Mac.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/WebWindow.Native/src/WebWindow.Mac.mm b/src/WebWindow.Native/src/WebWindow.Mac.mm index ad5fc20..cb01994 100644 --- a/src/WebWindow.Native/src/WebWindow.Mac.mm +++ b/src/WebWindow.Native/src/WebWindow.Mac.mm @@ -276,5 +276,3 @@ [[window standardWindowButton:NSWindowDocumentIconButton] setImage:icon]; } } - -#endif From 0f0b92ec9bb552c3d236086e6ddb573a519349be Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 8 Jan 2020 11:23:15 +0800 Subject: [PATCH 07/11] Solve csproj conflicts. --- src/WebWindow/WebWindow.csproj | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/WebWindow/WebWindow.csproj b/src/WebWindow/WebWindow.csproj index 374f09a..198b650 100644 --- a/src/WebWindow/WebWindow.csproj +++ b/src/WebWindow/WebWindow.csproj @@ -18,17 +18,7 @@ -<<<<<<< HEAD -======= - - - ->>>>>>> master From 95c30c478dd86351f387a555edc845f60ea606f8 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 8 Jan 2020 11:32:03 +0800 Subject: [PATCH 08/11] Revert packages update. --- src/WebWindow.Native/WebWindow.Native.vcxproj | 8 ++++---- src/WebWindow.Native/packages.config | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/WebWindow.Native/WebWindow.Native.vcxproj b/src/WebWindow.Native/WebWindow.Native.vcxproj index 1123a2f..b3a98fa 100644 --- a/src/WebWindow.Native/WebWindow.Native.vcxproj +++ b/src/WebWindow.Native/WebWindow.Native.vcxproj @@ -162,14 +162,14 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/WebWindow.Native/packages.config b/src/WebWindow.Native/packages.config index 59d72aa..8137acf 100644 --- a/src/WebWindow.Native/packages.config +++ b/src/WebWindow.Native/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file From 010bccc8d816c7899dc62cfbb4effbc909318ed7 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 8 Jan 2020 11:36:22 +0800 Subject: [PATCH 09/11] Fix cmake. --- src/WebWindow.Native/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/WebWindow.Native/CMakeLists.txt b/src/WebWindow.Native/CMakeLists.txt index 2e1c574..724a599 100644 --- a/src/WebWindow.Native/CMakeLists.txt +++ b/src/WebWindow.Native/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.7) -project(WebWindowNative CXX) +project(WebWindowNative) if(APPLE) file(GLOB LIB_SOURCE "src/WebWindow.Mac.*") @@ -20,6 +20,7 @@ else() target_compile_definitions(WebWindow.Native PUBLIC "OS_LINUX" ${GTK3_CFLAGS_OTHER} ${WEBKIT4_CFLAGS_OTHER}) target_include_directories(WebWindow.Native PUBLIC ${GTK3_INCLUDE_DIRS} ${WEBKIT4_INCLUDE_DIRS}) - target_link_directories(WebWindow.Native PUBLIC ${GTK3_LIBRARY_DIRS} ${WEBKIT4_LIBRARY_DIRS}) + # target_link_directories(WebWindow.Native PUBLIC ${GTK3_LIBRARY_DIRS} ${WEBKIT4_LIBRARY_DIRS}) + link_directories(${GTK3_LIBRARY_DIRS} ${WEBKIT4_LIBRARY_DIRS}) target_link_libraries(WebWindow.Native ${GTK3_LIBRARIES} ${WEBKIT4_LIBRARIES}) endif() From bf21832a5f6d22d8d2320e49006bcf0e7e3c1c27 Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 8 Jan 2020 11:53:05 +0800 Subject: [PATCH 10/11] Fix Linux build and package. --- src/WebWindow.Native/CMakeLists.txt | 5 +++-- src/WebWindow/WebWindow.csproj | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/WebWindow.Native/CMakeLists.txt b/src/WebWindow.Native/CMakeLists.txt index 724a599..b20aab1 100644 --- a/src/WebWindow.Native/CMakeLists.txt +++ b/src/WebWindow.Native/CMakeLists.txt @@ -11,14 +11,15 @@ add_library(WebWindow.Native SHARED ${LIB_SOURCE}) target_include_directories(WebWindow.Native PUBLIC include) if(APPLE) - target_compile_definitions(WebWindow.Native PUBLIC "OS_MAC") + target_compile_definitions(WebWindow.Native PUBLIC "-DOS_MAC") target_link_libraries(WebWindow.Native "-framework Cocoa" "-framework WebKit") else() find_package(PkgConfig REQUIRED) pkg_check_modules(GTK3 REQUIRED gtk+-3.0) pkg_check_modules(WEBKIT4 REQUIRED webkit2gtk-4.0) - target_compile_definitions(WebWindow.Native PUBLIC "OS_LINUX" ${GTK3_CFLAGS_OTHER} ${WEBKIT4_CFLAGS_OTHER}) + target_compile_definitions(WebWindow.Native PUBLIC "-DOS_LINUX") + target_compile_options(WebWindow.Native PUBLIC ${GTK3_CFLAGS_OTHER} ${WEBKIT4_CFLAGS_OTHER}) target_include_directories(WebWindow.Native PUBLIC ${GTK3_INCLUDE_DIRS} ${WEBKIT4_INCLUDE_DIRS}) # target_link_directories(WebWindow.Native PUBLIC ${GTK3_LIBRARY_DIRS} ${WEBKIT4_LIBRARY_DIRS}) link_directories(${GTK3_LIBRARY_DIRS} ${WEBKIT4_LIBRARY_DIRS}) diff --git a/src/WebWindow/WebWindow.csproj b/src/WebWindow/WebWindow.csproj index 198b650..c5ae092 100644 --- a/src/WebWindow/WebWindow.csproj +++ b/src/WebWindow/WebWindow.csproj @@ -6,7 +6,7 @@ Apache-2.0 netstandard2.1 ..\WebWindow.Native\x64\$(Configuration)\ - ..\WebWindow.Native\builddir\$(Configuration)\x64\ + ..\WebWindow.Native\builddir\$(Configuration)\any\ $([MSBuild]::IsOsPlatform('OSX')) win-x64 linux-x64 From 548a9d1e8347f729161624054a026b123189819a Mon Sep 17 00:00:00 2001 From: Berrysoft Date: Wed, 8 Jan 2020 12:01:57 +0800 Subject: [PATCH 11/11] Add lib prefix. --- src/WebWindow/WebWindow.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WebWindow/WebWindow.csproj b/src/WebWindow/WebWindow.csproj index c5ae092..909151b 100644 --- a/src/WebWindow/WebWindow.csproj +++ b/src/WebWindow/WebWindow.csproj @@ -24,8 +24,8 @@ <_NativeLibraries Include="$(NativeOutputDir)WebWindow.Native.dll" Condition="Exists('$(NativeOutputDir)WebWindow.Native.dll')" /> <_NativeLibraries Include="$(NativeOutputDir)WebView2Loader.dll" Condition="Exists('$(NativeOutputDir)WebView2Loader.dll')" /> - <_NativeLibraries Include="$(NativeOutputDir)WebWindow.Native.so" Condition="Exists('$(NativeOutputDir)WebWindow.Native.so')" /> - <_NativeLibraries Include="$(NativeOutputDir)WebWindow.Native.dylib" Condition="Exists('$(NativeOutputDir)WebWindow.Native.dylib')" /> + <_NativeLibraries Include="$(NativeOutputDir)libWebWindow.Native.so" Condition="Exists('$(NativeOutputDir)libWebWindow.Native.so')" /> + <_NativeLibraries Include="$(NativeOutputDir)libWebWindow.Native.dylib" Condition="Exists('$(NativeOutputDir)libWebWindow.Native.dylib')" /> PreserveNewest %(Filename)%(Extension)