From b3c87b7c4fa18943400c221d94ae7e796d3e5bcb Mon Sep 17 00:00:00 2001 From: iakov Date: Mon, 12 Aug 2024 13:26:41 +0300 Subject: [PATCH] Purge CONFIGURATION variable, use CONFIG+=trik_not_brick for stubs (#768) --- .github/mergeable.yml | 7 -- .github/workflows/main.yml | 2 +- .github/workflows/rockylinux.yml | 2 +- .github/workflows/trik-toolchain.yml | 6 +- azure-pipelines.yml | 6 +- global.pri | 34 +-------- mlx90640-library/mlx90640-library.pro | 12 ++- scripts/azure/runtests.sh | 2 +- scripts/azure/script.sh | 4 +- scripts/runtests.sh | 2 +- scripts/script.sh | 2 +- trikControl/trikControlExport.pri | 45 +---------- trikGui/{linux => }/powerLevel.cpp | 0 .../powerLevel.cpp => powerLevel_stub.cpp} | 0 trikGui/trikGui.pro | 10 ++- trikGui/windows/powerLevel.cpp | 22 ------ trikHal/trikHal.pro | 2 +- trikKernel/trikKernel.pro | 11 ++- .../src/windows/wpaSupplicantCommunicator.cpp | 74 ------------------- .../{linux => }/wpaSupplicantCommunicator.cpp | 0 ...cpp => wpaSupplicantCommunicator_stub.cpp} | 0 trikWiFi/trikWiFi.pro | 7 +- 22 files changed, 46 insertions(+), 204 deletions(-) rename trikGui/{linux => }/powerLevel.cpp (100%) rename trikGui/{mac/powerLevel.cpp => powerLevel_stub.cpp} (100%) delete mode 100644 trikGui/windows/powerLevel.cpp delete mode 100644 trikWiFi/src/windows/wpaSupplicantCommunicator.cpp rename trikWiFi/src/{linux => }/wpaSupplicantCommunicator.cpp (100%) rename trikWiFi/src/{mac/wpaSupplicantCommunicator.cpp => wpaSupplicantCommunicator_stub.cpp} (100%) diff --git a/.github/mergeable.yml b/.github/mergeable.yml index 5246564f1..bb0b00688 100644 --- a/.github/mergeable.yml +++ b/.github/mergeable.yml @@ -11,13 +11,6 @@ mergeable: - do: milestone no_empty: enabled: true - must_include: - regex: '[0-9]+\.[0-9]+$' - - do: approvals - min: - count: 1 - required: - assignees: true - when: issues.opened validate: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9471b523..8664e6a0a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -128,7 +128,7 @@ jobs: - name: QMake shell: msys2 {0} - run: 'qmake trikRuntime.pro -spec win32-g++ CONFIG+=tests CONFIG+=release PYTHON_PATH="${pythonLocation}" CONFIG+=force_debug_info CONFIG+=sanitizer CONFIG+=sanitize_undefined' + run: 'qmake trikRuntime.pro -spec win32-g++ CONFIG+=trik_not_brick CONFIG+=tests CONFIG+=release PYTHON_PATH="${pythonLocation}" CONFIG+=force_debug_info CONFIG+=sanitizer CONFIG+=sanitize_undefined' - name: QMake all shell: msys2 {0} diff --git a/.github/workflows/rockylinux.yml b/.github/workflows/rockylinux.yml index c73144636..7b8617ee4 100644 --- a/.github/workflows/rockylinux.yml +++ b/.github/workflows/rockylinux.yml @@ -84,7 +84,7 @@ jobs: - name: QMake timeout-minutes: 1 run: | - qmake CONFIG+=release CONFIG+=${{ matrix.nopython == 'nopython' && 'trik_nopython' || '' }} \ + qmake CONFIG+=release CONFIG+=trik_not_brick CONFIG+=${{ matrix.nopython == 'nopython' && 'trik_nopython' || '' }} \ CONFIG+=tests CONFIG+=ccache CONFIG+=sanitizer \ CONFIG+=sanitize_undefined CONFIG+=${{ matrix.qjsengine == 'qjsengine' && 'trik_use_qjsengine' || '' }} \ "$GITHUB_WORKSPACE/" diff --git a/.github/workflows/trik-toolchain.yml b/.github/workflows/trik-toolchain.yml index 88c7dc8c5..f713c9b7b 100644 --- a/.github/workflows/trik-toolchain.yml +++ b/.github/workflows/trik-toolchain.yml @@ -90,7 +90,7 @@ jobs: ccache --version qemu-arm --version - - name: "[TRIK brick] QMake" + - name: "[TRIK controller] QMake" timeout-minutes: 1 run: | . /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi @@ -99,14 +99,14 @@ jobs: qmake CONFIG+=release CONFIG+=force_debug_info CONFIG+=precompile_header \ "$GITHUB_WORKSPACE/" - - name: "[TRIK brick] QMake all" + - name: "[TRIK controller] QMake all" timeout-minutes: 3 run: | . /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi cd build-brick make -j $(nproc) qmake_all - - name: "[TRIK brick] Make all" + - name: "[TRIK controller] Make all" timeout-minutes: 10 run: | . /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f0920559c..ac9e71ec1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,16 +22,16 @@ jobs: matrix: Linux release: imageName: 'ubuntu-latest' - QMAKE_EXTRA: "CONFIG+=tests CONFIG+=ccache CONFIG+=force_debug_info CONFIG+=sanitize_undefined CONFIG+=sanitizer" + QMAKE_EXTRA: "CONFIG+=tests CONFIG+=ccache CONFIG+=force_debug_info CONFIG+=sanitize_undefined CONFIG+=trik_not_brick CONFIG+=sanitizer" Linux debug: imageName: 'ubuntu-latest' CONFIG: debug VERA: true TRANSLATIONS: true - QMAKE_EXTRA: "CONFIG+=tests CONFIG+=precompile_header CONFIG+=sanitize_address CONFIG+=sanitize_undefined CONFIG+=sanitizer" + QMAKE_EXTRA: "CONFIG+=trik_not_brick CONFIG+=tests CONFIG+=precompile_header CONFIG+=sanitize_address CONFIG+=sanitize_undefined CONFIG+=sanitizer" macOs release: imageName: 'macOS-12' - QMAKE_EXTRA: "CONFIG+=tests CONFIG+=precompile_header CONFIG+=sanitize_address CONFIG+=sanitize_undefined CONFIG+=sanitizer CONFIG+=force_debug_info CONFIG+=trik_nopython" + QMAKE_EXTRA: "CONFIG+=trik_not_brick CONFIG+=tests CONFIG+=precompile_header CONFIG+=sanitize_address CONFIG+=sanitize_undefined CONFIG+=sanitizer CONFIG+=force_debug_info CONFIG+=trik_nopython" TRIK_PYTHON3_VERSION_MINOR: 10 TRIK_QT_VERSION: 5.12 diff --git a/global.pri b/global.pri index c401bd2e3..f95de25df 100644 --- a/global.pri +++ b/global.pri @@ -38,24 +38,6 @@ COMPILER_IS_ARM = $$find(COMPILER, arm-.*) PYTHONQTALL_CONFIG=PythonQtCore -count(COMPILER_IS_ARM, 1) { - ARCHITECTURE = arm -} else { - ARCHITECTURE = x86 -} - -win32 { - PLATFORM = windows -} - -unix:!macx { - PLATFORM = linux -} - -macx { - PLATFORM = mac -} - CONFIG *= qt CONFIG -= app_bundle @@ -74,16 +56,9 @@ CONFIG = $$unique(CONFIG) QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO *= -Og QMAKE_CXXFLAGS_DEBUG *= -Og -CONFIG(debug) { - isEmpty(CONFIGURATION): CONFIGURATION = $$ARCHITECTURE-debug - unix { +unix:debug { QMAKE_CXXFLAGS += -coverage QMAKE_LFLAGS += -coverage - } - CONFIGURATION_SUFFIX= -} else { - isEmpty(CONFIGURATION): CONFIGURATION = $$ARCHITECTURE-release - CONFIGURATION_SUFFIX= } !gcc4:!gcc5:!clang:!win32:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<5\\.[0-9]+\\."' ){ CONFIG += gcc5 } @@ -93,7 +68,7 @@ GLOBAL_PWD = $$absolute_path($$PWD) GLOBAL_OUTPWD = $$absolute_path($$OUT_PWD) isEmpty(GLOBAL_DESTDIR) { - GLOBAL_DESTDIR = $$GLOBAL_OUTPWD/bin/$$CONFIGURATION + GLOBAL_DESTDIR = $$GLOBAL_OUTPWD/bin } isEmpty(DESTDIR) { DESTDIR = $$GLOBAL_DESTDIR @@ -222,11 +197,6 @@ macx-clang { } } -OBJECTS_DIR = .build/$$CONFIGURATION/obj -MOC_DIR = .build/$$CONFIGURATION/moc -RCC_DIR = .build/$$CONFIGURATION/rcc -UI_DIR = .build/$$CONFIGURATION/ui - precompile_header { PRECOMPILED_HEADER = $$PWD/pch.h QMAKE_CXXFLAGS *= -Wno-error=invalid-pch diff --git a/mlx90640-library/mlx90640-library.pro b/mlx90640-library/mlx90640-library.pro index fb126cd18..d1a866778 100644 --- a/mlx90640-library/mlx90640-library.pro +++ b/mlx90640-library/mlx90640-library.pro @@ -29,13 +29,11 @@ HEADERS += \ SOURCES += \ $$PWD/mlx90640-library/functions/MLX90640_API.cpp -linux-* { -SOURCES += \ - $$PWD/mlx90640-library/functions/MLX90640_LINUX_I2C_Driver.cpp -} - -!linux-* { -SOURCES += \ +trik_not_brick { + SOURCES += \ $$PWD/src/MLX90640_STUB_I2C_Driver.cpp +} else { + SOURCES += \ + $$PWD/mlx90640-library/functions/MLX90640_LINUX_I2C_Driver.cpp } diff --git a/scripts/azure/runtests.sh b/scripts/azure/runtests.sh index eb70681b4..46ae192cb 100755 --- a/scripts/azure/runtests.sh +++ b/scripts/azure/runtests.sh @@ -10,7 +10,7 @@ export MSAN_OPTIONS=poison_in_dtor=1 for t in "$@" do - cd $BUILDDIR/bin/x86-$CONFIG + cd $BUILDDIR/bin errCode=0 if [ $AGENT_OS = linux ] ; then ulimit -c unlimited diff --git a/scripts/azure/script.sh b/scripts/azure/script.sh index eeac4d387..9f3f49924 100755 --- a/scripts/azure/script.sh +++ b/scripts/azure/script.sh @@ -35,11 +35,11 @@ $EXECUTOR bash -lic " set -x; \ && env TRIK_PYTHONPATH=\`python3.\${TRIK_PYTHON3_VERSION_MINOR} -c 'import sys; import os; print(os.pathsep.join(sys.path))'\` \ PYTHONMALLOC=malloc \ ASAN_OPTIONS=disable_coredump=0:detect_stack_use_after_return=1:fast_unwind_on_malloc=0:use_sigaltstack=0 \ - LSAN_OPTIONS=suppressions=\$PWD/bin/x86-$CONFIG/lsan.supp:fast_unwind_on_malloc=0 \ + LSAN_OPTIONS=suppressions=\$PWD/bin/lsan.supp:fast_unwind_on_malloc=0 \ MSAN_OPTIONS=poison_in_dtor=1 \ QT_QPA_PLATFORM=minimal \ make -k -j 2 check \ -&& ls bin/x86-$CONFIG " +&& ls bin" exec bash -c 'eval timeout -k 10s 100s $EXECUTOR scripts/azure/runtests.sh trikKernelTests trikCameraPhotoTests trikCommunicatorTests trikJsRunnerTests $([ -x ./trikPyRunnerTests ] && echo trikPyRunnerTests || : )' diff --git a/scripts/runtests.sh b/scripts/runtests.sh index 97f55f2ac..36e01a2f5 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -11,7 +11,7 @@ for t in "$@" MSAN_OPTIONS=poison_in_dtor=1 \ TRIK_PYTHONPATH=$TRIK_PYTHONPATH \ sh -xc \ - "cd $BUILDDIR/bin/x86-$CONFIG && \ + "cd $BUILDDIR/bin && \ { \ errCode=0 ; \ if [ $TRAVIS_OS_NAME = linux ] ; then ulimit -c unlimited ; echo core > /proc/sys/kernel/core_pattern ; echo 0 > /proc/sys/kernel/core_uses_pid; fi ; \ diff --git a/scripts/script.sh b/scripts/script.sh index dc489b854..105485a93 100755 --- a/scripts/script.sh +++ b/scripts/script.sh @@ -36,7 +36,7 @@ $EXECUTOR bash -lic " set -x; \ DISPLAY=:0 \ PYTHONMALLOC=malloc \ ASAN_OPTIONS=disable_coredump=0:detect_stack_use_after_return=1:fast_unwind_on_malloc=0:symbolize=1:use_sigaltstack=0 \ - LSAN_OPTIONS=suppressions=\$PWD/bin/x86-$CONFIG/lsan.supp:fast_unwind_on_malloc=0 \ + LSAN_OPTIONS=suppressions=\$PWD/bin/lsan.supp:fast_unwind_on_malloc=0 \ MSAN_OPTIONS=poison_in_dtor=1 \ make check -k -j2 \ && ls bin/x86-$CONFIG" diff --git a/trikControl/trikControlExport.pri b/trikControl/trikControlExport.pri index 694ac108a..5f50c3531 100644 --- a/trikControl/trikControlExport.pri +++ b/trikControl/trikControlExport.pri @@ -31,28 +31,6 @@ if (equals(QT_MAJOR_VERSION, 5)) { COMPILER = $$(CXX) -COMPILER_IS_ARM = $$find(COMPILER, arm-oe.*) - -count(COMPILER_IS_ARM, 1) { - ARCHITECTURE = arm -} else { - ARCHITECTURE = x86 -} - -win32 { - PLATFORM = windows -} else { - PLATFORM = linux -} - -CONFIG(debug, debug | release) { - CONFIGURATION = $$ARCHITECTURE-debug - CONFIGURATION_SUFFIX = -d -} else { - CONFIGURATION = $$ARCHITECTURE-release - CONFIGURATION_SUFFIX = -} - equals(TEMPLATE, app) { !macx { QMAKE_LFLAGS += -Wl,-O1,-rpath,. @@ -60,7 +38,7 @@ equals(TEMPLATE, app) { } } -isEmpty(TRIK_RUNTIME_BIN_DIR):TRIK_RUNTIME_BIN_DIR = $$TRIK_RUNTIME_DIR/bin/$$CONFIGURATION +isEmpty(TRIK_RUNTIME_BIN_DIR):TRIK_RUNTIME_BIN_DIR = $$TRIK_RUNTIME_DIR/bin LIBS += -L$$TRIK_RUNTIME_BIN_DIR @@ -129,24 +107,3 @@ copyToDestdir( \ $$PWD/system-config.xml \ $$PWD/../media/ \ ) - -# Compiler swithces to enable Google Sanitizers support. -unix:equals(ARCHITECTURE, "x86") { - CONFIG(debug) { - QMAKE_CXXFLAGS += -fno-omit-frame-pointer - CONFIG(sanitize-address) { - QMAKE_CXXFLAGS += -fsanitize=address - QMAKE_LFLAGS += -fsanitize=address - } - CONFIG(sanitize-undefined) { - # UBSan does not play well with precompiled headers for some reason. - QMAKE_CXXFLAGS += -fsanitize=undefined - QMAKE_LFLAGS += -fsanitize=undefined - } - CONFIG(sanitize-thread) { - QMAKE_CXXFLAGS += -fsanitize=thread - QMAKE_LFLAGS += -fsanitize=thread - LIBS += -ltsan - } - } -} diff --git a/trikGui/linux/powerLevel.cpp b/trikGui/powerLevel.cpp similarity index 100% rename from trikGui/linux/powerLevel.cpp rename to trikGui/powerLevel.cpp diff --git a/trikGui/mac/powerLevel.cpp b/trikGui/powerLevel_stub.cpp similarity index 100% rename from trikGui/mac/powerLevel.cpp rename to trikGui/powerLevel_stub.cpp diff --git a/trikGui/trikGui.pro b/trikGui/trikGui.pro index 8d9a65334..9733aa1b7 100644 --- a/trikGui/trikGui.pro +++ b/trikGui/trikGui.pro @@ -105,7 +105,6 @@ SOURCES += \ $$PWD/sensorLever.cpp \ $$PWD/scriptHolder.cpp \ $$PWD/gamepadIndicator.cpp \ - $$PWD/$$PLATFORM/powerLevel.cpp \ $$PWD/gyroscopeIndicator.cpp \ $$PWD/accelerometerWidget.cpp \ $$PWD/networkWidget.cpp \ @@ -113,6 +112,15 @@ SOURCES += \ $$PWD/cameraWidget.cpp \ $$PWD/pwmCaptureIndicator.cpp + + +!trik_not_brick { + SOURCES += $$PWD/powerLevel.cpp +} else { + SOURCES += $$PWD/powerLevel_stub.cpp +} + + RESOURCES = trikGui.qrc OTHER_FILES += \ diff --git a/trikGui/windows/powerLevel.cpp b/trikGui/windows/powerLevel.cpp deleted file mode 100644 index 62df424bb..000000000 --- a/trikGui/windows/powerLevel.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2016 CyberTech Labs Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ - -#include "powerLevel.h" - -using namespace trikGui; - -PowerLevel::Level PowerLevel::currentLevel() -{ - return Level::twelveVolt; -} diff --git a/trikHal/trikHal.pro b/trikHal/trikHal.pro index 8a4310a22..535673fcf 100644 --- a/trikHal/trikHal.pro +++ b/trikHal/trikHal.pro @@ -82,7 +82,7 @@ SOURCES += \ $$PWD/src/stub/stubFifo.cpp \ $$PWD/src/stub/stubIIOFile.cpp \ -equals(ARCHITECTURE, arm):!trik_not_brick { +!trik_not_brick { SOURCES += $$PWD/src/trik/hardwareAbstractionFactory.cpp } else { SOURCES += $$PWD/src/stub/hardwareAbstractionFactory.cpp diff --git a/trikKernel/trikKernel.pro b/trikKernel/trikKernel.pro index 8e886f19a..24344ca26 100644 --- a/trikKernel/trikKernel.pro +++ b/trikKernel/trikKernel.pro @@ -51,12 +51,19 @@ SOURCES += \ $$PWD/src/loggingHelper.cpp \ $$PWD/src/rcReader.cpp \ $$PWD/src/translationsHelper.cpp \ - $$PWD/src/$$PLATFORM/coreDumping.cpp \ + + +macx { PLATFORM = mac } else:win32 { PLATFORM = windows } else:PLATFORM = linux + + + +SOURCES += $$PWD/src/$$PLATFORM/coreDumping.cpp \ + OTHER_FILES += \ $$PWD/stubTrikRc \ -equals(ARCHITECTURE, arm):!trik_not_brick { +!trik_not_brick { SOURCES += $$PWD/src/trik/paths.cpp } else { SOURCES += $$PWD/src/stub/paths.cpp diff --git a/trikWiFi/src/windows/wpaSupplicantCommunicator.cpp b/trikWiFi/src/windows/wpaSupplicantCommunicator.cpp deleted file mode 100644 index b22561d3d..000000000 --- a/trikWiFi/src/windows/wpaSupplicantCommunicator.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2013 Roman Kurbatov, Yurii Litvinov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ - -#include "src/wpaSupplicantCommunicator.h" - -using namespace trikWiFi; - -struct sockaddr_un -{ - int x; -}; - -WpaSupplicantCommunicator::WpaSupplicantCommunicator( - const QString &interfaceFile - , const QString &daemonFile - , QObject *parent - ) - : QObject(parent) - , mLocal(new sockaddr_un()) - , mDest(new sockaddr_un()) -{ - Q_UNUSED(interfaceFile); - Q_UNUSED(daemonFile); -} - -WpaSupplicantCommunicator::~WpaSupplicantCommunicator() -{ -} - -int WpaSupplicantCommunicator::fileDescriptor() -{ - return -1; -} - -int WpaSupplicantCommunicator::attach() -{ - return -1; -} - -int WpaSupplicantCommunicator::detach() -{ - return -1; -} - -int WpaSupplicantCommunicator::request(const QString &command, QString &reply) -{ - Q_UNUSED(command); - Q_UNUSED(reply); - - return -1; -} - -bool WpaSupplicantCommunicator::isPending() -{ - return false; -} - -int WpaSupplicantCommunicator::receive(QString &message) -{ - Q_UNUSED(message); - - return 0; -} diff --git a/trikWiFi/src/linux/wpaSupplicantCommunicator.cpp b/trikWiFi/src/wpaSupplicantCommunicator.cpp similarity index 100% rename from trikWiFi/src/linux/wpaSupplicantCommunicator.cpp rename to trikWiFi/src/wpaSupplicantCommunicator.cpp diff --git a/trikWiFi/src/mac/wpaSupplicantCommunicator.cpp b/trikWiFi/src/wpaSupplicantCommunicator_stub.cpp similarity index 100% rename from trikWiFi/src/mac/wpaSupplicantCommunicator.cpp rename to trikWiFi/src/wpaSupplicantCommunicator_stub.cpp diff --git a/trikWiFi/trikWiFi.pro b/trikWiFi/trikWiFi.pro index f9e553289..de1b1cca3 100644 --- a/trikWiFi/trikWiFi.pro +++ b/trikWiFi/trikWiFi.pro @@ -32,7 +32,12 @@ HEADERS += \ SOURCES += \ $$PWD/src/trikWiFi.cpp \ $$PWD/src/trikWiFiWorker.cpp \ - $$PWD/src/$$PLATFORM/wpaSupplicantCommunicator.cpp \ + +trik_not_brick { + SOURCES += $$PWD/src/wpaSupplicantCommunicator_stub.cpp +} else { + SOURCES += $$PWD/src/wpaSupplicantCommunicator.cpp +} implementationIncludes(trikKernel) links(trikRuntimeQsLog trikKernel)