Skip to content

Commit

Permalink
Merge branch 'master' of github.com:PDAL/PDAL
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Oct 24, 2012
2 parents d0ed3eb + 6bf99f0 commit a6bd2ef
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 60 deletions.
31 changes: 18 additions & 13 deletions CMakeLists.txt
Expand Up @@ -288,13 +288,13 @@ endif()

set(WITH_FLANN FALSE CACHE BOOL "Choose if FLANN support should be built")
if (WITH_FLANN)
find_package(Flann 1.7)
if (FLANN_FOUND)
mark_as_advanced(CLEAR FLANN_INCLUDE_DIR)
mark_as_advanced(CLEAR FLANN_LIBRARY)
include_directories(${FLANN_INCLUDE_DIR})
set(PDAL_HAVE_FLANN 1)
endif()
find_package(Flann 1.7)
if (FLANN_FOUND)
mark_as_advanced(CLEAR FLANN_INCLUDE_DIR)
mark_as_advanced(CLEAR FLANN_LIBRARY)
include_directories(${FLANN_INCLUDE_DIR})
set(PDAL_HAVE_FLANN 1)
endif()
endif()

if(WITH_GDAL)
Expand Down Expand Up @@ -376,6 +376,10 @@ if(WITH_LIBXML2)
endif()
endif()

if(NOT LIBXML2_FOUND)
message(STATUS "libxml2 not selected or not found, pcinfo will not be build")
endif()

# Oracle support - optional, default=OFF
set(WITH_ORACLE FALSE CACHE BOOL "Choose if Oracle support should be built")

Expand Down Expand Up @@ -534,7 +538,14 @@ set(PDAL_DATA_DIR ${PDAL_DATA_SUBDIR})
install(FILES AUTHORS.txt LICENSE.txt
DESTINATION ${PDAL_DATA_DIR}/doc)

#------------------------------------------------------------------------------
# generate the pdal_config.h header
#------------------------------------------------------------------------------

configure_file(
"${PROJECT_SOURCE_DIR}/pdal_defines.h.in"
"${PROJECT_BINARY_DIR}/pdal_defines.h")
include_directories(${PROJECT_BINARY_DIR})

#------------------------------------------------------------------------------
# subdirectory controls
Expand Down Expand Up @@ -606,10 +617,4 @@ include(CPack)
#add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)


#------------------------------------------------------------------------------
# finally, generate the pdal_config.h header
#------------------------------------------------------------------------------

configure_file(
"${PROJECT_SOURCE_DIR}/pdal_defines.h.in"
"${PROJECT_SOURCE_DIR}/include/pdal/pdal_defines.h")
14 changes: 7 additions & 7 deletions apps/CMakeLists.txt
Expand Up @@ -45,35 +45,35 @@ link_directories(${Boost_LIBRARY_DIRS})

# Build pcinfo
if(PCINFO)
if(WITH_LIBXML2)
if(LIBXML2_FOUND)
list(APPEND PDAL_UTILITIES ${PCINFO})
add_executable(${PCINFO} pcinfo.cpp ${COMMON_APP_SOURCES})
target_link_libraries(${PCINFO} ${PDAL_LIB_NAME} ${Boost_LIBRARIES})
endif()
endif()
endif(LIBXML2_FOUND)
endif(PCINFO)

if(PC2PC)
list(APPEND PDAL_UTILITIES ${PC2PC})
add_executable(${PC2PC} pc2pc.cpp ${COMMON_APP_SOURCES})
target_link_libraries(${PC2PC} ${PDAL_LIB_NAME} ${Boost_LIBRARIES})
target_link_libraries(${PC2PC} ${PDAL_LIB_NAME} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})
endif()

if(PCPIPELINE)
list(APPEND PDAL_UTILITIES ${PCPIPELINE})
add_executable(${PCPIPELINE} pcpipeline.cpp ${COMMON_APP_SOURCES})
target_link_libraries(${PCPIPELINE} ${PDAL_LIB_NAME} ${Boost_LIBRARIES})
target_link_libraries(${PCPIPELINE} ${PDAL_LIB_NAME} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})
endif()

if(PCQUERY)
list(APPEND PDAL_UTILITIES ${PCQUERY})
add_executable(${PCQUERY} pcquery.cpp ${COMMON_APP_SOURCES})
target_link_libraries(${PCQUERY} ${PDAL_LIB_NAME} ${Boost_LIBRARIES})
target_link_libraries(${PCQUERY} ${PDAL_LIB_NAME} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})
endif()

