Skip to content

Commit

Permalink
Remove need for GUI to build authentication methods (#43262)
Browse files Browse the repository at this point in the history
* Remove need for GUI to build authentication methods

* Nyall and Denis know better, add the flag :)

* Fix header .cpp file name

* Remove needless include_directories

* separate gui/core parts of auth method libraries

* core part to add gui modules for auth methods

* move oauth resources to top level

* refactor methods to support both modules

* move qjsonwrapper to external

* some fixes

* revert separation of modules gui/core, just a better code separation

Co-authored-by: Denis Rouzaud <denis.rouzaud@gmail.com>
  • Loading branch information
3nids committed May 19, 2021
2 parents 0b8d683 + 18497e2 commit c85903e
Show file tree
Hide file tree
Showing 69 changed files with 447 additions and 331 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -144,6 +144,8 @@ if(WITH_CORE)

set (WITH_GUI TRUE CACHE BOOL "Determines whether QGIS GUI library (and everything built on top of it) should be built")

set (WITH_AUTH TRUE CACHE BOOL "Determines whether QGIS authentication methods should be built")

set (WITH_ANALYSIS TRUE CACHE BOOL "Determines whether QGIS analysis library should be built")

set (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be built")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -19,6 +19,10 @@
* SOFTWARE.
*/


#define SIP_NO_FILE


#pragma once
#ifndef QJSONWRAPPER_JSON_H
#define QJSONWRAPPER_JSON_H
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
@@ -1,14 +1,17 @@
add_subdirectory(native)
add_subdirectory(core)

if (WITH_AUTH)
add_subdirectory(auth)
endif()

if (WITH_ANALYSIS)
add_subdirectory(analysis)
endif()

if (WITH_GUI)
add_subdirectory(ui)
add_subdirectory(gui)
add_subdirectory(auth)
endif()

add_subdirectory(providers)
Expand Down
45 changes: 30 additions & 15 deletions src/auth/basic/CMakeLists.txt
@@ -1,32 +1,47 @@
set(AUTH_BASIC_SRCS
qgsauthbasicmethod.cpp
qgsauthbasicedit.cpp
core/qgsauthbasicmethod.cpp
)

set(AUTH_BASIC_HDRS
qgsauthbasicedit.h
qgsauthbasicmethod.h
core/qgsauthbasicmethod.h
)

set(AUTH_BASIC_UIS qgsauthbasicedit.ui)
set(AUTH_BASIC_UIS_H "")

include_directories (
${CMAKE_CURRENT_BINARY_DIR}
)
if (WITH_GUI)
set(AUTH_BASIC_SRCS ${AUTH_BASIC_SRCS}
gui/qgsauthbasicmethodgui.cpp
gui/qgsauthbasicedit.cpp
)
set(AUTH_BASIC_HDRS ${AUTH_BASIC_HDRS}
gui/qgsauthbasicedit.h
)
set(AUTH_BASIC_UIS gui/qgsauthbasicedit.ui)
QT5_WRAP_UI(AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})
endif()

QT5_WRAP_UI (AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})
add_library(basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})

add_library (basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})
target_include_directories(basicauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)

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

target_link_libraries (basicauthmethod
qgis_core
qgis_gui
)
target_link_libraries(basicauthmethod qgis_core)

