diff --git a/CMakeLists.txt b/CMakeLists.txt index a5547316f..ef17c00bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ FetchContent_MakeAvailable(Catch2 GSL mimicpp) include(Modules/private/CreateClangTidyTargets.cmake) 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 000000000..d376b9f25 --- /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 542636260..0bdb3d19b 100644 --- a/phlex/CMakeLists.txt +++ b/phlex/CMakeLists.txt @@ -34,6 +34,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 3c0a57af0..9f9d44592 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 14d3ba1f4..38b7a4520 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 96161b773..c275ebcbe 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 ec1dbe940..e7be449f9 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 b456b9137..328ec2982 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 7dcf3945d..7346a5983 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 e2e24664e..f73d287fd 100644 --- a/phlex/core/CMakeLists.txt +++ b/phlex/core/CMakeLists.txt @@ -41,6 +41,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 11f5205ef..b58a13475 100644 --- a/phlex/core/consumer.hpp +++ b/phlex/core/consumer.hpp @@ -2,12 +2,13 @@ #define PHLEX_CORE_CONSUMER_HPP #include "phlex/model/algorithm_name.hpp" +#include "phlex_core_export.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 c1e337bf8..69276cddd 100644 --- a/phlex/core/declared_fold.hpp +++ b/phlex/core/declared_fold.hpp @@ -16,6 +16,7 @@ #include "phlex/model/product_specification.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_unordered_map.h" #include "oneapi/tbb/flow_graph.h" @@ -33,7 +34,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 eebe0235b..0d1ce3b98 100644 --- a/phlex/core/declared_observer.hpp +++ b/phlex/core/declared_observer.hpp @@ -15,6 +15,7 @@ #include "phlex/model/product_specification.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" #include "oneapi/tbb/flow_graph.h" @@ -30,7 +31,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 7ca82f4f2..0b9bffe84 100644 --- a/phlex/core/declared_output.hpp +++ b/phlex/core/declared_output.hpp @@ -7,6 +7,7 @@ #include "phlex/model/algorithm_name.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" @@ -20,7 +21,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 2606cdc1c..f6334aaaf 100644 --- a/phlex/core/declared_predicate.hpp +++ b/phlex/core/declared_predicate.hpp @@ -15,6 +15,7 @@ #include "phlex/model/handle.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" #include "oneapi/tbb/flow_graph.h" @@ -33,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 57e2a3f93..c67f512d3 100644 --- a/phlex/core/declared_provider.hpp +++ b/phlex/core/declared_provider.hpp @@ -11,6 +11,7 @@ #include "phlex/model/product_specification.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" #include "oneapi/tbb/concurrent_unordered_map.h" @@ -26,7 +27,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 fdb04738b..bdf21e527 100644 --- a/phlex/core/declared_transform.hpp +++ b/phlex/core/declared_transform.hpp @@ -18,6 +18,7 @@ #include "phlex/model/product_specification.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" #include "oneapi/tbb/concurrent_unordered_map.h" @@ -37,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 967f76d0c..b07d34d57 100644 --- a/phlex/core/declared_unfold.hpp +++ b/phlex/core/declared_unfold.hpp @@ -13,6 +13,7 @@ #include "phlex/model/product_specification.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" #include "oneapi/tbb/flow_graph.h" @@ -32,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, @@ -53,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 4d6dcd2de..fab00db5c 100644 --- a/phlex/core/detail/filter_impl.hpp +++ b/phlex/core/detail/filter_impl.hpp @@ -4,6 +4,7 @@ #include "phlex/core/fwd.hpp" #include "phlex/core/product_query.hpp" #include "phlex/model/product_store.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" @@ -29,7 +30,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 +48,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 1e86b2ddb..4e2437b24 100644 --- a/phlex/core/detail/make_algorithm_name.hpp +++ b/phlex/core/detail/make_algorithm_name.hpp @@ -6,6 +6,8 @@ #include +#include "phlex_core_export.hpp" + namespace phlex { class configuration; } @@ -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 196915d7f..294122d65 100644 --- a/phlex/core/detail/maybe_predicates.hpp +++ b/phlex/core/detail/maybe_predicates.hpp @@ -8,12 +8,15 @@ #include #include +#include "phlex_core_export.hpp" + namespace phlex { class configuration; } 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/edge_creation_policy.hpp b/phlex/core/edge_creation_policy.hpp index b149e3b6e..17bca4375 100644 --- a/phlex/core/edge_creation_policy.hpp +++ b/phlex/core/edge_creation_policy.hpp @@ -4,6 +4,7 @@ #include "phlex/core/message.hpp" #include "phlex/model/product_specification.hpp" #include "phlex/model/type_id.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" @@ -14,7 +15,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 8aef9b260..7764949bb 100644 --- a/phlex/core/edge_maker.hpp +++ b/phlex/core/edge_maker.hpp @@ -6,6 +6,7 @@ #include "phlex/core/edge_creation_policy.hpp" #include "phlex/core/filter.hpp" #include "phlex/core/multiplexer.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" #include "spdlog/spdlog.h" @@ -24,8 +25,8 @@ namespace phlex::experimental { using product_name_t = std::string; - multiplexer::input_ports_t make_provider_edges(multiplexer::head_ports_t head_ports, - declared_providers& providers); + phlex_core_EXPORT multiplexer::input_ports_t make_provider_edges( + multiplexer::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 36ccac003..d5e83c8a9 100644 --- a/phlex/core/filter.hpp +++ b/phlex/core/filter.hpp @@ -4,6 +4,7 @@ #include "phlex/core/detail/filter_impl.hpp" #include "phlex/core/fwd.hpp" #include "phlex/core/message.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" @@ -12,7 +13,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 6dc8b7e73..be2de83e7 100644 --- a/phlex/core/framework_graph.hpp +++ b/phlex/core/framework_graph.hpp @@ -16,6 +16,7 @@ #include "phlex/source.hpp" #include "phlex/utilities/max_allowed_parallelism.hpp" #include "phlex/utilities/resource_usage.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" #include "oneapi/tbb/info.h" @@ -34,7 +35,7 @@ namespace phlex { } namespace phlex::experimental { - class layer_sentry { + class phlex_core_EXPORT layer_sentry { public: layer_sentry(flush_counters& counters, message_sender& sender, product_store_ptr store); ~layer_sentry(); @@ -47,7 +48,7 @@ namespace phlex::experimental { std::size_t depth_; }; - 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 86d47e12d..df9a0c66c 100644 --- a/phlex/core/glue.hpp +++ b/phlex/core/glue.hpp @@ -6,6 +6,7 @@ #include "phlex/core/registrar.hpp" #include "phlex/core/registration_api.hpp" #include "phlex/metaprogramming/delegate.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" @@ -23,7 +24,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/input_arguments.hpp b/phlex/core/input_arguments.hpp index 4e7e429e1..e90414fca 100644 --- a/phlex/core/input_arguments.hpp +++ b/phlex/core/input_arguments.hpp @@ -4,6 +4,7 @@ #include "phlex/core/message.hpp" #include "phlex/core/product_query.hpp" #include "phlex/model/handle.hpp" +#include "phlex_core_export.hpp" #include #include @@ -29,8 +30,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 d1e188c5f..185dba325 100644 --- a/phlex/core/message.hpp +++ b/phlex/core/message.hpp @@ -6,6 +6,7 @@ #include "phlex/model/handle.hpp" #include "phlex/model/product_store.hpp" #include "phlex/utilities/sized_tuple.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" // <-- belongs somewhere else @@ -26,12 +27,12 @@ namespace phlex::experimental { template using messages_t = sized_tuple; - struct MessageHasher { + struct phlex_core_EXPORT MessageHasher { std::size_t operator()(message const& msg) const noexcept; }; // 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); namespace detail { template @@ -39,7 +40,7 @@ namespace phlex::experimental { using no_join_base_t = tbb::flow::function_node, tbb::flow::lightweight>; - struct no_join : no_join_base_t { + struct phlex_core_EXPORT no_join : no_join_base_t { no_join(tbb::flow::graph& g, MessageHasher); }; } @@ -66,8 +67,8 @@ namespace phlex::experimental { } } - 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); template tbb::flow::receiver& receiver_for(detail::join_messages_t& join, diff --git a/phlex/core/message_sender.hpp b/phlex/core/message_sender.hpp index 5aea9357a..2aedaa272 100644 --- a/phlex/core/message_sender.hpp +++ b/phlex/core/message_sender.hpp @@ -5,12 +5,13 @@ #include "phlex/core/message.hpp" #include "phlex/core/multiplexer.hpp" #include "phlex/model/fwd.hpp" +#include "phlex_core_export.hpp" #include namespace phlex::experimental { - class message_sender { + class phlex_core_EXPORT message_sender { public: explicit message_sender(multiplexer& mplexer); diff --git a/phlex/core/multiplexer.hpp b/phlex/core/multiplexer.hpp index 846aed779..516b22673 100644 --- a/phlex/core/multiplexer.hpp +++ b/phlex/core/multiplexer.hpp @@ -3,6 +3,7 @@ #include "phlex/core/message.hpp" #include "phlex/model/data_cell_index.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" #include "oneapi/tbb/flow_graph.h" @@ -15,7 +16,7 @@ namespace phlex::experimental { - class multiplexer : public tbb::flow::function_node { + class phlex_core_EXPORT multiplexer : public tbb::flow::function_node { using base = tbb::flow::function_node; public: diff --git a/phlex/core/node_catalog.hpp b/phlex/core/node_catalog.hpp index 447f11d40..cb9641888 100644 --- a/phlex/core/node_catalog.hpp +++ b/phlex/core/node_catalog.hpp @@ -10,6 +10,7 @@ #include "phlex/core/declared_unfold.hpp" #include "phlex/core/registrar.hpp" #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include "boost/pfr.hpp" @@ -17,7 +18,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 d11b9b696..f36003c4b 100644 --- a/phlex/core/product_query.hpp +++ b/phlex/core/product_query.hpp @@ -2,13 +2,14 @@ #define PHLEX_CORE_PRODUCT_QUERY_HPP #include "phlex/model/product_specification.hpp" +#include "phlex_core_export.hpp" // #include #include #include namespace phlex { - class product_query { + class phlex_core_EXPORT product_query { public: product_query(experimental::product_specification spec, std::string layer); @@ -29,7 +30,7 @@ namespace phlex { } namespace phlex::experimental { - struct product_tag { + struct phlex_core_EXPORT product_tag { product_specification spec; product_query operator()(std::string layer) &&; }; @@ -72,7 +73,7 @@ namespace phlex::experimental { } namespace phlex { - experimental::product_tag operator""_in(char const* str, std::size_t); + phlex_core_EXPORT experimental::product_tag operator""_in(char const* str, std::size_t); } #endif // PHLEX_CORE_PRODUCT_QUERY_HPP diff --git a/phlex/core/products_consumer.hpp b/phlex/core/products_consumer.hpp index ee7a12532..b84c2f6f6 100644 --- a/phlex/core/products_consumer.hpp +++ b/phlex/core/products_consumer.hpp @@ -7,6 +7,7 @@ #include "phlex/core/message.hpp" #include "phlex/core/product_query.hpp" #include "phlex/model/algorithm_name.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/flow_graph.h" @@ -14,7 +15,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 92ef9e55b..32b4dc9b3 100644 --- a/phlex/core/registrar.hpp +++ b/phlex/core/registrar.hpp @@ -48,6 +48,7 @@ // ======================================================================================= #include "phlex/utilities/simple_ptr_map.hpp" +#include "phlex_core_export.hpp" #include #include @@ -58,7 +59,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 66ceae608..b9fab2da8 100644 --- a/phlex/core/registration_api.hpp +++ b/phlex/core/registration_api.hpp @@ -10,6 +10,7 @@ #include "phlex/metaprogramming/delegate.hpp" #include "phlex/metaprogramming/type_deduction.hpp" #include "phlex/model/algorithm_name.hpp" +#include "phlex_core_export.hpp" #include #include @@ -304,7 +305,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 f509c7a8c..2b526bbb1 100644 --- a/phlex/core/store_counters.hpp +++ b/phlex/core/store_counters.hpp @@ -5,6 +5,7 @@ #include "phlex/model/data_cell_counter.hpp" #include "phlex/model/data_cell_index.hpp" #include "phlex/model/product_store.hpp" +#include "phlex_core_export.hpp" #include "oneapi/tbb/concurrent_hash_map.h" #include "oneapi/tbb/concurrent_unordered_map.h" @@ -14,7 +15,7 @@ #include namespace phlex::experimental { - class store_flag { + class phlex_core_EXPORT store_flag { public: void flush_received(std::size_t original_message_id); bool is_complete() const noexcept; @@ -28,7 +29,7 @@ namespace phlex::experimental { original_message_id_{}; // Necessary for matching inputs to downstream join nodes. }; - class detect_flush_flag { + class phlex_core_EXPORT detect_flush_flag { protected: void mark_flush_received(data_cell_index::hash_type hash, std::size_t original_message_id); void mark_processed(data_cell_index::hash_type hash); @@ -45,7 +46,7 @@ namespace phlex::experimental { // ========================================================================= - class store_counter { + class phlex_core_EXPORT store_counter { public: void set_flush_value(product_store_const_ptr const& ptr, std::size_t original_message_id); void increment(data_cell_index::hash_type layer_hash); @@ -66,7 +67,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/graph/CMakeLists.txt b/phlex/graph/CMakeLists.txt index 3b668d173..1fc3a7174 100644 --- a/phlex/graph/CMakeLists.txt +++ b/phlex/graph/CMakeLists.txt @@ -11,6 +11,7 @@ cet_make_library( phlex::utilities fmt::fmt ) +phlex_apply_symbol_visibility(phlex_graph) install(FILES serial_node.hpp serializer_node.hpp DESTINATION include/phlex/graph) diff --git a/phlex/graph/serializer_node.hpp b/phlex/graph/serializer_node.hpp index 5e5975d69..92d6863d3 100644 --- a/phlex/graph/serializer_node.hpp +++ b/phlex/graph/serializer_node.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_GRAPH_SERIALIZER_NODE_HPP #define PHLEX_GRAPH_SERIALIZER_NODE_HPP +#include "phlex_graph_export.hpp" + #include "phlex/utilities/sized_tuple.hpp" #include "oneapi/tbb/flow_graph.h" @@ -13,7 +15,7 @@ namespace phlex::experimental { using token_t = int; using base_impl = tbb::flow::buffer_node; - class serializer_node : public base_impl { + class phlex_graph_EXPORT serializer_node : public base_impl { public: explicit serializer_node(tbb::flow::graph& g, std::string const& name) : base_impl{g}, name_{name} @@ -35,7 +37,7 @@ namespace phlex::experimental { std::string name_; }; - class serializers { + class phlex_graph_EXPORT serializers { public: explicit serializers(tbb::flow::graph& g); void activate(); diff --git a/phlex/model/CMakeLists.txt b/phlex/model/CMakeLists.txt index 256bae49f..8ba0ab614 100644 --- a/phlex/model/CMakeLists.txt +++ b/phlex/model/CMakeLists.txt @@ -22,6 +22,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 4ff1c5d3a..4d9f637d4 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 f744a18b1..c041f1f27 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); @@ -35,7 +37,7 @@ namespace phlex::experimental { using flush_counts_ptr = std::shared_ptr; - 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); @@ -58,7 +60,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 3e70752f4..f51687e03 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 @@ -12,7 +14,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(); @@ -34,7 +36,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(); @@ -46,8 +48,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 b94141315..a27139140 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 b9ca23d73..334e54172 100644 --- a/phlex/model/identifier.hpp +++ b/phlex/model/identifier.hpp @@ -1,6 +1,8 @@ #ifndef PHLEX_MODEL_IDENTIFIER_H_ #define PHLEX_MODEL_IDENTIFIER_H_ +#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; @@ -38,8 +40,9 @@ namespace phlex::experimental { std::strong_ordering operator<=>(identifier const& rhs) const noexcept; // 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); + phlex_model_EXPORT friend bool operator==(identifier const& lhs, identifier_query rhs); + phlex_model_EXPORT friend std::strong_ordering operator<=>(identifier const& lhs, + identifier_query rhs); friend std::hash; private: @@ -49,8 +52,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 632273f06..2ca5a55e0 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 18a09e05d..d15584d33 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 22eeeb620..7f08efcd0 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" @@ -14,7 +16,7 @@ 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", @@ -58,7 +60,8 @@ namespace phlex::experimental { stage stage_; }; - 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); template Element const& get_most_derived(Tuple const& tup, Element const& element) diff --git a/phlex/model/products.hpp b/phlex/model/products.hpp index 1729427f6..7985524c0 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 cc6c0228d..7355d3f1b 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 04b6c0455..5078892af 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 f79f4b4c6..4a5cfab48 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();