Skip to content

Commit

Permalink
Rename project back to sharedlibpp (#12)
Browse files Browse the repository at this point in the history
* Rename project back to sharedlibpp
  • Loading branch information
traversaro authored Nov 5, 2024
1 parent a5e2aad commit 23918e8
Show file tree
Hide file tree
Showing 22 changed files with 137 additions and 137 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

cmake_minimum_required(VERSION 3.5)

project(shlibpp
VERSION 0.0.2
project(sharedlibpp
VERSION 0.0.3
DESCRIPTION "Tiny cross-platform plug-in system (dll, so, dylib)"
LANGUAGES CXX)

Expand Down Expand Up @@ -62,10 +62,10 @@ add_subdirectory(src)

# Install CMake config files for the library
include(InstallBasicPackageFiles)
install_basic_package_files(shlibpp
VERSION ${shlibpp_VERSION}
install_basic_package_files(sharedlibpp
VERSION ${sharedlibpp_VERSION}
COMPATIBILITY AnyNewerVersion
EXPORT shlibpp
EXPORT sharedlibpp
NO_CHECK_REQUIRED_COMPONENTS_MACRO)

# Add uninstall target
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Simple cross platform plug-in system
====================================

`shlibpp` is a tiny cross-platform library to create and load shared
libraries for different platform (Linux/Mac/Windows). `shlibpp` provides
`sharedlibpp` is a tiny cross-platform library to create and load shared
libraries for different platform (Linux/Mac/Windows). `sharedlibpp` provides
an easy and portable way to create plug-ins which encapsulate your c++ classes
inside a shared library (so, dylib, dll).
The original code is taken and from
Expand All @@ -13,7 +13,7 @@ added to report the native OS error messages on failures.

Building on Linux/Mac
---------------------
$ cd shlibpp
$ cd sharedlibpp
$ cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
$ cmake --build . --config Release
$ cmake --install .
Expand All @@ -25,7 +25,7 @@ The build system by default compiles and build the examples.

* On Linux/Mac
```
$ cd shlibpp/build/examples
$ cd sharedlibpp/build/examples
$ ./math_test mymath
$ ./math_test_custom mymathcustom
```
Expand Down
8 changes: 4 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# BSD-3-Clause license. See the accompanying LICENSE file for details.

add_library(mymath MODULE MyMath.cpp MyMath.h)
target_include_directories(mymath PRIVATE $<TARGET_PROPERTY:shlibpp::shlibpp,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(mymath PRIVATE $<TARGET_PROPERTY:sharedlibpp::sharedlibpp,INTERFACE_INCLUDE_DIRECTORIES>)

add_executable(math_test math_test.cpp)
target_link_libraries(math_test PRIVATE shlibpp::shlibpp)
target_link_libraries(math_test PRIVATE sharedlibpp::sharedlibpp)

add_library(mymathcustom MODULE MyMathCustom.cpp MyMathCustom.h)
target_include_directories(mymathcustom PRIVATE $<TARGET_PROPERTY:shlibpp::shlibpp,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(mymathcustom PRIVATE $<TARGET_PROPERTY:sharedlibpp::sharedlibpp,INTERFACE_INCLUDE_DIRECTORIES>)

add_executable(math_test_custom math_test_custom.cpp)
target_link_libraries(math_test_custom PRIVATE shlibpp::shlibpp)
target_link_libraries(math_test_custom PRIVATE sharedlibpp::sharedlibpp)
2 changes: 1 addition & 1 deletion examples/MyMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#include "MyMath.h"
#include <shlibpp/SharedLibraryClass.h>
#include <sharedlibpp/SharedLibraryClass.h>

SHLIBPP_DEFINE_SHARED_SUBCLASS(my_math, MyMathImpl, MyMath);

Expand Down
2 changes: 1 addition & 1 deletion examples/MyMathCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#include "MyMathCustom.h"
#include <shlibpp/SharedLibraryClass.h>
#include <sharedlibpp/SharedLibraryClass.h>

SHLIBPP_DEFINE_SHARED_SUBCLASS_CUSTOM(CUSTOM_START_CHECK, CUSTOM_END_CHECK, CUSTOM_SYSTEM_VERSION, my_math_custom, MyMathCustomImpl, MyMathCustom);

Expand Down
8 changes: 4 additions & 4 deletions examples/math_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <stdio.h>
#include "MyMath.h"

#include <shlibpp/SharedLibraryClass.h>
#include <shlibpp/SharedLibrary.h>
#include <sharedlibpp/SharedLibraryClass.h>
#include <sharedlibpp/SharedLibrary.h>


int main(int argc, char *argv[])
Expand All @@ -24,15 +24,15 @@ int main(int argc, char *argv[])

// create an instance of shared library class factory to load the library
printf("Loading the shared library... \n");
shlibpp::SharedLibraryClassFactory<MyMath> myMathFactory(argv[1], "my_math");
sharedlibpp::SharedLibraryClassFactory<MyMath> myMathFactory(argv[1], "my_math");
if (!myMathFactory.isValid()) {
printf("error (%d) : %s\n", static_cast<std::uint32_t>(myMathFactory.getStatus()),
myMathFactory.getError().c_str());
return 1;
}

// create an instance of the class and call its functions
shlibpp::SharedLibraryClass<MyMath> myMath(myMathFactory);
sharedlibpp::SharedLibraryClass<MyMath> myMath(myMathFactory);
printf("Calling some of its functions... \n");
printf("15 + 12 = %d\n", myMath->add(15, 12));
printf("15 - 12 = %d\n", myMath->sub(15, 12));
Expand Down
8 changes: 4 additions & 4 deletions examples/math_test_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <stdio.h>
#include "MyMathCustom.h"

#include <shlibpp/SharedLibraryClass.h>
#include <shlibpp/SharedLibrary.h>
#include <sharedlibpp/SharedLibraryClass.h>
#include <sharedlibpp/SharedLibrary.h>


int main(int argc, char *argv[])
Expand All @@ -24,7 +24,7 @@ int main(int argc, char *argv[])

// create an instance of shared library class factory to load the library
printf("Loading the shared library... \n");
shlibpp::SharedLibraryClassFactory<MyMathCustom> myMathFactory(argv[1],
sharedlibpp::SharedLibraryClassFactory<MyMathCustom> myMathFactory(argv[1],
CUSTOM_START_CHECK,
CUSTOM_END_CHECK,
CUSTOM_SYSTEM_VERSION,
Expand All @@ -36,7 +36,7 @@ int main(int argc, char *argv[])
}

// create an instance of the class and call its functions
shlibpp::SharedLibraryClass<MyMathCustom> myMath(myMathFactory);
sharedlibpp::SharedLibraryClass<MyMathCustom> myMath(myMathFactory);
printf("Calling some of its functions... \n");
printf("15 + 12 = %d\n", myMath->add(15, 12));
printf("15 - 12 = %d\n", myMath->sub(15, 12));
Expand Down
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "shlibpp"
name = "sharedlibpp"
# As this version is currently ignored, we do not
# waste effort in mantain it in synch with the value
# specified in CMakeLists.txt
Expand Down
58 changes: 29 additions & 29 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@

include (GNUInstallDirs)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shlibpp/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/shlibpp/config.h"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sharedlibpp/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/sharedlibpp/config.h"
@ONLY)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shlibpp/version.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/shlibpp/version.h"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sharedlibpp/version.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/sharedlibpp/version.h"
@ONLY)

set(shlibpp_HDRS "${CMAKE_CURRENT_BINARY_DIR}/shlibpp/config.h"
"${CMAKE_CURRENT_BINARY_DIR}/shlibpp/version.h"
shlibpp/api.h
shlibpp/SharedLibraryClassApi.h
shlibpp/SharedLibraryClassFactory.h
shlibpp/SharedLibraryClassFactory-inl.h
shlibpp/SharedLibraryClass.h
shlibpp/SharedLibraryClass-inl.h
shlibpp/SharedLibraryFactory.h
shlibpp/SharedLibrary.h)
set(sharedlibpp_HDRS "${CMAKE_CURRENT_BINARY_DIR}/sharedlibpp/config.h"
"${CMAKE_CURRENT_BINARY_DIR}/sharedlibpp/version.h"
sharedlibpp/api.h
sharedlibpp/SharedLibraryClassApi.h
sharedlibpp/SharedLibraryClassFactory.h
sharedlibpp/SharedLibraryClassFactory-inl.h
sharedlibpp/SharedLibraryClass.h
sharedlibpp/SharedLibraryClass-inl.h
sharedlibpp/SharedLibraryFactory.h
sharedlibpp/SharedLibrary.h)

set(shlibpp_SRCS version.cpp
set(sharedlibpp_SRCS version.cpp
SharedLibrary.cpp
SharedLibraryFactory.cpp)

add_library(shlibpp ${shlibpp_SRCS} ${shlibpp_HDRS})
add_library(shlibpp::shlibpp ALIAS shlibpp)
add_library(sharedlibpp ${sharedlibpp_SRCS} ${sharedlibpp_HDRS})
add_library(sharedlibpp::sharedlibpp ALIAS sharedlibpp)

# Add build definitions
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(shlibpp PRIVATE SHLIBPP_STATIC)
endif()
set_target_properties(shlibpp PROPERTIES DEFINE_SYMBOL BUILDING_SHLIBPP)
set_target_properties(sharedlibpp PROPERTIES DEFINE_SYMBOL BUILDING_SHLIBPP)

target_include_directories(shlibpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
target_include_directories(sharedlibpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

Expand All @@ -47,24 +47,24 @@ if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.8)
endif()
if(CMAKE_VERSION VERSION_LESS 3.8)
# Should be enough to enable c++11
target_compile_features(shlibpp PUBLIC cxx_constexpr
target_compile_features(sharedlibpp PUBLIC cxx_constexpr
cxx_nullptr)
else()
target_compile_features(shlibpp PUBLIC cxx_std_11)
target_compile_features(sharedlibpp PUBLIC cxx_std_11)
endif()

if(UNIX)
target_link_libraries(shlibpp PRIVATE dl)
target_link_libraries(sharedlibpp PRIVATE dl)
endif()

set_property(TARGET shlibpp PROPERTY PUBLIC_HEADER ${shlibpp_HDRS})
set_property(TARGET shlibpp PROPERTY VERSION ${shlibpp_VERSION})
set_property(TARGET shlibpp PROPERTY SOVERSION 1)
set_property(TARGET sharedlibpp PROPERTY PUBLIC_HEADER ${sharedlibpp_HDRS})
set_property(TARGET sharedlibpp PROPERTY VERSION ${sharedlibpp_VERSION})
set_property(TARGET sharedlibpp PROPERTY SOVERSION 1)

install(TARGETS shlibpp
EXPORT shlibpp
COMPONENT shlibpp
install(TARGETS sharedlibpp
EXPORT sharedlibpp
COMPONENT sharedlibpp
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/shlibpp)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sharedlibpp)
4 changes: 2 additions & 2 deletions src/SharedLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# include <dlfcn.h>
#endif

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

using namespace shlibpp;
using namespace sharedlibpp;


class SharedLibrary::Private
Expand Down
Loading

0 comments on commit 23918e8

Please sign in to comment.