Skip to content

Commit

Permalink
Fix PDAL support on MinGW-w64
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiChinoune authored and nyalldawson committed May 25, 2024
1 parent a6a32bd commit ded31e1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mingw-w64-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
-DPython_EXECUTABLE=${MINGW_PREFIX}/bin/python \
-DWITH_3D=ON \
-DWITH_DRACO=ON \
-DWITH_PDAL=OFF \
-DWITH_PDAL=ON \
-DWITH_CUSTOM_WIDGETS=ON \
-DWITH_BINDINGS=OFF \
-DWITH_GRASS=OFF \
Expand Down
4 changes: 4 additions & 0 deletions external/pdal_wrench/tile/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ std::vector<std::string> directoryList(const std::string& dir)
fs::directory_iterator end;
while (it != end)
{
#ifndef __MINGW32__
files.push_back(untwine::fromNative(it->path()));
#else
files.push_back(untwine::fromNative(it->path().string()));
#endif
it++;
}
}
Expand Down
8 changes: 8 additions & 0 deletions external/untwine/untwine/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ MapContext mapFile(const std::string& filename, bool readOnly, size_t pos, size_
#ifndef _WIN32
ctx.m_fd = ::open(filename.data(), readOnly ? O_RDONLY : O_RDWR);
#else
#ifdef _MSC_VER
ctx.m_fd = ::_wopen(toNative(filename).data(), readOnly ? _O_RDONLY : _O_RDWR);
#else
ctx.m_fd = ::_open(toNative(filename).data(), readOnly ? _O_RDONLY : _O_RDWR);
#endif
#endif

if (ctx.m_fd == -1)
Expand Down Expand Up @@ -129,7 +133,11 @@ std::vector<std::string> directoryList(const std::string& dir)
fs::directory_iterator end;
while (it != end)
{
#ifndef __MINGW32__
files.push_back(untwine::fromNative(it->path()));
#else
files.push_back(untwine::fromNative(it->path().string()));
#endif
it++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion external/untwine/untwine/Untwine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void cleanup(const std::string& dir, bool rmdir)

} // namespace untwine

#ifdef _WIN32
#ifdef _MSC_VER
int wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] )
#else
int main(int argc, char *argv[])
Expand Down

0 comments on commit ded31e1

Please sign in to comment.