mirror of
https://github.com/meganz/MEGAcmd
synced 2025-08-30 05:17:41 +00:00
Fixes for Windows building
- unify vcpkg inclusion - disable object_parallel_to_source for windows - removed not available icon.rc for tests executables - disable sanitizer for win32 in unit tests - other building adjustments - have InstrumentsException inherit form exception instead of system_error
This commit is contained in:
parent
3be402f289
commit
d9724a52c6
5
.gitignore
vendored
5
.gitignore
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,4 @@
|
||||
include(../../vcpkg_inclusion.pri)
|
||||
|
||||
MEGACMD_BASE_PATH_RELATIVE = ../../../../..
|
||||
MEGACMD_BASE_PATH = $$PWD/$$MEGACMD_BASE_PATH_RELATIVE
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
51
contrib/QtCreator/MEGAcmd/vcpkg_inclusion.pri
Normal file
51
contrib/QtCreator/MEGAcmd/vcpkg_inclusion.pri
Normal file
@ -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
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user