if (WITH_GUI)
target_include_directories(basicauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(basicauthmethod qgis_gui)
endif()

target_compile_definitions(basicauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS basicauthmethod
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
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
File renamed without changes.
File renamed without changes.
Expand Up @@ -18,6 +18,7 @@
#define QGSAUTHBASICEDIT_H

#include <QWidget>

#include "qgsauthmethodedit.h"
#include "ui_qgsauthbasicedit.h"

Expand Down
File renamed without changes.
25 changes: 25 additions & 0 deletions src/auth/basic/gui/qgsauthbasicmethodgui.cpp
@@ -0,0 +1,25 @@
/***************************************************************************
qgsauthbasicmethodgui.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 );
}
57 changes: 32 additions & 25 deletions src/auth/esritoken/CMakeLists.txt
@@ -1,40 +1,47 @@
set(AUTH_ESRI_TOKEN_SRCS
qgsauthesritokenmethod.cpp
qgsauthesritokenedit.cpp
set(AUTH_ESRITOKEN_SRCS
core/qgsauthesritokenmethod.cpp
)

set(AUTH_ESRI_TOKEN_HDRS
qgsauthesritokenedit.h
qgsauthesritokenmethod.h
set(AUTH_ESRITOKEN_HDRS
core/qgsauthesritokenmethod.h
)

set(AUTH_ESRI_TOKEN_UIS qgsauthesritokenedit.ui)
set(AUTH_ESRITOKEN_UIS_H "")

include_directories (
../../core
../../core/auth
../../core/geometry
../../core/metadata
)
include_directories (
../../gui
../../gui/auth
${CMAKE_CURRENT_BINARY_DIR}
)
if (WITH_GUI)
set(AUTH_ESRITOKEN_SRCS ${AUTH_ESRITOKEN_SRCS}
gui/qgsauthesritokenmethodgui.cpp
gui/qgsauthesritokenedit.cpp
)
set(AUTH_ESRITOKEN_HDRS ${AUTH_ESRITOKEN_HDRS}
gui/qgsauthesritokenedit.h
)
set(AUTH_ESRITOKEN_UIS gui/qgsauthesritokenedit.ui)
QT5_WRAP_UI(AUTH_ESRITOKEN_UIS_H ${AUTH_ESRITOKEN_UIS})
endif()

QT5_WRAP_UI (AUTH_ESRI_TOKEN_UIS_H ${AUTH_ESRI_TOKEN_UIS})
add_library(esritokenauthmethod MODULE ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H})

add_library (esritokenauthmethod MODULE ${AUTH_ESRI_TOKEN_SRCS} ${AUTH_ESRI_TOKEN_HDRS} ${AUTH_ESRI_TOKEN_UIS_H})
target_include_directories(esritokenauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)

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

target_link_libraries (esritokenauthmethod
qgis_core
qgis_gui
)
target_link_libraries(esritokenauthmethod qgis_core)

if (WITH_GUI)
target_include_directories(esritokenauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(esritokenauthmethod qgis_gui)
endif()

target_compile_definitions(esritokenauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS esritokenauthmethod
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions src/auth/esritoken/gui/qgsauthesritokenmethodgui.cpp
@@ -0,0 +1,27 @@
/***************************************************************************
qgsauthesritokenmethodgui.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 );
}

58 changes: 33 additions & 25 deletions src/auth/identcert/CMakeLists.txt
@@ -1,44 +1,52 @@
set(AUTH_IDENTCERT_SRCS
qgsauthidentcertmethod.cpp
qgsauthidentcertedit.cpp
core/qgsauthidentcertmethod.cpp
)

set(AUTH_IDENTCERT_HDRS
qgsauthidentcertedit.h
qgsauthidentcertmethod.h
core/qgsauthidentcertmethod.h
)

set(AUTH_IDENTCERT_UIS qgsauthidentcertedit.ui)
set(AUTH_IDENTCERT_UIS_H "")

include_directories (
../../core
../../core/auth
../../core/geometry
../../core/metadata
)
include_directories (SYSTEM
if (WITH_GUI)
set(AUTH_IDENTCERT_SRCS ${AUTH_IDENTCERT_SRCS}
gui/qgsauthidentcertmethodgui.cpp
gui/qgsauthidentcertedit.cpp
)
set(AUTH_IDENTCERT_HDRS ${AUTH_IDENTCERT_HDRS}
gui/qgsauthidentcertedit.h
)
set(AUTH_IDENTCERT_UIS gui/qgsauthidentcertedit.ui)
QT5_WRAP_UI(AUTH_IDENTCERT_UIS_H ${AUTH_IDENTCERT_UIS})
endif()

add_library(identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})

target_include_directories(identcertauthmethod SYSTEM PUBLIC
${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})

add_library (identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})
target_include_directories(identcertauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)

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

target_link_libraries (identcertauthmethod
qgis_core
qgis_gui
)
target_link_libraries(identcertauthmethod qgis_core)

if (WITH_GUI)
target_include_directories(identcertauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(identcertauthmethod qgis_gui)
endif()

target_compile_definitions(identcertauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS identcertauthmethod
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c85903e

Please sign in to comment.