From 9719d9f0f5d368381004635e171399bc07380216 Mon Sep 17 00:00:00 2001 From: Aser Garcia Date: Thu, 9 May 2024 11:19:48 -0400 Subject: [PATCH] Ensuring consistent use of the export macro `MORPHEUS_EXPORT` (#1672) This PR makes exporting symbols consistent across header files. The docs and examples for the developer_guide is also updated. Closes #1595 ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md). - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. Authors: - Aser Garcia (https://github.com/aserGarcia) - David Gardner (https://github.com/dagardner-nv) Approvers: - Yuchen Zhang (https://github.com/yuchenz427) - Michael Demoret (https://github.com/mdemoret-nv) URL: https://github.com/nv-morpheus/Morpheus/pull/1672 --- .../guides/3_simple_cpp_stage.md | 29 +++++----- .../guides/4_source_cpp_stage.md | 18 +++---- .../developer_guide/guides/8_cpp_modules.md | 7 +-- .../src/simple_cpp_stage/_lib/pass_thru.hpp | 11 ++-- .../_lib/rabbitmq_source.hpp | 11 ++-- .../include/morpheus/doca/doca_source.hpp | 9 ++-- .../_lib/include/morpheus/io/data_loader.hpp | 8 ++- .../morpheus/io/data_loader_registry.hpp | 7 ++- .../include/morpheus/io/deserializers.hpp | 18 +++---- .../_lib/include/morpheus/io/loaders/file.hpp | 7 +-- .../_lib/include/morpheus/io/loaders/grpc.hpp | 7 +-- .../include/morpheus/io/loaders/lambda.hpp | 7 +-- .../include/morpheus/io/loaders/payload.hpp | 7 +-- .../_lib/include/morpheus/io/loaders/rest.hpp | 7 +-- .../_lib/include/morpheus/io/serializers.hpp | 54 ++++++++++--------- .../include/morpheus/messages/control.hpp | 11 ++-- .../messages/memory/inference_memory.hpp | 8 ++- .../messages/memory/inference_memory_fil.hpp | 5 +- .../messages/memory/inference_memory_nlp.hpp | 9 ++-- .../messages/memory/response_memory.hpp | 9 ++-- .../messages/memory/response_memory_probs.hpp | 8 +-- .../messages/memory/tensor_memory.hpp | 8 ++- .../_lib/include/morpheus/messages/meta.hpp | 12 ++--- .../_lib/include/morpheus/messages/multi.hpp | 17 +++--- .../morpheus/messages/multi_inference.hpp | 8 +-- .../morpheus/messages/multi_inference_fil.hpp | 9 ++-- .../morpheus/messages/multi_inference_nlp.hpp | 8 +-- .../morpheus/messages/multi_response.hpp | 8 +-- .../messages/multi_response_probs.hpp | 9 ++-- .../morpheus/messages/multi_tensor.hpp | 8 ++- .../morpheus/modules/data_loader_module.hpp | 6 +-- .../_lib/include/morpheus/objects/dtype.hpp | 10 ++-- .../morpheus/objects/factory_registry.hpp | 7 ++- .../include/morpheus/objects/fiber_queue.hpp | 9 ++-- .../include/morpheus/objects/file_types.hpp | 14 +++-- .../morpheus/objects/filter_source.hpp | 9 ++-- .../objects/mutable_table_ctx_mgr.hpp | 6 +-- .../include/morpheus/objects/rmm_tensor.hpp | 7 ++- .../_lib/include/morpheus/objects/tensor.hpp | 6 +-- .../morpheus/objects/wrapped_tensor.hpp | 5 +- .../morpheus/stages/add_classification.hpp | 8 ++- .../include/morpheus/stages/add_scores.hpp | 7 ++- .../morpheus/stages/add_scores_stage_base.hpp | 6 +-- .../include/morpheus/stages/deserialize.hpp | 9 ++-- .../include/morpheus/stages/file_source.hpp | 7 ++- .../morpheus/stages/filter_detection.hpp | 8 ++- .../stages/http_server_source_stage.hpp | 8 ++- .../include/morpheus/stages/kafka_source.hpp | 10 ++-- .../include/morpheus/stages/preallocate.hpp | 10 ++-- .../morpheus/stages/preprocess_fil.hpp | 8 +-- .../morpheus/stages/preprocess_nlp.hpp | 9 ++-- .../include/morpheus/stages/serialize.hpp | 9 ++-- .../include/morpheus/stages/write_to_file.hpp | 9 ++-- .../morpheus/utilities/http_server.hpp | 13 +++-- .../morpheus/utilities/python_util.hpp | 10 ++-- 55 files changed, 257 insertions(+), 297 deletions(-) diff --git a/docs/source/developer_guide/guides/3_simple_cpp_stage.md b/docs/source/developer_guide/guides/3_simple_cpp_stage.md index 3b0982d21e..678fc3074f 100644 --- a/docs/source/developer_guide/guides/3_simple_cpp_stage.md +++ b/docs/source/developer_guide/guides/3_simple_cpp_stage.md @@ -54,7 +54,7 @@ def supports_cpp_node(self): return True ``` -C++ message object declarations can be found in the header files that are located in the `morpheus/_lib/include/morpheus/messages` directory. For example, the `MessageMeta` class declaration is located in `morpheus/_lib/include/morpheus/messages/meta.hpp`. In code this would be included as: +C++ message object declarations can be found in the header files that are located in the `morpheus/_lib/include/morpheus/messages` directory. For example, the `MessageMeta` class declaration is located in `morpheus/_lib/include/morpheus/messages/meta.hpp`. Since this code is outside of the morpheus directory it would be included as: ```cpp #include @@ -89,6 +89,7 @@ While our Python implementation accepts messages of any type (in the form of Pyt To start with, we have our Morpheus and MRC-specific includes: ```cpp +#include #include // for MultiMessage #include // for Segment Builder #include // for Segment Object @@ -100,12 +101,10 @@ We'll want to define our stage in its own namespace. In this case, we will name ```cpp namespace morpheus_example { -// pybind11 sets visibility to hidden by default; we want to export our symbols -#pragma GCC visibility push(default) - using namespace morpheus; -class PassThruStage : public mrc::pymrc::PythonNode, std::shared_ptr> +// pybind11 sets visibility to hidden by default; we want to export our symbols +class MORPHEUS_EXPORT PassThruStage : public mrc::pymrc::PythonNode, std::shared_ptr> { public: using base_t = mrc::pymrc::PythonNode, std::shared_ptr>; @@ -119,7 +118,13 @@ class PassThruStage : public mrc::pymrc::PythonNode