Skip to content

Commit

Permalink
Update dependencies and upgrade to c++20
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed Aug 28, 2024
1 parent f878996 commit 523e805
Show file tree
Hide file tree
Showing 22 changed files with 96 additions and 108 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(CMAKE_INSTALL_DATAROOTDIR "data")
include(GNUInstallDirs)

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.3)

Expand Down
2 changes: 1 addition & 1 deletion deps/vcpkg
Submodule vcpkg updated 79 files
+4 −1 .gitattributes
+24 −24 .github/workflows/bootstrap-linux.yml
+28 −0 ports/asio/CMakeLists.txt
+0 −3 ports/asio/CONTROL
+9 −0 ports/asio/asio-config.cmake
+22 −18 ports/asio/portfile.cmake
+38 −0 ports/asio/vcpkg.json
+0 −15 ports/cpr/001-cpr-config.patch
+13 −0 ports/cpr/disable_werror.patch
+12 −8 ports/cpr/portfile.cmake
+2 −1 ports/cpr/vcpkg.json
+0 −15 ports/curl/0002_fix_uwp.patch
+11 −11 ports/curl/0005_remove_imp_suffix.patch
+0 −14 ports/curl/0012-fix-dependency-idn2.patch
+12 −12 ports/curl/0020-fix-pc-file.patch
+0 −13 ports/curl/0021-normaliz.patch
+12 −9 ports/curl/0022-deduplicate-libs.patch
+12 −0 ports/curl/cmake-config.patch
+26 −11 ports/curl/cmake-project-include.cmake
+147 −0 ports/curl/dependencies.patch
+16 −17 ports/curl/export-components.patch
+20 −0 ports/curl/gnutls.patch
+0 −14 ports/curl/mbedtls-ws2_32.patch
+49 −39 ports/curl/portfile.cmake
+4 −0 ports/curl/usage
+43 −19 ports/curl/vcpkg-cmake-wrapper.cmake
+72 −9 ports/curl/vcpkg.json
+0 −3 ports/geos/CONTROL
+0 −12 ports/geos/charset.patch
+76 −0 ports/geos/fix-exported-config.patch
+0 −25 ports/geos/fix-exported-includes.patch
+53 −42 ports/geos/portfile.cmake
+10 −0 ports/geos/usage
+17 −0 ports/geos/vcpkg.json
+14 −10 ports/gtest/fix-main-lib-path.patch
+1 −1 ports/gtest/portfile.cmake
+2 −2 ports/gtest/vcpkg.json
+10 −8 ports/libpq/portfile.cmake
+1 −1 ports/libpq/unix/fix-configure.patch
+1 −2 ports/libpq/vcpkg.json
+42 −0 ports/libpqxx/fix_build_cmake_3.30.patch
+14 −14 ports/libpqxx/fix_build_with_vs2017.patch
+4 −3 ports/libpqxx/portfile.cmake
+2 −1 ports/libpqxx/vcpkg.json
+54 −53 ports/libspatialite/portfile.cmake
+12 −0 ports/libxlsxwriter/pdb.patch
+1 −0 ports/libxlsxwriter/portfile.cmake
+14 −0 ports/maplibregl-native/cmake-changes.patch
+52 −0 ports/openssl/cmake-config.patch
+13 −0 ports/openssl/command-line-length.patch
+61 −20 ports/openssl/portfile.cmake
+22 −0 ports/openssl/script-prefix.patch
+0 −281 ports/openssl/unix/CMakeLists.txt
+20 −0 ports/openssl/unix/android-cc.patch
+31 −0 ports/openssl/unix/configure
+16 −0 ports/openssl/unix/move-openssldir.patch
+22 −0 ports/openssl/unix/no-empty-dirs.patch
+12 −0 ports/openssl/unix/no-static-libs-for-shared.patch
+140 −17 ports/openssl/unix/portfile.cmake
+7 −7 ports/openssl/unix/remove-deps.cmake
+5 −4 ports/openssl/usage
+0 −16 ports/openssl/uwp/make-openssl.bat
+0 −155 ports/openssl/uwp/portfile.cmake
+3 −3 ports/openssl/vcpkg-cmake-wrapper.cmake.in
+19 −4 ports/openssl/vcpkg.json
+0 −22 ports/openssl/windows/flags.patch
+13 −0 ports/openssl/windows/install-layout.patch
+46 −0 ports/openssl/windows/install-pdbs.patch
+118 −180 ports/openssl/windows/portfile.cmake
+0 −38 ports/shapelib/FindShapelib.cmake
+18 −16 ports/shapelib/portfile.cmake
+5 −2 ports/shapelib/vcpkg.json
+24 −24 ports/type-safe/portfile.cmake
+10 −10 ports/type-safe/vcpkg.json
+3 −2 ports/vc/portfile.cmake
+18 −18 ports/vc/vcpkg.json
+17 −3 scripts/buildtools/vcpkg.py
+8 −8 triplets/x64-linux-musl.cmake
+4 −0 triplets/x64-linux-static.cmake
6 changes: 3 additions & 3 deletions logic/chimereoutputbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ static std::string_view grid_resolution_string(ModelGrid grid)
static fs::path create_chimere_output_name(ModelGrid grid, const Pollutant& pol, date::year year, std::string_view suffix)
{
// output_Chimere_resolutie_polluent_zichtjaar_suffix
return fs::u8path(fmt::format("output_Chimere_{}_{}_{}{}.dat", grid_resolution_string(grid), pol.code(), static_cast<int32_t>(year), suffix));
return file::u8path(fmt::format("output_Chimere_{}_{}_{}{}.dat", grid_resolution_string(grid), pol.code(), static_cast<int32_t>(year), suffix));
}

