Skip to content

[eccodes] Add new port#51301

Merged
BillyONeal merged 45 commits into
microsoft:masterfrom
kadirlua:add_eccodes
May 6, 2026
Merged

[eccodes] Add new port#51301
BillyONeal merged 45 commits into
microsoft:masterfrom
kadirlua:add_eccodes

Conversation

@kadirlua

Copy link
Copy Markdown
Contributor
  • Changes comply with the maintainer guide.
  • The packaged project shows strong association with the chosen port name. Check this box if at least one of the following criteria is met:
    • The project is in Repology: https://repology.org//versions
    • The project is amongst the first web search results for "" or " C++". Include a screenshot of the search engine results in the PR.
    • The port name follows the 'GitHubOrg-GitHubRepo' form or equivalent Owner-Project form.
  • Optional dependencies of the build are all controlled by the port. A dependency is controlled if it is declared an unconditional dependency in vcpkg.json, or explicitly disabled through patches or build system arguments such as CMAKE_DISABLE_FIND_PACKAGE_Xxx or VCPKG_LOCK_FIND_PACKAGE
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is brief and accurate. See adding-usage for context. Don't add a usage file if the automatically generated usage is correct.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Exactly one version is added in each modified versions file.

@BillyONeal BillyONeal marked this pull request as draft April 21, 2026 18:26
@BillyONeal

Copy link
Copy Markdown
Member

Drafting due to legitimate build failures.

@kadirlua

Copy link
Copy Markdown
Contributor Author

The PR is ready @BillyONeal.

@kadirlua kadirlua marked this pull request as ready for review April 30, 2026 13:42
Comment thread ports/ecbuild/portfile.cmake Outdated
Comment thread ports/ecbuild/portfile.cmake
Comment thread ports/ecbuild/vcpkg-port-config.cmake Outdated
Comment thread ports/eccodes/portfile.cmake Outdated
Comment thread ports/eccodes/portfile.cmake Outdated
Comment thread ports/eccodes/portfile.cmake Outdated
Comment thread ports/eccodes/usage Outdated
Comment thread ports/eccodes/use-system-ecbuild.patch Outdated
Comment thread ports/eccodes/vcpkg.json Outdated
Comment thread ports/eccodes/vcpkg.json Outdated
Comment thread ports/eccodes/vcpkg.json Outdated
Comment thread ports/eccodes/vcpkg.json Outdated
Comment thread ports/eccodes/vcpkg.json Outdated
Comment thread ports/eccodes/vcpkg.json Outdated
Comment thread ports/ecbuild/ecbuild-config-version.cmake.in
Comment thread ports/eccodes/vcpkg.json
Comment thread ports/ecbuild/vcpkg.json
@BillyONeal BillyONeal marked this pull request as draft May 1, 2026 01:08
kadirlua and others added 7 commits May 1, 2026 11:46
Co-authored-by: Billy O'Neal <bion@microsoft.com>
Co-authored-by: Billy O'Neal <bion@microsoft.com>
Co-authored-by: Billy O'Neal <bion@microsoft.com>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
…ions, update version handling, and enhance NetCDF support
Comment thread ports/eccodes/portfile.cmake Outdated
@kadirlua

kadirlua commented May 2, 2026

Copy link
Copy Markdown
Contributor Author

The PR is ready, but I'm not sure why the x64_android triplet failed. We don't support Android for this port, so it's likely a CI-related issue.

@dg0yt

dg0yt commented May 3, 2026

Copy link
Copy Markdown
Contributor

Hm, I start wondering if ecbuild should be a port or just another download in eccodes.
All wrappers on top of CMake add their own problems. (Vcpkg included...)

Comment thread ports/ecbuild/ecbuild-config-version.cmake.in Outdated
@kadirlua

kadirlua commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Hm, I start wondering if ecbuild should be a port or just another download in eccodes. All wrappers on top of CMake add their own problems. (Vcpkg included...)

