Skip to content

Commit

Permalink
Merge pull request ecmwf#145 from ecmwf/feature/findaec
Browse files Browse the repository at this point in the history
Update FindAEC and add to CI
  • Loading branch information
iainrussell authored Oct 29, 2024
2 parents 4550f54 + db99575 commit 9cd9faf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/ci-config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_options: -DENABLE_ECKIT_GEO=ON
dependencies: |
ecmwf/ecbuild
MathisRosenhauer/libaec@master
dependency_branch: develop
parallelism_factor: 8
15 changes: 10 additions & 5 deletions cmake/FindAEC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@
#
# AEC_DIR - prefix path of the AEC installation
# AEC_PATH - prefix path of the AEC installation

find_path( AEC_INCLUDE_DIR szlib.h
PATHS ${AEC_DIR} ${AEC_PATH} ENV AEC_DIR ENV AEC_PATH
# LIBAEC_DIR
# libaec_DIR
# LIBAEC_PATH
# libaec_PATH
# libaec_ROOT

find_path( AEC_INCLUDE_DIR libaec.h
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ${libaec_ROOT} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH ENV libaec_ROOT
PATH_SUFFIXES include include/aec NO_DEFAULT_PATH )
find_path( AEC_INCLUDE_DIR szlib.h PATH_SUFFIXES include include/aec )
find_path( AEC_INCLUDE_DIR libaec.h PATH_SUFFIXES include include/aec )

find_library( AEC_LIBRARY NAMES aec
PATHS ${AEC_DIR} ${AEC_PATH} ENV AEC_DIR ENV AEC_PATH
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ${libaec_ROOT} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH ENV libaec_ROOT
PATH_SUFFIXES lib lib64 lib/aec lib64/aec NO_DEFAULT_PATH )
find_library( AEC_LIBRARY NAMES aec PATH_SUFFIXES lib lib64 lib/aec lib64/aec )

Expand Down
10 changes: 9 additions & 1 deletion src/eckit/system/LibraryManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ class LibraryRegistry {
return plib;
}

Log::warning() << "Failed to load library " << dynamicLibraryName << std::endl;
Log::warning() << "Failed to load library " << dynamicLibraryName
<< " dlerror: " << ::dlerror() << std::endl;

return nullptr;
}

Expand All @@ -234,6 +236,12 @@ class LibraryRegistry {
// lets load since the associated library isn't registered
void* libhandle = loadDynamicLibrary(lib);

if (!libhandle) {
std::ostringstream ss;
ss << "Failed to load library " << lib;
throw FailedSystemCall(ss.str().c_str(), Here());
}

// the plugin should self-register when the library loads
Plugin* plugin = lookupPlugin(name);
if (plugin) {
Expand Down

0 comments on commit 9cd9faf

Please sign in to comment.