static fs::path create_chimere_point_source_output_name(date::year year, std::string_view suffix)
{
// output_Chimere_pointsources_zichtjaar_suffix_ps
return fs::u8path(fmt::format("output_Chimere_pointsources_{}{}_ps.dat", static_cast<int32_t>(year), suffix));
return file::u8path(fmt::format("output_Chimere_pointsources_{}{}_ps.dat", static_cast<int32_t>(year), suffix));
}

void ChimereOutputBuilder::flush_pollutant(const Pollutant& pol, WriteMode /*mode*/)
Expand Down Expand Up @@ -193,4 +193,4 @@ void ChimereOutputBuilder::flush(WriteMode /*mode*/)
_pointSources.clear();
}

}
}
2 changes: 1 addition & 1 deletion logic/configurationparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ static fs::path read_optional_path(const NamedSection& ns, std::string_view name
}

if (auto pathValue = nodeValue.value<std::string_view>(); pathValue.has_value()) {
auto result = fs::u8path(*pathValue);
auto result = file::u8path(*pathValue);
if ((!result.empty()) && result.is_relative()) {
result = fs::absolute(basePath / result);
}
Expand Down
4 changes: 3 additions & 1 deletion logic/configurationutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

namespace emap {

using namespace inf;

inline fs::path spatial_pattern_filename(date::year year, const EmissionIdentifier& emissionId)
{
return fs::u8path(fmt::format("spatial_pattern_{}_{}_{}_{}.tif", static_cast<int>(year), emissionId.country.iso_code(), emissionId.sector.gnfr_name(), inf::str::lowercase(emissionId.pollutant.code())));
return file::u8path(fmt::format("spatial_pattern_{}_{}_{}_{}.tif", static_cast<int>(year), emissionId.country.iso_code(), emissionId.sector.gnfr_name(), inf::str::lowercase(emissionId.pollutant.code())));
}

}
2 changes: 1 addition & 1 deletion logic/emissioninventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ static SingleEmissions read_country_pollutant_point_sources(const fs::path& dir,
for (auto iter : fs::directory_iterator(dir)) {
if (iter.is_regular_file() && iter.path().extension() == ".csv") {
const auto& path = iter.path();
if (str::starts_with(path.filename().u8string(), match)) {
if (str::starts_with(file::u8string(path.filename()), match)) {
pathsToUse.insert(iter.path());
}
}
Expand Down
6 changes: 3 additions & 3 deletions logic/emissionscollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ void EmissionsCollector::flush_pollutant_to_disk(WriteMode mode)
_outputBuilder->flush_pollutant(*_pollutant, convert_write_mode(mode));

for (auto& [name, raster] : _collectedEmissions) {
const auto outputPath = _cfg.output_dir_for_rasters() / fs::u8path(fmt::format("{}_{}_{}.tif", _pollutant->code(), name, _grid->name));
const auto outputPath = _cfg.output_dir_for_rasters() / file::u8path(fmt::format("{}_{}_{}.tif", _pollutant->code(), name, _grid->name));
gdx::write_raster(std::move(raster), outputPath);
}

for (auto& [id, raster] : _collectedCountryEmissions) {
const auto outputPath = _cfg.output_dir_for_rasters() / fs::u8path(fmt::format("{}_{}_{}_{}.tif", _pollutant->code(), id.second, id.first, _grid->name));
const auto outputPath = _cfg.output_dir_for_rasters() / file::u8path(fmt::format("{}_{}_{}_{}.tif", _pollutant->code(), id.second, id.first, _grid->name));
gdx::write_raster(std::move(raster), outputPath);
}

Expand All @@ -151,4 +151,4 @@ void EmissionsCollector::final_flush_to_disk(WriteMode mode)
{
_outputBuilder->flush(convert_write_mode(mode));
}
}
}
13 changes: 5 additions & 8 deletions logic/include/emap/country.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,19 @@ struct hash<emap::Country>
};
}

