Skip to content

Commit 53fa073

Browse files
authored
de-vendor gtest and bump to 1.15.2 (#13)
* de-vendor gtest and bump to 1.15.2 * support building against 2.8 too * put back StageWrapper usage – require PDAL 2.9.2 for passing test * bump ci * remove carriage returns when comparing strings for tests * typo fix * use replaceAll from PDAL * try different replacement * explicitly remove \r's
1 parent b9a73a3 commit 53fa073

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+39
-26181
lines changed

CMakeLists.txt

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,41 @@ PDAL_PYTHON_ADD_PLUGIN(python_filter filter python
203203

204204

205205
if (WITH_TESTS)
206-
set(GOOGLETEST_VERSION 1.12.1)
207-
208206
enable_testing()
207+
208+
message(STATUS "Fetching GTest from GitHub ...")
209+
210+
# Add Google Test
211+
#
212+
# See https://github.com/google/googletest/blob/main/googletest/README.md
213+
214+
if(POLICY CMP0135)
215+
cmake_policy(SET CMP0135 NEW) # for DOWNLOAD_EXTRACT_TIMESTAMP option
216+
endif()
217+
218+
set(GTEST_VERSION "1.15.2")
219+
220+
include(FetchContent)
221+
FetchContent_Declare(
222+
googletest
223+
URL https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.zip
224+
EXCLUDE_FROM_ALL # ignored before CMake 3.28
225+
)
226+
227+
# For Windows: Prevent overriding the parent project's compiler/linker settings
209228
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
210-
add_subdirectory(src/pdal/test/gtest)
211-
enable_testing()
212-
include_directories(pdal/test/gtest/include .. ${CMAKE_CURRENT_BINARY_DIR})
229+
230+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.28.0")
231+
FetchContent_MakeAvailable(googletest)
232+
else()
233+
# Pre CMake 3.28 workaround to prevent installing files
234+
FetchContent_GetProperties(googletest)
235+
if(NOT googletest_POPULATED)
236+
FetchContent_Populate(googletest)
237+
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
238+
endif()
239+
endif()
240+
213241
PDAL_PYTHON_ADD_TEST(pdal_io_numpy_test
214242
FILES
215243
./src/pdal/test/NumpyReaderTest.cpp

src/pdal/plang/Environment.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454
#define NPY_API_SYMBOL_ATTRIBUTE
5555
#define NPY_NO_DEPRECATED_API NPY_1_22_API_VERSION
5656

57-
// PDAL renamed this but it is not aliased on windows for PDAL 2.9
58-
# define PDAL_DLL PDAL_EXPORT
59-
6057
namespace pdal
6158
{
6259
namespace plang

src/pdal/plang/Invocation.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
#include <pdal/Dimension.hpp>
4343
#include <pdal/PointView.hpp>
4444

45-
// PDAL renamed this but it is not aliased on windows for PDAL 2.9
46-
# define PDAL_DLL PDAL_EXPORT
47-
4845
namespace pdal
4946
{
5047
namespace plang

src/pdal/plang/Script.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838

3939
#include <pdal/Options.hpp>
4040

41+
#ifndef PDAL_DLL
4142
// PDAL renamed this but it is not aliased on windows for PDAL 2.9
4243
# define PDAL_DLL PDAL_EXPORT
44+
#endif
4345

4446
namespace pdal
4547
{

src/pdal/test/Support.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ uint32_t Support::diff_text_files(std::istream& str1, std::istream& str2,
136136
std::getline(str1, buf1);
137137
std::getline(str2, buf2);
138138

139+
// Remove \r's
140+
buf1.erase( std::remove(buf1.begin(), buf1.end(), '\r'), buf1.end() );
141+
buf2.erase( std::remove(buf2.begin(), buf2.end(), '\r'), buf2.end() );
142+
139143
if (currLine == ignoreLine1)
140144
{
141145
++currLine;

0 commit comments

Comments
 (0)