Skip to content

Commit e14ad25

Browse files
committed
initial release
1 parent 4069dde commit e14ad25

31 files changed

+3808
-1
lines changed

.clang-format

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
BasedOnStyle: Google
3+
IndentWidth: 4
4+
ColumnLimit: 100
5+
NamespaceIndentation: None
6+
AccessModifierOffset: -4
7+
AlignAfterOpenBracket: Align
8+
AlignConsecutiveAssignments: false
9+
AlignConsecutiveDeclarations: false
10+
AlignOperands: true
11+
AlignTrailingComments: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: Never
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakTemplateDeclarations: Yes
18+
BreakBeforeBraces: Attach
19+
BreakConstructorInitializers: BeforeColon
20+
BreakInheritanceList: BeforeColon
21+
PointerAlignment: Left
22+
ReferenceAlignment: Left
23+
SortIncludes: true
24+
SortUsingDeclarations: true
25+
SpaceAfterCStyleCast: false
26+
SpaceAfterTemplateKeyword: true
27+
SpaceBeforeAssignmentOperators: true
28+
SpaceBeforeCpp11BracedList: false
29+
SpaceBeforeParens: ControlStatements
30+
SpaceInEmptyParentheses: false
31+
SpacesInAngles: false
32+
SpacesInCStyleCastParentheses: false
33+
SpacesInContainerLiterals: false
34+
SpacesInParentheses: false
35+
SpacesInSquareBrackets: false
36+
Standard: c++17
37+
UseTab: Never
38+
...

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: SlickQuant
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build-and-test:
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
build_type: [Release, Debug]
18+
19+
runs-on: ${{ matrix.os }}
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Configure CMake
25+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
26+
27+
- name: Build
28+
run: cmake --build build --config ${{ matrix.build_type }}
29+
30+
- name: Run Tests
31+
working-directory: build
32+
run: ctest -C ${{ matrix.build_type }} --output-on-failure

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Trigger on version tags like v0.1.0, v1.0.0, etc.
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Extract version from tag
19+
id: get_version
20+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
21+
22+
- name: Create Release
23+
uses: softprops/action-gh-release@v1
24+
with:
25+
name: Release ${{ github.ref_name }}
26+
body: |
27+
## slick_shm ${{ github.ref_name }}
28+
29+
A modern C++17 header-only, cross-platform shared memory library.
30+
31+
### Installation
32+
33+
#### vcpkg
34+
```bash
35+
vcpkg install slick-shm
36+
```
37+
38+
#### CMake FetchContent
39+
```cmake
40+
FetchContent_Declare(
41+
slick_shm
42+
GIT_REPOSITORY https://github.com/SlickQuant/slick_shm.git
43+
GIT_TAG ${{ github.ref_name }}
44+
)
45+
FetchContent_MakeAvailable(slick_shm)
46+
target_link_libraries(your_target PRIVATE slick::shm)
47+
```
48+
49+
#### Header-Only
50+
Download and extract the source, then copy the `include/slick` directory to your project.
51+
52+
### What's Changed
53+
See the [CHANGELOG](https://github.com/SlickQuant/slick_shm/blob/main/CHANGELOG.md) for details.
54+
55+
### Platform Support
56+
- ✅ Windows (MSVC 2017+, MinGW)
57+
- ✅ Linux (GCC 7+, Clang 5+)
58+
- ✅ macOS (Apple Clang)
59+
draft: false
60+
prerelease: false
61+
generate_release_notes: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@
3939

4040
# debug information files
4141
*.dwo
42+
43+
build/

CMakeLists.txt

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project(slick_shm
4+
VERSION 0.1.0
5+
LANGUAGES CXX
6+
DESCRIPTION "C++ header-only cross-platform shared memory library"
7+
)
8+
9+
# Options
10+
option(SLICK_SHM_BUILD_EXAMPLES "Build example programs" ON)
11+
option(SLICK_SHM_BUILD_TESTS "Build unit tests" ON)
12+
option(SLICK_SHM_INSTALL "Generate install target" ON)
13+
14+
# Interface library (header-only)
15+
add_library(slick_shm INTERFACE)
16+
add_library(slick::shm ALIAS slick_shm)
17+
18+
target_include_directories(slick_shm INTERFACE
19+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
20+
$<INSTALL_INTERFACE:include>
21+
)
22+
23+
target_compile_features(slick_shm INTERFACE cxx_std_17)
24+
25+
# Platform-specific linking
26+
if(WIN32)
27+
# No special libraries needed on Windows
28+
elseif(UNIX)
29+
# Link with rt (realtime) for shm_open/shm_unlink on POSIX systems
30+
# pthread may be needed for some implementations
31+
target_link_libraries(slick_shm INTERFACE rt)
32+
33+
# On some systems (older Linux), pthread is also needed
34+
find_package(Threads)
35+
if(Threads_FOUND)
36+
target_link_libraries(slick_shm INTERFACE Threads::Threads)
37+
endif()
38+
endif()
39+
40+
# Examples
41+
if(SLICK_SHM_BUILD_EXAMPLES)
42+
add_subdirectory(examples)
43+
endif()
44+
45+
# Tests
46+
if(SLICK_SHM_BUILD_TESTS)
47+
enable_testing()
48+
add_subdirectory(tests)
49+
endif()
50+
51+
# Install
52+
if(SLICK_SHM_INSTALL)
53+
include(GNUInstallDirs)
54+
include(CMakePackageConfigHelpers)
55+
56+
# Install headers
57+
install(DIRECTORY include/slick
58+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
59+
)
60+
61+
# Install targets
62+
install(TARGETS slick_shm
63+
EXPORT slick_shm-targets
64+
)
65+
66+
# Install export set
67+
install(EXPORT slick_shm-targets
68+
FILE slick_shm-targets.cmake
69+
NAMESPACE slick::
70+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/slick_shm
71+
)
72+
73+
# Generate and install package config file
74+
configure_package_config_file(
75+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/slick_shm-config.cmake.in
76+
${CMAKE_CURRENT_BINARY_DIR}/slick_shm-config.cmake
77+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/slick_shm
78+
)
79+
80+
# Generate and install package version file
81+
write_basic_package_version_file(
82+
${CMAKE_CURRENT_BINARY_DIR}/slick_shm-config-version.cmake
83+
VERSION ${PROJECT_VERSION}
84+
COMPATIBILITY SameMajorVersion
85+
)
86+
87+
# Install config files
88+
install(FILES
89+
${CMAKE_CURRENT_BINARY_DIR}/slick_shm-config.cmake
90+
${CMAKE_CURRENT_BINARY_DIR}/slick_shm-config-version.cmake
91+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/slick_shm
92+
)
93+
endif()

0 commit comments

Comments
 (0)