namespace fmt {
template <>
struct formatter<emap::Country>
struct fmt::formatter<emap::Country>
{
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin())
FMT_CONSTEXPR20 auto parse(format_parse_context& ctx) -> format_parse_context::iterator
{
return ctx.begin();
}

template <typename FormatContext>
auto format(const emap::Country& val, FormatContext& ctx) const -> decltype(ctx.out())
auto format(const emap::Country& val, format_context& ctx) const -> format_context::iterator
{
return format_to(ctx.out(), "{}", val.to_string());
return fmt::format_to(ctx.out(), "{}", val.to_string());
}
};
}

namespace std {
// we want to use it with the std::unordered_* containers
Expand All @@ -135,4 +132,4 @@ struct hash<emap::CountryId> : type_safe::hashable<emap::CountryId>
{
};

}
}
2 changes: 1 addition & 1 deletion logic/include/emap/emissioninventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void merge_unique_emissions(EmissionCollection<T>& output, EmissionCollection<T>
if (output.empty()) {
std::swap(output, toMerge);
} else {
output.add_emissions(std::forward<EmissionCollection<T>>(toMerge));
output.add_emissions(std::span(toMerge.begin(), toMerge.end()));
}
}

Expand Down
32 changes: 12 additions & 20 deletions logic/include/emap/emissions.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,55 +289,47 @@ inline EmissionIdentifier convert_emission_id_to_gnfr_level(const EmissionIdenti

}

namespace fmt {
template <>
struct formatter<emap::EmissionIdentifier>
struct fmt::formatter<emap::EmissionIdentifier>
{
template <typename ParseContext>
constexpr auto parse(ParseContext& ctx)
FMT_CONSTEXPR20 auto parse(format_parse_context& ctx) -> format_parse_context::iterator
{
return ctx.begin();
}

template <typename FormatContext>
auto format(const emap::EmissionIdentifier& val, FormatContext& ctx)
auto format(const emap::EmissionIdentifier& val, format_context& ctx) const -> format_context::iterator
{
return format_to(ctx.out(), "{} - {} - {}", val.country, val.sector, val.pollutant);
return fmt::format_to(ctx.out(), "{} - {} - {}", val.country, val.sector, val.pollutant);
}
};

template <>
struct formatter<emap::EmissionType>
struct fmt::formatter<emap::EmissionType>
{
template <typename ParseContext>
constexpr auto parse(ParseContext& ctx)
FMT_CONSTEXPR20 auto parse(format_parse_context& ctx) -> format_parse_context::iterator
{
return ctx.begin();
}

template <typename FormatContext>
auto format(const emap::EmissionType& val, FormatContext& ctx)
auto format(const emap::EmissionType& val, format_context& ctx) const -> format_context::iterator
{
return format_to(ctx.out(), emission_type_name(val));
return fmt::format_to(ctx.out(), "{}", emission_type_name(val));
}
};

template <>
struct formatter<emap::EmissionSector::Type>
struct fmt::formatter<emap::EmissionSector::Type>
{
template <typename ParseContext>
constexpr auto parse(ParseContext& ctx)
FMT_CONSTEXPR20 auto parse(format_parse_context& ctx) -> format_parse_context::iterator
{
return ctx.begin();
}

template <typename FormatContext>
auto format(const emap::EmissionSector::Type& val, FormatContext& ctx)
auto format(const emap::EmissionSector::Type& val, format_context& ctx) const -> format_context::iterator
{
return format_to(ctx.out(), emission_sector_type_name(val));
return fmt::format_to(ctx.out(), "{}", emission_sector_type_name(val));
}
};
}

namespace std {
template <>
Expand Down
11 changes: 4 additions & 7 deletions logic/include/emap/pollutant.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,16 @@ class PollutantInventory

}

namespace fmt {
template <>
struct formatter<emap::Pollutant>
struct fmt::formatter<emap::Pollutant>
{
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin())
FMT_CONSTEXPR20 auto parse(format_parse_context& ctx) -> format_parse_context::iterator
{
return ctx.begin();
}

template <typename FormatContext>
auto format(const emap::Pollutant& val, FormatContext& ctx) const -> decltype(ctx.out())
auto format(const emap::Pollutant& val, format_context& ctx) const -> format_context::iterator
{
return format_to(ctx.out(), "{}", val.code());
return fmt::format_to(ctx.out(), "{}", val.code());
}
};
}
11 changes: 4 additions & 7 deletions logic/include/emap/sector.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,22 +223,19 @@ class EmissionSector

}

namespace fmt {
template <>
struct formatter<emap::EmissionSector>
struct fmt::formatter<emap::EmissionSector>
{
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin())
FMT_CONSTEXPR20 auto parse(format_parse_context& ctx) -> format_parse_context::iterator
{
return ctx.begin();
}

template <typename FormatContext>
auto format(const emap::EmissionSector& val, FormatContext& ctx) const -> decltype(ctx.out())
auto format(const emap::EmissionSector& val, format_context& ctx) const -> format_context::iterator
{
return format_to(ctx.out(), "{}", val.name());
return fmt::format_to(ctx.out(), "{}", val.name());
}
};
}

