diff --git a/app/README.md b/app/README.md index 6cd086d97d..4824221cbf 100644 --- a/app/README.md +++ b/app/README.md @@ -39,20 +39,6 @@ Platform specific conan profile Update `CMake` to the [Latest Release](https://cmake.org/download/) or use the Qt's "$QTBASE/Tools/CMake/..." -### Build with conan - -```bash -# linux -CMAKE_PREFIX_PATH="$HOME/Qt/6.3.2/gcc_64" conan build . -if=build/conan -bf=build - -# MacOS: CMAKE_PREFIX_PATH="$HOME/Qt/6.3.2/macos" conan build . -if=build/conan -bf=build - -# Windows: CMAKE_PREFIX_PATH="$HOME/Qt/6.3.2/mingw_64" conan build . -if=build/conan -bf=build - -ctest -VV -C Release -./status-desktop -``` - ### Build with cmake ```bash @@ -71,3 +57,14 @@ cmake --build build ```bash ctest --test-dir ./build ``` + +### Build with QtCreator + +If go is installed with brew use the following configuration otherwise adapt the configuration. +Go to QtCreator's preferences navigate to Environment -> System -> Environment -> Change and paste + +```ini +GOBIN=${GOPATH}/bin +GOPATH=${HOME}/go +PATH=${PATH}:${GOBIN}:/opt/homebrew/bin:/opt/homebrew/sbin +``` diff --git a/app/qml/Status/Application/MainShortcuts.qml b/app/qml/Status/Application/MainShortcuts.qml index a1c17ce3da..20cbba6341 100644 --- a/app/qml/Status/Application/MainShortcuts.qml +++ b/app/qml/Status/Application/MainShortcuts.qml @@ -7,7 +7,7 @@ Item { property alias enableHideWindow: hideWindowShortcut.enabled Shortcut { - sequence: StandardKey.FullScreen + sequences: [StandardKey.FullScreen] onActivated: { if (visibility === Window.FullScreen) window.showNormal() diff --git a/ci/Jenkinsfile.linux-cpp.todo b/ci/Jenkinsfile.linux-cpp similarity index 88% rename from ci/Jenkinsfile.linux-cpp.todo rename to ci/Jenkinsfile.linux-cpp index 01feddd6f2..916057ddf2 100644 --- a/ci/Jenkinsfile.linux-cpp.todo +++ b/ci/Jenkinsfile.linux-cpp @@ -45,10 +45,17 @@ pipeline { steps { sh "conan install ${env.WORKSPACE}/ --profile=${env.WORKSPACE}/vendor/conan-configs/linux.ini -s build_type=Release --build=missing -if=${env.WORKSPACE}/build/conan -of=${env.WORKSPACE}/build" // TODO: This fails compiling status-go with Jenkins user but not when run with docker's user. Fix go installation to work for all users or build docker with jenkin's - sh "conan build ${env.WORKSPACE} --build-folder=${env.WORKSPACE}/build/conan" + sh "CC=gcc-10 CXX=g++-10 qt-cmake ${env.WORKSPACE}/ -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${env.WORKSPACE}/build/conan/conan_toolchain.cmake" + sh "cmake --build ${env.WORKSPACE}/build" } } + // stage('Run Tests') { + // steps { + // sh "CTEST_OUTPUT_ON_FAILURE=1 QT_QPA_PLATFORM=offscreen ctest --test-dir ${env.WORKSPACE}/build" + // } + // } + stage('Package') { steps { sh "linuxdeploy --plugin qt --executable=${env.WORKSPACE}/build/status-desktop --appdir ${env.WORKSPACE}/build/AppDir --desktop-file=${env.WORKSPACE}/status.desktop --icon-file=${env.WORKSPACE}/status.svg --custom-apprun=${env.WORKSPACE}/AppRun-cpp" diff --git a/ci/cpp/Dockerfile-linux b/ci/cpp/Dockerfile-linux index 0799b2ad55..43af3b80a3 100644 --- a/ci/cpp/Dockerfile-linux +++ b/ci/cpp/Dockerfile-linux @@ -2,10 +2,27 @@ FROM stateoftheartio/qt6:6.3-gcc-aqt RUN export DEBIAN_FRONTEND=noninteractive \ && sudo apt update -yq \ - && sudo apt install -yq libgl-dev libvulkan-dev libxcb*-dev libxkbcommon-x11-dev python3-pip gcc-10 golang-go + && sudo apt install -yq libgl-dev libvulkan-dev libxcb*-dev libxkbcommon-x11-dev python3-pip gcc-10 golang-go wget RUN sudo pip install conan +# Installing Golang +RUN GOLANG_SHA256="9e5de37f9c49942c601b191ac5fba404b868bfc21d446d6960acc12283d6e5f2" \ + && GOLANG_TARBALL="go1.18.5.linux-amd64.tar.gz" \ + && wget -q "https://dl.google.com/go/${GOLANG_TARBALL}" \ + && echo "${GOLANG_SHA256} ${GOLANG_TARBALL}" | sha256sum -c \ + && sudo tar -C /usr/local -xzf "${GOLANG_TARBALL}" \ + && rm "${GOLANG_TARBALL}" \ + && sudo ln -s /usr/local/go/bin/go /usr/local/bin + +RUN sudo apt install -yq g++-10 + +# Jenkins user needs a specific UID/GID to work +RUN sudo groupadd -g 1001 jenkins \ + && sudo useradd --create-home -u 1001 -g 1001 jenkins +USER jenkins +ENV HOME="/home/jenkins" + # TODO finish installing dependencies then enable building the appimage in CI # RUN cd /tmp && git clone --single-branch --recursive https://github.com/AppImage/AppImageKit && cd AppImageKit/ && cmake -B ./build -S . # If still needed diff --git a/libs/ChatSection/src/ChatSectionController.cpp b/libs/ChatSection/src/ChatSectionController.cpp index 31d57f10fc..bf23e57bca 100644 --- a/libs/ChatSection/src/ChatSectionController.cpp +++ b/libs/ChatSection/src/ChatSectionController.cpp @@ -11,6 +11,7 @@ ChatSectionController::ChatSectionController() void ChatSectionController::init(const QString& sectionId) { auto chatSectionData = m_dataProvider->getSectionData(sectionId); + assert(chatSectionData.chats.size() > 0); std::vector model; for (auto c : chatSectionData.chats) { model.push_back(std::make_shared(std::move(c))); diff --git a/libs/Helpers/src/Helpers/NamedType.h b/libs/Helpers/src/Helpers/NamedType.h index bb5e28c67a..c463722ab0 100644 --- a/libs/Helpers/src/Helpers/NamedType.h +++ b/libs/Helpers/src/Helpers/NamedType.h @@ -4,7 +4,6 @@ #include #include -#include using json = nlohmann::json; @@ -33,18 +32,12 @@ public: return m_value; } -#if defined __cpp_impl_three_way_comparison && defined __cpp_lib_three_way_comparison - friend auto operator<=>(const NamedType& l, const NamedType& r) noexcept { - return l.m_value <=> r.m_value; - }; -#else bool operator<(const NamedType &other) const { return m_value < other.m_value; }; bool operator>(const NamedType &other) const { return m_value > other.m_value; }; bool operator<=(const NamedType &other) const { return m_value <= other.m_value; }; bool operator>=(const NamedType &other) const { return m_value >= other.m_value; }; bool operator==(const NamedType &other) const { return m_value == other.m_value; }; bool operator!=(const NamedType &other) const { return m_value != other.m_value; }; -#endif T &operator=(NamedType const& rhs) { return m_value = rhs.m_value; diff --git a/libs/Onboarding/src/Onboarding/UserAccountsModel.cpp b/libs/Onboarding/src/Onboarding/UserAccountsModel.cpp index b025afd984..e0a0f1611d 100644 --- a/libs/Onboarding/src/Onboarding/UserAccountsModel.cpp +++ b/libs/Onboarding/src/Onboarding/UserAccountsModel.cpp @@ -38,6 +38,7 @@ QVariant UserAccountsModel::data(const QModelIndex& index, int role) const switch(static_cast(role)) { case Name: return QVariant::fromValue(m_accounts[index.row()].get()->name()); case Account: return QVariant::fromValue(m_accounts[index.row()].get()); + default: return QVariant(); } } diff --git a/libs/StatusGoQt/CMakeLists.txt b/libs/StatusGoQt/CMakeLists.txt index 0f28ca592f..6ac567314a 100644 --- a/libs/StatusGoQt/CMakeLists.txt +++ b/libs/StatusGoQt/CMakeLists.txt @@ -64,9 +64,27 @@ add_custom_command( install( IMPORTED_RUNTIME_ARTIFACTS - statusgo_shared + statusgo_shared ) +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + add_custom_command( + TARGET + ${PROJECT_NAME} + POST_BUILD + # Workaround, status-go CMakeLists.txt should set the correct TARGET_SONAME_FILE + COMMAND ${CMAKE_COMMAND} -E copy + $/libstatus.so.0 + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMENT "Copying status-go libstatus.so.0 lib beside project executable" + ) + install( + FILES + $/libstatus.so.0 + TYPE LIB + ) +endif() + target_sources(${PROJECT_NAME} PRIVATE src/StatusGo/General.h diff --git a/libs/StatusGoQt/src/StatusGo/Wallet/BigInt.cpp b/libs/StatusGoQt/src/StatusGo/Wallet/BigInt.cpp index d6ab54a596..d2c3059fc1 100644 --- a/libs/StatusGoQt/src/StatusGo/Wallet/BigInt.cpp +++ b/libs/StatusGoQt/src/StatusGo/Wallet/BigInt.cpp @@ -10,7 +10,7 @@ namespace StatusGo::Wallet { std::string toHexData(const BigInt &num, bool uppercase) { - return num.str(0, std::ios_base::showbase | std::ios_base::hex | (uppercase ? std::ios_base::uppercase : 0)); + return num.str(0, std::ios_base::showbase | std::ios_base::hex | (uppercase ? std::ios_base::uppercase : std::ios_base::fmtflags(0))); }