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 77bf850
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
9 changes: 6 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 @@ -16,10 +16,13 @@ if(HPX_WITH_DISTRIBUTED_RUNTIME)

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_init
"${_parcelport_init} ${parcelport}_factory_init(factories);\n"
Expand Down
6 changes: 4 additions & 2 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,6 +9,8 @@

#pragma once

#include <hpx/config.hpp>

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

Expand All @@ -17,7 +19,7 @@
@_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
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,14 +30,15 @@ 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_directories(
compression_snappy PRIVATE ${SNAPPY_LIBRARY_DIR} ${SNAPPY_LIBRARY}
)

target_link_libraries(compression_snappy PUBLIC Boost::iostreams)

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
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>; \
HPX_EXPORT hpx::plugins::parcelport_factory_base* (*HPX_PP_CAT(pluginname, \
_factory_init))(std::vector<hpx::plugins::parcelport_factory_base*> & \
factories) = nullptr; \
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 77bf850

Please sign in to comment.