Skip to content

Commit

Permalink
Better MinGW build support (maplibre#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdcosta100 authored Mar 23, 2023
1 parent ee44990 commit 96c2d5a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions platform/qt/qt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ if(NOT MBGL_QT_LIBRARY_ONLY)
PRIVATE WORK_DIRECTORY=${PROJECT_SOURCE_DIR}
)

if(WIN32)
target_compile_definitions(
mbgl-test-runner
PRIVATE MBGL_BUILDING_LIB
)
endif()

target_link_libraries(
mbgl-test-runner
PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions platform/qt/test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <cerrno>
#include <cstdio>

#if defined(_MSC_VER) && !defined(__clang__)
#if defined(WIN32) && !defined(__clang__)
#include <direct.h>
#else
#include <unistd.h>
Expand All @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);

#ifdef WORK_DIRECTORY
#ifdef _MSC_VER
#ifdef WIN32
const int result = _chdir(xstr(WORK_DIRECTORY));
#else
const int result = chdir(xstr(WORK_DIRECTORY));
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ target_link_libraries(
$<$<AND:$<PLATFORM_ID:Windows>,$<BOOL:MINGW>>:psapi>
)

if(MSVC)
if(WIN32)
target_compile_definitions(
mbgl-test
PRIVATE MBGL_BUILDING_LIB
Expand Down
4 changes: 2 additions & 2 deletions test/style/style_parser.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <fstream>
#include <set>

#if defined(_MSC_VER) && !defined(__clang__)
#if defined(WIN32) && !defined(__clang__)
#include <Windows.h>
#ifdef GetObject
#undef GetObject
Expand Down Expand Up @@ -97,7 +97,7 @@ static void populateNames(std::vector<std::string>& names) {
}
};

#if defined(_MSC_VER) && !defined(__clang__)
#if defined(WIN32) && !defined(__clang__)
style_directory += "/*";
WIN32_FIND_DATAA ffd;
HANDLE hFind = FindFirstFileA(style_directory.c_str(), &ffd);
Expand Down

0 comments on commit 96c2d5a

Please sign in to comment.