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(Qt5Qml)
find_package(Qt5Quick) find_package(Qt5Quick)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 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 # Automatically create moc files
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -94,8 +22,6 @@ set(DATA_DIR /)
set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop) set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop)
add_executable(${PROJECT_NAME} main.cpp) 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) qt5_use_modules(${PROJECT_NAME} Gui Qml Quick)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) 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(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
install(DIRECTORY qml DESTINATION ${DATA_DIR}) install(DIRECTORY qml DESTINATION ${DATA_DIR})
install(DIRECTORY assets DESTINATION ${DATA_DIR}) install(DIRECTORY assets DESTINATION ${DATA_DIR})
install(DIRECTORY local/lib DESTINATION ${DATA_DIR})
install(DIRECTORY password-store 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}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR})
add_subdirectory(third)
add_subdirectory(po) add_subdirectory(po)
add_subdirectory(plugins) add_subdirectory(plugins)

View File

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

View File

@ -13,6 +13,27 @@ add_library(${PLUGIN} MODULE ${SRC})
set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN}) set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN})
qt5_use_modules(${PLUGIN} Qml Quick DBus) 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( execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET OUTPUT_VARIABLE ARCH_TRIPLET

View File

@ -2,15 +2,21 @@
#include <QFile> #include <QFile>
#include "pass.h" #include "pass.h"
#include "gpgme++/global.h" #include "gpgme++/global.h"
#include "qgpgme/protocol.h"
#include "qgpgme/encryptjob.h" #include "qgpgme/encryptjob.h"
#include "qgpgme/decryptjob.h" #include "qgpgme/decryptjob.h"
#include "qgpgme/keylistjob.h" #include "qgpgme/keylistjob.h"
Pass::Pass() { Pass::Pass() {
GpgME::initializeLibrary(); qDebug() << "Initializing GpgMe";
this->gpgHome = qgetenv("GNUPGHOME"); /*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) { QString Pass::decrypt(const QByteArray cipherText) {
@ -56,4 +62,4 @@ bool Pass::encrypt_file(const QString str, const QString path) {
} }
file.write(Pass::encrypt(str)); file.write(Pass::encrypt(str));
return true;*/ return true;*/
} }

View File

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

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: utpass.qrouland\n" "Project-Id-Version: utpass.qrouland\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,11 +17,6 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\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 #: ../qml/pages/PasswordList.qml:17
msgid "Back" msgid "Back"
msgstr "" msgstr ""
@ -30,7 +25,7 @@ msgstr ""
msgid "No password found in the current folder" msgid "No password found in the current folder"
msgstr "" 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" msgid "Settings"
msgstr "" msgstr ""
@ -39,7 +34,12 @@ msgstr ""
msgid "UTPass" msgid "UTPass"
msgstr "" 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" msgid "Info"
msgstr "" msgstr ""

View File

@ -1,6 +1,7 @@
import QtQuick 2.4 import QtQuick 2.4
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import Ubuntu.Components 1.3 import Ubuntu.Components 1.3
import Pass 1.0
import "components" import "components"
@ -19,4 +20,5 @@ MainView {
Component.onCompleted: push(pageStack.push(Qt.resolvedUrl("pages/PasswordList.qml"))) 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 FileDir 1.0 FileDir.qml
Link 1.0 Link.qml Link 1.0 Link.qml
Search 1.0 Search.qml

View File

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