diff --git a/.gitignore b/.gitignore index 0d49e17a..708757d0 100644 --- a/.gitignore +++ b/.gitignore @@ -120,6 +120,11 @@ contrib/QtCreator/*/*/Makefile contrib/QtCreator/*/*/*/Makefile test_integration test_unit +.qtc_clangd +CMakeFiles +build-x64-windows-mega +Makefile.Debug +Makefile.Release /Makefile* build/Release_x64 diff --git a/contrib/QtCreator/MEGAcmd/MEGAcmdCommon.pri b/contrib/QtCreator/MEGAcmd/MEGAcmdCommon.pri index 4832fdaa..0255b8e9 100644 --- a/contrib/QtCreator/MEGAcmd/MEGAcmdCommon.pri +++ b/contrib/QtCreator/MEGAcmd/MEGAcmdCommon.pri @@ -1,26 +1,4 @@ -isEmpty(THIRDPARTY_VCPKG_BASE_PATH){ - THIRDPARTY_VCPKG_BASE_PATH = $$PWD/../../../../3rdParty_megacmd -} - -win32 { - contains(QMAKE_TARGET.arch, x86_64):VCPKG_TRIPLET = x64-windows-mega - !contains(QMAKE_TARGET.arch, x86_64):VCPKG_TRIPLET = x86-windows-mega -} - -macx{ - isEmpty(VCPKG_TRIPLET){ - contains(QT_ARCH, x86_64):VCPKG_TRIPLET = x64-osx-mega - contains(QT_ARCH, arm64):VCPKG_TRIPLET = arm64-osx-mega - } - contains(VCPKG_TRIPLET, arm64-osx-mega):contains(QMAKE_HOST.arch, arm64):QMAKE_APPLE_DEVICE_ARCHS=arm64 - - message("Building for macOS $$QT_ARCH in a $$QMAKE_HOST.arch host.") -} - -unix:!macx:VCPKG_TRIPLET = x64-linux - -message("THIRDPARTY_VCPKG_BASE_PATH: $$THIRDPARTY_VCPKG_BASE_PATH") -message("VCPKG_TRIPLET: $$VCPKG_TRIPLET") +include(vcpkg_inclusion.pri) packagesExist(libpcrecpp) | macx { LIBS += -lpcrecpp diff --git a/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_common/MEGAcmdTest_common.pri b/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_common/MEGAcmdTest_common.pri index 175292bc..896a429f 100644 --- a/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_common/MEGAcmdTest_common.pri +++ b/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_common/MEGAcmdTest_common.pri @@ -1,3 +1,4 @@ +include(../../vcpkg_inclusion.pri) MEGACMD_BASE_PATH_RELATIVE = ../../../../.. MEGACMD_BASE_PATH = $$PWD/$$MEGACMD_BASE_PATH_RELATIVE diff --git a/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_integration/MEGAcmdTest_integration.pro b/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_integration/MEGAcmdTest_integration.pro index 4bdfd341..2051557e 100644 --- a/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_integration/MEGAcmdTest_integration.pro +++ b/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_integration/MEGAcmdTest_integration.pro @@ -12,7 +12,7 @@ TARGET = test_integration TEMPLATE = app CONFIG -= qt -CONFIG += object_parallel_to_source +!win32:CONFIG += object_parallel_to_source CONFIG += console DEFINES += MEGACMD_TESTING_CODE @@ -21,7 +21,6 @@ win32 { LIBS += -lshlwapi -lws2_32 LIBS += -lshell32 -luser32 -ladvapi32 - RC_FILE = icon.rc QMAKE_LFLAGS += /LARGEADDRESSAWARE QMAKE_LFLAGS_WINDOWS += /SUBSYSTEM:WINDOWS,5.01 QMAKE_LFLAGS_CONSOLE += /SUBSYSTEM:CONSOLE,5.01 diff --git a/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_unit/MEGAcmdTest_unit.pro b/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_unit/MEGAcmdTest_unit.pro index 20cddbe6..cd9d1a38 100644 --- a/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_unit/MEGAcmdTest_unit.pro +++ b/contrib/QtCreator/MEGAcmd/MEGAcmdTests/MEGAcmdTest_unit/MEGAcmdTest_unit.pro @@ -6,15 +6,11 @@ CONFIG(release, debug|release) { CONFIG -= debug release CONFIG += release } - -MEGACMD_BASE_PATH_RELATIVE = ../../../../.. -MEGACMD_BASE_PATH = $$PWD/$$MEGACMD_BASE_PATH_RELATIVE - TARGET = test_unit TEMPLATE = app CONFIG -= qt -CONFIG += object_parallel_to_source +!win32:CONFIG += object_parallel_to_source CONFIG += console DEFINES += MEGACMD_TESTING_CODE @@ -23,7 +19,6 @@ win32 { LIBS += -lshlwapi -lws2_32 LIBS += -lshell32 -luser32 -ladvapi32 - RC_FILE = icon.rc QMAKE_LFLAGS += /LARGEADDRESSAWARE QMAKE_LFLAGS_WINDOWS += /SUBSYSTEM:WINDOWS,5.01 QMAKE_LFLAGS_CONSOLE += /SUBSYSTEM:CONSOLE,5.01 @@ -49,21 +44,26 @@ QMAKE_CXXFLAGS-=-std=c++11 CONFIG += c++17 QMAKE_CXXFLAGS+=-std=c++17 -QMAKE_CXXFLAGS += "-fsanitize=address" -QMAKE_LFLAGS += "-fsanitize=address" -QMAKE_CXXFLAGS_DEBUG += "-fsanitize=address" - -INCLUDEPATH += \ -$$MEGACMD_BASE_PATH_RELATIVE/sdk/include \ -$$MEGACMD_BASE_PATH_RELATIVE/src \ +!win32 { + QMAKE_CXXFLAGS += "-fsanitize=address" + QMAKE_LFLAGS += "-fsanitize=address" + QMAKE_CXXFLAGS_DEBUG += "-fsanitize=address" +} include(../MEGAcmdTest_common/MEGAcmdTest_common.pri) +MEGACMD_BASE_PATH_RELATIVE = ../../../../.. +MEGACMD_BASE_PATH = $$PWD/$$MEGACMD_BASE_PATH_RELATIVE + +INCLUDEPATH += \ + $$MEGACMD_BASE_PATH/sdk/include \ + $$MEGACMD_BASE_PATH/src \ + + SOURCES += \ -$$MEGACMD_BASE_PATH_RELATIVE/tests/unit/StringUtilsTests.cpp \ -$$MEGACMD_BASE_PATH_RELATIVE/tests/unit/main.cpp + $$MEGACMD_BASE_PATH/tests/unit/StringUtilsTests.cpp \ + $$MEGACMD_BASE_PATH/tests/unit/main.cpp #Dependencies: SOURCES += \ -$$MEGACMD_BASE_PATH_RELATIVE/src/megacmdcommonutils.cpp - + $$MEGACMD_BASE_PATH/src/megacmdcommonutils.cpp diff --git a/contrib/QtCreator/MEGAcmd/MEGAcmdUpdater/MEGAcmdUpdater.pro b/contrib/QtCreator/MEGAcmd/MEGAcmdUpdater/MEGAcmdUpdater.pro index 56062279..a3cef665 100644 --- a/contrib/QtCreator/MEGAcmd/MEGAcmdUpdater/MEGAcmdUpdater.pro +++ b/contrib/QtCreator/MEGAcmd/MEGAcmdUpdater/MEGAcmdUpdater.pro @@ -1,34 +1,4 @@ -isEmpty(THIRDPARTY_VCPKG_BASE_PATH){ - THIRDPARTY_VCPKG_BASE_PATH = $$PWD/../../../../../3rdParty_megacmd -} - -win32 { - contains(QMAKE_TARGET.arch, x86_64):VCPKG_TRIPLET = x64-windows-mega - !contains(QMAKE_TARGET.arch, x86_64):VCPKG_TRIPLET = x86-windows-mega -} - -macx{ - isEmpty(VCPKG_TRIPLET){ - contains(QT_ARCH, x86_64):VCPKG_TRIPLET = x64-osx-mega - contains(QT_ARCH, arm64):VCPKG_TRIPLET = arm64-osx-mega - } - contains(VCPKG_TRIPLET, arm64-osx-mega):contains(QMAKE_HOST.arch, arm64):QMAKE_APPLE_DEVICE_ARCHS=arm64 - - message("Building for macOS $$QT_ARCH in a $$QMAKE_HOST.arch host.") -} - -unix:!macx:VCPKG_TRIPLET = x64-linux - -message("THIRDPARTY_VCPKG_BASE_PATH: $$THIRDPARTY_VCPKG_BASE_PATH") -message("VCPKG_TRIPLET: $$VCPKG_TRIPLET") - -THIRDPARTY_VCPKG_PATH = $$THIRDPARTY_VCPKG_BASE_PATH/vcpkg/installed/$$VCPKG_TRIPLET -exists($$THIRDPARTY_VCPKG_PATH) { - CONFIG += vcpkg -} -vcpkg:debug:message("Building DEBUG with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH") -vcpkg:release:message("Building RELEASE with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH") -!vcpkg:message("vcpkg not used") +include(../vcpkg_inclusion.pri) CONFIG -= qt MEGASDK_BASE_PATH = $$PWD/../../../../sdk diff --git a/contrib/QtCreator/MEGAcmd/vcpkg_inclusion.pri b/contrib/QtCreator/MEGAcmd/vcpkg_inclusion.pri new file mode 100644 index 00000000..9b72d57b --- /dev/null +++ b/contrib/QtCreator/MEGAcmd/vcpkg_inclusion.pri @@ -0,0 +1,51 @@ +macx|win32 { +# have VCPKG included if not done already +isEmpty(VCPKG_TRIPLET) { + MEGACMD_BASE_PATH_RELATIVE = ../../.. + MEGACMD_BASE_PATH = $$PWD/$$MEGACMD_BASE_PATH_RELATIVE + + isEmpty(THIRDPARTY_VCPKG_BASE_PATH){ + THIRDPARTY_VCPKG_BASE_PATH = $$MEGACMD_BASE_PATH/../3rdParty_megacmd + } + + win32 { + contains(QMAKE_TARGET.arch, x86_64):VCPKG_TRIPLET = x64-windows-mega + !contains(QMAKE_TARGET.arch, x86_64):VCPKG_TRIPLET = x86-windows-mega + } + + macx{ + isEmpty(VCPKG_TRIPLET){ + contains(QT_ARCH, x86_64):VCPKG_TRIPLET = x64-osx-mega + contains(QT_ARCH, arm64):VCPKG_TRIPLET = arm64-osx-mega + } + contains(VCPKG_TRIPLET, arm64-osx-mega):contains(QMAKE_HOST.arch, arm64):QMAKE_APPLE_DEVICE_ARCHS=arm64 + + message("Building for macOS $$QT_ARCH in a $$QMAKE_HOST.arch host.") + } + + unix:!macx:VCPKG_TRIPLET = x64-linux + + message("vcpkg inclusion: THIRDPARTY_VCPKG_BASE_PATH: $$THIRDPARTY_VCPKG_BASE_PATH") + message("vcpkg inclusion: VCPKG_TRIPLET: $$VCPKG_TRIPLET") + + THIRDPARTY_VCPKG_PATH = $$THIRDPARTY_VCPKG_BASE_PATH/vcpkg/installed/$$VCPKG_TRIPLET + exists($$THIRDPARTY_VCPKG_PATH) { + CONFIG += vcpkg + } +} +else { + message("vcpkg inclusion: REUSING THIRDPARTY_VCPKG_BASE_PATH: $$THIRDPARTY_VCPKG_BASE_PATH") + message("vcpkg inclusion: REUSING VCPKG_TRIPLET: $$VCPKG_TRIPLET") +} + +#print vcpkg inclusion status +vcpkg:debug:message("vcpkg inclusion: Building DEBUG with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH") +vcpkg:release:message("vcpkg inclusion: Building RELEASE with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH") +!vcpkg:message("vcpkg inclusion: vcpkg not used") + +# Now do the actual includes: +vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include +release:LIBS += -L"$$THIRDPARTY_VCPKG_PATH/lib" +debug:LIBS += -L"$$THIRDPARTY_VCPKG_PATH/debug/lib" + +} #macx|win32 diff --git a/tests/common/Instruments.h b/tests/common/Instruments.h index 6a4cd2af..41da406b 100644 --- a/tests/common/Instruments.h +++ b/tests/common/Instruments.h @@ -31,9 +31,8 @@ using MegaCmdEvent = int; //TODO: instead have MEGAcmd events used -struct InstrumentsException : public std::system_error +struct InstrumentsException : public std::exception { - using std::system_error::system_error; virtual ~InstrumentsException() = default; };