I considered both options. I kept ecbuild as a helper port because it is a CMake macro/build-system package, and using a host helper port makes the dependency explicit, avoids relying on ecCodes' FetchContent path, and keeps the ecCodes port focused on building ecCodes itself.

That said, if the preference is to avoid introducing a separate helper port for ecbuild, I can fold the ecbuild download into the eccodes port and pass the local ecbuild source path directly during configure.

Comment thread ports/ecbuild/portfile.cmake
Comment thread ports/ecbuild/ecbuild-config-version.cmake.in
Comment thread ports/ecbuild/vcpkg.json Outdated
@BillyONeal BillyONeal added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label May 5, 2026
@kadirlua kadirlua requested a review from BillyONeal May 5, 2026 02:34
@kadirlua

kadirlua commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

Everything is OK now @BillyONeal. Check again.

@dg0yt

dg0yt commented May 5, 2026

Copy link
Copy Markdown
Contributor

ecbuild is a CMake macro/helper package, and its macros expect the full upstream cmake module directory to be available through CMAKE_MODULE_PATH. ecCodes uses ecbuild's package-discovery layer, including NetCDF detection, so removing the Find modules makes this helper port incomplete.

Sometimes these 3rd-party Find modules are not helpers but evil. They cannot know (but only guess) how we configured the dependency. We have CMake config and we have wrappers for official (Kitware) Find modules to capture the configuration when we build the dependency. You have to patch anyways, so you might as well patch for adopting the known-good package provider.

netcdf-c provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(netCDF CONFIG REQUIRED)
  target_link_libraries(main PRIVATE netCDF::netcdf)

@kadirlua

kadirlua commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

ecbuild is a CMake macro/helper package, and its macros expect the full upstream cmake module directory to be available through CMAKE_MODULE_PATH. ecCodes uses ecbuild's package-discovery layer, including NetCDF detection, so removing the Find modules makes this helper port incomplete.

Sometimes these 3rd-party Find modules are not helpers but evil. They cannot know (but only guess) how we configured the dependency. We have CMake config and we have wrappers for official (Kitware) Find modules to capture the configuration when we build the dependency. You have to patch anyways, so you might as well patch for adopting the known-good package provider.

netcdf-c provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(netCDF CONFIG REQUIRED)
  target_link_libraries(main PRIVATE netCDF::netcdf)

Done. I patched ecCodes to use the vcpkg-provided netcdf-c config package directly instead of relying on ecbuild's FindNetCDF.cmake.

The netcdf feature now uses find_package(netCDF CONFIG REQUIRED) and links grib_to_netcdf with netCDF::netcdf. I also excluded ecbuild's upstream Find*.cmake files again, so the helper port no longer installs those third-party Find modules.

With this, netcdf discovery comes from the known vcpkg package provider instead of ecbuild's heuristic module.

@BillyONeal

Copy link
Copy Markdown
Member

@vicroms points out that since CMAKE_MODULE_PATH was not being obviously changed it's possible the installed find modules were being ignored.

@kadirlua

kadirlua commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

@vicroms points out that since CMAKE_MODULE_PATH was not being obviously changed it's possible the installed find modules were being ignored.

Good point. The earlier failure does not necessarily prove that the installed ecbuild Find*.cmake modules were being used.

The helper config does add ecbuild's cmake directory to CMAKE_MODULE_PATH so that ecbuild's own macros can be included, but after the latest change this no longer matters for NetCDF: the ecCodes patch now uses find_package(netCDF CONFIG REQUIRED) and links netCDF::netcdf directly.

So the final state is still to exclude ecbuild's third-party Find*.cmake modules and use the vcpkg-provided config package for NetCDF.

@BillyONeal BillyONeal removed the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label May 6, 2026

@BillyONeal BillyONeal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@BillyONeal BillyONeal merged commit de03680 into microsoft:master May 6, 2026
16 checks passed
@kadirlua kadirlua deleted the add_eccodes branch May 6, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants