Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake netCDF Compatibility with WPS #2121

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

islas
Copy link
Collaborator

@islas islas commented Oct 16, 2024

TYPE: bug fix

KEYWORDS: compilation, cmake, netcdf

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
PR #2054 changes the netCDF target linking for WRF targets generated through CMake. When used with any other software relying on the package config generated from cmake/template/WRFConfig.cmake, there must be a way to find non-CMake supported packages like netCDF. WRF provides these find modules in <install dir>/share but does not use them within its own package config. WPS also has a FindnetCDF.cmake and FindnetCDF-Fortran.cmake, but these use the classic variable approach instead of an import target.

Thus, when building WPS referencing WRF with the changes of #2054, it will use the WPS netCDF find modules instead of WRF's. This will result in an error like:

CMake Error at /home/aislas/wrf-model/wrf/install/lib/cmake/WRF/WRFTargets.cmake:111 (set_target_properties):
  The link interface of target "WRF::io_netcdf" contains:

    netCDF::netcdff

Solution:
Adjust the generated package config file to use WRF's find modules and give them precedence over WPS for WRF's imported targets specifically. Additionally, move imported target inclusion to after dependencies have been resolved so that WRF package finding precedence is used.

TESTS CONDUCTED:

  1. Tested with gcc/OpenMPI to build WRF and WPS (v4.6.0) together

@islas islas requested a review from a team as a code owner October 16, 2024 17:45
@amstokely amstokely self-requested a review October 16, 2024 18:19
@mgduda mgduda self-requested a review October 16, 2024 18:52
@weiwangncar
Copy link
Collaborator

The Jenkins test results:

Test Type              | Expected  | Received |  Failed
= = = = = = = = = = = = = = = = = = = = = = = =  = = = =
Number of Tests        : 23           24
Number of Builds       : 60           57
Number of Simulations  : 158           150        0
Number of Comparisons  : 95           86        0

Failed Simulations are: 
None
Which comparisons are not bit-for-bit: 
None

@islas islas merged commit b1e1258 into wrf-model:release-v4.6.1 Oct 16, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants