JCSDA / CRTMv3

CRTMv3 repository for coordinated development and releases. Code history is not carried in this repository prior to v3, to reduce the cloning overhead. For v2.x history leading up to v3, see JCSDA/crtm repository.
Other
6 stars 6 forks source link

Patch so that "make install" works properly. #140

Closed rhoneyager-tomorrow closed 4 months ago

rhoneyager-tomorrow commented 5 months ago

Description

The ecbuild to cmake update broke the ability to have CMake "install" CRTM. This fixes it. The patch is based on the v3.1.0-skylabv8 tag, which is why there are conflicts against develop.

Expected behavior:

cmake -D CMAKE_INSTALL_PREFIX=/some/installation/directory   path_to_crtm_source
make install

-- Install configuration: "Release"
-- Up-to-date: /some/installation/directory/lib64/libcrtm.a
-- Up-to-date: /some/installation/directory/lib64/cmake/crtm/crtm-config.cmake
-- Up-to-date: /some/installation/directory/lib64/cmake/crtm/crtm-config-version.cmake
-- Up-to-date: /some/installation/directory/lib64/cmake/crtm/crtm-targets.cmake
-- Up-to-date: /some/installation/directory/lib64/cmake/crtm/crtm-targets-release.cmake
-- Up-to-date: /some/installation/directory/module/crtm/Intel/2021.9.0.20230302
-- Up-to-date: /some/installation/directory/module/crtm/Intel/2021.9.0.20230302/crtm_module.mod
......

Issue(s) addressed

None tracked here.

Dependencies

None.

Impact

Spack can build CRTM v3 again.

Checklist

BenjaminTJohnson commented 5 months ago

@rhoneyager-tomorrow just tested and looks like it works without any issues.

rhoneyager-tomorrow commented 5 months ago

Still working on it! It's in draft and visible so that Rick Grubin can also take a look and finish any leftover parts.

rhoneyager-tomorrow commented 4 months ago

Open for review.

You have to consider three cases for how CMake can be built and linked with dependent projects.

  1. A jedi-bundle build. This is managed by ecbuild, and a whole slew of different repositories are combined together as a set of CMake projects and sub-projects. There's nothing special in this case.
  2. Linking a downstream project to a CMake build directory. At your build root, the crtm-config.cmake and crtm-targets*.cmake files are written, and find_package(crtm) will locate crtm if you give it a hint (by setting crtm_DIR to the crtm build location).
  3. Linking a downstream project to a CMake install directory. This is the collection of files and folders written when you run make install. Normally, this defaults to /usr/local, but this install path may be customized by setting CMAKE_PREFIX_PATH accordingly. As with case 2, find_package(crtm) will locate crtm if you give it a hint (by setting crtm_DIR to the crtm install location). This is also how Spack installs packages. It sets the correct CMake variables and runs make install, and everything just works.

I've tested all three cases, and can successfully link crtm to ufo in each case.