if(PCEQUAL)
list(APPEND PDAL_UTILITIES ${PCEQUAL})
add_executable(${PCEQUAL} pcequal.cpp ${COMMON_APP_SOURCES})
target_link_libraries(${PCEQUAL} ${PDAL_LIB_NAME} ${Boost_LIBRARIES})
target_link_libraries(${PCEQUAL} ${PDAL_LIB_NAME} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})
endif()

#------------------------------------------------------------------------------
Expand Down
15 changes: 10 additions & 5 deletions include/pdal/Utils.hpp
Expand Up @@ -152,10 +152,10 @@ class PDAL_DLL Utils
std::vector<unsigned char> retval;
for (std::string::const_iterator it = source.begin(); it < source.end(); it += 2) {
unsigned char v = 0;
if (std::isxdigit(*it))
v = nibbles[std::toupper(*it) - '0'] << 4;
if (it + 1 < source.end() && std::isxdigit(*(it + 1)))
v += nibbles[std::toupper(*(it + 1)) - '0'];
if (::isxdigit(*it))
v = nibbles[::toupper(*it) - '0'] << 4;
if (it + 1 < source.end() && ::isxdigit(*(it + 1)))
v += nibbles[::toupper(*(it + 1)) - '0'];
retval.push_back(v);
}
return retval;
Expand Down Expand Up @@ -216,7 +216,12 @@ class PDAL_DLL Utils
static FILE* portable_popen(const std::string& command, const std::string& mode);
static int portable_pclose(FILE* fp);
static int run_shell_command(const std::string& cmd, std::string& output);


static std::string replaceAll(std::string result,
const std::string& replaceWhat,
const std::string& replaceWithWhat);


private:
template<typename T>
static inline char* as_buffer(T& data)
Expand Down
2 changes: 1 addition & 1 deletion include/pdal/Writer.hpp
Expand Up @@ -78,7 +78,7 @@ class PDAL_DLL Writer : public StageBase
virtual boost::property_tree::ptree toPTree() const;
virtual PointBuffer const* getPointBuffer() const { return m_buffer; }

static const boost::uint32_t s_defaultChunkSize;
static const boost::uint32_t s_defaultChunkSize = 1048576;

protected:
// this is called once before the loop with all the writeBuffer calls
Expand Down
2 changes: 1 addition & 1 deletion include/pdal/pdal_export.hpp
Expand Up @@ -35,7 +35,7 @@
#ifndef EXPORT_HPP_INCLUDED
#define EXPORT_HPP_INCLUDED

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

#ifndef PDAL_DLL
#if defined(PDAL_COMPILER_MSVC) && !defined(PDAL_DISABLE_DLL)
Expand Down
2 changes: 1 addition & 1 deletion include/pdal/pdal_internal.hpp
Expand Up @@ -40,7 +40,7 @@
#include <iostream>

#include <pdal/pdal_export.hpp>
#include <pdal/pdal_defines.h>
#include "pdal_defines.h"
#include <pdal/pdal_types.hpp>
#include <pdal/pdal_error.hpp>

Expand Down
11 changes: 7 additions & 4 deletions src/CMakeLists.txt
Expand Up @@ -503,7 +503,7 @@ set(PDAL_CONFIG_HPP
${PDAL_HEADERS_DIR}/pdal_export.hpp
${PDAL_HEADERS_DIR}/pdal_internal.hpp
${PDAL_HEADERS_DIR}/pdal_config.hpp
${PDAL_HEADERS_DIR}/pdal_defines.h
${PROJECT_BINARY_DIR}/pdal_defines.h
)

set (PDAL_CONFIG_CPP
Expand Down Expand Up @@ -616,14 +616,14 @@ message(STATUS "Using boost lib: ${Boost_LIBRARIES}")
if (WIN32)
if (CMAKE_VERSION VERSION_GREATER 2.8.6)
target_link_libraries(${APPS_CPP_DEPENDENCIES}
LINK_PRIVATE general ${Boost_LIBRARIES})
LINK_PRIVATE general ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})
else()
target_link_libraries(${APPS_CPP_DEPENDENCIES}
${Boost_LIBRARIES})
${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})
endif()
else()
target_link_libraries(${APPS_CPP_DEPENDENCIES}
${Boost_LIBRARIES})
${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY})

endif(WIN32)

