Skip to content

Commit

Permalink
Added extensionless solution also.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Williamson authored and mattw-nws committed Aug 4, 2022
1 parent bff5c82 commit f64ffd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions data/example_bmi_multi_realization_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "bmi_fortran",
"params": {
"model_type_name": "bmi_fortran_noahowp",
"library_file": "./extern/noah-owp-modular/cmake_build/libsurfacebmi.so",
"library_file": "./extern/noah-owp-modular/cmake_build/libsurfacebmi",
"forcing_file": "",
"init_config": "./data/bmi/fortran/noah-owp-modular-init-{{id}}.namelist.input",
"allow_exceed_end_time": true,
Expand All @@ -36,7 +36,7 @@
"name": "bmi_c",
"params": {
"model_type_name": "bmi_c_cfe",
"library_file": "./extern/cfe/cmake_build/libcfebmi.so",
"library_file": "./extern/cfe/cmake_build/libcfebmi",
"forcing_file": "",
"init_config": "./data/bmi/c/cfe/{{id}}_bmi_config.ini",
"allow_exceed_end_time": true,
Expand Down
12 changes: 11 additions & 1 deletion include/realizations/catchment/AbstractCLibBmiAdapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,19 @@ namespace models {
std::string alt_bmi_lib_file;
if(bmi_lib_file.substr(idx) == ".so"){
alt_bmi_lib_file = bmi_lib_file.substr(0,idx) + ".dylib";
} else {
} else if(bmi_lib_file.substr(idx) == ".dylib"){
alt_bmi_lib_file = bmi_lib_file.substr(0,idx) + ".so";
} else {
// Try appending instead of replacing...
#ifdef __APPLE__
alt_bmi_lib_file = bmi_lib_file + ".dylib";
#else
#ifdef __GNUC__
alt_bmi_lib_file = bmi_lib_file + ".so";
#endif // __GNUC__
#endif // __APPLE__
}
//TODO: Try looking in e.g. /usr/lib, /usr/local/lib, $LD_LIBRARY_PATH... try pre-pending "lib"...
if (utils::FileChecker::file_is_readable(alt_bmi_lib_file)) {
bmi_lib_file = alt_bmi_lib_file;
} else {
Expand Down

0 comments on commit f64ffd3

Please sign in to comment.