Skip to content

Commit

Permalink
Remove need for GUI to build authentication methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and 3nids committed May 19, 2021
1 parent c543a57 commit 50339f1
Show file tree
Hide file tree
Showing 21 changed files with 369 additions and 138 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
@@ -1,5 +1,6 @@
add_subdirectory(native)
add_subdirectory(core)
add_subdirectory(auth)

if (WITH_ANALYSIS)
add_subdirectory(analysis)
Expand All @@ -8,7 +9,6 @@ endif()
if (WITH_GUI)
add_subdirectory(ui)
add_subdirectory(gui)
add_subdirectory(auth)
endif()

add_subdirectory(providers)
Expand Down
37 changes: 27 additions & 10 deletions src/auth/basic/CMakeLists.txt
@@ -1,30 +1,47 @@
set(AUTH_BASIC_SRCS
qgsauthbasicmethod.cpp
qgsauthbasicedit.cpp
)
if (WITH_GUI)
set(AUTH_BASIC_SRCS ${AUTH_BASIC_SRCS}
qgsauthbasicmethodgui.cpp
qgsauthbasicedit.cpp
)
endif()

set(AUTH_BASIC_HDRS
qgsauthbasicedit.h
qgsauthbasicmethod.h
)
if (WITH_GUI)
set(AUTH_BASIC_HDRS ${AUTH_BASIC_HDRS}
qgsauthbasicedit.h
)
endif()

set(AUTH_BASIC_UIS qgsauthbasicedit.ui)

include_directories (
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)

QT5_WRAP_UI (AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})

add_library (basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})
if (WITH_GUI)
set(AUTH_BASIC_UIS qgsauthbasicedit.ui)
QT5_WRAP_UI(AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})
add_library(basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})
else()
add_library(basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS})
endif()

# require c++17
target_compile_features(basicauthmethod PRIVATE cxx_std_17)