Expand Down Expand Up @@ -656,3 +656,6 @@ install(TARGETS ${PDAL_LIB_NAME} ${PDAL_C_LIB_NAME} ${PDAL_CSV_WRITER_NAME}
install(DIRECTORY ${PDAL_HEADERS_DIR}
DESTINATION ${PDAL_INCLUDE_DIR}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")

install(FILES "${PROJECT_BINARY_DIR}/pdal_defines.h"
DESTINATION "${PDAL_INCLUDE_DIR}/pdal")
18 changes: 17 additions & 1 deletion src/Utils.cpp
Expand Up @@ -442,7 +442,7 @@ FILE* Utils::portable_popen(const std::string& command, const std::string& mode)
FILE* fp = 0;

#ifdef PDAL_PLATFORM_WIN32
const std::string dos_command = Support::replaceAll(command, "/", "\\");
const std::string dos_command = Utils::replaceAll(command, "/", "\\");
fp = _popen(dos_command.c_str(), mode.c_str());
#else
fp = popen(command.c_str(), mode.c_str());
Expand Down Expand Up @@ -519,4 +519,20 @@ int Utils::run_shell_command(const std::string& cmd, std::string& output)
return stat;
}

//#ifdef PDAL_COMPILER_MSVC
// http://www.codepedia.com/1/CppStringReplace
std::string Utils::replaceAll(std::string result,
const std::string& replaceWhat,
const std::string& replaceWithWhat)
{
while (1)
{
const int pos = result.find(replaceWhat);
if (pos==-1) break;
result.replace(pos,replaceWhat.size(),replaceWithWhat);
}
return result;
}
//#endif

} // namespace pdal
3 changes: 0 additions & 3 deletions src/Writer.cpp
Expand Up @@ -50,9 +50,6 @@
namespace pdal
{

const boost::uint32_t Writer::s_defaultChunkSize = 1048576; // 2^20


Writer::Writer(Stage& prevStage, const Options& options)
: StageBase(StageBase::makeVector(prevStage), options)
, m_chunkSize(options.getValueOrDefault("chunk_size", s_defaultChunkSize))
Expand Down
2 changes: 1 addition & 1 deletion src/pdal_config.cpp
Expand Up @@ -44,7 +44,7 @@
#include <pdal/pdal_config.hpp>

#include <sstream>
#include <pdal/pdal_defines.h>
#include "pdal_defines.h"

#ifdef PDAL_HAVE_LIBGEOTIFF
#include <geotiff.h>
Expand Down
7 changes: 6 additions & 1 deletion test/unit/CMakeLists.txt
Expand Up @@ -13,7 +13,6 @@ endif()

SET(PDAL_UNITTEST_TEST_SRC
apps/pc2pcTest.cpp
apps/pcinfoTest.cpp
apps/pcpipelineTest.cpp
BoundsTest.cpp
drivers/bpf/BPFTest.cpp
Expand Down Expand Up @@ -64,6 +63,12 @@ SET(PDAL_UNITTEST_TEST_SRC
${PDAL_UNITTEST_XMLSCHEMA_TEST}
)

if(LIBXML2_FOUND)
list(APPEND ${PDAL_UNITTEST_TEST_SRC}
apps/pcinfoTest.cpp
)
endif(LIBXML2_FOUND)

set(PDAL_PLANG_TEST_SRC
plang/PLangTest.cpp
plang/PredicateFilterTest.cpp
Expand Down
3 changes: 2 additions & 1 deletion test/unit/FileUtilsTest.cpp
Expand Up @@ -35,6 +35,7 @@
#include <boost/test/unit_test.hpp>

#include <pdal/FileUtils.hpp>
#include <pdal/Utils.hpp>
#include "Support.hpp"

using namespace pdal;
Expand Down Expand Up @@ -114,7 +115,7 @@ static const std::string drive = "";

static std::string normalize(const std::string p)
{
return Support::replaceAll(p, "\\", "/");
return Utils::replaceAll(p, "\\", "/");
}

static void compare_paths(const std::string a, const std::string b)
Expand Down
17 changes: 0 additions & 17 deletions test/unit/Support.cpp
Expand Up @@ -450,20 +450,3 @@ void Support::compareBounds(const pdal::Bounds<double>& p, const pdal::Bounds<do
BOOST_CHECK_CLOSE(p.getMaximum(2), q.getMaximum(2), 1);
}


//#ifdef PDAL_COMPILER_MSVC
// http://www.codepedia.com/1/CppStringReplace
std::string Support::replaceAll(std::string result,
const std::string& replaceWhat,
const std::string& replaceWithWhat)
{
while (1)
{
const int pos = result.find(replaceWhat);
if (pos==-1) break;
result.replace(pos,replaceWhat.size(),replaceWithWhat);
}
return result;
}
//#endif

4 changes: 0 additions & 4 deletions test/unit/Support.hpp
Expand Up @@ -123,10 +123,6 @@ class Support
//
// note: under windows, all "/" characrters in cmd will be converted to "\\" for you
// static int run_command(const std::string& cmd, std::string& output);

static std::string replaceAll(std::string result,
const std::string& replaceWhat,
const std::string& replaceWithWhat);
};


Expand Down

0 comments on commit a6bd2ef

Please sign in to comment.