Skip to content

Commit

Permalink
Merge pull request #4366 from rouault/cpp_17
Browse files Browse the repository at this point in the history
Build: Update to C++17 version
  • Loading branch information
rouault authored Jan 9, 2025
2 parents 0dd04bd + cdd7809 commit 081d12a
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 358 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang_static_analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions:
jobs:

clang_static_analyzer:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ jobs:
cd %PROJ_BUILD%
set PROJ_DIR=%GITHUB_WORKSPACE%\proj_dir
:: Not directly linked to BUILD_SHARED_LIBS, but a way to test different C++ standard versions
if "${{ env.BUILD_SHARED_LIBS }}"=="ON" (set EXTRA_CXX_FLAGS="/std:c++20")
if "${{ env.BUILD_SHARED_LIBS }}"=="ON" (set CMAKE_CXX_STANDARD="-DCMAKE_CXX_STANDARD=20")
if "${{ env.BUILD_TYPE }}"=="Release" (set CMAKE_UNITY_BUILD_OPT="-DCMAKE_UNITY_BUILD=ON")
cmake -D CMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" ^
-D BUILD_SHARED_LIBS="${{ env.BUILD_SHARED_LIBS }}" ^
-D CMAKE_C_FLAGS="/WX" ^
-D CMAKE_CXX_FLAGS="/WX %EXTRA_CXX_FLAGS%" ^
-D CMAKE_CXX_FLAGS="/WX" ^
%CMAKE_CXX_STANDARD% ^
-D CMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake ^
-D CMAKE_INSTALL_PREFIX="%PROJ_DIR%" ^
-D PROJ_DB_CACHE_DIR=%PROJ_DB_CACHE_DIR% ^
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ cmake_policy(SET CMP0054 NEW)

# Set C++ version
# Make CMAKE_CXX_STANDARD available as cache option overridable by user
set(CMAKE_CXX_STANDARD 11
CACHE STRING "C++ standard version to use (default is 11)")
set(CMAKE_CXX_STANDARD 17
CACHE STRING "C++ standard version to use (default is 17)")
message(STATUS "Requiring C++${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Build requirements
++++++++++++++++++

- C99 compiler
- C++11 compiler
- C++17 compiler
- CMake >= 3.16
- SQLite3 >= 3.11: headers and library for target architecture, and sqlite3 executable for build architecture
- libtiff >= 4.0 (optional but recommended)
Expand All @@ -160,7 +160,7 @@ Test requirements

These are only required if testing is built (see :option:`BUILD_TESTING`, default ON)

- GoogleTest (GTest) >= 1.8.1; if not found and :option:`TESTING_USE_NETWORK` is ON, then version 1.12.1 is fetched from GitHub and locally installed
- GoogleTest (GTest) >= 1.8.1; if not found and :option:`TESTING_USE_NETWORK` is ON, then version 1.15.2 is fetched from GitHub and locally installed
- Python >= 3.7
- `importlib_metadata <https://pypi.org/project/importlib-metadata/>`_ only needed for Python 3.7
- One of either `PyYAML <https://pypi.org/project/PyYAML/>`_ or `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_
Expand Down
19 changes: 12 additions & 7 deletions src/iso19111/coordinates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,18 @@ CoordinateMetadataNNPtr
CoordinateMetadata::promoteTo3D(const std::string &newName,
const io::DatabaseContextPtr &dbContext) const {
auto crs = d->crs_->promoteTo3D(newName, dbContext);
auto coordinateMetadata(
d->coordinateEpoch_.has_value()
? CoordinateMetadata::nn_make_shared<CoordinateMetadata>(
crs, coordinateEpochAsDecimalYear())
: CoordinateMetadata::nn_make_shared<CoordinateMetadata>(crs));
coordinateMetadata->assignSelf(coordinateMetadata);
return coordinateMetadata;
if (d->coordinateEpoch_.has_value()) {
auto coordinateMetadata(
CoordinateMetadata::nn_make_shared<CoordinateMetadata>(
crs, coordinateEpochAsDecimalYear()));
coordinateMetadata->assignSelf(coordinateMetadata);
return coordinateMetadata;
} else {
auto coordinateMetadata(
CoordinateMetadata::nn_make_shared<CoordinateMetadata>(crs));
coordinateMetadata->assignSelf(coordinateMetadata);
return coordinateMetadata;
}
}

// ---------------------------------------------------------------------------
Expand Down
18 changes: 11 additions & 7 deletions src/iso19111/datum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,13 +818,17 @@ EllipsoidNNPtr Ellipsoid::createSphere(const util::PropertyMap &properties,
EllipsoidNNPtr Ellipsoid::createFlattenedSphere(
const util::PropertyMap &properties, const common::Length &semiMajorAxisIn,
const common::Scale &invFlattening, const std::string &celestialBody) {
auto ellipsoid(invFlattening.value() == 0
? Ellipsoid::nn_make_shared<Ellipsoid>(semiMajorAxisIn,
celestialBody)
: Ellipsoid::nn_make_shared<Ellipsoid>(
semiMajorAxisIn, invFlattening, celestialBody));
ellipsoid->setProperties(properties);
return ellipsoid;
if (invFlattening.value() == 0) {
auto ellipsoid(Ellipsoid::nn_make_shared<Ellipsoid>(semiMajorAxisIn,
celestialBody));
ellipsoid->setProperties(properties);
return ellipsoid;
} else {
auto ellipsoid(Ellipsoid::nn_make_shared<Ellipsoid>(
semiMajorAxisIn, invFlattening, celestialBody));
ellipsoid->setProperties(properties);
return ellipsoid;
}
}

// ---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/iso19111/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3114,9 +3114,9 @@ std::string
DatabaseContext::suggestsCodeFor(const common::IdentifiedObjectNNPtr &object,
const std::string &authName,
bool numericCode) {
const char *tableName = "";
const char *tableName = "prime_meridian";
if (dynamic_cast<const datum::PrimeMeridian *>(object.get())) {
tableName = "prime_meridian";
// tableName = "prime_meridian";
} else if (dynamic_cast<const datum::Ellipsoid *>(object.get())) {
tableName = "ellipsoid";
} else if (dynamic_cast<const datum::GeodeticReferenceFrame *>(
Expand Down
4 changes: 2 additions & 2 deletions src/iso19111/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2832,9 +2832,9 @@ WKTParser::Private::buildCS(const WKTNodeNNPtr &node, /* maybe null */
children[1]->GP()->value()));
}
} else {
const char *csTypeCStr = "";
const char *csTypeCStr = CartesianCS::WKT2_TYPE;
if (ci_equal(parentNodeName, WKTConstants::GEOCCS)) {
csTypeCStr = CartesianCS::WKT2_TYPE;
// csTypeCStr = CartesianCS::WKT2_TYPE;
isGeocentric = true;
if (axisCount == 0) {
auto unit =
Expand Down
Loading

0 comments on commit 081d12a

Please sign in to comment.