-
-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(example): add example CommWebview
- Loading branch information
Showing
7 changed files
with
80,184 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#*************************************************************************** | ||
# @file CMakeLists.txt | ||
# @author itas109 (itas109@qq.com) \n\n | ||
# Blog : https://blog.csdn.net/itas109 \n | ||
# Github : https://github.com/itas109 \n | ||
# Gitee : https://gitee.com/itas109 \n | ||
# QQ Group : 129518033 | ||
# @brief Lightweight cross-platform serial port library based on C++ | ||
# @copyright The CSerialPort is Copyright (C) 2014 itas109 <itas109@qq.com>. | ||
# You may use, copy, modify, and distribute the CSerialPort, under the terms | ||
# of the LICENSE file. | ||
############################################################################ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
|
||
project(CommWebview) | ||
|
||
add_definitions(-DCSERIALPORT_DEBUG) # CSerialPort Debug Mode | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
# curl -sSLo "https://raw.githubusercontent.com/webview/webview/master/webview.h" | ||
|
||
if (WIN32) | ||
# WebView2.h | ||
# curl -sSL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2" | tar -xf - -C | ||
elseif(APPLE) | ||
|
||
elseif(UNIX) | ||
# Find GTK3 and WebKit2GTK | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0) | ||
pkg_check_modules(WEBKIT2GTK REQUIRED webkit2gtk-4.0) | ||
|
||
include_directories(${GTK3_INCLUDE_DIRS} ${WEBKIT2GTK_INCLUDE_DIRS}) | ||
link_directories(${GTK3_LIBRARY_DIRS} ${WEBKIT2GTK_LIBRARY_DIRS}) | ||
endif() | ||
|
||
include_directories(.) | ||
|
||
# cserialport files | ||
set(CSerialPortRootPath "${CMAKE_CURRENT_SOURCE_DIR}/../..") | ||
include_directories(${CSerialPortRootPath}/include) | ||
list(APPEND CSerialPortSourceFiles ${CSerialPortRootPath}/src/SerialPort.cpp ${CSerialPortRootPath}/src/SerialPortBase.cpp ${CSerialPortRootPath}/src/SerialPortInfo.cpp ${CSerialPortRootPath}/src/SerialPortInfoBase.cpp) | ||
if (WIN32) | ||
list(APPEND CSerialPortSourceFiles ${CSerialPortRootPath}/src/SerialPortInfoWinBase.cpp ${CSerialPortRootPath}/src/SerialPortWinBase.cpp) | ||
list(APPEND CSerialPortSourceFiles ${CSerialPortRootPath}/lib/version.rc) | ||
elseif (UNIX) | ||
list(APPEND CSerialPortSourceFiles ${CSerialPortRootPath}/src/SerialPortInfoUnixBase.cpp ${CSerialPortRootPath}/src/SerialPortUnixBase.cpp) | ||
endif () | ||
|
||
add_executable(${PROJECT_NAME} main.cpp ${CSerialPortSourceFiles}) | ||
|
||
if (WIN32) | ||
target_link_libraries( ${PROJECT_NAME} setupapi) | ||
elseif(APPLE) | ||
find_library(IOKIT_LIBRARY IOKit) | ||
find_library(FOUNDATION_LIBRARY Foundation) | ||
find_library(WebKit_LIBRARY WebKit REQUIRED) | ||
target_link_libraries( ${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${WebKit_LIBRARY}) | ||
elseif (UNIX) | ||
target_link_libraries( ${PROJECT_NAME} pthread ${GTK3_LIBRARIES} ${WEBKIT2GTK_LIBRARIES}) | ||
endif() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# CSerialPort for Webview | ||
|
||
``` | ||
cmake: 3.8.2 | ||
webview: v0.10.0 | ||
``` | ||
|
||
## Build | ||
|
||
``` | ||
cd example/CommWebview | ||
mkdir bin && cd bin | ||
cmake .. | ||
cmake --build . | ||
``` | ||
|
||
## Run | ||
|
||
``` | ||
./CommWebview | ||
``` |
Oops, something went wrong.