Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to use external sharedlibpp instead of internal shlibpp and bump version to 1.0.0 #87

Merged
merged 2 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Example:
#define BLOCKFACTORY_CORE_FACTORYSINGLETON_H

#include "BlockFactory/Core/Log.h"
#include "shlibpp/SharedLibrary.h"
#include "shlibpp/SharedLibraryClass.h"
#include "sharedlibpp/SharedLibrary.h"
#include "sharedlibpp/SharedLibraryClass.h"

#include <memory>

Expand Down
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# GNU Lesser General Public License v2.1 or any later version.

cmake_minimum_required(VERSION 3.16...3.31)
project(blockfactory LANGUAGES CXX VERSION 0.8.5)
project(blockfactory LANGUAGES CXX VERSION 1.0.0)

if(BUILD_DOCS)
add_subdirectory(doc)
Expand Down Expand Up @@ -109,19 +109,20 @@ endif()
# Handle unit tests support
option(BUILD_TESTING "Create tests using CMake" OFF)

option(BLOCKFACTORY_USES_SYSTEM_SHLIBPP "If ON, find shlibpp with find_package(shlibpp)" OFF)
if(BLOCKFACTORY_USES_SYSTEM_SHLIBPP)
find_package(shlibpp REQUIRED)
option(BLOCKFACTORY_USES_SYSTEM_SHAREDLIBPP "If ON, find sharedlibpp with find_package(sharedlibpp)" OFF)
if(BLOCKFACTORY_USES_SYSTEM_SHAREDLIBPP)
find_package(sharedlibpp REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(
shlibpp
URL https://github.com/ami-iit/shlibpp/archive/refs/tags/v0.0.2.zip
sharedlibpp
URL https://github.com/ami-iit/sharedlibpp/archive/refs/tags/v0.0.3.zip
)
FetchContent_MakeAvailable(shlibpp)
FetchContent_MakeAvailable(sharedlibpp)
endif()

add_subdirectory(deps)
include(InstallBasicPackageFiles)
add_subdirectory(sources)

if(USES_MATLAB)
Expand Down
2 changes: 1 addition & 1 deletion doc/mkdocs/data/create_new_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ A plugin library usually contains multiple classes used for multiple Blocks. The
#include "SignalMath.h"

// Class factory API
#include <shlibpp/SharedLibraryClassApi.h>
#include <sharedlibpp/SharedLibraryClassApi.h>

// Add the example::SignalMath class to the plugin factory
SHLIBPP_DEFINE_SHARED_SUBCLASS(SignalMath, example::SignalMath, blockfactory::core::Block);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void AutogenerationExampleModelClass::initialize()
// TODO: find a better way to handle them.
{
// Create a new class. This object will be destroyed at the end of the scope.
shlibpp::SharedLibraryClass<blockfactory::core::Block> blockPtr(*factory);
sharedlibpp::SharedLibraryClass<blockfactory::core::Block> blockPtr(*factory);
auto tmpCoderBlockInfo = std::unique_ptr<blockfactory::coder::CoderBlockInformation>(
new blockfactory::coder::CoderBlockInformation);
tmpCoderBlockInfo->storeRTWParameters(params);
Expand Down
2 changes: 1 addition & 1 deletion example/src/Factory.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "SignalMath.h"

// Class factory API
#include <shlibpp/SharedLibraryClassApi.h>
#include <sharedlibpp/SharedLibraryClassApi.h>

// Add the example::SignalMath class to the plugin factory
SHLIBPP_DEFINE_SHARED_SUBCLASS(SignalMath, example::SignalMath, blockfactory::core::Block);
2 changes: 1 addition & 1 deletion matlab/BlockFactory.tlc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
// TODO: find a better way to handle them.
{
// Create a new class. This object will be destroyed at the end of the scope.
shlibpp::SharedLibraryClass<blockfactory::core::Block> blockPtr(*factory);
sharedlibpp::SharedLibraryClass<blockfactory::core::Block> blockPtr(*factory);

auto tmpCoderBlockInfo = std::unique_ptr<blockfactory::coder::CoderBlockInformation>(
new blockfactory::coder::CoderBlockInformation);
Expand Down
4 changes: 2 additions & 2 deletions sources/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(CORE_PRIVATE_HDR
add_library(Core ${CORE_SRC} ${CORE_PUBLIC_HDR} ${CORE_PRIVATE_HDR})
add_library(BlockFactory::Core ALIAS Core)

target_link_libraries(Core PUBLIC shlibpp::shlibpp)
target_link_libraries(Core PUBLIC sharedlibpp::sharedlibpp)

target_include_directories(Core PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down Expand Up @@ -55,6 +55,6 @@ install_basic_package_files(BlockFactoryCore
COMPATIBILITY AnyNewerVersion
EXPORT BlockFactoryCoreExport
FIRST_TARGET Core
DEPENDENCIES shlibpp
DEPENDENCIES sharedlibpp
NAMESPACE BlockFactory::
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
10 changes: 5 additions & 5 deletions sources/Core/include/BlockFactory/Core/FactorySingleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define BLOCKFACTORY_CORE_FACTORYSINGLETON_H

#include "BlockFactory/Core/Log.h"
#include "shlibpp/SharedLibrary.h"
#include "shlibpp/SharedLibraryClass.h"
#include "sharedlibpp/SharedLibrary.h"
#include "sharedlibpp/SharedLibraryClass.h"

#include <memory>

Expand All @@ -23,9 +23,9 @@ namespace blockfactory {
} // namespace blockfactory

/**
* @brief Class for interfacing with shlibpp plugin library
* @brief Class for interfacing with sharedlibpp plugin library
*
* This helper class ease the integration of shlibpp within the BlockFactory framework. It is
* This helper class ease the integration of sharedlibpp within the BlockFactory framework. It is
* implemented with a singleton pattern.
*
* It can handle multiple plugin libraries together and provides support of destructing the related
Expand All @@ -41,7 +41,7 @@ class blockfactory::core::ClassFactorySingleton
#endif

public:
using ClassFactory = shlibpp::SharedLibraryClassFactory<blockfactory::core::Block>;
using ClassFactory = sharedlibpp::SharedLibraryClassFactory<blockfactory::core::Block>;
using ClassFactoryPtr = std::shared_ptr<ClassFactory>;

/// @brief Name of the factory associated to the class specified during its registration
Expand Down
6 changes: 3 additions & 3 deletions sources/Simulink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
include/BlockFactory/Simulink/Private/SimulinkBlockInformationImpl.h
src/BlockFactory.cpp
NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES
LINK_TO ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} BlockFactory::Core shlibpp::shlibpp mxpp)
LINK_TO ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} BlockFactory::Core sharedlibpp::sharedlibpp mxpp)
else()
matlab_add_mex(
NAME Simulink
Expand All @@ -23,7 +23,7 @@ else()
src/SimulinkBlockInformationImpl.cpp
include/BlockFactory/Simulink/Private/SimulinkBlockInformationImpl.h
src/BlockFactory.cpp
LINK_TO ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} BlockFactory::Core shlibpp::shlibpp mxpp)
LINK_TO ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} BlockFactory::Core sharedlibpp::sharedlibpp mxpp)
endif()
add_library(BlockFactory::Simulink ALIAS Simulink)

Expand All @@ -50,6 +50,6 @@ install_basic_package_files(BlockFactorySimulink
COMPATIBILITY AnyNewerVersion
EXPORT BlockFactorySimulinkExport
FIRST_TARGET Simulink
DEPENDENCIES BlockFactoryCore mxpp shlibpp
DEPENDENCIES BlockFactoryCore mxpp sharedlibpp
NAMESPACE BlockFactory::
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
2 changes: 1 addition & 1 deletion tests/Factory/MockPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "MockPlugin.h"
#include <BlockFactory/Core/Parameter.h>

#include <shlibpp/SharedLibraryClassApi.h>
#include <sharedlibpp/SharedLibraryClassApi.h>

mock::MockBlock::MockBlock()
{
Expand Down
Loading