mirror of
				https://github.com/yuezk/GlobalProtect-openconnect.git
				synced 2025-05-20 07:26:58 -04:00 
			
		
		
		
	migrate to cmake
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -6,6 +6,7 @@ gpservice | |||||||
| *.gz | *.gz | ||||||
| .DS_Store | .DS_Store | ||||||
| build-debian | build-debian | ||||||
|  | build | ||||||
|  |  | ||||||
| # Auto generated DBus files | # Auto generated DBus files | ||||||
| *_adaptor.cpp | *_adaptor.cpp | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,5 @@ | |||||||
| [submodule "singleapplication"] | [submodule "singleapplication"] | ||||||
| 	path = singleapplication | 	path = SingleApplication | ||||||
| 	url = https://github.com/itay-grudev/SingleApplication.git | 	url = https://github.com/itay-grudev/SingleApplication.git | ||||||
|  |  | ||||||
| [submodule "plog"] | [submodule "plog"] | ||||||
|   | |||||||
							
								
								
									
										29
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | cmake_minimum_required(VERSION 3.1.0) | ||||||
|  |  | ||||||
|  | project(GlobalProtect-openconnect VERSION 1.3.3) | ||||||
|  |  | ||||||
|  | set(CMAKE_CXX_STANDARD 11) | ||||||
|  | set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||||||
|  |  | ||||||
|  | set(CMAKE_AUTOMOC ON) | ||||||
|  | set(CMAKE_AUTORCC ON) | ||||||
|  | set(CMAKE_AUTOUIC ON) | ||||||
|  |  | ||||||
|  | set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication") | ||||||
|  |  | ||||||
|  | include(cmake/CPM.cmake) | ||||||
|  |  | ||||||
|  | find_package(Qt5 REQUIRED COMPONENTS | ||||||
|  |     Core | ||||||
|  |     Widgets | ||||||
|  |     WebSockets | ||||||
|  |     WebEngine | ||||||
|  |     WebEngineWidgets | ||||||
|  |     DBus | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | CPMAddPackage("gh:itay-grudev/SingleApplication@3.3.0") | ||||||
|  | CPMAddPackage("gh:SergiusTheBest/plog#1.1.5") | ||||||
|  |  | ||||||
|  | add_subdirectory(GPService) | ||||||
|  | add_subdirectory(GPClient) | ||||||
							
								
								
									
										37
									
								
								GPClient/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								GPClient/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | |||||||
|  | project(gpclient) | ||||||
|  |  | ||||||
|  | set(gpclient_GENERATED_SOURCES) | ||||||
|  |  | ||||||
|  | qt5_add_dbus_interface(gpclient_GENERATED_SOURCES ${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml gpserviceinterface) | ||||||
|  |  | ||||||
|  | add_executable(gpclient | ||||||
|  |     cdpcommand.cpp | ||||||
|  |     cdpcommandmanager.cpp | ||||||
|  |     enhancedwebview.cpp | ||||||
|  |     gatewayauthenticator.cpp | ||||||
|  |     gatewayauthenticatorparams.cpp | ||||||
|  |     gpgateway.cpp | ||||||
|  |     gphelper.cpp | ||||||
|  |     loginparams.cpp | ||||||
|  |     main.cpp | ||||||
|  |     normalloginwindow.cpp | ||||||
|  |     portalauthenticator.cpp | ||||||
|  |     portalconfigresponse.cpp | ||||||
|  |     preloginresponse.cpp | ||||||
|  |     samlloginwindow.cpp | ||||||
|  |     gpclient.cpp | ||||||
|  |     settingsdialog.cpp | ||||||
|  |     ${gpclient_GENERATED_SOURCES} | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | target_include_directories(gpclient PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) | ||||||
|  |  | ||||||
|  | target_link_libraries(gpclient | ||||||
|  |     plog | ||||||
|  |     SingleApplication | ||||||
|  |     Qt5::Widgets | ||||||
|  |     Qt5::WebSockets | ||||||
|  |     Qt5::WebEngine | ||||||
|  |     Qt5::WebEngineWidgets | ||||||
|  |     Qt5::DBus | ||||||
|  | ) | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| #ifndef GPCLIENT_H | #ifndef GPCLIENT_H | ||||||
| #define GPCLIENT_H | #define GPCLIENT_H | ||||||
|  |  | ||||||
| #include "gpservice_interface.h" | #include "gpserviceinterface.h" | ||||||
| #include "portalconfigresponse.h" | #include "portalconfigresponse.h" | ||||||
| #include "settingsdialog.h" | #include "settingsdialog.h" | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										29
									
								
								GPService/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								GPService/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | project(gpservice) | ||||||
|  |  | ||||||
|  | set(gpservice_GENERATED_SOURCES) | ||||||
|  |  | ||||||
|  | # generate the dbus xml definition | ||||||
|  | qt5_generate_dbus_interface(gpservice.h ${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml) | ||||||
|  |  | ||||||
|  | # generate dbus adaptor | ||||||
|  | qt5_add_dbus_adaptor( | ||||||
|  |     gpservice_GENERATED_SOURCES | ||||||
|  |     ${CMAKE_BINARY_DIR}/com.yuezk.qt.GPService.xml | ||||||
|  |     gpservice.h | ||||||
|  |     GPService | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | add_executable(gpservice | ||||||
|  |     gpservice.cpp | ||||||
|  |     main.cpp | ||||||
|  |     sigwatch.cpp | ||||||
|  |     ${gpservice_GENERATED_SOURCES} | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | target_include_directories(gpservice PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) | ||||||
|  |  | ||||||
|  | target_link_libraries(gpservice | ||||||
|  |     SingleApplication | ||||||
|  |     Qt5::Core | ||||||
|  |     Qt5::DBus | ||||||
|  | ) | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| #include "gpservice.h" | #include "gpservice.h" | ||||||
| #include "gpservice_adaptor.h" | #include "gpserviceadaptor.h" | ||||||
|  |  | ||||||
| #include <QFileInfo> | #include <QFileInfo> | ||||||
| #include <QtDBus> | #include <QtDBus> | ||||||
|   | |||||||
| @@ -21,6 +21,8 @@ public: | |||||||
|     explicit GPService(QObject *parent = nullptr); |     explicit GPService(QObject *parent = nullptr); | ||||||
|     ~GPService(); |     ~GPService(); | ||||||
|  |  | ||||||
|  |     void quit(); | ||||||
|  |  | ||||||
|     enum VpnStatus { |     enum VpnStatus { | ||||||
|         VpnNotConnected, |         VpnNotConnected, | ||||||
|         VpnConnecting, |         VpnConnecting, | ||||||
| @@ -38,7 +40,6 @@ public slots: | |||||||
|     void connect(QString server, QString username, QString passwd, QString extraArgs); |     void connect(QString server, QString username, QString passwd, QString extraArgs); | ||||||
|     void disconnect(); |     void disconnect(); | ||||||
|     int status(); |     int status(); | ||||||
|     void quit(); |  | ||||||
|  |  | ||||||
| private slots: | private slots: | ||||||
|     void onProcessStarted(); |     void onProcessStarted(); | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								cmake/CPM.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								cmake/CPM.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | set(CPM_DOWNLOAD_VERSION 0.32.3) | ||||||
|  |  | ||||||
|  | if(CPM_SOURCE_CACHE) | ||||||
|  |   # Expand relative path. This is important if the provided path contains a tilde (~) | ||||||
|  |   get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE) | ||||||
|  |   set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||||||
|  | elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||||||
|  |   set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||||||
|  | else() | ||||||
|  |   set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) | ||||||
|  |   message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") | ||||||
|  |   file(DOWNLOAD | ||||||
|  |        https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||||||
|  |        ${CPM_DOWNLOAD_LOCATION} | ||||||
|  |   ) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | include(${CPM_DOWNLOAD_LOCATION}) | ||||||
		Reference in New Issue
	
	Block a user