maplibre support for Qt6 and MSVC 2019 (#125)

* [qt] Updating CMake project files for Qt6

* [qt] Updating non-test projects for Qt6 and msvc2019

* [qt] Test fixes for Qt6 and msvc2019

* [qt] Link whole test archive for Qt and msvc2019

* [qt] Fixing Qt6 headless backend renderer

* [qt] Fixes for test failures

* [qt] Expression and style parser test fixes

* [qt] Backwards compatibility with Qt5 and Qt6

Minimum version is Qt 5.4 due to use of QOpenGLWidget

* [qt] LLVM is no longer required for a Windows build

* [msvc] msvc2019 fixes for maplibre

* Update test/storage/offline_database.test.cpp

Co-authored-by: Tadej Novak <tadej@tano.si>

* Vector + const is not standard C++

Co-authored-by: Tadej Novak <tadej@tano.si>
This commit is contained in:
Dan Paulat
2021-08-07 10:10:45 -05:00
committed by GitHub
parent 1eee73bdce
commit 8b804a1903
51 changed files with 406 additions and 213 deletions

View File

@@ -13,7 +13,14 @@
#include <fstream>
#include <set>
#if defined(_MSC_VER) && !defined(__clang__)
#include <Windows.h>
#ifdef GetObject
#undef GetObject
#endif
#else
#include <dirent.h>
#endif
using namespace mbgl;
@@ -61,6 +68,10 @@ TEST_P(StyleParserTest, ParseStyle) {
js_entry[rapidjson::SizeType(3)].GetString()
};
#if defined(WIN32)
Sleep(10);
#endif
EXPECT_EQ(count, observer->count(message)) << "Message: " << message << std::endl;
}
}
@@ -74,23 +85,44 @@ TEST_P(StyleParserTest, ParseStyle) {
}
}
static void populateNames(std::vector<std::string>& names) {
const std::string ending = ".info.json";
std::string style_directory = "test/fixtures/style_parser";
auto testName = [&](const std::string& name) {
if (name.length() >= ending.length() &&
name.compare(name.length() - ending.length(), ending.length(), ending) == 0) {
names.push_back(name.substr(0, name.length() - ending.length()));
}
};
#if defined(_MSC_VER) && !defined(__clang__)
style_directory += "/*";
WIN32_FIND_DATAA ffd;
HANDLE hFind = FindFirstFileA(style_directory.c_str(), &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
const std::string name = ffd.cFileName;
testName(name);
} while (FindNextFileA(hFind, &ffd) != 0);
FindClose(hFind);
}
#else
DIR *dir = opendir(style_directory.c_str());
if (dir != nullptr) {
for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) {
const std::string name = dp->d_name;
testName(name);
}
closedir(dir);
}
#endif
}
INSTANTIATE_TEST_SUITE_P(StyleParser, StyleParserTest, ::testing::ValuesIn([] {
std::vector<std::string> names;
const std::string ending = ".info.json";
const std::string style_directory = "test/fixtures/style_parser";
DIR *dir = opendir(style_directory.c_str());
if (dir != nullptr) {
for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) {
const std::string name = dp->d_name;
if (name.length() >= ending.length() &&
name.compare(name.length() - ending.length(), ending.length(), ending) == 0) {
names.push_back(name.substr(0, name.length() - ending.length()));
}
}
closedir(dir);
}
populateNames(names);
EXPECT_GT(names.size(), 0u);
return names;
}()));