target_link_libraries (basicauthmethod
target_link_libraries(basicauthmethod
qgis_core
qgis_gui
)

if (WITH_GUI)
target_link_libraries (basicauthmethod
qgis_gui
)
endif()

target_compile_definitions(basicauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS basicauthmethod
Expand Down
9 changes: 0 additions & 9 deletions src/auth/basic/qgsauthbasicmethod.cpp
Expand Up @@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsauthbasicmethod.h"
#include "qgsauthbasicedit.h"

#include "qgsauthmanager.h"
#include "qgslogger.h"
Expand Down Expand Up @@ -409,14 +408,6 @@ QGISEXTERN bool isAuthMethod()
return true;
}

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthBasicEdit *editWidget( QWidget *parent )
{
return new QgsAuthBasicEdit( parent );
}

/**
* Required cleanup function
*/
Expand Down
25 changes: 25 additions & 0 deletions src/auth/basic/qgsauthbasicmethodgui.cpp
@@ -0,0 +1,25 @@
/***************************************************************************
qgsauthbasicmethod.cpp
---------------------
begin : September 1, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsauthbasicedit.h"

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthBasicEdit *editWidget( QWidget *parent )
{
return new QgsAuthBasicEdit( parent );
}
45 changes: 33 additions & 12 deletions src/auth/esritoken/CMakeLists.txt
@@ -1,38 +1,59 @@
set(AUTH_ESRI_TOKEN_SRCS
qgsauthesritokenmethod.cpp
qgsauthesritokenedit.cpp
)
if (WITH_GUI)
set(AUTH_ESRI_TOKEN_SRCS ${AUTH_ESRI_TOKEN_SRCS}
qgsauthesritokenmethodgui.cpp
qgsauthesritokenedit.cpp
)
endif()

set(AUTH_ESRI_TOKEN_HDRS
qgsauthesritokenedit.h
qgsauthesritokenmethod.h
)

set(AUTH_ESRI_TOKEN_UIS qgsauthesritokenedit.ui)
if (WITH_GUI)
set(AUTH_ESRI_TOKEN_HDRS ${AUTH_ESRI_TOKEN_HDRS}
qgsauthesritokenedit.h
)
endif()

include_directories (
../../core
../../core/auth
../../core/geometry
../../core/metadata
)
include_directories (
../../gui
../../gui/auth
${CMAKE_CURRENT_BINARY_DIR}
)

QT5_WRAP_UI (AUTH_ESRI_TOKEN_UIS_H ${AUTH_ESRI_TOKEN_UIS})
if (WITH_GUI)
include_directories (
../../gui
../../gui/auth
)
endif()

add_library (esritokenauthmethod MODULE ${AUTH_ESRI_TOKEN_SRCS} ${AUTH_ESRI_TOKEN_HDRS} ${AUTH_ESRI_TOKEN_UIS_H})

if (WITH_GUI)
set(AUTH_ESRI_TOKEN_UIS qgsauthesritokenedit.ui)
QT5_WRAP_UI(AUTH_ESRI_TOKEN_UIS_H ${AUTH_ESRI_TOKEN_UIS})
add_library(esritokenauthmethod MODULE ${AUTH_ESRI_TOKEN_SRCS} ${AUTH_ESRI_TOKEN_HDRS} ${AUTH_ESRI_TOKEN_UIS_H})
else()
add_library(esritokenauthmethod MODULE ${AUTH_ESRI_TOKEN_SRCS} ${AUTH_ESRI_TOKEN_HDRS})
endif()

# require c++17
target_compile_features(esritokenauthmethod PRIVATE cxx_std_17)

target_link_libraries (esritokenauthmethod
target_link_libraries(esritokenauthmethod
qgis_core
qgis_gui
)

if (WITH_GUI)
target_link_libraries(esritokenauthmethod
qgis_gui
)
endif()

target_compile_definitions(esritokenauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS esritokenauthmethod
Expand Down
9 changes: 0 additions & 9 deletions src/auth/esritoken/qgsauthesritokenmethod.cpp
Expand Up @@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsauthesritokenmethod.h"
#include "qgsauthesritokenedit.h"

#include "qgsauthmanager.h"
#include "qgslogger.h"
Expand Down Expand Up @@ -171,14 +170,6 @@ QGISEXTERN bool isAuthMethod()
return true;
}

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthEsriTokenEdit *editWidget( QWidget *parent )
{
return new QgsAuthEsriTokenEdit( parent );
}

/**
* Required cleanup function
*/
Expand Down
25 changes: 25 additions & 0 deletions src/auth/esritoken/qgsauthesritokenmethodgui.cpp
@@ -0,0 +1,25 @@
/***************************************************************************
qgsauthesritokenmethod.cpp
--------------------------
begin : October 2018
copyright : (C) 2018 by Nyall Dawson
author : Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsauthesritokenedit.h"

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthEsriTokenEdit *editWidget( QWidget *parent )
{
return new QgsAuthEsriTokenEdit( parent );
}
42 changes: 31 additions & 11 deletions src/auth/identcert/CMakeLists.txt
@@ -1,14 +1,21 @@
set(AUTH_IDENTCERT_SRCS
qgsauthidentcertmethod.cpp
qgsauthidentcertedit.cpp
)
if (WITH_GUI)
set(AUTH_IDENTCERT_SRCS ${AUTH_IDENTCERT_SRCS}
qgsauthidentcertmethodgui.cpp
qgsauthidentcertedit.cpp
)
endif()

set(AUTH_IDENTCERT_HDRS
qgsauthidentcertedit.h
qgsauthidentcertmethod.h
)

set(AUTH_IDENTCERT_UIS qgsauthidentcertedit.ui)
if (WITH_GUI)
set(AUTH_IDENTCERT_HDRS ${AUTH_IDENTCERT_HDRS}
qgsauthidentcertedit.h
)
endif()

include_directories (
../../core
Expand All @@ -19,24 +26,37 @@ include_directories (
include_directories (SYSTEM
${QCA_INCLUDE_DIR}
${QTKEYCHAIN_INCLUDE_DIR}
)
include_directories (
../../gui
../../gui/auth
${CMAKE_CURRENT_BINARY_DIR}
)

QT5_WRAP_UI (AUTH_IDENTCERT_UIS_H ${AUTH_IDENTCERT_UIS})
if (WITH_GUI)
include_directories (
../../gui
../../gui/auth
)
endif()

add_library (identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})
if (WITH_GUI)
set(AUTH_IDENTCERT_UIS qgsauthidentcertedit.ui)
QT5_WRAP_UI (AUTH_IDENTCERT_UIS_H ${AUTH_IDENTCERT_UIS})
add_library (identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})
else()
add_library (identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS})
endif()

# require c++17
target_compile_features(identcertauthmethod PRIVATE cxx_std_17)

target_link_libraries (identcertauthmethod
qgis_core
qgis_gui
)

if (WITH_GUI)
target_link_libraries (identcertauthmethod
qgis_gui
)
endif()

target_compile_definitions(identcertauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS identcertauthmethod
Expand Down
9 changes: 0 additions & 9 deletions src/auth/identcert/qgsauthidentcertmethod.cpp
Expand Up @@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsauthidentcertmethod.h"
#include "qgsauthidentcertedit.h"

#include <QDir>
#include <QFile>
Expand Down Expand Up @@ -333,14 +332,6 @@ QGISEXTERN bool isAuthMethod()
return true;
}

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthIdentCertEdit *editWidget( QWidget *parent )
{
return new QgsAuthIdentCertEdit( parent );
}

/**
* Required cleanup function
*/
Expand Down
25 changes: 25 additions & 0 deletions src/auth/identcert/qgsauthidentcertmethodgui.cpp
@@ -0,0 +1,25 @@
/***************************************************************************
qgsauthidentcertmethod.cpp
---------------------
begin : September 1, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsauthidentcertedit.h"

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthIdentCertEdit *editWidget( QWidget *parent )
{
return new QgsAuthIdentCertEdit( parent );
}

0 comments on commit 50339f1

Please sign in to comment.