Fix build cmake

This commit is contained in:
Quentin Rouland 2019-03-16 16:18:05 +01:00
parent 7458507c9b
commit 86643fa46f
11 changed files with 106 additions and 103 deletions

View File

@ -8,80 +8,8 @@ find_package(Qt5Core)
find_package(Qt5Qml)
find_package(Qt5Quick)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Add external dependencies
set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/local")
set(COMPILE_TOOLS "${CMAKE_SOURCE_DIR}/tools")
set(ENV{PATH} "${EXTERNAL_LIBS}/bin:${COMPILE_TOOLS}:$ENV{PATH}")
set(THIRD_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third")
set(LIBGPGERROR_PATH "${THIRD_PATH}/libgpg-error")
set(LIBASSUANSRC_PATH "${THIRD_PATH}/libassuan")
set(LIBGPGME_PATH "${THIRD_PATH}/gpgme")
INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include)
LINK_DIRECTORIES(${EXTERNAL_LIBS}/lib)
ExternalProject_Add(
LibGpgError
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBGPGERROR_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --enable-static --host ${ARCH_TRIPLET}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
add_library(target-LibGpgError SHARED IMPORTED)
set_property(TARGET target-LibGpgError PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpg-error.so")
ExternalProject_Add(
LibGpgAssuan
DEPENDS LibGpgError
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBASSUANSRC_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --enable-static --with-libgpg-error-prefix=${EXTERNAL_LIBS} --host ${ARCH_TRIPLET}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
add_library(target-LibGpgAssuan SHARED IMPORTED)
set_property(TARGET target-LibGpgAssuan PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libassuan.so")
ExternalProject_Add(
LibGpgme
DEPENDS LibGpgError LibGpgAssuan
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBGPGME_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --enable-languages=cpp,qt --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --enable-static --with-libgpg-error-prefix=${EXTERNAL_LIBS} --with-libassuan-prefix=${EXTERNAL_LIBS} --host ${ARCH_TRIPLET}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
add_library(target-LibGpgppme SHARED IMPORTED)
set_property(TARGET target-LibGpgppme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgmepp.so")
add_library(target-LibQGpgme SHARED IMPORTED)
set_property(TARGET target-LibQGpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libqgpgme.so")
# Automatically create moc files
set(CMAKE_AUTOMOC ON)
@ -94,8 +22,6 @@ set(DATA_DIR /)
set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop)
add_executable(${PROJECT_NAME} main.cpp)
add_dependencies(${PROJECT_NAME} LibGpgAssuan LibGpgError LibGpgme)
target_link_libraries(${PROJECT_NAME} target-LibGpgAssuan target-LibGpgError target-LibGpgppme target-LibQGpgme)
qt5_use_modules(${PROJECT_NAME} Gui Qml Quick)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
@ -105,7 +31,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INST
install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
install(DIRECTORY qml DESTINATION ${DATA_DIR})
install(DIRECTORY assets DESTINATION ${DATA_DIR})
install(DIRECTORY local/lib DESTINATION ${DATA_DIR})
install(DIRECTORY password-store DESTINATION ${DATA_DIR})
@ -130,6 +55,7 @@ add_custom_target(${DESKTOP_FILE_NAME} ALL
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR})
add_subdirectory(third)
add_subdirectory(po)
add_subdirectory(plugins)

View File

@ -11,5 +11,8 @@
"dependencies_build": [
"texinfo",
"gpgsm"
],
"dependencies_target": [
]
}

View File

@ -13,6 +13,27 @@ add_library(${PLUGIN} MODULE ${SRC})
set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN})
qt5_use_modules(${PLUGIN} Qml Quick DBus)
set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/local")
set(THIRD_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include)
add_dependencies(${PLUGIN} LibGpgme)
add_library(target-LibGpgError STATIC IMPORTED)
set_property(TARGET target-LibGpgError PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpg-error.a")
add_library(target-LibGpgAssuan STATIC IMPORTED)
set_property(TARGET target-LibGpgAssuan PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libassuan.a")
add_library(target-LibGpgppme STATIC IMPORTED)
set_property(TARGET target-LibGpgppme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgmepp.a")
add_library(target-LibQGpgme STATIC IMPORTED)
set_property(TARGET target-LibQGpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libqgpgme.a")
target_link_libraries(${PLUGIN} target-LibGpgAssuan target-LibGpgError target-LibGpgppme target-LibQGpgme)
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET

View File

@ -2,15 +2,21 @@
#include <QFile>
#include "pass.h"
#include "gpgme++/global.h"
#include "qgpgme/protocol.h"
#include "qgpgme/encryptjob.h"
#include "qgpgme/decryptjob.h"
#include "qgpgme/keylistjob.h"
Pass::Pass() {
GpgME::initializeLibrary();
this->gpgHome = qgetenv("GNUPGHOME");
qDebug() << "Initializing GpgMe";
/*auto err = GpgME::initializeLibrary(GpgME::OpenPGP);
if(err) {
qFatal("Fatal error when initializing GpgMe");
}*/
}
void Pass::speak() {
qDebug() << "Starting app from main.cpp";
}
QString Pass::decrypt(const QByteArray cipherText) {

View File

@ -11,6 +11,7 @@ public:
Pass();
~Pass() override = default;
Q_INVOKABLE void speak();
Q_INVOKABLE QString decrypt(QByteArray plainText);
Q_INVOKABLE QString decrypt_file(QString path);
Q_INVOKABLE QByteArray encrypt(QString str);

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: utpass.qrouland\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-16 09:07+0000\n"
"POT-Creation-Date: 2019-03-16 15:17+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,11 +17,6 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../qml/components/Search.qml:6 ../qml/pages/headers/MainHeader.qml:23
#: ../qml/pages/headers/MainHeader.qml:36
msgid "Search"
msgstr ""
#: ../qml/pages/PasswordList.qml:17
msgid "Back"
msgstr ""
@ -30,7 +25,7 @@ msgstr ""
msgid "No password found in the current folder"
msgstr ""
#: ../qml/pages/Settings.qml:8 ../qml/pages/headers/MainHeader.qml:44
#: ../qml/pages/Settings.qml:8 ../qml/pages/headers/MainHeader.qml:47
msgid "Settings"
msgstr ""
@ -39,7 +34,12 @@ msgstr ""
msgid "UTPass"
msgstr ""
#: ../qml/pages/headers/MainHeader.qml:51 ../qml/pages/Info.qml:9
#: ../qml/pages/headers/MainHeader.qml:23
#: ../qml/pages/headers/MainHeader.qml:36
msgid "Search"
msgstr ""
#: ../qml/pages/headers/MainHeader.qml:54 ../qml/pages/Info.qml:9
msgid "Info"
msgstr ""

View File

@ -1,6 +1,7 @@
import QtQuick 2.4
import QtQuick.Layouts 1.1
import Ubuntu.Components 1.3
import Pass 1.0
import "components"
@ -19,4 +20,5 @@ MainView {
Component.onCompleted: push(pageStack.push(Qt.resolvedUrl("pages/PasswordList.qml")))
}
Component.onCompleted: Pass.speak()
}

View File

@ -1,12 +0,0 @@
import QtQuick 2.4
Item {
TextField {
id: searchBar
placeholderText: i18n.tr("Search")
height: units.gu(4)
visible: false
anchors.verticalCenter: parent.verticalCenter
}
Component.onCompleted: ;
}

View File

@ -1,3 +1,2 @@
FileDir 1.0 FileDir.qml
Link 1.0 Link.qml
Search 1.0 Search.qml

View File

@ -24,6 +24,7 @@ PageHeader {
height: units.gu(4)
visible: false
anchors.verticalCenter: parent.verticalCenter
onFocusChanged: {}
}
}
@ -34,8 +35,11 @@ PageHeader {
iconName: "search"
text: i18n.tr("Search")
onTriggered: {
searchBar.visible = searchBar.visible ? false : true;
labelTitle.visible = labelTitle.visible ? false : true;
searchBar.visible = !searchBar.visible;
labelTitle.visible = !searchBar.visible;
if (searchBar.visible === true) {
searchBar.focus = true
}
}
},
Action {

53
third/CMakeLists.txt Normal file
View File

@ -0,0 +1,53 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/local")
set(THIRD_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
set(ENV{PATH} "${EXTERNAL_LIBS}/bin")
set(LIBGPGERROR_PATH "${THIRD_PATH}/libgpg-error")
set(LIBASSUANSRC_PATH "${THIRD_PATH}/libassuan")
set(LIBGPGME_PATH "${THIRD_PATH}/gpgme")
#INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include)
#LINK_DIRECTORIES(${EXTERNAL_LIBS}/lib)
ExternalProject_Add(
LibGpgError
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBGPGERROR_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-static=yes --enable-shared=no --with-pic=yes --enable-maintainer-mode --host ${ARCH_TRIPLET}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add(
LibGpgAssuan
DEPENDS LibGpgError
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBASSUANSRC_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --prefix=${EXTERNAL_LIBS} --enable-static=yes --enable-shared=no --with-pic=yes --enable-maintainer-mode --with-libgpg-error-prefix=${EXTERNAL_LIBS} --host ${ARCH_TRIPLET}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add(
LibGpgme
DEPENDS LibGpgError LibGpgAssuan
INSTALL_DIR ${EXTERNAL_LIBS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${LIBGPGME_PATH}
CONFIGURE_COMMAND <SOURCE_DIR>/autogen.sh && <SOURCE_DIR>/configure --enable-languages=cpp,qt --enable-static=yes --enable-shared=no --with-pic=yes --prefix=${EXTERNAL_LIBS} --enable-maintainer-mode --with-libgpg-error-prefix=${EXTERNAL_LIBS} --with-libassuan-prefix=${EXTERNAL_LIBS} --host ${ARCH_TRIPLET}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND make install
)