namespace std {
// we want to use it with the std::unordered_* containers
Expand Down
17 changes: 10 additions & 7 deletions logic/modelpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#include <fmt/format.h>

namespace emap {

using namespace inf;

ModelPaths::ModelPaths(std::string_view scenario, const fs::path& dataRoot, const fs::path& outputRoot)
: _scenario(scenario)
, _dataRoot(dataRoot)
Expand Down Expand Up @@ -51,13 +54,13 @@ fs::path ModelPaths::sector_parameters_config_path() const

fs::path ModelPaths::emission_output_raster_path(date::year year, const EmissionIdentifier& emissionId) const
{
return output_path() / std::to_string(static_cast<int>(year)) / fs::u8path(fmt::format("{}_{}_{}.tif", emissionId.pollutant.code(), emissionId.sector.name(), emissionId.country.iso_code()));
return output_path() / std::to_string(static_cast<int>(year)) / file::u8path(fmt::format("{}_{}_{}.tif", emissionId.pollutant.code(), emissionId.sector.name(), emissionId.country.iso_code()));
}

fs::path ModelPaths::emission_brn_output_path(date::year year, const Pollutant& pol, const EmissionSector& sector) const
{
const int yearInt = static_cast<int>(year);
return output_path() / std::to_string(yearInt) / fs::u8path(fmt::format("{}_{}_{}.brn", pol.code(), sector, yearInt));
return output_path() / std::to_string(yearInt) / file::u8path(fmt::format("{}_{}_{}.brn", pol.code(), sector, yearInt));
}

const fs::path& ModelPaths::data_root() const noexcept
Expand Down Expand Up @@ -92,30 +95,30 @@ fs::path ModelPaths::output_dir_for_rasters() const

fs::path ModelPaths::output_path_for_country_raster(const EmissionIdentifier& id, const GridData& grid) const
{
return output_dir_for_rasters() / fs::u8path(fmt::format("{}_{}_{}_{}.tif", id.country.iso_code(), id.pollutant.code(), id.sector.name(), grid.name));
return output_dir_for_rasters() / file::u8path(fmt::format("{}_{}_{}_{}.tif", id.country.iso_code(), id.pollutant.code(), id.sector.name(), grid.name));
}

fs::path ModelPaths::output_path_for_grid_raster(const Pollutant& pol, const EmissionSector& sector, const GridData& grid) const
{
return output_dir_for_rasters() / fs::u8path(fmt::format("{}_{}_{}.tif", pol.code(), sector.name(), grid.name));
return output_dir_for_rasters() / file::u8path(fmt::format("{}_{}_{}.tif", pol.code(), sector.name(), grid.name));
}

fs::path ModelPaths::output_path_for_spatial_pattern_raster(const EmissionIdentifier& id, const GridData& grid) const
{
return output_dir_for_rasters() / fs::u8path(fmt::format("{}_{}_{}_{}_spatpat.tif", id.country.iso_code(), id.pollutant.code(), id.sector.name(), grid.name));
return output_dir_for_rasters() / file::u8path(fmt::format("{}_{}_{}_{}_spatpat.tif", id.country.iso_code(), id.pollutant.code(), id.sector.name(), grid.name));
}

fs::path ModelPaths::emissions_dir_path(date::year reportYear) const
{
return _dataRoot / "01_data_emissions" / "inventory" / fs::u8path(fmt::format("reporting_{}", static_cast<int>(reportYear)));
return _dataRoot / "01_data_emissions" / "inventory" / file::u8path(fmt::format("reporting_{}", static_cast<int>(reportYear)));
}

fs::path ModelPaths::append_scenario_suffix_if_available(const fs::path& path) const
{
if (!_scenario.empty()) {
auto scenarioPath = path;
auto filename = path.filename();
scenarioPath.replace_filename(fs::u8path(fmt::format("{}_{}{}", filename.stem(), _scenario, filename.extension())));
scenarioPath.replace_filename(file::u8path(fmt::format("{}_{}{}", filename.stem(), _scenario, filename.extension())));
if (fs::is_regular_file(scenarioPath)) {
return scenarioPath;
}
Expand Down
6 changes: 3 additions & 3 deletions logic/spatialpatterninventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ std::vector<SpatialPatternInventory::SpatialPatterns> SpatialPatternInventory::s

static fs::path reporing_dir(date::year reportYear)
{
return fs::u8path(fmt::format("reporting_{}", static_cast<int>(reportYear)));
return file::u8path(fmt::format("reporting_{}", static_cast<int>(reportYear)));
}

void SpatialPatternInventory::scan_dir(date::year reportingYear, date::year startYear, const fs::path& spatialPatternPath)
Expand Down Expand Up @@ -655,7 +655,7 @@ std::vector<SpatialPatternInventory::SpatialPatternException> SpatialPatternInve
SpatialPatternException ex;
ex.yearRange = parse_year_range(feature.field_as<std::string>(colYear));
ex.emissionId = EmissionIdentifier(country, *sector, pollutant);
ex.spatialPattern = exceptionsFile.parent_path() / fs::u8path(feature.field_as<std::string_view>(colPath));
ex.spatialPattern = exceptionsFile.parent_path() / file::u8path(feature.field_as<std::string_view>(colPath));
ex.type = exception_type_from_string(feature.field_as<std::string_view>(colType));

if (feature.field_is_valid(colViaNfr)) {
Expand All @@ -675,4 +675,4 @@ std::vector<SpatialPatternInventory::SpatialPatternException> SpatialPatternInve

return result;
}
}
}
10 changes: 5 additions & 5 deletions logic/test/emissioninventoryintegrationtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST_CASE("Emission inventory [integration]" * skip(true))
)toml";

RunSummary summary;
auto cfg = parse_run_configuration(configToml, fs::u8path(INTEGRATION_TEST_DATA_DIR));
auto cfg = parse_run_configuration(configToml, file::u8path(INTEGRATION_TEST_DATA_DIR));

auto nfrTotalEmissions = read_nfr_emissions(cfg.year(), cfg, summary);
auto pointSources = read_country_point_sources(cfg, countries::BEF, summary);
Expand Down Expand Up @@ -97,7 +97,7 @@ TEST_CASE("Emission inventory [integration]" * skip(true))
{
TempDir temp("emap_model_run");

std::string_view configToml = R"toml(
constexpr std::string_view configToml = R"toml(
[model]
grid = "vlops1km"
datapath = "./_input"
Expand All @@ -120,7 +120,7 @@ TEST_CASE("Emission inventory [integration]" * skip(true))
const auto outputPath = temp.path() / "output";

RunSummary summary;
auto cfg = parse_run_configuration(fmt::format(configToml, outputPath.generic_u8string()), fs::u8path(INTEGRATION_TEST_DATA_DIR));
auto cfg = parse_run_configuration(fmt::format(configToml, file::generic_u8string(outputPath)), file::u8path(INTEGRATION_TEST_DATA_DIR));

CHECK(run_model(cfg, [](const auto&) { return inf::ProgressStatusResult::Continue; }) == EXIT_SUCCESS);

Expand Down Expand Up @@ -186,7 +186,7 @@ TEST_CASE("Emission inventory [integration]" * skip(true))

RunSummary summary;

auto cfg = parse_run_configuration(configToml, fs::u8path(INTEGRATION_TEST_DATA_DIR));
auto cfg = parse_run_configuration(configToml, file::u8path(INTEGRATION_TEST_DATA_DIR));
auto pointEmissions = read_country_point_sources(cfg, countries::BEF, summary);
double pm10Sum = 0.0;
double pm25Sum = 0.0;
Expand All @@ -209,4 +209,4 @@ TEST_CASE("Emission inventory [integration]" * skip(true))
}
}

}
}
4 changes: 2 additions & 2 deletions logic/test/emissioninventorytest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TEST_CASE("Emission inventory")
{
RunSummary summary;

const auto parametersPath = fs::u8path(TEST_DATA_DIR) / "_input" / "05_model_parameters";
const auto parametersPath = file::u8path(TEST_DATA_DIR) / "_input" / "05_model_parameters";
const auto countryInventory = parse_countries(parametersPath / "id_nummers.xlsx");
const auto sectorInventory = parse_sectors(parametersPath / "id_nummers.xlsx", parametersPath / "code_conversions.xlsx", parametersPath / "names_to_be_ignored.xlsx", countryInventory);
const auto pollutantInventory = parse_pollutants(parametersPath / "id_nummers.xlsx", parametersPath / "code_conversions.xlsx", parametersPath / "names_to_be_ignored.xlsx", countryInventory);
Expand Down Expand Up @@ -292,4 +292,4 @@ TEST_CASE("Emission inventory")
}
}

}
}
Loading

0 comments on commit 523e805

Please sign in to comment.