Skip to content

Commit

Permalink
maybe it builds
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Jun 17, 2024
1 parent f4d019f commit 41a1e0e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 40 deletions.
15 changes: 1 addition & 14 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,6 @@ fi
fi #SONAME
fi #AUTOBREW

# Define system endianness (compile-time endianness using system/compiler
# defines isn't detected on Solaris)
# based on endian detection from the feather package by @hadley
R_ENDIAN=`${R_HOME}/bin/Rscript -e 'cat(.Platform$endian)'`
# Trim off any warning messages that Rscript appends in front of the platform endianness
R_ENDIAN=`expr "$R_ENDIAN" : '.*\(little\)$'`
SYS_ENDIAN=""
if [ "$R_ENDIAN" = "little" ]; then
PKG_CFLAGS="$PKG_CFLAGS -DIS_LITTLE_ENDIAN"
else
PKG_CFLAGS="$PKG_CFLAGS -DIS_BIG_ENDIAN"
fi

# Check pkg-config for abseil-cpp, but fall back to a cmake build.
# This should possibly be updated to check that the pkg-config detected
# version will actually work; however, the version of abseil that included
Expand Down Expand Up @@ -147,7 +134,7 @@ else
R_S2_ABSL_HOME="`pwd`/tools/dist"
fi

ABSL_LIBS="-labsl_cord -labsl_cordz_info -labsl_cord_internal -labsl_cordz_functions -labsl_cordz_handle -labsl_crc_cord_state -labsl_crc32c -labsl_crc_internal -labsl_crc_cpu_detect -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_synchronization -labsl_graphcycles_internal -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -labsl_malloc_internal -labsl_time -labsl_civil_time -labsl_time_zone -labsl_hash -labsl_city -labsl_bad_optional_access -labsl_bad_variant_access -labsl_low_level_hash -labsl_str_format_internal -labsl_strings -labsl_string_view -labsl_strings_internal -labsl_int128 -labsl_throw_delegate -labsl_demangle_internal -labsl_base -labsl_spinlock_wait -labsl_debugging_internal -labsl_raw_logging_internal -labsl_log_severity"
ABSL_LIBS="-labsl_flags_internal -labsl_flags_marshalling -labsl_flags_reflection -labsl_flags_private_handle_accessor -labsl_flags_commandlineflag -labsl_flags_commandlineflag_internal -labsl_flags_config -labsl_flags_program_name -labsl_cord -labsl_cordz_info -labsl_cord_internal -labsl_cordz_functions -labsl_cordz_handle -labsl_crc_cord_state -labsl_crc32c -labsl_crc_internal -labsl_crc_cpu_detect -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_log_internal_check_op -labsl_log_internal_conditions -labsl_log_internal_message -labsl_examine_stack -labsl_log_internal_format -labsl_log_internal_proto -labsl_log_internal_nullguard -labsl_log_internal_log_sink_set -labsl_log_internal_globals -labsl_log_globals -labsl_hash -labsl_city -labsl_bad_variant_access -labsl_low_level_hash -labsl_vlog_config_internal -labsl_log_internal_fnmatch -labsl_bad_optional_access -labsl_log_sink -labsl_log_entry -labsl_synchronization -labsl_graphcycles_internal -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -labsl_malloc_internal -labsl_strerror -labsl_time -labsl_civil_time -labsl_time_zone -labsl_str_format_internal -labsl_strings -labsl_strings_internal -labsl_string_view -labsl_int128 -labsl_throw_delegate -labsl_demangle_internal -labsl_base -labsl_spinlock_wait -labsl_debugging_internal -labsl_raw_logging_internal -labsl_log_severity"
PKG_CFLAGS="-I${R_S2_ABSL_HOME}/include ${PKG_CFLAGS}"
PKG_LIBS="-L${R_S2_ABSL_HOME}/lib ${ABSL_LIBS} ${PKG_LIBS}"
fi
Expand Down
25 changes: 10 additions & 15 deletions src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@ PKG_CXXFLAGS = @cflags@ -pthread

CXX_STD = CXX17

