Skip to content

Commit

Permalink
Windows 2015 warnings rollup (#1383)
Browse files Browse the repository at this point in the history
* STL exporting

Only export functions, not entire class to shut up MSVC about exporting
STL containers

* windows warnings

* cmake warning

* my current configuration

* more windows warnings

* missing PDAL_DLL decl

* Make sure to initialize Everything union

* Only filters.chipper uses lround. Move it into that filter instead of globally

* hobu's current cmake configu that works

* windows warning patrol

* Refactor pg_query_once to return string instead of char* which we end up leaking

* warnings about DLL import redefinition

* unused var

* mismatched types warning

* comparison warnings

* I build project files now

* silence PyTuple_GetItem argument warning

* conversion to doubles warnings

* inconsistent dll linkage w/ python

* more accurate test output

* don't explicitly initialize Everything

* truncation warning in OCI driver
  • Loading branch information
hobu committed Nov 13, 2016
1 parent ddc6345 commit 4d43c65
Show file tree
Hide file tree
Showing 29 changed files with 167 additions and 152 deletions.
63 changes: 28 additions & 35 deletions cmake/examples/hobu-windows.bat
Expand Up @@ -19,16 +19,6 @@ set PDAL_DIR=.

:: Where is your OSGeo4W installed (recommended basic way to satisfy dependent libs)
set OSGEO4W_DIR=C:\OSGeo4W64
set BOOST=%OSGEO4W_DIR%

:: Where is boost installed?
rem set BOOST_DIR=c:\utils\boost_1_49_0
REM set BOOST_DIR=%PDAL_DIR%\boost

:: CARIS
REM set CARIS_ENABLED=ON
set CARIS_INCLUDE_DIR=%CARIS_DIR%\include
set CARIS_LIBRARY=%CARIS_DIR%\caris.lib

:: GDAL
set GDAL_ENABLED=ON
Expand Down Expand Up @@ -63,39 +53,42 @@ set LIBXML2_LIBRARIES=%OSGEO4W_DIR%\lib\libxml2.lib

:: Python
set PYTHON_ENABLED=ON
REM set PYTHON_EXECUTABLE=%OSGEO4W_DIR\bin\python27.exe
REM set PYTHON_INCLUDE_DIR=%OSGEO4W_DIR\apps\python27\include
REM set PYTHON_LIBRARY=%OSGEO4W_DIR\apps\python27\libs\python27.lib
set PYTHON_EXECUTABLE=%OSGEO4W_DIR\bin\python27.exe
set PYTHON_INCLUDE_DIR=%OSGEO4W_DIR\apps\python27\include
set PYTHON_LIBRARY=%OSGEO4W_DIR\apps\python27\libs\python27.lib



if EXIST CMakeCache.txt del CMakeCache.txt
del /S /Q CMakeFiles
cd %PDAL_DIR%/build
cmake -G %GENERATOR% ^
-DBOOST_INCLUDEDIR=%BOOST%\include\boost-1_56 -DCMAKE_INSTALL_PREFIX=C:\dev\PDAL\built ^
-DBOOST_LIBRARYDIR=%BOOST%\lib -DCMAKE_BUILD_TYPE=Release -DBoost_DEBUG=ON -DBoost_COMPILER="-vc110" ^
-DWITH_GEOTIFF=%GEOTIFF_ENABLED% ^
-DBUILD_PLUGIN_OCI=%ORACLE_ENABLED% ^

cmake -G "Visual Studio 14 2015 Win64" ^
-DBUILD_PLUGIN_CPD=OFF ^
-DBUILD_PLUGIN_GREYHOUND=OFF ^
-DBUILD_PLUGIN_HEXBIN=ON ^
-DBUILD_PLUGIN_ICEBRIDGE=OFF ^
-DBUILD_PLUGIN_MRSID=OFF ^
-DBUILD_PLUGIN_NITF=ON ^
-DBUILD_PLUGIN_OCI=ON ^
-DBUILD_PLUGIN_P2G=ON ^
-DBUILD_PLUGIN_PCL=OFF ^
-DBUILD_PLUGIN_PGPOINTCLOUD=ON ^
-DWITH_LASZIP=%LASZIP_ENABLED% ^
-DWITH_LIBXML2=%LIBXML2_ENABLED% ^
-DWITH_PYTHON=%PYTHON_ENABLED% ^
-DBUILD_PLUGIN_NITF=ON ^
-DBUILD_PLUGIN_HEXBIN=ON ^
-DBUILD_PLUGIN_SQLITE=ON ^
-DBUILD_PLUGIN_RIVLIB=OFF ^
-DBUILD_PLUGIN_PYTHON=ON ^
-DENABLE_CTEST=OFF ^
-DWITH_APPS=ON ^
-DWITH_LAZPERF=%PDAL_OPTIONAL_COMPONENTS% ^
-DWITH_GEOTIFF=ON ^
-DWITH_LASZIP=ON ^
-DWITH_TESTS=ON ^
-DPYTHON_EXECUTABLE=%OSGEO4W_DIR%\bin\python.exe ^
-DPYTHON_INCLUDE_DIR=%OSGEO4W_DIR%\apps\python27\include ^
-DPYTHON_LIBRARY=%OSGEO4W_DIR%\apps\python27\libs\python27.lib ^
-DNUMPY_INCLUDE_DIR=%OSGEO4W_DIR%\apps\python27\lib\site-packages\numpy\core\include ^
-DNUMPY_VERSION=1.8.1 ^
-DNUMPY_VERSION=1.11.1 ^
-Dgtest_force_shared_crt=ON ^
-DCMAKE_INSTALL_PREFIX=C:\pdalbin ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DCMAKE_VERBOSE_MAKEFILE=OFF ^
-DBUILD_PLUGIN_SQLITE=ON ^
-DBUILD_PLUGIN_PCL=ON ^
..
cd ..

rem -DBOOST_INCLUDEDIR=%BOOST_DIR% ^
rem -DNUMPY_INCLUDE_DIR=%OSGEO4W_DIR%\apps\python27\lib\site-packages\numpy\core\include ^
rem -DPYTHONPATH=%OSGEO4W_DIR%\apps\python27\lib\site-packages ^
rem -DPYTHON_LIBRARY=%PYTHON_LIBRARY% ^
.

2 changes: 1 addition & 1 deletion cmake/modules/FindJSONCPP.cmake
Expand Up @@ -35,7 +35,7 @@ set(_pathsuffixes
msvc80
msvc90
linux-gcc)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
execute_process(COMMAND
${CMAKE_CXX_COMPILER}
-dumpversion
Expand Down
16 changes: 16 additions & 0 deletions filters/chipper/ChipperFilter.cpp
Expand Up @@ -143,6 +143,22 @@ void ChipperFilter::load(PointView& view, ChipRefList& xvec, ChipRefList& yvec,
}




#ifdef _WIN32
inline long lround(double d)
{
long l;

if (d < 0)
l = (long)ceil(d - .5);
else
l = (long)floor(d + .5);
return l;
}
#endif


// Build a list of partitions. The partition is the size of each block in
// the x and y directions in number of points.
void ChipperFilter::partition(point_count_t size)
Expand Down
2 changes: 1 addition & 1 deletion filters/transformation/TransformationFilter.cpp
Expand Up @@ -54,7 +54,7 @@ std::string TransformationFilter::getName() const { return s_info.name; }
TransformationMatrix transformationMatrixFromString(const std::string& s)
{
std::istringstream iss(s);
TransformationMatrix matrix;
TransformationMatrix matrix{ 0 };
double entry;
TransformationMatrix::size_type i = 0;
while (iss >> entry)
Expand Down
7 changes: 6 additions & 1 deletion include/pdal/PDALUtils.hpp
Expand Up @@ -46,6 +46,11 @@
#include <unistd.h>
#endif

#ifdef PDAL_COMPILER_MSVC
//# pragma warning(disable: 4127) // conditional expression is constant
#endif


namespace pdal
{
class Options;
Expand Down Expand Up @@ -106,7 +111,7 @@ inline Everything extractDim(Extractor& ext, Dimension::Type type)
{
using Type = Dimension::Type;

Everything e;
Everything e;
switch (type)
{
case Type::Unsigned8:
Expand Down
48 changes: 24 additions & 24 deletions include/pdal/PointLayout.hpp
Expand Up @@ -45,51 +45,51 @@
namespace pdal
{

class PDAL_DLL PointLayout
class PointLayout
{
public:
/**
Default constructor.
*/
PointLayout();
virtual ~PointLayout() {}
PDAL_DLL PointLayout();
PDAL_DLL virtual ~PointLayout() {}

/**
Mark a layout as finalized. Dimensions can't be added to a finalized
PointLayout.
*/
void finalize();
PDAL_DLL void finalize();

/**
Determine if the PointLayout is finalized.
\return Whether the PointLayout is finalized.
*/
bool finalized() const
PDAL_DLL bool finalized() const
{ return m_finalized; }

/**
Register a vector of dimensions.
\param ids Vector of IDs to register.
*/
void registerDims(std::vector<Dimension::Id> ids);
PDAL_DLL void registerDims(std::vector<Dimension::Id> ids);

/**
Register a list of dimensions.
\param id Pointer to list of IDs to register. The last ID in the list
must have the value Unknown.
*/
void registerDims(Dimension::Id *id);
PDAL_DLL void registerDims(Dimension::Id *id);

/**
Register use of a standard dimension (declare that a point will contain
data for this dimension). Use the default type for the dimension.
\param id ID of dimension to be registered.
*/
void registerDim(Dimension::Id id);
PDAL_DLL void registerDim(Dimension::Id id);

/**
Register use of a standard dimension (declare that a point will contain
Expand All @@ -100,7 +100,7 @@ class PDAL_DLL PointLayout
\param id ID of dimension to be registered.
\param type Minimum type to assign to the dimension.
*/
void registerDim(Dimension::Id id, Dimension::Type type);
PDAL_DLL void registerDim(Dimension::Id id, Dimension::Type type);

/**
Assign a non-existing (proprietary) dimension with the given name and
Expand All @@ -114,7 +114,7 @@ class PDAL_DLL PointLayout
\param type Minimum type to assign to the dimension.
\return ID of the new or existing dimension, or Unknown on failure.
*/
Dimension::Id assignDim( const std::string& name,
PDAL_DLL Dimension::Id assignDim( const std::string& name,
Dimension::Type type);

/**
Expand All @@ -126,15 +126,15 @@ class PDAL_DLL PointLayout
accomodate values of this type.
\return ID of dimension registered or assigned.
*/
Dimension::Id registerOrAssignDim(const std::string name,
PDAL_DLL Dimension::Id registerOrAssignDim(const std::string name,
Dimension::Type type);

/**
Get a list of DimType objects that define the layout.
\return A list of DimType objects.
*/
DimTypeList dimTypes() const;
PDAL_DLL DimTypeList dimTypes() const;

/**
Get a DimType structure for a named dimension.
Expand All @@ -143,23 +143,23 @@ class PDAL_DLL PointLayout
\return A DimType associated with the named dimension. Returns a
DimType with an Unknown ID if the dimension isn't part of the layout.
*/
DimType findDimType(const std::string& name) const;
PDAL_DLL DimType findDimType(const std::string& name) const;

/**
Get the ID of a dimension (standard or proprietary) given its name.
\param name Name of the dimension.
\return ID of the dimension or Unknown.
*/
Dimension::Id findDim(const std::string& name) const;
PDAL_DLL Dimension::Id findDim(const std::string& name) const;

/**
Get the ID of a proprietary dimension given its name.
\param name Name of the dimension.
\return ID of the dimension or Unknown.
*/
Dimension::Id findProprietaryDim(const std::string& name) const;
PDAL_DLL Dimension::Id findProprietaryDim(const std::string& name) const;

/**
Get the name of a dimension give its ID. A dimension may have more
Expand All @@ -168,65 +168,65 @@ class PDAL_DLL PointLayout
\param id ID of the dimension.
\return A name associated with the dimension, or a NULL string.
*/
std::string dimName(Dimension::Id id) const;
PDAL_DLL std::string dimName(Dimension::Id id) const;

/**
Determine if the PointLayout uses the dimension with the given ID.
\param id ID of the dimension to check.
\return \c true if the layout uses the dimension, \c false otherwise.
*/
bool hasDim(Dimension::Id id) const;
PDAL_DLL bool hasDim(Dimension::Id id) const;

/**
Get a reference to vector of the IDs of currently used dimensions.
\return Vector of IDs of dimensions that are part of the layout.
*/
const Dimension::IdList& dims() const;
PDAL_DLL const Dimension::IdList& dims() const;

/**
Get the type of a dimension.
\param id ID of the dimension.
\return Type of the dimension.
*/
Dimension::Type dimType(Dimension::Id id) const;
PDAL_DLL Dimension::Type dimType(Dimension::Id id) const;

/**
Get the current size in bytes of the dimension.
\param id ID of the dimension.
\return Size of the dimension in bytes.
*/
size_t dimSize(Dimension::Id id) const;
PDAL_DLL size_t dimSize(Dimension::Id id) const;

/**
Get the offset of the dimension in the layout.
\param id ID of the dimension.
\return Offset of the dimension in bytes.
*/
size_t dimOffset(Dimension::Id id) const;
PDAL_DLL size_t dimOffset(Dimension::Id id) const;

/**
Get number of bytes that make up a point. Returns the sum of the dimSize
for all dimensions in the layout.
\return Size of a point in bytes.
*/
size_t pointSize() const;
PDAL_DLL size_t pointSize() const;

/**
Get a pointer to a dimension's detail information.
\param id ID of the dimension.
\return A pointer a dimension's detail.
*/
const Dimension::Detail *dimDetail(Dimension::Id id) const;
PDAL_DLL const Dimension::Detail *dimDetail(Dimension::Id id) const;

private:
virtual bool update(Dimension::Detail dd, const std::string& name);
PDAL_DLL virtual bool update(Dimension::Detail dd, const std::string& name);

Dimension::Type resolveType( Dimension::Type t1,
Dimension::Type t2);
Expand Down
13 changes: 0 additions & 13 deletions include/pdal/pdal_macros.hpp
Expand Up @@ -107,16 +107,3 @@ struct PluginInfo
return 0; \
}

#ifdef _WIN32
inline long lround(double d)
{
long l;

if (d < 0)
l = (long)ceil(d - .5);
else
l = (long)floor(d + .5);
return l;
}
#endif

6 changes: 6 additions & 0 deletions include/pdal/plang/Redirector.hpp
Expand Up @@ -11,6 +11,12 @@
#pragma once

#include <functional>
#include <pdal/pdal_defines.h>

#ifdef PDAL_COMPILER_MSVC
# pragma warning(disable: 4127) // conditional expression is constant
#define HAVE_ROUND // inconsistent dll linkage otherwise
#endif

#include <Python.h>

Expand Down
4 changes: 2 additions & 2 deletions io/ilvis2/Ilvis2MetadataReader.cpp
Expand Up @@ -63,7 +63,7 @@ void Ilvis2MetadataReader::parseGranuleMetaDataFile(xmlNodePtr node, MetadataNod

xmlNodePtr child = getFirstChildElementNode(node);
assertElementIs(child, "DTDVersion");
m->add<float>("DTDVersion", extractDouble(child));
m->add<double>("DTDVersion", extractDouble(child));

child = getNextElementNode(child);
assertElementIs(child, "DataCenterId");
Expand All @@ -81,7 +81,7 @@ void Ilvis2MetadataReader::parseGranuleURMetaData(xmlNodePtr node, MetadataNode*
{
assertElementIs(node, "GranuleURMetaData");

xmlNodePtr child, subchild;
xmlNodePtr child;

child = getFirstChildElementNode(node);
assertElementIs(child, "GranuleUR");
Expand Down

0 comments on commit 4d43c65

Please sign in to comment.