diff --git a/cmake/HPX_ParcelPorts.cmake b/cmake/HPX_ParcelPorts.cmake index 0c7aab45bb31..8c15d47c1744 100644 --- a/cmake/HPX_ParcelPorts.cmake +++ b/cmake/HPX_ParcelPorts.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Hartmut Kaiser +# Copyright (c) 2021-2023 Hartmut Kaiser # # SPDX-License-Identifier: BSL-1.0 # Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -12,14 +12,24 @@ if(HPX_WITH_DISTRIBUTED_RUNTIME) # add_subdirectory is called before to insure HPX_STATIC_PARCELPORT_PLUGINS # cache variable is filled set(_parcelport_export) + set(_parcelport_export_source) set(_parcelport_init) foreach(parcelport ${HPX_STATIC_PARCELPORT_PLUGINS}) set(_parcelport_export - "${_parcelport_export}HPX_EXPORT hpx::plugins::parcelport_factory_base *${parcelport}_factory_init(\n" + "${_parcelport_export}extern HPX_EXPORT hpx::plugins::parcelport_factory_base *\n" ) set(_parcelport_export - "${_parcelport_export} std::vector& factories);\n" + "${_parcelport_export} (*${parcelport}_factory_init)(\n" + ) + set(_parcelport_export + "${_parcelport_export} std::vector& factories);\n" + ) + set(_parcelport_export_source + "${_parcelport_export_source}hpx::plugins::parcelport_factory_base * (*${parcelport}_factory_init)(\n" + ) + set(_parcelport_export_source + "${_parcelport_export_source} std::vector& factories) = nullptr;\n" ) set(_parcelport_init "${_parcelport_init} ${parcelport}_factory_init(factories);\n" @@ -31,4 +41,10 @@ if(HPX_WITH_DISTRIBUTED_RUNTIME) "${PROJECT_BINARY_DIR}/libs/full/parcelset/include/hpx/parcelset/static_parcelports.hpp" @ONLY ) + + configure_file( + "${PROJECT_SOURCE_DIR}/cmake/templates/static_parcelports_impl.hpp.in" + "${PROJECT_BINARY_DIR}/libs/full/parcelset/include/hpx/parcelset/static_parcelports_impl.hpp" + @ONLY + ) endif() diff --git a/cmake/templates/static_parcelports.hpp.in b/cmake/templates/static_parcelports.hpp.in index 4f068f446455..481f0725689d 100644 --- a/cmake/templates/static_parcelports.hpp.in +++ b/cmake/templates/static_parcelports.hpp.in @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Thomas Heller -// Copyright (c) 2007-2021 Hartmut Kaiser +// Copyright (c) 2007-2023 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -9,7 +9,7 @@ #pragma once -#include +#include #include #include @@ -17,7 +17,7 @@ @_parcelport_export@ namespace hpx::parcelset { - void init_static_parcelport_factories( + inline void init_static_parcelport_factories( std::vector& factories) { @_parcelport_init@ } diff --git a/cmake/templates/static_parcelports_impl.hpp.in b/cmake/templates/static_parcelports_impl.hpp.in new file mode 100644 index 000000000000..614c63c45b54 --- /dev/null +++ b/cmake/templates/static_parcelports_impl.hpp.in @@ -0,0 +1,18 @@ +// Copyright (c) 2012-2015 Thomas Heller +// Copyright (c) 2007-2023 Hartmut Kaiser +// +// SPDX-License-Identifier: BSL-1.0 +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// Do not edit this file! It has been generated by the cmake configuration step. + +#pragma once + +#include +#include +#include + +#include + +@_parcelport_export_source@ diff --git a/components/parcel_plugins/binary_filter/bzip2/CMakeLists.txt b/components/parcel_plugins/binary_filter/bzip2/CMakeLists.txt index cd0ed71697ec..33d173ab75af 100644 --- a/components/parcel_plugins/binary_filter/bzip2/CMakeLists.txt +++ b/components/parcel_plugins/binary_filter/bzip2/CMakeLists.txt @@ -30,14 +30,15 @@ add_hpx_library( "hpx/binary_filter/bzip2_serialization_filter.hpp" "hpx/binary_filter/bzip2_serialization_filter_registration.hpp" PREPEND_HEADER_ROOT INSTALL_HEADERS - FOLDER "Core/Plugins/Compression" - DEPENDENCIES ${BZIP2_LIBRARIES} ${HPX_WITH_UNITY_BUILD_OPTION} + FOLDER "Core/Plugins/Compression" ${HPX_WITH_UNITY_BUILD_OPTION} ) target_include_directories( compression_bzip2 SYSTEM PRIVATE ${BZIP2_INCLUDE_DIR} ) -target_link_libraries(compression_bzip2 PUBLIC Boost::iostreams) +target_link_libraries( + compression_bzip2 PUBLIC Boost::iostreams ${BZIP2_LIBRARIES} +) add_hpx_pseudo_dependencies( components.parcel_plugins.binary_filter.bzip2 compression_bzip2 diff --git a/components/parcel_plugins/binary_filter/snappy/CMakeLists.txt b/components/parcel_plugins/binary_filter/snappy/CMakeLists.txt index ebc41f37b119..6550e27e3ca1 100644 --- a/components/parcel_plugins/binary_filter/snappy/CMakeLists.txt +++ b/components/parcel_plugins/binary_filter/snappy/CMakeLists.txt @@ -30,8 +30,7 @@ add_hpx_library( "hpx/binary_filter/snappy_serialization_filter.hpp" "hpx/binary_filter/snappy_serialization_filter_registration.hpp" PREPEND_HEADER_ROOT INSTALL_HEADERS - FOLDER "Core/Plugins/Compression" - DEPENDENCIES ${SNAPPY_LIBRARY} ${HPX_WITH_UNITY_BUILD_OPTION} + FOLDER "Core/Plugins/Compression" ${HPX_WITH_UNITY_BUILD_OPTION} ) target_include_directories( @@ -39,7 +38,9 @@ target_include_directories( ) target_link_directories(compression_snappy PRIVATE ${SNAPPY_LIBRARY_DIR}) -target_link_libraries(compression_snappy PUBLIC Boost::iostreams) +target_link_libraries( + compression_snappy PUBLIC Boost::iostreams ${SNAPPY_LIBRARY} +) add_hpx_pseudo_dependencies( components.parcel_plugins.binary_filter.snappy compression_snappy diff --git a/components/parcel_plugins/binary_filter/zlib/CMakeLists.txt b/components/parcel_plugins/binary_filter/zlib/CMakeLists.txt index 1b324f17e1c7..6dba673e7225 100644 --- a/components/parcel_plugins/binary_filter/zlib/CMakeLists.txt +++ b/components/parcel_plugins/binary_filter/zlib/CMakeLists.txt @@ -30,12 +30,13 @@ add_hpx_library( "hpx/binary_filter/zlib_serialization_filter.hpp" "hpx/binary_filter/zlib_serialization_filter_registration.hpp" PREPEND_HEADER_ROOT INSTALL_HEADERS - FOLDER "Core/Plugins/Compression" - DEPENDENCIES ${ZLIB_LIBRARIES} ${HPX_WITH_UNITY_BUILD_OPTION} + FOLDER "Core/Plugins/Compression" ${HPX_WITH_UNITY_BUILD_OPTION} ) target_include_directories(compression_zlib SYSTEM PRIVATE ${ZLIB_INCLUDE_DIRS}) -target_link_libraries(compression_zlib PUBLIC Boost::iostreams) +target_link_libraries( + compression_zlib PUBLIC Boost::iostreams ${ZLIB_LIBRARIES} +) add_hpx_pseudo_dependencies( components.parcel_plugins.binary_filter.zlib compression_zlib diff --git a/libs/full/parcelset/CMakeLists.txt b/libs/full/parcelset/CMakeLists.txt index 3b331756c5a8..9adda527c92a 100644 --- a/libs/full/parcelset/CMakeLists.txt +++ b/libs/full/parcelset/CMakeLists.txt @@ -41,7 +41,7 @@ set(parcelset_compat_headers set(parcelset_sources detail/message_handler_interface_functions.cpp detail/parcel_await.cpp - message_handler.cpp parcel.cpp parcelhandler.cpp + message_handler.cpp parcel.cpp parcelhandler.cpp static_parcelports.cpp ) if(HPX_WITH_DISTRIBUTED_RUNTIME) diff --git a/libs/full/plugin_factories/include/hpx/plugin_factories/parcelport_factory.hpp b/libs/full/plugin_factories/include/hpx/plugin_factories/parcelport_factory.hpp index 763aab44c689..00765ea4d297 100644 --- a/libs/full/plugin_factories/include/hpx/plugin_factories/parcelport_factory.hpp +++ b/libs/full/plugin_factories/include/hpx/plugin_factories/parcelport_factory.hpp @@ -1,5 +1,5 @@ // Copyright (c) 2014 Thomas Heller -// Copyright (c) 2007-2022 Hartmut Kaiser +// Copyright (c) 2007-2023 Hartmut Kaiser // Copyright (c) 2020 Google // // SPDX-License-Identifier: BSL-1.0 @@ -178,14 +178,25 @@ namespace hpx::plugins { HPX_DEF_UNIQUE_PLUGIN_NAME( \ HPX_PP_CAT(pluginname, _plugin_factory_type), pp) \ template struct hpx::plugins::parcelport_factory; \ + extern HPX_EXPORT hpx::plugins::parcelport_factory_base* ( \ + *HPX_PP_CAT(pluginname, _factory_init))( \ + std::vector & factories); \ HPX_EXPORT hpx::plugins::parcelport_factory_base* HPX_PP_CAT( \ - pluginname, _factory_init)( \ + pluginname, _factory_init_impl)( \ std::vector & factories) \ { \ static HPX_PP_CAT(pluginname, _plugin_factory_type) \ factory(factories); \ return &factory; \ } \ + struct HPX_EXPORT HPX_PP_CAT(pluginname, _init_type) \ + { \ + HPX_PP_CAT(pluginname, _init_type)() \ + { \ + HPX_PP_CAT(pluginname, _factory_init) = \ + HPX_PP_CAT(pluginname, _factory_init_impl); \ + } \ + } HPX_PP_CAT(pluginname, _init); \ /**/ #define HPX_REGISTER_PARCELPORT(Parcelport, pluginname) \