This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathCMakeLists.txt
78 lines (68 loc) · 2.11 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
project(QvPlugin-SS)
cmake_minimum_required(VERSION 3.1.0)
set(CMAKE_CXX_STANDARD 17)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
include(CTest)
option(QVPLUGIN_USE_QT6 "Use Qt6")
if(QVPLUGIN_USE_QT6)
set(QV_QT_LIBNAME Qt6)
else()
set(QV_QT_LIBNAME Qt5)
endif()
find_package(${QV_QT_LIBNAME} COMPONENTS Core Widgets Gui Network REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(cmake/shadowsocks-uvw.cmake)
set(QVPLUGIN_INTERFACE_INCLUDE_DIR "interface/")
set(QVPLUGIN_HAS_HTTP_TO_SOCKS_HELPER ON)
include(interface/QvPluginInterface.cmake)
include(interface/QvGUIPluginInterface.cmake)
include_directories(${QVPLUGIN_INTERFACE_INCLUDE_DIR})
add_library(${PROJECT_NAME} MODULE
SSPlugin.hpp
SSPlugin.cpp
common/CommonHelpers.cpp
common/CommonHelpers.hpp
core/Serializer.cpp
core/Serializer.hpp
core/EventHandler.cpp
core/EventHandler.hpp
core/kernel/SSInstance.cpp
core/kernel/SSInstance.hpp
ui/SSOutboundEditor.cpp
ui/SSOutboundEditor.hpp
ui/SSOutboundEditor.ui
ui/GUIInterface.hpp
resx.qrc
${QVPLUGIN_INTERFACE_HEADERS}
${QVGUIPLUGIN_INTERFACE_HEADERS})
if(APPLE)
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../Frameworks/" $<TARGET_FILE:${PROJECT_NAME}>)
endif()
target_link_libraries(${PROJECT_NAME}
${QV_QT_LIBNAME}::Core
${QV_QT_LIBNAME}::Gui
${QV_QT_LIBNAME}::Widgets
${QV_QT_LIBNAME}::Network
${SHADOWSOCKS_UVW_LIBRARY})
install(TARGETS ${PROJECT_NAME} DESTINATION share/qv2ray/plugins)
if(BUILD_TESTING)
add_executable(testparsess test/TestParseSS.cpp test/catch.hpp
common/CommonHelpers.cpp
common/CommonHelpers.hpp
core/Serializer.cpp
core/Serializer.hpp
${QVPLUGIN_INTERFACE_HEADERS})
target_link_libraries(testparsess
${QV_QT_LIBNAME}::Core
${QV_QT_LIBNAME}::Gui
${QV_QT_LIBNAME}::Widgets
${QV_QT_LIBNAME}::Network)
add_test(NAME testparsess COMMAND $<TARGET_FILE:testparsess>)
endif()