diff --git a/CMakeLists.txt b/CMakeLists.txt index dad56423..c67482ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ set(CTEST_TEST_TIMEOUT 90 CACHE STRING "Per-test timeout (s) for CTest") FetchContent_MakeAvailable(Catch2 GSL mimicpp) include(Modules/private/CreateCoverageTargets.cmake) +include(Modules/private/PhlexSymbolVisibility.cmake) option(ENABLE_TSAN "Enable Thread Sanitizer" OFF) option(ENABLE_ASAN "Enable Address Sanitizer" OFF) diff --git a/Modules/private/PhlexSymbolVisibility.cmake b/Modules/private/PhlexSymbolVisibility.cmake new file mode 100644 index 00000000..d376b9f2 --- /dev/null +++ b/Modules/private/PhlexSymbolVisibility.cmake @@ -0,0 +1,26 @@ +include(GenerateExportHeader) + +function(phlex_apply_symbol_visibility target) + set(EXPORT_HEADER "${PROJECT_BINARY_DIR}/include/${target}_export.hpp") + set(EXPORT_MACRO_NAME "${target}_EXPORT") + + generate_export_header( + ${target} + BASE_NAME ${target} + EXPORT_FILE_NAME ${EXPORT_HEADER} + EXPORT_MACRO_NAME ${EXPORT_MACRO_NAME} + STATIC_DEFINE "${target}_STATIC_DEFINE" + ) + + set_target_properties( + ${target} + PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON + ) + + target_include_directories( + ${target} + PUBLIC $ $ + ) + + install(FILES "${EXPORT_HEADER}" DESTINATION include) +endfunction() diff --git a/phlex/CMakeLists.txt b/phlex/CMakeLists.txt index f208a812..e81b7002 100644 --- a/phlex/CMakeLists.txt +++ b/phlex/CMakeLists.txt @@ -33,6 +33,7 @@ cet_make_library( Boost::json phlex::core ) +phlex_apply_symbol_visibility(phlex_configuration_internal) cet_make_library( LIBRARY_NAME diff --git a/phlex/app/CMakeLists.txt b/phlex/app/CMakeLists.txt index 3c0a57af..9f9d4459 100644 --- a/phlex/app/CMakeLists.txt +++ b/phlex/app/CMakeLists.txt @@ -16,6 +16,7 @@ cet_make_library( Boost::json Boost::boost ) +phlex_apply_symbol_visibility(run_phlex) install(FILES load_module.hpp run.hpp version.hpp DESTINATION include/phlex/app) diff --git a/phlex/app/load_module.hpp b/phlex/app/load_module.hpp index 14d3ba1f..38b7a452 100644 --- a/phlex/app/load_module.hpp +++ b/phlex/app/load_module.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_APP_LOAD_MODULE_HPP #define PHLEX_APP_LOAD_MODULE_HPP +#include "run_phlex_export.hpp" + #include "phlex/core/fwd.hpp" #include "phlex/driver.hpp" @@ -12,12 +14,17 @@ namespace phlex::experimental { namespace detail { // Adjust_config adds the module_label as a parameter, and it checks if the 'py' // parameter exists, inserting the 'cpp: "pymodule"' configuration if necessary. - boost::json::object adjust_config(std::string const& label, boost::json::object raw_config); + run_phlex_EXPORT boost::json::object adjust_config(std::string const& label, + boost::json::object raw_config); } - void load_module(framework_graph& g, std::string const& label, boost::json::object config); - void load_source(framework_graph& g, std::string const& label, boost::json::object config); - detail::next_index_t load_driver(boost::json::object const& config); + run_phlex_EXPORT void load_module(framework_graph& g, + std::string const& label, + boost::json::object config); + run_phlex_EXPORT void load_source(framework_graph& g, + std::string const& label, + boost::json::object config); + run_phlex_EXPORT detail::next_index_t load_driver(boost::json::object const& config); } #endif // PHLEX_APP_LOAD_MODULE_HPP diff --git a/phlex/app/run.hpp b/phlex/app/run.hpp index 96161b77..c275ebcb 100644 --- a/phlex/app/run.hpp +++ b/phlex/app/run.hpp @@ -1,12 +1,14 @@ #ifndef PHLEX_APP_RUN_HPP #define PHLEX_APP_RUN_HPP +#include "run_phlex_export.hpp" + #include "boost/json.hpp" #include namespace phlex::experimental { - void run(boost::json::object const& configurations, int max_parallelism); + run_phlex_EXPORT void run(boost::json::object const& configurations, int max_parallelism); } #endif // PHLEX_APP_RUN_HPP diff --git a/phlex/app/version.hpp b/phlex/app/version.hpp index ec1dbe94..e7be449f 100644 --- a/phlex/app/version.hpp +++ b/phlex/app/version.hpp @@ -1,7 +1,9 @@ #ifndef PHLEX_APP_VERSION_HPP #define PHLEX_APP_VERSION_HPP +#include "run_phlex_export.hpp" + namespace phlex::experimental { - char const* version(); + run_phlex_EXPORT char const* version(); } #endif // PHLEX_APP_VERSION_HPP diff --git a/phlex/concurrency.hpp b/phlex/concurrency.hpp index b456b913..328ec298 100644 --- a/phlex/concurrency.hpp +++ b/phlex/concurrency.hpp @@ -1,10 +1,12 @@ #ifndef PHLEX_CONCURRENCY_HPP #define PHLEX_CONCURRENCY_HPP +#include "phlex_core_export.hpp" + #include namespace phlex { - struct concurrency { + struct phlex_core_EXPORT concurrency { static concurrency const unlimited; static concurrency const serial; diff --git a/phlex/configuration.hpp b/phlex/configuration.hpp index 7dcf3945..7346a598 100644 --- a/phlex/configuration.hpp +++ b/phlex/configuration.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CONFIGURATION_HPP #define PHLEX_CONFIGURATION_HPP +#include "phlex_configuration_internal_export.hpp" + #include "boost/json.hpp" #include "phlex/core/product_query.hpp" #include "phlex/model/identifier.hpp" @@ -22,8 +24,8 @@ namespace phlex { } // Used later for product_query - std::optional value_if_exists(boost::json::object const& obj, - std::string_view parameter); + phlex_configuration_internal_EXPORT std::optional + value_if_exists(boost::json::object const& obj, std::string_view parameter); // helper for unpacking json array template @@ -34,7 +36,7 @@ namespace phlex { } } - class configuration { + class phlex_configuration_internal_EXPORT configuration { public: configuration() = default; explicit configuration(boost::json::object const& config) : config_{config} {} @@ -89,15 +91,15 @@ namespace phlex { // To enable direct conversions from Boost JSON types to our own types, we implement // tag_invoke(...) function overloads, which are the customization points Boost JSON // provides. - configuration tag_invoke(boost::json::value_to_tag const&, - boost::json::value const& jv); + phlex_configuration_internal_EXPORT configuration + tag_invoke(boost::json::value_to_tag const&, boost::json::value const& jv); - product_query tag_invoke(boost::json::value_to_tag const&, - boost::json::value const& jv); + phlex_configuration_internal_EXPORT product_query + tag_invoke(boost::json::value_to_tag const&, boost::json::value const& jv); namespace experimental { - identifier tag_invoke(boost::json::value_to_tag const&, - boost::json::value const& jv); + phlex_configuration_internal_EXPORT identifier + tag_invoke(boost::json::value_to_tag const&, boost::json::value const& jv); } template diff --git a/phlex/core/CMakeLists.txt b/phlex/core/CMakeLists.txt index c59d0ccd..7616b2b3 100644 --- a/phlex/core/CMakeLists.txt +++ b/phlex/core/CMakeLists.txt @@ -40,6 +40,7 @@ cet_make_library( Boost::json spdlog::spdlog ) +phlex_apply_symbol_visibility(phlex_core) install( FILES concepts.hpp diff --git a/phlex/core/consumer.hpp b/phlex/core/consumer.hpp index 11f5205e..010e500f 100644 --- a/phlex/core/consumer.hpp +++ b/phlex/core/consumer.hpp @@ -1,13 +1,15 @@ #ifndef PHLEX_CORE_CONSUMER_HPP #define PHLEX_CORE_CONSUMER_HPP +#include "phlex_core_export.hpp" + #include "phlex/model/algorithm_name.hpp" #include #include namespace phlex::experimental { - class consumer { + class phlex_core_EXPORT consumer { public: consumer(algorithm_name name, std::vector predicates); diff --git a/phlex/core/declared_fold.hpp b/phlex/core/declared_fold.hpp index 5d7afd86..6c1a9ab3 100644 --- a/phlex/core/declared_fold.hpp +++ b/phlex/core/declared_fold.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DECLARED_FOLD_HPP #define PHLEX_CORE_DECLARED_FOLD_HPP +#include "phlex_core_export.hpp" + #include "phlex/concurrency.hpp" #include "phlex/core/concepts.hpp" #include "phlex/core/fold/send.hpp" @@ -34,7 +36,7 @@ #include namespace phlex::experimental { - class declared_fold : public products_consumer { + class phlex_core_EXPORT declared_fold : public products_consumer { public: declared_fold(algorithm_name name, std::vector predicates, diff --git a/phlex/core/declared_observer.hpp b/phlex/core/declared_observer.hpp index d1bea85e..d41ff6ec 100644 --- a/phlex/core/declared_observer.hpp +++ b/phlex/core/declared_observer.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DECLARED_OBSERVER_HPP #define PHLEX_CORE_DECLARED_OBSERVER_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/concepts.hpp" #include "phlex/core/fwd.hpp" #include "phlex/core/input_arguments.hpp" @@ -30,7 +32,7 @@ namespace phlex::experimental { - class declared_observer : public products_consumer { + class phlex_core_EXPORT declared_observer : public products_consumer { public: declared_observer(algorithm_name name, std::vector predicates, diff --git a/phlex/core/declared_output.hpp b/phlex/core/declared_output.hpp index 7ca82f4f..479d9942 100644 --- a/phlex/core/declared_output.hpp +++ b/phlex/core/declared_output.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DECLARED_OUTPUT_HPP #define PHLEX_CORE_DECLARED_OUTPUT_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/consumer.hpp" #include "phlex/core/fwd.hpp" #include "phlex/core/message.hpp" @@ -20,7 +22,7 @@ namespace phlex::experimental { namespace detail { using output_function_t = std::function; } - class declared_output : public consumer { + class phlex_core_EXPORT declared_output : public consumer { public: declared_output(algorithm_name name, std::size_t concurrency, diff --git a/phlex/core/declared_predicate.hpp b/phlex/core/declared_predicate.hpp index 72643c7d..0d94968d 100644 --- a/phlex/core/declared_predicate.hpp +++ b/phlex/core/declared_predicate.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DECLARED_PREDICATE_HPP #define PHLEX_CORE_DECLARED_PREDICATE_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/concepts.hpp" #include "phlex/core/detail/filter_impl.hpp" #include "phlex/core/fwd.hpp" @@ -32,7 +34,7 @@ namespace phlex::experimental { - class declared_predicate : public products_consumer { + class phlex_core_EXPORT declared_predicate : public products_consumer { public: declared_predicate(algorithm_name name, std::vector predicates, diff --git a/phlex/core/declared_provider.hpp b/phlex/core/declared_provider.hpp index 9c3228d4..b5502c67 100644 --- a/phlex/core/declared_provider.hpp +++ b/phlex/core/declared_provider.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DECLARED_PROVIDER_HPP #define PHLEX_CORE_DECLARED_PROVIDER_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/concepts.hpp" #include "phlex/core/fwd.hpp" #include "phlex/core/message.hpp" @@ -22,7 +24,7 @@ namespace phlex::experimental { - class declared_provider { + class phlex_core_EXPORT declared_provider { public: declared_provider(algorithm_name name, product_query output_product); virtual ~declared_provider(); diff --git a/phlex/core/declared_transform.hpp b/phlex/core/declared_transform.hpp index 34358cd8..bd9e9981 100644 --- a/phlex/core/declared_transform.hpp +++ b/phlex/core/declared_transform.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DECLARED_TRANSFORM_HPP #define PHLEX_CORE_DECLARED_TRANSFORM_HPP +#include "phlex_core_export.hpp" + // FIXME: Add comments explaining the process. For each implementation, explain what part // of the process a given section of code is addressing. @@ -36,7 +38,7 @@ namespace phlex::experimental { - class declared_transform : public products_consumer { + class phlex_core_EXPORT declared_transform : public products_consumer { public: declared_transform(algorithm_name name, std::vector predicates, diff --git a/phlex/core/declared_unfold.hpp b/phlex/core/declared_unfold.hpp index 6349637c..28481cee 100644 --- a/phlex/core/declared_unfold.hpp +++ b/phlex/core/declared_unfold.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DECLARED_UNFOLD_HPP #define PHLEX_CORE_DECLARED_UNFOLD_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/concepts.hpp" #include "phlex/core/fwd.hpp" #include "phlex/core/input_arguments.hpp" @@ -31,7 +33,7 @@ namespace phlex::experimental { - class generator { + class phlex_core_EXPORT generator { public: explicit generator(product_store_const_ptr const& parent, std::string node_name, @@ -52,7 +54,7 @@ namespace phlex::experimental { std::map child_counts_; }; - class declared_unfold : public products_consumer { + class phlex_core_EXPORT declared_unfold : public products_consumer { public: declared_unfold(algorithm_name name, std::vector predicates, diff --git a/phlex/core/detail/filter_impl.hpp b/phlex/core/detail/filter_impl.hpp index 4d6dcd2d..fe932f65 100644 --- a/phlex/core/detail/filter_impl.hpp +++ b/phlex/core/detail/filter_impl.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DETAIL_FILTER_IMPL_HPP #define PHLEX_CORE_DETAIL_FILTER_IMPL_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/fwd.hpp" #include "phlex/core/product_query.hpp" #include "phlex/model/product_store.hpp" @@ -29,7 +31,7 @@ namespace phlex::experimental { return value == true_value; } - class decision_map { + class phlex_core_EXPORT decision_map { using decisions_t = oneapi::tbb::concurrent_hash_map; public: @@ -47,7 +49,7 @@ namespace phlex::experimental { decisions_t results_; }; - class data_map { + class phlex_core_EXPORT data_map { using stores_t = oneapi::tbb::concurrent_hash_map>; diff --git a/phlex/core/detail/make_algorithm_name.hpp b/phlex/core/detail/make_algorithm_name.hpp index 1e86b2dd..221bdddb 100644 --- a/phlex/core/detail/make_algorithm_name.hpp +++ b/phlex/core/detail/make_algorithm_name.hpp @@ -4,6 +4,8 @@ // This simple utility is placed in an implementation file to avoid including the // phlex/configuration.hpp in framework code. +#include "phlex_core_export.hpp" + #include namespace phlex { @@ -14,7 +16,8 @@ namespace phlex::experimental { class algorithm_name; namespace detail { - algorithm_name make_algorithm_name(configuration const* config, std::string name); + phlex_core_EXPORT algorithm_name make_algorithm_name(configuration const* config, + std::string name); } } diff --git a/phlex/core/detail/maybe_predicates.hpp b/phlex/core/detail/maybe_predicates.hpp index 196915d7..bd89e211 100644 --- a/phlex/core/detail/maybe_predicates.hpp +++ b/phlex/core/detail/maybe_predicates.hpp @@ -4,6 +4,8 @@ // This simple utility is placed in an implementation file to avoid including the // phlex/configuration.hpp in framework code. +#include "phlex_core_export.hpp" + #include #include #include @@ -13,7 +15,8 @@ namespace phlex { } namespace phlex::experimental::detail { - std::optional> maybe_predicates(configuration const* config); + phlex_core_EXPORT std::optional> maybe_predicates( + configuration const* config); } #endif // PHLEX_CORE_DETAIL_MAYBE_PREDICATES_HPP diff --git a/phlex/core/detail/repeater_node.hpp b/phlex/core/detail/repeater_node.hpp index eb9ba978..a0983994 100644 --- a/phlex/core/detail/repeater_node.hpp +++ b/phlex/core/detail/repeater_node.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_DETAIL_REPEATER_NODE_HPP #define PHLEX_CORE_DETAIL_REPEATER_NODE_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/message.hpp" #include "oneapi/tbb/concurrent_hash_map.h" @@ -15,7 +17,8 @@ namespace phlex::experimental::detail { using repeater_node_input = std::tuple; - class repeater_node : public tbb::flow::composite_node> { + class phlex_core_EXPORT repeater_node : + public tbb::flow::composite_node> { public: repeater_node(tbb::flow::graph& g, std::string node_name, identifier layer_name); diff --git a/phlex/core/edge_creation_policy.hpp b/phlex/core/edge_creation_policy.hpp index 66654497..0944f764 100644 --- a/phlex/core/edge_creation_policy.hpp +++ b/phlex/core/edge_creation_policy.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_EDGE_CREATION_POLICY_HPP #define PHLEX_CORE_EDGE_CREATION_POLICY_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/message.hpp" #include "phlex/model/product_specification.hpp" #include "phlex/model/type_id.hpp" @@ -14,7 +16,7 @@ namespace phlex::experimental { using product_name_t = std::string; - class edge_creation_policy { + class phlex_core_EXPORT edge_creation_policy { public: template edge_creation_policy(Args&... producers); diff --git a/phlex/core/edge_maker.hpp b/phlex/core/edge_maker.hpp index 07dbef26..40eb778c 100644 --- a/phlex/core/edge_maker.hpp +++ b/phlex/core/edge_maker.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_EDGE_MAKER_HPP #define PHLEX_CORE_EDGE_MAKER_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/declared_fold.hpp" #include "phlex/core/declared_output.hpp" #include "phlex/core/declared_provider.hpp" @@ -25,8 +27,8 @@ namespace phlex::experimental { using product_name_t = std::string; - index_router::provider_input_ports_t make_provider_edges(index_router::head_ports_t head_ports, - declared_providers& providers); + phlex_core_EXPORT index_router::provider_input_ports_t make_provider_edges( + index_router::head_ports_t head_ports, declared_providers& providers); class edge_maker { public: diff --git a/phlex/core/filter.hpp b/phlex/core/filter.hpp index 36ccac00..e1af1ad3 100644 --- a/phlex/core/filter.hpp +++ b/phlex/core/filter.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_FILTER_HPP #define PHLEX_CORE_FILTER_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/detail/filter_impl.hpp" #include "phlex/core/fwd.hpp" #include "phlex/core/message.hpp" @@ -12,7 +14,7 @@ namespace phlex::experimental { oneapi::tbb::flow::composite_node, std::tuple>; - class filter : public filter_base { + class phlex_core_EXPORT filter : public filter_base { using indexer_t = oneapi::tbb::flow::indexer_node; using tag_t = indexer_t::output_type; diff --git a/phlex/core/framework_graph.hpp b/phlex/core/framework_graph.hpp index 49a1a6c0..3741b0dc 100644 --- a/phlex/core/framework_graph.hpp +++ b/phlex/core/framework_graph.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_FRAMEWORK_GRAPH_HPP #define PHLEX_CORE_FRAMEWORK_GRAPH_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/declared_fold.hpp" #include "phlex/core/declared_unfold.hpp" #include "phlex/core/filter.hpp" @@ -31,7 +33,7 @@ namespace phlex { } namespace phlex::experimental { - class framework_graph { + class phlex_core_EXPORT framework_graph { public: explicit framework_graph(data_cell_index_ptr index, int max_parallelism = oneapi::tbb::info::default_concurrency()); diff --git a/phlex/core/glue.hpp b/phlex/core/glue.hpp index 86d47e12..ecdb37e9 100644 --- a/phlex/core/glue.hpp +++ b/phlex/core/glue.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_GLUE_HPP #define PHLEX_CORE_GLUE_HPP +#include "phlex_core_export.hpp" + #include "phlex/concurrency.hpp" #include "phlex/core/concepts.hpp" #include "phlex/core/registrar.hpp" @@ -23,7 +25,7 @@ namespace phlex::experimental { struct node_catalog; namespace detail { - void verify_name(std::string const& name, configuration const* config); + phlex_core_EXPORT void verify_name(std::string const& name, configuration const* config); } // ============================================================================== diff --git a/phlex/core/index_router.hpp b/phlex/core/index_router.hpp index b15065eb..5d8ecb64 100644 --- a/phlex/core/index_router.hpp +++ b/phlex/core/index_router.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_INDEX_ROUTER_HPP #define PHLEX_CORE_INDEX_ROUTER_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/fwd.hpp" #include "phlex/core/message.hpp" #include "phlex/model/data_cell_counter.hpp" @@ -30,7 +32,7 @@ namespace phlex::experimental { // join operation. It: // (a) routes index messages to either the matching layer or its data-layer parent, and // (b) emits flush tokens to the repeater to evict a cached data product from memory. - class multilayer_slot { + class phlex_core_EXPORT multilayer_slot { public: multilayer_slot(tbb::flow::graph& g, identifier layer, @@ -55,7 +57,7 @@ namespace phlex::experimental { // A layer_scope object is an RAII object that manages layer-scoped operations during // data-cell-index routing. It updates flush counters on construction and ensures cleanup // (flushing end tokens and releasing fold results) on destruction. - class layer_scope { + class phlex_core_EXPORT layer_scope { public: layer_scope(flush_counters& counters, flusher_t& flusher, @@ -74,7 +76,7 @@ namespace phlex::experimental { }; } - class index_router { + class phlex_core_EXPORT index_router { public: struct named_input_port { product_query product_label; diff --git a/phlex/core/input_arguments.hpp b/phlex/core/input_arguments.hpp index 1ad1b5c2..d15a7912 100644 --- a/phlex/core/input_arguments.hpp +++ b/phlex/core/input_arguments.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_INPUT_ARGUMENTS_HPP #define PHLEX_CORE_INPUT_ARGUMENTS_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/message.hpp" #include "phlex/core/product_query.hpp" #include "phlex/model/handle.hpp" @@ -29,8 +31,8 @@ namespace phlex::experimental { } namespace detail { - void verify_no_duplicate_input_products(std::string const& algorithm_name, - product_queries to_sort); + phlex_core_EXPORT void verify_no_duplicate_input_products(std::string const& algorithm_name, + product_queries to_sort); } template diff --git a/phlex/core/message.hpp b/phlex/core/message.hpp index bea2af04..50685060 100644 --- a/phlex/core/message.hpp +++ b/phlex/core/message.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_MESSAGE_HPP #define PHLEX_CORE_MESSAGE_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/fwd.hpp" #include "phlex/core/product_query.hpp" #include "phlex/model/fwd.hpp" @@ -44,7 +46,7 @@ namespace phlex::experimental { std::size_t id; }; - struct message_matcher { + struct phlex_core_EXPORT message_matcher { std::size_t operator()(message const& msg) const noexcept; }; @@ -62,13 +64,13 @@ namespace phlex::experimental { using named_index_ports = std::vector; // Overload for use with most_derived - message const& more_derived(message const& a, message const& b); + phlex_core_EXPORT message const& more_derived(message const& a, message const& b); // Non-template overload for single message case inline message const& most_derived(message const& msg) { return msg; } - std::size_t port_index_for(product_queries const& product_labels, - product_query const& product_label); + phlex_core_EXPORT std::size_t port_index_for(product_queries const& product_labels, + product_query const& product_label); } #endif // PHLEX_CORE_MESSAGE_HPP diff --git a/phlex/core/node_catalog.hpp b/phlex/core/node_catalog.hpp index 447f11d4..dc306db9 100644 --- a/phlex/core/node_catalog.hpp +++ b/phlex/core/node_catalog.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_NODE_CATALOG_HPP #define PHLEX_CORE_NODE_CATALOG_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/declared_fold.hpp" #include "phlex/core/declared_observer.hpp" #include "phlex/core/declared_output.hpp" @@ -17,7 +19,7 @@ #include namespace phlex::experimental { - struct node_catalog { + struct phlex_core_EXPORT node_catalog { template auto registrar_for(std::vector& errors) { diff --git a/phlex/core/product_query.hpp b/phlex/core/product_query.hpp index 76f1919d..f6f8186e 100644 --- a/phlex/core/product_query.hpp +++ b/phlex/core/product_query.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_PRODUCT_QUERY_HPP #define PHLEX_CORE_PRODUCT_QUERY_HPP +#include "phlex_core_export.hpp" + #include "phlex/model/identifier.hpp" #include "phlex/model/product_specification.hpp" #include "phlex/model/type_id.hpp" @@ -60,7 +62,7 @@ namespace phlex { }; } - struct product_query { + struct phlex_core_EXPORT product_query { detail::required_creator_name creator; detail::required_layer_name layer; std::optional suffix; diff --git a/phlex/core/products_consumer.hpp b/phlex/core/products_consumer.hpp index c6ae79c0..e8172fa2 100644 --- a/phlex/core/products_consumer.hpp +++ b/phlex/core/products_consumer.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_PRODUCTS_CONSUMER_HPP #define PHLEX_CORE_PRODUCTS_CONSUMER_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/consumer.hpp" #include "phlex/core/fwd.hpp" #include "phlex/core/input_arguments.hpp" @@ -15,7 +17,7 @@ #include namespace phlex::experimental { - class products_consumer : public consumer { + class phlex_core_EXPORT products_consumer : public consumer { public: products_consumer(algorithm_name name, std::vector predicates, diff --git a/phlex/core/registrar.hpp b/phlex/core/registrar.hpp index d51fa32e..9e41a8cc 100644 --- a/phlex/core/registrar.hpp +++ b/phlex/core/registrar.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_REGISTRAR_HPP #define PHLEX_CORE_REGISTRAR_HPP +#include "phlex_core_export.hpp" + // ======================================================================================= // // The registrar class completes the registration of a node at the end of a registration @@ -58,7 +60,8 @@ namespace phlex::experimental { namespace detail { - void add_to_error_messages(std::vector& errors, std::string const& name); + phlex_core_EXPORT void add_to_error_messages(std::vector& errors, + std::string const& name); } template diff --git a/phlex/core/registration_api.hpp b/phlex/core/registration_api.hpp index ce4d8e5b..893b04a2 100644 --- a/phlex/core/registration_api.hpp +++ b/phlex/core/registration_api.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_REGISTRATION_API_HPP #define PHLEX_CORE_REGISTRATION_API_HPP +#include "phlex_core_export.hpp" + #include "phlex/concurrency.hpp" #include "phlex/core/concepts.hpp" #include "phlex/core/declared_fold.hpp" @@ -304,7 +306,7 @@ namespace phlex::experimental { // ==================================================================================== // Output API - class output_api { + class phlex_core_EXPORT output_api { public: output_api(registrar reg, configuration const* config, diff --git a/phlex/core/store_counters.hpp b/phlex/core/store_counters.hpp index 8363a93d..6750e92f 100644 --- a/phlex/core/store_counters.hpp +++ b/phlex/core/store_counters.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_CORE_STORE_COUNTERS_HPP #define PHLEX_CORE_STORE_COUNTERS_HPP +#include "phlex_core_export.hpp" + #include "phlex/core/fwd.hpp" #include "phlex/model/data_cell_counter.hpp" #include "phlex/model/data_cell_index.hpp" @@ -14,7 +16,7 @@ #include namespace phlex::experimental { - class store_counter { + class phlex_core_EXPORT store_counter { public: void set_flush_value(flush_counts_ptr counts, std::size_t original_message_id); void increment(data_cell_index::hash_type layer_hash); @@ -35,7 +37,7 @@ namespace phlex::experimental { std::atomic ready_to_flush_{true}; }; - class count_stores { + class phlex_core_EXPORT count_stores { protected: store_counter& counter_for(data_cell_index::hash_type hash); std::unique_ptr done_with(data_cell_index::hash_type hash); diff --git a/phlex/model/CMakeLists.txt b/phlex/model/CMakeLists.txt index 6b5eabf2..8842e269 100644 --- a/phlex/model/CMakeLists.txt +++ b/phlex/model/CMakeLists.txt @@ -21,6 +21,7 @@ cet_make_library( phlex::utilities TBB::tbb ) +phlex_apply_symbol_visibility(phlex_model) install( FILES diff --git a/phlex/model/algorithm_name.hpp b/phlex/model/algorithm_name.hpp index 4ff1c5d3..4d9f637d 100644 --- a/phlex/model/algorithm_name.hpp +++ b/phlex/model/algorithm_name.hpp @@ -1,10 +1,12 @@ #ifndef PHLEX_MODEL_ALGORITHM_NAME_HPP #define PHLEX_MODEL_ALGORITHM_NAME_HPP +#include "phlex_model_export.hpp" + #include namespace phlex::experimental { - class algorithm_name { + class phlex_model_EXPORT algorithm_name { enum specified_fields { neither, either, both }; public: diff --git a/phlex/model/data_cell_counter.hpp b/phlex/model/data_cell_counter.hpp index ff5f0d50..33cb668e 100644 --- a/phlex/model/data_cell_counter.hpp +++ b/phlex/model/data_cell_counter.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_DATA_CELL_COUNTER_HPP #define PHLEX_MODEL_DATA_CELL_COUNTER_HPP +#include "phlex_model_export.hpp" + #include "phlex/model/data_cell_index.hpp" #include "phlex/model/fwd.hpp" @@ -11,7 +13,7 @@ #include namespace phlex::experimental { - class flush_counts { + class phlex_model_EXPORT flush_counts { public: flush_counts(); explicit flush_counts(std::map child_counts); @@ -33,7 +35,7 @@ namespace phlex::experimental { std::map child_counts_{}; }; - class data_cell_counter { + class phlex_model_EXPORT data_cell_counter { public: data_cell_counter(); data_cell_counter(data_cell_counter* parent, std::string const& layer_name); @@ -56,7 +58,7 @@ namespace phlex::experimental { std::map child_counts_{}; }; - class flush_counters { + class phlex_model_EXPORT flush_counters { public: void update(data_cell_index_ptr const id); flush_counts extract(data_cell_index_ptr const id); diff --git a/phlex/model/data_cell_index.hpp b/phlex/model/data_cell_index.hpp index 3cebad72..dcd207bd 100644 --- a/phlex/model/data_cell_index.hpp +++ b/phlex/model/data_cell_index.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_DATA_CELL_INDEX_HPP #define PHLEX_MODEL_DATA_CELL_INDEX_HPP +#include "phlex_model_export.hpp" + #include "phlex/model/fwd.hpp" #include @@ -13,7 +15,7 @@ #include namespace phlex { - class data_cell_index : public std::enable_shared_from_this { + class phlex_model_EXPORT data_cell_index : public std::enable_shared_from_this { public: static data_cell_index const& base(); static data_cell_index_ptr base_ptr(); @@ -35,7 +37,7 @@ namespace phlex { std::string to_string() const; std::string to_string_this_layer() const; - friend std::ostream& operator<<(std::ostream& os, data_cell_index const& id); + friend phlex_model_EXPORT std::ostream& operator<<(std::ostream& os, data_cell_index const& id); private: data_cell_index(); @@ -47,8 +49,6 @@ namespace phlex { std::size_t depth_{}; hash_type hash_{0}; }; - - std::ostream& operator<<(std::ostream& os, data_cell_index const& id); } namespace std { diff --git a/phlex/model/data_layer_hierarchy.hpp b/phlex/model/data_layer_hierarchy.hpp index b9414131..a2713914 100644 --- a/phlex/model/data_layer_hierarchy.hpp +++ b/phlex/model/data_layer_hierarchy.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_DATA_LAYER_HIERARCHY_HPP #define PHLEX_MODEL_DATA_LAYER_HIERARCHY_HPP +#include "phlex_model_export.hpp" + #include "phlex/model/data_cell_index.hpp" #include "phlex/model/fwd.hpp" @@ -13,7 +15,7 @@ namespace phlex::experimental { - class data_layer_hierarchy { + class phlex_model_EXPORT data_layer_hierarchy { public: ~data_layer_hierarchy(); void increment_count(data_cell_index_ptr const& id); diff --git a/phlex/model/identifier.hpp b/phlex/model/identifier.hpp index d78c638a..d5181d90 100644 --- a/phlex/model/identifier.hpp +++ b/phlex/model/identifier.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_IDENTIFIER_HPP #define PHLEX_MODEL_IDENTIFIER_HPP +#include "phlex_model_export.hpp" + #include #include @@ -18,7 +20,7 @@ namespace phlex::experimental { /// Carries around the string itself (as a shared_ptr to string to make copies lighter) /// along with a precomputed hash used for all comparisons - class identifier { + class phlex_model_EXPORT identifier { public: static std::uint64_t hash_string(std::string_view str); identifier(identifier const& other) = default; @@ -44,8 +46,9 @@ namespace phlex::experimental { std::string const& trans_get_string() const noexcept { return content_; } // Comparison operators with _id queries - friend bool operator==(identifier const& lhs, identifier_query rhs); - friend std::strong_ordering operator<=>(identifier const& lhs, identifier_query rhs); + friend phlex_model_EXPORT bool operator==(identifier const& lhs, identifier_query rhs); + friend phlex_model_EXPORT std::strong_ordering operator<=>(identifier const& lhs, + identifier_query rhs); friend std::hash; private: @@ -55,8 +58,8 @@ namespace phlex::experimental { // Identifier UDL namespace literals { - identifier operator""_id(char const* lit, std::size_t len); - identifier_query operator""_idq(char const* lit, std::size_t len); + phlex_model_EXPORT identifier operator""_id(char const* lit, std::size_t len); + phlex_model_EXPORT identifier_query operator""_idq(char const* lit, std::size_t len); } // Really trying to avoid the extra function call here diff --git a/phlex/model/product_matcher.hpp b/phlex/model/product_matcher.hpp index 632273f0..2ca5a55e 100644 --- a/phlex/model/product_matcher.hpp +++ b/phlex/model/product_matcher.hpp @@ -9,13 +9,15 @@ // // ======================================================================================= +#include "phlex_model_export.hpp" + #include "phlex/model/fwd.hpp" #include #include namespace phlex::experimental { - class product_matcher { + class phlex_model_EXPORT product_matcher { public: explicit product_matcher(std::string matcher_spec); bool matches(product_store_const_ptr const& store) const; diff --git a/phlex/model/product_specification.hpp b/phlex/model/product_specification.hpp index 18a09e05..d15584d3 100644 --- a/phlex/model/product_specification.hpp +++ b/phlex/model/product_specification.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_PRODUCT_SPECIFICATION_HPP #define PHLEX_MODEL_PRODUCT_SPECIFICATION_HPP +#include "phlex_model_export.hpp" + #include "phlex/model/algorithm_name.hpp" #include "phlex/model/type_id.hpp" @@ -9,7 +11,7 @@ #include namespace phlex::experimental { - class product_specification { + class phlex_model_EXPORT product_specification { public: product_specification(); product_specification(char const* name); @@ -38,9 +40,8 @@ namespace phlex::experimental { using product_specifications = std::vector; - product_specifications to_product_specifications(std::string name, - std::vector output_labels, - std::vector output_types); + phlex_model_EXPORT product_specifications to_product_specifications( + std::string name, std::vector output_labels, std::vector output_types); } #endif // PHLEX_MODEL_PRODUCT_SPECIFICATION_HPP diff --git a/phlex/model/product_store.hpp b/phlex/model/product_store.hpp index 480ff96a..c3750539 100644 --- a/phlex/model/product_store.hpp +++ b/phlex/model/product_store.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_PRODUCT_STORE_HPP #define PHLEX_MODEL_PRODUCT_STORE_HPP +#include "phlex_model_export.hpp" + #include "phlex/model/data_cell_index.hpp" #include "phlex/model/fwd.hpp" #include "phlex/model/handle.hpp" @@ -13,7 +15,7 @@ #include namespace phlex::experimental { - class product_store { + class phlex_model_EXPORT product_store { public: explicit product_store(data_cell_index_ptr id, std::string source = "Source", @@ -53,7 +55,8 @@ namespace phlex::experimental { source_; // FIXME: Should not have to copy the string (the source should outlive the product store) }; - product_store_ptr const& more_derived(product_store_ptr const& a, product_store_ptr const& b); + phlex_model_EXPORT product_store_ptr const& more_derived(product_store_ptr const& a, + product_store_ptr const& b); // Non-template overload for single product_store_ptr case inline product_store_ptr const& most_derived(product_store_ptr const& store) { return store; } diff --git a/phlex/model/products.hpp b/phlex/model/products.hpp index 1729427f..7985524c 100644 --- a/phlex/model/products.hpp +++ b/phlex/model/products.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_PRODUCTS_HPP #define PHLEX_MODEL_PRODUCTS_HPP +#include "phlex_model_export.hpp" + #include "phlex/model/product_specification.hpp" #include @@ -32,7 +34,7 @@ namespace phlex::experimental { std::remove_cvref_t obj; }; - class products { + class phlex_model_EXPORT products { using collection_t = std::unordered_map>; public: diff --git a/phlex/utilities/CMakeLists.txt b/phlex/utilities/CMakeLists.txt index cc6c0228..7355d3f1 100644 --- a/phlex/utilities/CMakeLists.txt +++ b/phlex/utilities/CMakeLists.txt @@ -11,6 +11,7 @@ cet_make_library( PUBLIC spdlog::spdlog ) +phlex_apply_symbol_visibility(phlex_utilities) install( FILES diff --git a/phlex/utilities/hashing.hpp b/phlex/utilities/hashing.hpp index 04b6c045..5078892a 100644 --- a/phlex/utilities/hashing.hpp +++ b/phlex/utilities/hashing.hpp @@ -1,14 +1,16 @@ #ifndef PHLEX_UTILITIES_HASHING_HPP #define PHLEX_UTILITIES_HASHING_HPP +#include "phlex_utilities_export.hpp" + #include #include namespace phlex::experimental { - std::size_t hash(std::string const& str); - std::size_t hash(std::size_t i) noexcept; - std::size_t hash(std::size_t i, std::size_t j); - std::size_t hash(std::size_t i, std::string const& str); + phlex_utilities_EXPORT std::size_t hash(std::string const& str); + phlex_utilities_EXPORT std::size_t hash(std::size_t i) noexcept; + phlex_utilities_EXPORT std::size_t hash(std::size_t i, std::size_t j); + phlex_utilities_EXPORT std::size_t hash(std::size_t i, std::string const& str); template std::size_t hash(std::size_t i, std::size_t j, Ts... ks) { diff --git a/phlex/utilities/resource_usage.hpp b/phlex/utilities/resource_usage.hpp index f79f4b4c..4a5cfab4 100644 --- a/phlex/utilities/resource_usage.hpp +++ b/phlex/utilities/resource_usage.hpp @@ -6,10 +6,12 @@ // resource_usage object. The destructor will also report the maximum RSS of the process. // ======================================================================================= +#include "phlex_utilities_export.hpp" + #include namespace phlex::experimental { - class resource_usage { + class phlex_utilities_EXPORT resource_usage { public: resource_usage() noexcept; ~resource_usage();