S2_OBJECTS = s2geography/accessors.o \
s2geography/accessors-geog.o \
s2geography/linear-referencing.o \
s2geography/distance.o \
s2geography/build.o \
s2geography/coverings.o \
s2geography/geography.o \
s2geography/predicates.o \
s2/base/stringprintf.o \
s2/base/strtoint.o \
s2/encoded_s2cell_id_vector.o \
S2_OBJECTS = s2/encoded_s2cell_id_vector.o \
s2/encoded_s2point_vector.o \
s2/encoded_s2shape_index.o \
s2/encoded_string_vector.o \
Expand All @@ -38,7 +28,6 @@ S2_OBJECTS = s2geography/accessors.o \
s2/s2builderutil_s2polyline_layer.o \
s2/s2builderutil_s2polyline_vector_layer.o \
s2/s2builderutil_snap_functions.o \
s2/s2builderutil_testing.o \
s2/s2cap.o \
s2/s2cell_id.o \
s2/s2cell_index.o \
Expand Down Expand Up @@ -103,13 +92,11 @@ S2_OBJECTS = s2geography/accessors.o \
s2/s2shapeutil_conversion.o \
s2/s2shapeutil_edge_iterator.o \
s2/s2shapeutil_get_reference_point.o \
s2/s2shapeutil_testing.o \
s2/s2shapeutil_visit_crossing_edge_pairs.o \
s2/s2testing.o \
s2/s2text_format.o \
s2/s2wedge_relations.o \
s2/s2winding_operation.o \
s2/thread_testing.o \
s2/util/bits/bit-interleave.o \
s2/util/coding/coder.o \
s2/util/coding/varint.o \
Expand All @@ -132,7 +119,15 @@ OBJECTS = cpp-compat.o \
s2-geography.o \
s2-lnglat.o \
s2-matrix.o \
wk-impl.o
wk-impl.o \
s2geography/accessors-geog.o \
s2geography/accessors.o \
s2geography/build.o \
s2geography/coverings.o \
s2geography/distance.o \
s2geography/geography.o \
s2geography/linear-referencing.o \
s2geography/predicates.o

$(SHLIB): $(STATLIB)

Expand Down
2 changes: 1 addition & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Configure Abseil. If it wasn't available via pkg-config, it was built
# by cmake in configure.win.

ABSL_LIBS = -labsl_cord -labsl_cordz_info -labsl_cord_internal -labsl_cordz_functions -labsl_cordz_handle -labsl_crc_cord_state -labsl_crc32c -labsl_crc_internal -labsl_crc_cpu_detect -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_synchronization -labsl_graphcycles_internal -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -labsl_malloc_internal -labsl_time -labsl_civil_time -labsl_time_zone -labsl_hash -labsl_city -labsl_bad_optional_access -labsl_bad_variant_access -labsl_low_level_hash -labsl_str_format_internal -labsl_strings -labsl_string_view -labsl_strings_internal -labsl_int128 -labsl_throw_delegate -labsl_demangle_internal -labsl_base -labsl_spinlock_wait -labsl_debugging_internal -labsl_raw_logging_internal -labsl_log_severity
ABSL_LIBS = -labsl_flags_internal -labsl_flags_marshalling -labsl_flags_reflection -labsl_flags_private_handle_accessor -labsl_flags_commandlineflag -labsl_flags_commandlineflag_internal -labsl_flags_config -labsl_flags_program_name -labsl_cord -labsl_cordz_info -labsl_cord_internal -labsl_cordz_functions -labsl_cordz_handle -labsl_crc_cord_state -labsl_crc32c -labsl_crc_internal -labsl_crc_cpu_detect -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_log_internal_check_op -labsl_log_internal_conditions -labsl_log_internal_message -labsl_examine_stack -labsl_log_internal_format -labsl_log_internal_proto -labsl_log_internal_nullguard -labsl_log_internal_log_sink_set -labsl_log_internal_globals -labsl_log_globals -labsl_hash -labsl_city -labsl_bad_variant_access -labsl_low_level_hash -labsl_vlog_config_internal -labsl_log_internal_fnmatch -labsl_bad_optional_access -labsl_log_sink -labsl_log_entry -labsl_synchronization -labsl_graphcycles_internal -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -labsl_malloc_internal -labsl_strerror -labsl_time -labsl_civil_time -labsl_time_zone -labsl_str_format_internal -labsl_strings -labsl_strings_internal -labsl_string_view -labsl_int128 -labsl_throw_delegate -labsl_demangle_internal -labsl_base -labsl_spinlock_wait -labsl_debugging_internal -labsl_raw_logging_internal -labsl_log_severity

