diff --git a/CMakeLists.txt b/CMakeLists.txt index c7b1555..3da6347 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,10 @@ if (HAVE_GRIBJUMP_LOCAL_EXTRACT) message(FATAL_ERROR "AEC version is too old. Minimum supported version is 1.1.1. Found version: ${AEC_VERSION}") endif() + # Optional dependency: dhskit + ecbuild_find_package( NAME dhskit VERSION 0.8.6 ) + set(GRIBJUMP_HAVE_DHSKIT ${dhskit_FOUND}) + endif() ######################################################################################################################## @@ -66,13 +70,15 @@ if (HAVE_GRIBJUMP_LOCAL_EXTRACT) add_subdirectory( tests ) endif() +######################################################################################################################## +# PLUGIN # Write and install the manifest file for the plugin set( gribjump_plugin_file share/plugins/gribjump-plugin.yml ) file( WRITE ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} "plugin:\n" ) file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " name: gribjump-plugin\n" ) file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " namespace: int.ecmwf\n" ) file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " url: http://www.ecmwf.int\n" ) -file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " version: ${${PROJECT_NAME}_VERSION}\n" ) # TODO set version +file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " version: ${${PROJECT_NAME}_VERSION}\n" ) file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " library: gribjump\n" ) install( FILES ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} DESTINATION share/plugins ) diff --git a/src/gribjump/CMakeLists.txt b/src/gribjump/CMakeLists.txt index fc4ec3a..35d6049 100644 --- a/src/gribjump/CMakeLists.txt +++ b/src/gribjump/CMakeLists.txt @@ -125,6 +125,10 @@ if( HAVE_GRIBJUMP_LOCAL_EXTRACT ) endif() +if (GRIBJUMP_HAVE_DHSKIT) +list( APPEND SERVER_LIBS dhskit ) +endif() + ecbuild_add_library( TARGET gribjump diff --git a/src/gribjump/gribjump_config.h.in b/src/gribjump/gribjump_config.h.in index df7324b..4e933ef 100644 --- a/src/gribjump/gribjump_config.h.in +++ b/src/gribjump/gribjump_config.h.in @@ -7,5 +7,6 @@ // features #define GRIBJUMP_HAVE_FDB @GRIBJUMP_HAVE_FDB@ +#cmakedefine GRIBJUMP_HAVE_DHSKIT #endif // gribjump_gribjump_config_h diff --git a/src/tools/gribjump-server.cc b/src/tools/gribjump-server.cc index 349ce78..a57c311 100644 --- a/src/tools/gribjump-server.cc +++ b/src/tools/gribjump-server.cc @@ -8,25 +8,38 @@ * does it submit to any jurisdiction. */ -#include "gribjump/remote/GribJumpServer.h" -#include "eckit/runtime/Application.h" #include #include #include "eckit/config/Resource.h" #include "eckit/net/Port.h" +#include "eckit/runtime/Application.h" -namespace gribjump { +#include "gribjump/gribjump_config.h" +#include "gribjump/remote/GribJumpServer.h" +#ifdef GRIBJUMP_HAVE_DHSKIT +#include "dhskit/runtime/DHSApplication.h" +#endif + +namespace { +#ifdef GRIBJUMP_HAVE_DHSKIT +using BaseApp = dhskit::DHSApplication; +#else +using BaseApp = eckit::Application; +#endif +} // namespace + + +namespace gribjump { -class GribJumpServerApp : public eckit::Application, public GribJumpServer { +class GribJumpServerApp : public BaseApp, public GribJumpServer { public: GribJumpServerApp(int argc, char** argv) : - Application(argc, argv), - GribJumpServer(eckit::net::Port( - "gribJumpServer", - eckit::Resource("$GRIBJUMP_SERVER_PORT;gribjumpServerPort", LibGribJump::instance().config().getInt("server.port", 9777) + BaseApp(argc, argv), + GribJumpServer(eckit::net::Port( // gribjumpServerPort + "gribjumpServer", eckit::Resource("$GRIBJUMP_SERVER_PORT", LibGribJump::instance().config().getInt("server.port", 9777) ))) {} @@ -48,7 +61,6 @@ class GribJumpServerApp : public eckit::Application, public GribJumpServer { int main(int argc, char** argv) { - eckit::Log::info() << "Starting gribjump server" << std::endl; gribjump::GribJumpServerApp app(argc, argv); app.start(); return 0;