Skip to content

Commit

Permalink
Fixing cyclic dependencies related to parcelport symbols
Browse files Browse the repository at this point in the history
- flyby: fixing compression filter linking order
  • Loading branch information
hkaiser committed Aug 11, 2023
1 parent a42c8f9 commit 02465de
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 18 deletions.
22 changes: 19 additions & 3 deletions cmake/HPX_ParcelPorts.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<hpx::plugins::parcelport_factory_base *>& factories);\n"
"${_parcelport_export} (*${parcelport}_factory_init)(\n"
)
set(_parcelport_export
"${_parcelport_export} std::vector<hpx::plugins::parcelport_factory_base *>& 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<hpx::plugins::parcelport_factory_base *>& factories) = nullptr;\n"
)
set(_parcelport_init
"${_parcelport_init} ${parcelport}_factory_init(factories);\n"
Expand All @@ -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()
6 changes: 3 additions & 3 deletions cmake/templates/static_parcelports.hpp.in
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,15 +9,15 @@

#pragma once

#include <hpx/assert.hpp>
#include <hpx/config.hpp>
#include <hpx/plugin_factories/parcelport_factory_base.hpp>

#include <vector>

@_parcelport_export@
namespace hpx::parcelset
{
void init_static_parcelport_factories(
inline void init_static_parcelport_factories(
std::vector<plugins::parcelport_factory_base *>& factories)
{
@_parcelport_init@ }
Expand Down
18 changes: 18 additions & 0 deletions cmake/templates/static_parcelports_impl.hpp.in
Original file line number Diff line number Diff line change
@@ -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 <hpx/config.hpp>
#include <hpx/parcelset/static_parcelports.hpp>
#include <hpx/plugin_factories/parcelport_factory_base.hpp>

#include <vector>

@_parcelport_export_source@
7 changes: 4 additions & 3 deletions components/parcel_plugins/binary_filter/bzip2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions components/parcel_plugins/binary_filter/snappy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ 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(
compression_snappy SYSTEM PRIVATE ${SNAPPY_INCLUDE_DIR}
)
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
Expand Down
7 changes: 4 additions & 3 deletions components/parcel_plugins/binary_filter/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libs/full/parcelset/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<Parcelport>; \
extern HPX_EXPORT hpx::plugins::parcelport_factory_base* ( \
*HPX_PP_CAT(pluginname, _factory_init))( \
std::vector<hpx::plugins::parcelport_factory_base*> & factories); \
HPX_EXPORT hpx::plugins::parcelport_factory_base* HPX_PP_CAT( \
pluginname, _factory_init)( \
pluginname, _factory_init_impl)( \
std::vector<hpx::plugins::parcelport_factory_base*> & 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) \
Expand Down

0 comments on commit 02465de

Please sign in to comment.