-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5941d2
commit cde7dcb
Showing
17 changed files
with
193 additions
and
22 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 @@ | ||
build-demo* |
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,17 @@ | ||
# 通用步骤与功能介绍 | ||
|
||
快速开始前请先阅读以下文档 | ||
|
||
[Finclip桌面版Demo集成指引与功能介绍](https://github.com/finogeeks/finclip-desktop-demo/tree/master/examples/README.md) | ||
|
||
|
||
# 快速开始 | ||
|
||
1. 使用qt creator打开 demo文件夹 | ||
2. 点击运行, 即可打开 | ||
|
||
|
||
# 注意事项 | ||
|
||
1. 下载路径请不要有中文, 否则会有奇怪的问题 | ||
2. 集成时将finclip存放至独立的位置, 避免dll冲突 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1 +1 @@ | ||
build-demo* | ||
build/ |
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,92 @@ | ||
cmake_minimum_required(VERSION 3.21) | ||
project(FinClipQtDemo) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
set(FINCLIP_QTDEMO_TARGET "FinClipQtDemo") | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") | ||
|
||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
# 在arm下编译x86的包需要特殊处理 | ||
if(PROJECT_ARCH STREQUAL "x86_64") | ||
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE INTERNAL "" FORCE) | ||
endif() | ||
endif() | ||
|
||
set(FINCLIP_QTDEMO_SRCS src/main.cc) | ||
|
||
add_executable(${FINCLIP_QTDEMO_TARGET} ${FINCLIP_QTDEMO_SRCS}) | ||
|
||
if(NOT DEFINED PROJECT_ARCH) | ||
set(PROJECT_ARCH ${CMAKE_SYSTEM_PROCESSOR}) | ||
endif() | ||
|
||
add_library( finclip_wrapper SHARED IMPORTED ) | ||
|
||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | ||
if(PROJECT_ARCH STREQUAL "x86_64") | ||
set(FINCLIP_SDK_PATH "${PROJECT_SOURCE_DIR}/../../vendor/win/x86_64") | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_LOCATION "${FINCLIP_SDK_PATH}/FinClipSDKWrapper.dll") | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_IMPLIB "${FINCLIP_SDK_PATH}/FinClipSDKWrapper.lib") | ||
set(Qt5_DIR "C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5") | ||
elseif(PROJECT_ARCH STREQUAL "x86") | ||
set(FINCLIP_SDK_PATH "${PROJECT_SOURCE_DIR}/../../vendor/win/x86") | ||
set(Qt5_DIR "C:/Qt/5.15.2/msvc2019/lib/cmake/Qt5") | ||
else() | ||
|
||
endif() | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_LOCATION "${FINCLIP_SDK_PATH}/FinClipSDKWrapper.dll") | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_IMPLIB "${FINCLIP_SDK_PATH}/FinClipSDKWrapper.lib") | ||
add_custom_command(TARGET ${FINCLIP_QTDEMO_TARGET} POST_BUILD # Adds a post-build event to MyTest | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." | ||
"${FINCLIP_SDK_PATH}/FinClipSDKWrapper.dll" # <--this is in-file | ||
$<TARGET_FILE_DIR:${FINCLIP_QTDEMO_TARGET}>) # <--this is out-file path | ||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | ||
if(PROJECT_ARCH STREQUAL "x86_64") | ||
set(FINCLIP_SDK_PATH "${PROJECT_SOURCE_DIR}/../../vendor/linux/x86_64") | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_LOCATION "${FINCLIP_SDK_PATH}/libFinClipSDKWrapper.so") | ||
else() | ||
# arm64 | ||
set(FINCLIP_SDK_PATH "${PROJECT_SOURCE_DIR}/../../vendor/linux/arm64") | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_LOCATION "${FINCLIP_SDK_PATH}/libFinClipSDKWrapper.so") | ||
endif() | ||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") | ||
if(PROJECT_ARCH STREQUAL "x86_64") | ||
# intel | ||
set(FINCLIP_SDK_PATH "${PROJECT_SOURCE_DIR}/../../vendor/mac/intel") | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_LOCATION "${FINCLIP_SDK_PATH}/libFinClipSDKWrapper.so") | ||
else() | ||
# arm64 | ||
set(FINCLIP_SDK_PATH "${PROJECT_SOURCE_DIR}/../../vendor/mac/arm64") | ||
set_target_properties(finclip_wrapper PROPERTIES IMPORTED_LOCATION "${FINCLIP_SDK_PATH}/libFinClipSDKWrapper.so") | ||
endif() | ||
else() | ||
message("Operating System: Unknown") | ||
endif() | ||
find_package( | ||
Qt5 | ||
COMPONENTS Widgets Gui | ||
REQUIRED) | ||
target_include_directories(${FINCLIP_QTDEMO_TARGET} PRIVATE "${FINCLIP_SDK_PATH}") | ||
|
||
message(STATUS "cmake configuration is ${CMAKE_SYSTEM_NAME} ${PROJECT_ARCH} ${FINCLIP_SDK_PATH} ${Qt5_DIR}") | ||
|
||
# | ||
# include_directories(../vendor/json) | ||
|
||
target_link_libraries( | ||
${FINCLIP_QTDEMO_TARGET} | ||
finclip_wrapper | ||
Qt5::Widgets | ||
Qt5::Gui | ||
) | ||
|
||
|
||
|
||
|
||
|
||
|
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 |
---|---|---|
@@ -1,17 +0,0 @@ | ||
# 通用步骤与功能介绍 | ||
|
||
快速开始前请先阅读以下文档 | ||
|
||
[Finclip桌面版Demo集成指引与功能介绍](https://github.com/finogeeks/finclip-desktop-demo/tree/master/examples/README.md) | ||
|
||
|
||
# 快速开始 | ||
|
||
1. 使用qt creator打开 demo文件夹 | ||
2. 点击运行, 即可打开 | ||
|
||
|
||
# 注意事项 | ||
|
||
1. 下载路径请不要有中文, 否则会有奇怪的问题 | ||
2. 集成时将finclip存放至独立的位置, 避免dll冲突 | ||
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,79 @@ | ||
#include <QtGui/qscreen.h> | ||
|
||
#include <QApplication> | ||
#include <QDesktopServices> | ||
#include <QThread> | ||
#include <QUrl> | ||
#include <iostream> | ||
#include <string> | ||
|
||
#include "finclip_api.h" | ||
#include "finclip_api_const.h" | ||
|
||
using namespace std; | ||
#define CHECK_RESULT(func) \ | ||
do { \ | ||
int result = func; \ | ||
if (result == 0) { \ | ||
std::cout << "Result is 0" << std::endl; \ | ||
} else { \ | ||
std::cout << "Result is not 0" << std::endl; \ | ||
} \ | ||
} while (0) | ||
#define ASSERT_RESULT(result) \ | ||
do { \ | ||
if (result != 0) std::cout << "Result is " << result << std::endl; \ | ||
assert(result == 0); \ | ||
} while (0) | ||
void fc_lifecycle_close(enum LifecycleType type, const char* appid, | ||
void* input) { | ||
_Exit(0); | ||
} | ||
void fc_lifecycle_crash(enum LifecycleType type, const char* appid, | ||
void* input) { | ||
_Exit(0); | ||
} | ||
|
||
void example_api(const char* event, const char* param, void* input, | ||
int callbackid, const char* appid) { | ||
auto* params = finclip_create_params(); | ||
// YOUR CODE HERE | ||
finclip_callback_success(callbackid, params); | ||
finclip_destory_params(params); | ||
} | ||
|
||
int main(int argc, char* argv[]) { | ||
const QApplication app(argc, argv); | ||
const string appkey = ""; | ||
const string secret = ""; | ||
const string domain = ""; | ||
const string appid = ""; | ||
const string exe_path = ""; | ||
const string app_store = "1"; | ||
|
||
FinclipParams* config = finclip_create_params(); | ||
ASSERT_RESULT( | ||
finclip_params_set(config, FINCLIP_CONFIG_APPSTORE, app_store.c_str())); | ||
ASSERT_RESULT( | ||
finclip_params_set(config, FINCLIP_CONFIG_APPKEY, appkey.c_str())); | ||
ASSERT_RESULT( | ||
finclip_params_set(config, FINCLIP_CONFIG_SECRET, secret.c_str())); | ||
ASSERT_RESULT( | ||
finclip_params_set(config, FINCLIP_CONFIG_DOMAIN, domain.c_str())); | ||
ASSERT_RESULT( | ||
finclip_params_set(config, FINCLIP_CONFIG_EXE_PATH, exe_path.c_str())); | ||
ASSERT_RESULT(finclip_register_lifecycle(appid.c_str(), kLifecycleClosed, | ||
fc_lifecycle_close, nullptr)); | ||
ASSERT_RESULT(finclip_register_lifecycle(appid.c_str(), kLifecycleCrashed, | ||
fc_lifecycle_crash, nullptr)); | ||
finclip_register_api_v2(kApplet, "example_api", example_api, nullptr); | ||
finclip_register_api_v2(kWebView, "example_api1", example_api, nullptr); | ||
auto* params = finclip_create_params(); | ||
ASSERT_RESULT(finclip_init_with_config(app_store.c_str(), config)); | ||
|
||
ASSERT_RESULT( | ||
finclip_start_applet_params(app_store.c_str(), appid.data(), params)); | ||
|
||
app.exec(); | ||
return 0; | ||
} |
Empty file.
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 @@ | ||
*/ |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
arm/ | ||
x64/ | ||
*/ |
Empty file.
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
x86/ | ||
x64/ | ||
*/ |
Empty file.