ifeq (,$(shell pkg-config absl_base --libs 2>/dev/null))
ABSL_CFLAGS = -I../tools/dist/include
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ void cpp_s2_init() {
// R instead of throw an exception if this value is set to true.
// When possible, we also disable debug checks on a per-operation basis
// if there is another way to do so (e.g., constructing S2Loop and S2Polygon objects).
FLAGS_s2debug = false; // # nocov
absl::SetFlag(&FLAGS_s2debug, false);
}
2 changes: 1 addition & 1 deletion src/s2-predicates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ LogicalVector cpp_s2_prepared_dwithin(List geog1, List geog2, NumericVector dist
iterator.Init(&feature1->Index().ShapeIndex());
bool may_intersect_buffer = false;
for (const S2CellId& query_cell: covering) {
if (iterator.Locate(query_cell) != S2ShapeIndex::CellRelation::DISJOINT) {
if (iterator.Locate(query_cell) != S2CellRelation::DISJOINT) {
may_intersect_buffer = true;
break;
}
Expand Down
6 changes: 3 additions & 3 deletions src/s2geography/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ std::unique_ptr<PolygonGeography> s2_unary_union(const PolygonGeography& geog,
// the outside followed by holes such that the below strategy should work
// (since we are just iterating along the original loop structure)
if ((geog.Polygon()->loop(i)->depth() % 2) == 0) {
polygon_result->InitToUnion(accumulated_polygon.get(), loops[i].get());

polygon_result->InitToUnion(*accumulated_polygon, *loops[i]);
} else {
polygon_result->InitToDifference(accumulated_polygon.get(),
loops[i].get());
polygon_result->InitToDifference(*accumulated_polygon, *loops[i]);
}

accumulated_polygon.swap(polygon_result);
Expand Down
8 changes: 4 additions & 4 deletions src/s2geography/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ class GeographyIndex {
}

void Query(const S2CellId& cell_id, std::unordered_set<int>* indices) {
S2ShapeIndex::CellRelation relation = iterator_.Locate(cell_id);
S2CellRelation relation = iterator_.Locate(cell_id);

if (relation == S2ShapeIndex::CellRelation::INDEXED) {
if (relation == S2CellRelation::INDEXED) {
// We're in luck! these indexes have this cell in common
// add all the shapes it contains as possible intersectors
const S2ShapeIndexCell& index_cell = iterator_.cell();
for (int k = 0; k < index_cell.num_clipped(); k++) {
int shape_id = index_cell.clipped(k).shape_id();
indices->insert(index_->value(shape_id));
}
} else if (relation == S2ShapeIndex::CellRelation::SUBDIVIDED) {
} else if (relation == S2CellRelation::SUBDIVIDED) {
// Promising! the index has a child cell of iterator_.id()
// (at which iterator_ is now positioned). Keep iterating until the
// iterator is done OR we're no longer at a child cell of
Expand All @@ -76,7 +76,7 @@ class GeographyIndex {
}
}

// else: relation == S2ShapeIndex::CellRelation::DISJOINT (do nothing)
// else: relation == S2CellRelation::DISJOINT (do nothing)
}

private:
Expand Down
2 changes: 1 addition & 1 deletion tools/pkgconfig/absl_s2.pc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Name: absl_s2
Description: Abseil requirements
URL: https://github.com/r-spatial/s2
Version: 0.0
Requires: absl_base >= 20230802.0, absl_btree >= 20230802.0, absl_config >= 20230802.0, absl_core_headers >= 20230802.0, absl_dynamic_annotations >= 20230802.0, absl_endian >= 20230802.0, absl_fixed_array >= 20230802.0, absl_flat_hash_map >= 20230802.0, absl_flat_hash_set >= 20230802.0, absl_hash >= 20230802.0, absl_inlined_vector >= 20230802.0, absl_int128 >= 20230802.0, absl_log_severity >= 20230802.0, absl_memory >= 20230802.0, absl_span >= 20230802.0, absl_str_format >= 20230802.0, absl_strings >= 20230802.0, absl_type_traits >= 20230802.0, absl_utility >= 20230802.0, absl_demangle_internal >= 20230802.0, absl_debugging_internal >= 20230802.0
Requires: absl_base >= 20230802.0, absl_btree >= 20230802.0, absl_config >= 20230802.0, absl_core_headers >= 20230802.0, absl_dynamic_annotations >= 20230802.0, absl_endian >= 20230802.0, absl_fixed_array >= 20230802.0, absl_flags >= 20230802.0, absl_flat_hash_map >= 20230802.0, absl_flat_hash_set >= 20230802.0, absl_hash >= 20230802.0, absl_inlined_vector >= 20230802.0, absl_int128 >= 20230802.0, absl_log >= 20230802.0, absl_log_internal_check_impl >= 20230802.0, absl_log_severity >= 20230802.0, absl_memory >= 20230802.0, absl_span >= 20230802.0, absl_str_format >= 20230802.0, absl_strings >= 20230802.0, absl_type_traits >= 20230802.0, absl_utility >= 20230802.0, absl_demangle_internal >= 20230802.0, absl_debugging_internal >= 20230802.0
Libs:
Cflags:

0 comments on commit 41a1e0e

Please sign in to comment.