Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PDAL \ untwine on windows #178

Merged
merged 18 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ cmake -G Ninja ^
-D EXPAT_LIBRARY=%LIBRARY_LIB%\expat.lib ^
-D WITH_QTWEBKIT=TRUE ^
-D QGIS_INSTALL_SYS_LIBS=FALSE ^
-D WITH_PDAL=FALSE ^
-D WITH_EPT=FALSE ^
-D WITH_PDAL=TRUE ^
-D WITH_EPT=TRUE ^
-D LazPerf_INCLUDE_DIR=%LIBRARY_INC% ^
..
if errorlevel 1 exit 1

Expand Down
11 changes: 11 additions & 0 deletions recipe/fileprocessor.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- ./external/untwine/epf/FileProcessor.cpp.orig 2021-03-23 12:30:28.028677093 +1000
+++ ./external/untwine/epf/FileProcessor.cpp 2021-03-23 12:30:43.220828035 +1000
@@ -50,7 +50,7 @@
// This is some random cell that ultimately won't get used, but it contains a buffer
// into which we can write data.
Cell *cell = m_cellMgr.get(VoxelKey());
- f.setCallback([this, &count, &limit, &cell](pdal::PointRef& point)
+ f.setCallback([this, &count, &limit, &cell, CountIncrement](pdal::PointRef& point)
{
// Write the data into the point buffer in the cell. This is the *last*
// cell buffer that we used. We're hoping that it's the right one.
35 changes: 35 additions & 0 deletions recipe/leanandmean.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff -u -r qgis-3.18.2-orig/src/app/CMakeLists.txt qgis-3.18.2/src/app/CMakeLists.txt
--- qgis-3.18.2-orig/src/app/CMakeLists.txt 2021-04-19 11:26:26.355427047 +1000
+++ qgis-3.18.2/src/app/CMakeLists.txt 2021-04-19 11:27:48.408609210 +1000
@@ -501,7 +501,7 @@
libdxfrw
)

-target_compile_definitions(qgis_app PRIVATE "-DQT_NO_FOREACH")
+target_compile_definitions(qgis_app PRIVATE "-DQT_NO_FOREACH -DWIN32_LEAN_AND_MEAN")

if (WITH_BINDINGS)
target_link_libraries(qgis_app qgispython)
diff -u -r qgis-3.18.2-orig/src/app/qgisapp.h qgis-3.18.2/src/app/qgisapp.h
--- qgis-3.18.2-orig/src/app/qgisapp.h 2021-04-19 11:26:26.363427161 +1000
+++ qgis-3.18.2/src/app/qgisapp.h 2021-04-19 11:28:55.353573619 +1000
@@ -183,6 +183,8 @@

#ifdef Q_OS_WIN
#include <windows.h>
+// because of WIN32_LEAN_AND_MEAN we need to include this explicitly
+#include <shellapi.h>
#endif

class QgsLegendFilterButton;
diff -u -r qgis-3.18.2-orig/src/providers/pdal/CMakeLists.txt qgis-3.18.2/src/providers/pdal/CMakeLists.txt
--- qgis-3.18.2-orig/src/providers/pdal/CMakeLists.txt 2021-04-19 11:26:26.523429467 +1000
+++ qgis-3.18.2/src/providers/pdal/CMakeLists.txt 2021-04-19 11:26:59.655906800 +1000
@@ -105,6 +105,7 @@
set_target_properties(untwine PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIBEXEC_SUBDIR}
)
+target_compile_definitions(untwine PRIVATE WIN32_LEAN_AND_MEAN)

target_link_libraries (untwine
${PDAL_LIBRARIES}
26 changes: 26 additions & 0 deletions recipe/mapfile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- external/untwine/untwine/MapFile.cpp.orig 2021-03-11 16:36:16.907279906 +1000
+++ external/untwine/untwine/MapFile.cpp 2021-03-11 16:36:35.119565918 +1000
@@ -29,6 +29,10 @@
****************************************************************************/

#include "MapFile.hpp"
+#ifdef _WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif

namespace untwine
{
@@ -44,10 +48,10 @@
return ctx;
}

-#ifndef WIN32
+#ifndef _WIN32
ctx.m_fd = ::open(filename.c_str(), readOnly ? O_RDONLY : O_RDWR);
#else
- ctx.m_fd = ::_open(filename.c_str(), readOnly ? O_RDONLY : O_RDWR);
+ ctx.m_fd = ::_open(filename.c_str(), readOnly ? _O_RDONLY : _O_RDWR);
#endif

if (ctx.m_fd == -1)
19 changes: 13 additions & 6 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ package:
source:
url: https://qgis.org/downloads/qgis-{{ version }}.tar.bz2
sha256: 1913e4d5596bbc8b7d143f3defb18bf376f750a71f334f69d76af5deca7ecc5d
patches: proj8.patch
patches:
# backport of https://github.com/qgis/QGIS/pull/41774
- proj8.patch
# patches to get untwine working on Windows
- mapfile.patch # [win]
- leanandmean.patch # [win]
- fileprocessor.patch # [win]
- qgisuntwine.patch # [win]

build:
number: 0
number: 1
skip: true # [py2k]

requirements:
Expand Down Expand Up @@ -91,8 +98,8 @@ requirements:
- postgresql
- psycopg2
# Point Clouds
- pdal # [not win]
- laz-perf # [not win]
- pdal
- laz-perf
run:
- python
- icu
Expand Down Expand Up @@ -139,8 +146,8 @@ requirements:
- yaml
- owslib
- pyqtwebkit
- pdal # [not win]
- laz-perf # [not win]
- pdal
- laz-perf

run_constrained: # [osx]
- __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.9") }} # [osx]
Expand Down
8 changes: 8 additions & 0 deletions recipe/qgisuntwine.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--- ./external/untwine/api/QgisUntwine_win.cpp.orig 2021-04-14 11:11:56.364944891 +1000
+++ ./external/untwine/api/QgisUntwine_win.cpp 2021-04-14 11:12:28.621389038 +1000
@@ -1,4 +1,5 @@
#include <iostream>
+#include <algorithm>

#include "QgisUntwine.hpp"