Skip to content

Commit a5e2aad

Browse files
authored
Merge pull request #11 from ami-iit/alignwithblockfactory
Align shlibpp with the version vendored in blockfactory and add support for loading plugins by looking in SHLIBPP_PLUGIN_PATH env variable
2 parents 6192cc3 + 5acf076 commit a5e2aad

15 files changed

+4102
-40
lines changed

.github/workflows/test-pixi.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run tests with pixi
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
pixi-test:
9+
name: '[pixi:${{ matrix.os }}]'
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [
15+
ubuntu-22.04,
16+
macos-latest,
17+
windows-2019
18+
]
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up pixi
23+
uses: prefix-dev/[email protected]
24+
with:
25+
run-install: true
26+
cache: false
27+
28+
- name: Print pixi info
29+
run: pixi info
30+
31+
- name: Build and test the project
32+
run: pixi run test
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Update lockfiles
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: 0 5 1 * *
11+
12+
jobs:
13+
pixi-update:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up pixi
19+
uses: prefix-dev/[email protected]
20+
with:
21+
run-install: false
22+
23+
- name: Install pixi-diff-to-markdown
24+
run: pixi global install pixi-diff-to-markdown
25+
26+
- name: Update lockfiles
27+
run: |
28+
set -o pipefail
29+
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
30+
31+
- name: Create pull request
32+
uses: peter-evans/create-pull-request@v6
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
commit-message: Update pixi lockfile
36+
title: Update pixi lockfile
37+
body-path: diff.md
38+
branch: update-pixi
39+
base: main
40+
labels: pixi
41+
delete-branch: true
42+
add-paths: pixi.lock

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
build
22
*.*~
3+
.pixi
4+
.build

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
cmake_minimum_required(VERSION 3.5)
88

99
project(shlibpp
10-
VERSION 0.0.1
10+
VERSION 0.0.2
1111
DESCRIPTION "Tiny cross-platform plug-in system (dll, so, dylib)"
1212
LANGUAGES CXX)
1313

README.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Simple cross platform plug-in system
22
====================================
33

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

1414
Building on Linux/Mac
1515
---------------------
16-
$ cd sharedlibpp
17-
$ mkdir build; cd build
18-
$ cmake ../; make
16+
$ cd shlibpp
17+
$ cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
18+
$ cmake --build . --config Release
19+
$ cmake --install .
1920

2021

21-
Building on Windows
22-
-------------------
23-
The easiest way is to use Cmake to create VStudio project. To do that:
24-
25-
* download and install [cmake](http://www.cmake.org/download/) for windows.
26-
* open the cmake gui and set the source path to `sharedlibpp` and set the
27-
build path (for example `sharedlibpp/build`).
28-
* configure and generate visual studio project.
29-
* open the project and built it.
30-
3122
Running example
3223
---------------
33-
The build system by defualt compiles and build the examples.
24+
The build system by default compiles and build the examples.
3425

3526
* On Linux/Mac
3627
```
37-
$ cd sharedlibpp/build/examples
38-
$ ./math_test mymath.so
39-
$ ./math_test_custom mymathcustom.so
28+
$ cd shlibpp/build/examples
29+
$ ./math_test mymath
30+
$ ./math_test_custom mymathcustom
4031
```
4132
* On Windows first switch to directory where example is created and then
4233
```
43-
> math_test mymath.dll
44-
> math_test_custom mymathcustom.dll
34+
> math_test mymath
35+
> math_test_custom mymathcustom
4536
```

examples/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66

77
add_library(mymath MODULE MyMath.cpp MyMath.h)
88
target_include_directories(mymath PRIVATE $<TARGET_PROPERTY:shlibpp::shlibpp,INTERFACE_INCLUDE_DIRECTORIES>)
9-
set_property(TARGET mymath PROPERTY PREFIX "")
109

1110
add_executable(math_test math_test.cpp)
1211
target_link_libraries(math_test PRIVATE shlibpp::shlibpp)
1312

1413
add_library(mymathcustom MODULE MyMathCustom.cpp MyMathCustom.h)
1514
target_include_directories(mymathcustom PRIVATE $<TARGET_PROPERTY:shlibpp::shlibpp,INTERFACE_INCLUDE_DIRECTORIES>)
16-
set_property(TARGET mymathcustom PROPERTY PREFIX "")
1715

1816
add_executable(math_test_custom math_test_custom.cpp)
1917
target_link_libraries(math_test_custom PRIVATE shlibpp::shlibpp)

examples/math_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
1818

1919
if(argc < 2) {
2020
printf("Usage: %s <library file name>\n", argv[0]);
21-
printf("for example: %s libmymath.so\n", argv[0]);
21+
printf("for example: %s mymath\n", argv[0]);
2222
return 0;
2323
}
2424

examples/math_test_custom.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
1818

1919
if(argc < 2) {
2020
printf("Usage: %s <library file name>\n", argv[0]);
21-
printf("for example: %s libmymath.so\n", argv[0]);
21+
printf("for example: %s mymath\n", argv[0]);
2222
return 0;
2323
}
2424

0 commit comments

Comments
 (0)