From c6b31e497f39c1098538ae5e889e03559f3e07c6 Mon Sep 17 00:00:00 2001 From: program-- Date: Wed, 10 May 2023 11:47:56 -0700 Subject: [PATCH] disable optimizations for geometry.cpp if compiler is not intel --- src/geopackage/CMakeLists.txt | 12 ++++++++++++ src/geopackage/geometry.cpp | 2 +- src/geopackage/sqlite/iterator.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/geopackage/CMakeLists.txt b/src/geopackage/CMakeLists.txt index c06ddba4d4..2aead82963 100644 --- a/src/geopackage/CMakeLists.txt +++ b/src/geopackage/CMakeLists.txt @@ -1,4 +1,16 @@ cmake_minimum_required(VERSION 3.10) + + +string(COMPARE EQUAL "${CMAKE_CXX_COMPILER_ID}" "IntelLLVM" _cmp) +if (NOT _cmp) + message(WARNING "[NGen::geopackage] geometry.cpp cannot be optimized with " + "${CMAKE_CXX_COMPILER_ID} due to a suspected compiler/boost issue. " + "Use IntelLLVM if optimization for this source file is required.") + # !! Required due to optimizer issue with either clang or + # !! boost::geometry::srs::transformation + set_source_files_properties(geometry.cpp PROPERTIES COMPILE_FLAGS -O0) +endif() + add_library(geopackage STATIC geometry.cpp properties.cpp feature.cpp diff --git a/src/geopackage/geometry.cpp b/src/geopackage/geometry.cpp index 7949242355..af89b51b07 100644 --- a/src/geopackage/geometry.cpp +++ b/src/geopackage/geometry.cpp @@ -27,7 +27,7 @@ geojson::geometry geopackage::build_geometry( utils::copy_from(geometry_blob, index, srs_id, endian); const auto epsg = wkb::get_prj(srs_id); - const auto prj = bg::srs::transformation<>(epsg, wkb::get_prj(4326)); + const bg::srs::transformation<> prj{epsg, wkb::get_prj(4326)}; wkb::wgs84 pvisitor{srs_id, prj}; if (indicator > 0 & indicator < 5) { diff --git a/src/geopackage/sqlite/iterator.cpp b/src/geopackage/sqlite/iterator.cpp index cb4d1dc309..704bb7a476 100644 --- a/src/geopackage/sqlite/iterator.cpp +++ b/src/geopackage/sqlite/iterator.cpp @@ -94,7 +94,7 @@ int sqlite_iter::num_columns() const noexcept int sqlite_iter::column_index(const std::string& name) const noexcept { - const ptrdiff_t pos = + const size_t pos = std::distance(this->column_names.begin(), std::find(this->column_names.begin(), this->column_names.end(), name)); return pos >= this->column_names.size() ? -1 : pos;