capio-calf 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- capio_calf-0.1.0/.clang-format +10 -0
- capio_calf-0.1.0/.github/workflows/cpp-tests.yml +90 -0
- capio_calf-0.1.0/.github/workflows/python-tests.yml +47 -0
- capio_calf-0.1.0/.github/workflows/release.yml +159 -0
- capio_calf-0.1.0/.gitignore +76 -0
- capio_calf-0.1.0/CMakeLists.txt +158 -0
- capio_calf-0.1.0/LICENSE +21 -0
- capio_calf-0.1.0/PKG-INFO +346 -0
- capio_calf-0.1.0/README.md +308 -0
- capio_calf-0.1.0/bindings/calf/__init__.py +30 -0
- capio_calf-0.1.0/bindings/calf/__main__.py +5 -0
- capio_calf-0.1.0/bindings/python_bindings.cpp +146 -0
- capio_calf-0.1.0/calf/BaseLogger.h +150 -0
- capio_calf-0.1.0/calf/JsonBaseLogger.h +226 -0
- capio_calf-0.1.0/calf/StdOutLogger.h +138 -0
- capio_calf-0.1.0/calf/StlLogger.h +132 -0
- capio_calf-0.1.0/calf/SyscallLogger.h +178 -0
- capio_calf-0.1.0/calf/constants.h +22 -0
- capio_calf-0.1.0/calf.svg +49 -0
- capio_calf-0.1.0/profiler/README.md +147 -0
- capio_calf-0.1.0/profiler/__init__.py +3 -0
- capio_calf-0.1.0/profiler/__main__.py +88 -0
- capio_calf-0.1.0/profiler/app.py +517 -0
- capio_calf-0.1.0/profiler/loader.py +251 -0
- capio_calf-0.1.0/profiler/style.css +268 -0
- capio_calf-0.1.0/profiler/web/app.js +204 -0
- capio_calf-0.1.0/profiler/web/calf.svg +16 -0
- capio_calf-0.1.0/profiler/web/index.html +56 -0
- capio_calf-0.1.0/profiler/web/style.css +243 -0
- capio_calf-0.1.0/profiler/web.py +220 -0
- capio_calf-0.1.0/pyproject.toml +56 -0
- capio_calf-0.1.0/tests/core_tests.cpp +218 -0
- capio_calf-0.1.0/tests/disabled_tests.cpp +16 -0
- capio_calf-0.1.0/tests/python_bindings_tests.py +88 -0
- capio_calf-0.1.0/tests/stl_tests.cpp +54 -0
- capio_calf-0.1.0/tests/syscall_tests.cpp +57 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: C++ Unit Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: cpp-tests-${{ github.event.pull_request.number || github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
linux-tests:
|
|
15
|
+
name: ${{ matrix.build_type }} with ${{ matrix.compiler }}
|
|
16
|
+
runs-on: ubuntu-24.04
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
build_type: [Debug, Release]
|
|
21
|
+
compiler:
|
|
22
|
+
- gcc:9
|
|
23
|
+
- gcc:10
|
|
24
|
+
- gcc:11
|
|
25
|
+
- gcc:12
|
|
26
|
+
- gcc:13
|
|
27
|
+
- silkeh/clang:13
|
|
28
|
+
- silkeh/clang:14
|
|
29
|
+
- silkeh/clang:15
|
|
30
|
+
- silkeh/clang:16
|
|
31
|
+
- silkeh/clang:17
|
|
32
|
+
- silkeh/clang:18
|
|
33
|
+
|
|
34
|
+
container:
|
|
35
|
+
image: ${{ matrix.compiler }}
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v7
|
|
39
|
+
|
|
40
|
+
- name: Install build tools
|
|
41
|
+
run: |
|
|
42
|
+
apt-get update
|
|
43
|
+
apt-get install -y cmake git ninja-build
|
|
44
|
+
|
|
45
|
+
- name: Configure
|
|
46
|
+
shell: bash
|
|
47
|
+
run: |
|
|
48
|
+
cmake -S "${GITHUB_WORKSPACE}" \
|
|
49
|
+
-B "${GITHUB_WORKSPACE}/build" \
|
|
50
|
+
-G Ninja \
|
|
51
|
+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
|
|
52
|
+
-DCALF_TESTS=ON \
|
|
53
|
+
-DCALF_PYTHON_TESTS=OFF
|
|
54
|
+
|
|
55
|
+
- name: Build
|
|
56
|
+
run: cmake --build "${GITHUB_WORKSPACE}/build" --parallel
|
|
57
|
+
|
|
58
|
+
- name: Run C++ tests
|
|
59
|
+
working-directory: build
|
|
60
|
+
run: ctest --output-on-failure
|
|
61
|
+
|
|
62
|
+
macos-tests:
|
|
63
|
+
name: ${{ matrix.build_type }} with AppleClang
|
|
64
|
+
runs-on: macos-15
|
|
65
|
+
strategy:
|
|
66
|
+
fail-fast: false
|
|
67
|
+
matrix:
|
|
68
|
+
build_type: [Debug, Release]
|
|
69
|
+
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v7
|
|
72
|
+
|
|
73
|
+
- name: Install build tools
|
|
74
|
+
run: brew install cmake ninja
|
|
75
|
+
|
|
76
|
+
- name: Configure
|
|
77
|
+
run: |
|
|
78
|
+
cmake -S "${GITHUB_WORKSPACE}" \
|
|
79
|
+
-B "${GITHUB_WORKSPACE}/build" \
|
|
80
|
+
-G Ninja \
|
|
81
|
+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
|
|
82
|
+
-DCALF_TESTS=ON \
|
|
83
|
+
-DCALF_PYTHON_TESTS=OFF
|
|
84
|
+
|
|
85
|
+
- name: Build
|
|
86
|
+
run: cmake --build "${GITHUB_WORKSPACE}/build" --parallel
|
|
87
|
+
|
|
88
|
+
- name: Run C++ tests
|
|
89
|
+
working-directory: build
|
|
90
|
+
run: ctest --output-on-failure
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Python Bindings Unit Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: python-tests-${{ github.event.pull_request.number || github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
python-tests:
|
|
15
|
+
name: Python ${{ matrix.python_version }} on ${{ matrix.os }}
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
os: [ubuntu-24.04, macos-15-intel, macos-26]
|
|
21
|
+
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v7
|
|
25
|
+
|
|
26
|
+
- name: Set up Python ${{ matrix.python_version }}
|
|
27
|
+
uses: actions/setup-python@v6
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python_version }}
|
|
30
|
+
|
|
31
|
+
- name: Install build tools on Ubuntu
|
|
32
|
+
if: startsWith(matrix.os, 'ubuntu-')
|
|
33
|
+
run: sudo apt-get update && sudo apt-get install -y cmake git ninja-build
|
|
34
|
+
|
|
35
|
+
- name: Set up Homebrew
|
|
36
|
+
if: startsWith(matrix.os, 'macos-')
|
|
37
|
+
uses: Homebrew/actions/setup-homebrew@main
|
|
38
|
+
|
|
39
|
+
- name: Install build tools on macOS
|
|
40
|
+
if: startsWith(matrix.os, 'macos-')
|
|
41
|
+
run: brew install cmake ninja
|
|
42
|
+
|
|
43
|
+
- name: Build and install capio-calf
|
|
44
|
+
run: python -m pip install ".[test]"
|
|
45
|
+
|
|
46
|
+
- name: Run Python binding tests
|
|
47
|
+
run: python -m pytest -v tests/python_bindings_tests.py
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
name: Release Python Wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: [Python Bindings Unit Tests]
|
|
6
|
+
branches: [main]
|
|
7
|
+
types: [completed]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: python-release
|
|
12
|
+
cancel-in-progress: false
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
release-version:
|
|
16
|
+
name: Read release version
|
|
17
|
+
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
|
|
18
|
+
runs-on: ubuntu-24.04
|
|
19
|
+
outputs:
|
|
20
|
+
version: ${{ steps.version.outputs.version }}
|
|
21
|
+
should_publish: ${{ steps.version.outputs.should_publish }}
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v7
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
|
28
|
+
|
|
29
|
+
- name: Read CMake project version
|
|
30
|
+
id: version
|
|
31
|
+
shell: bash
|
|
32
|
+
run: |
|
|
33
|
+
version="$(sed -nE 's/^project\(CALF VERSION ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' CMakeLists.txt)"
|
|
34
|
+
if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
35
|
+
echo "Unable to read a semantic version from CMakeLists.txt" >&2
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "version=${version}" >> "${GITHUB_OUTPUT}"
|
|
40
|
+
if git ls-remote --exit-code --tags origin "refs/tags/v${version}" >/dev/null 2>&1; then
|
|
41
|
+
echo "Git tag v${version} already exists"
|
|
42
|
+
echo "should_publish=false" >> "${GITHUB_OUTPUT}"
|
|
43
|
+
elif curl --fail --silent "https://pypi.org/pypi/capio-calf/${version}/json" >/dev/null; then
|
|
44
|
+
echo "capio-calf ${version} is already published on PyPI"
|
|
45
|
+
echo "should_publish=false" >> "${GITHUB_OUTPUT}"
|
|
46
|
+
else
|
|
47
|
+
echo "Preparing release v${version}"
|
|
48
|
+
echo "should_publish=true" >> "${GITHUB_OUTPUT}"
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
wheels:
|
|
52
|
+
name: Wheels on ${{ matrix.os }}
|
|
53
|
+
needs: release-version
|
|
54
|
+
if: needs.release-version.outputs.should_publish == 'true'
|
|
55
|
+
runs-on: ${{ matrix.os }}
|
|
56
|
+
strategy:
|
|
57
|
+
fail-fast: false
|
|
58
|
+
matrix:
|
|
59
|
+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-latest]
|
|
60
|
+
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v7
|
|
63
|
+
with:
|
|
64
|
+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
|
65
|
+
|
|
66
|
+
- uses: actions/setup-python@v6
|
|
67
|
+
with:
|
|
68
|
+
python-version: "3.x"
|
|
69
|
+
|
|
70
|
+
- name: Install cibuildwheel
|
|
71
|
+
run: python -m pip install --upgrade cibuildwheel
|
|
72
|
+
|
|
73
|
+
- name: Build wheels
|
|
74
|
+
env:
|
|
75
|
+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
|
|
76
|
+
CIBW_BUILD_VERBOSITY: 1
|
|
77
|
+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
|
|
78
|
+
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
|
|
79
|
+
CIBW_TEST_COMMAND: >-
|
|
80
|
+
python -c "import calf; assert calf.__version__ == '${{ needs.release-version.outputs.version }}'"
|
|
81
|
+
MACOSX_DEPLOYMENT_TARGET: "15.0"
|
|
82
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
83
|
+
|
|
84
|
+
- uses: actions/upload-artifact@v7
|
|
85
|
+
with:
|
|
86
|
+
name: wheels-${{ matrix.os }}
|
|
87
|
+
path: wheelhouse/*.whl
|
|
88
|
+
if-no-files-found: error
|
|
89
|
+
|
|
90
|
+
sdist:
|
|
91
|
+
name: Source distribution
|
|
92
|
+
needs: release-version
|
|
93
|
+
if: needs.release-version.outputs.should_publish == 'true'
|
|
94
|
+
runs-on: ubuntu-24.04
|
|
95
|
+
|
|
96
|
+
steps:
|
|
97
|
+
- uses: actions/checkout@v7
|
|
98
|
+
with:
|
|
99
|
+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
|
100
|
+
|
|
101
|
+
- uses: actions/setup-python@v6
|
|
102
|
+
with:
|
|
103
|
+
python-version: "3.x"
|
|
104
|
+
|
|
105
|
+
- name: Build source distribution
|
|
106
|
+
run: |
|
|
107
|
+
python -m pip install --upgrade build
|
|
108
|
+
python -m build --sdist
|
|
109
|
+
|
|
110
|
+
- uses: actions/upload-artifact@v7
|
|
111
|
+
with:
|
|
112
|
+
name: sdist
|
|
113
|
+
path: dist/*.tar.gz
|
|
114
|
+
if-no-files-found: error
|
|
115
|
+
|
|
116
|
+
publish:
|
|
117
|
+
name: Publish to PyPI
|
|
118
|
+
needs: [release-version, wheels, sdist]
|
|
119
|
+
runs-on: ubuntu-24.04
|
|
120
|
+
environment: pypi
|
|
121
|
+
|
|
122
|
+
steps:
|
|
123
|
+
- uses: actions/download-artifact@v8
|
|
124
|
+
with:
|
|
125
|
+
path: dist
|
|
126
|
+
merge-multiple: true
|
|
127
|
+
|
|
128
|
+
- name: Validate distributions
|
|
129
|
+
run: |
|
|
130
|
+
python -m pip install --upgrade twine
|
|
131
|
+
python -m twine check dist/*
|
|
132
|
+
|
|
133
|
+
- name: Upload distributions
|
|
134
|
+
env:
|
|
135
|
+
TWINE_USERNAME: __token__
|
|
136
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_DEPLOY_KEY }}
|
|
137
|
+
run: python -m twine upload --verbose dist/*
|
|
138
|
+
|
|
139
|
+
github-release:
|
|
140
|
+
name: Create GitHub release
|
|
141
|
+
needs: [release-version, publish]
|
|
142
|
+
runs-on: ubuntu-24.04
|
|
143
|
+
permissions:
|
|
144
|
+
contents: write
|
|
145
|
+
|
|
146
|
+
steps:
|
|
147
|
+
- uses: actions/download-artifact@v8
|
|
148
|
+
with:
|
|
149
|
+
path: dist
|
|
150
|
+
merge-multiple: true
|
|
151
|
+
|
|
152
|
+
- name: Create release v${{ needs.release-version.outputs.version }}
|
|
153
|
+
uses: softprops/action-gh-release@v3
|
|
154
|
+
with:
|
|
155
|
+
tag_name: v${{ needs.release-version.outputs.version }}
|
|
156
|
+
name: v${{ needs.release-version.outputs.version }}
|
|
157
|
+
target_commitish: ${{ github.event.workflow_run.head_sha || github.sha }}
|
|
158
|
+
generate_release_notes: true
|
|
159
|
+
files: dist/*
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Prerequisites
|
|
2
|
+
*.d
|
|
3
|
+
|
|
4
|
+
# Compiled Object files
|
|
5
|
+
*.slo
|
|
6
|
+
*.lo
|
|
7
|
+
*.o
|
|
8
|
+
*.obj
|
|
9
|
+
|
|
10
|
+
# Precompiled Headers
|
|
11
|
+
*.gch
|
|
12
|
+
*.pch
|
|
13
|
+
|
|
14
|
+
# Linker files
|
|
15
|
+
*.ilk
|
|
16
|
+
|
|
17
|
+
# Debugger Files
|
|
18
|
+
*.pdb
|
|
19
|
+
|
|
20
|
+
# Compiled Dynamic libraries
|
|
21
|
+
*.so
|
|
22
|
+
*.dylib
|
|
23
|
+
*.dll
|
|
24
|
+
*.so.*
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Fortran module files
|
|
28
|
+
*.mod
|
|
29
|
+
*.smod
|
|
30
|
+
|
|
31
|
+
# Compiled Static libraries
|
|
32
|
+
*.lai
|
|
33
|
+
*.la
|
|
34
|
+
*.a
|
|
35
|
+
*.lib
|
|
36
|
+
|
|
37
|
+
# Executables
|
|
38
|
+
*.exe
|
|
39
|
+
*.out
|
|
40
|
+
*.app
|
|
41
|
+
|
|
42
|
+
# Build directories
|
|
43
|
+
build/
|
|
44
|
+
Build/
|
|
45
|
+
build-*/
|
|
46
|
+
|
|
47
|
+
# CMake generated files
|
|
48
|
+
CMakeFiles/
|
|
49
|
+
CMakeCache.txt
|
|
50
|
+
cmake_install.cmake
|
|
51
|
+
Makefile
|
|
52
|
+
install_manifest.txt
|
|
53
|
+
compile_commands.json
|
|
54
|
+
|
|
55
|
+
# Temporary files
|
|
56
|
+
*.tmp
|
|
57
|
+
*.log
|
|
58
|
+
*.bak
|
|
59
|
+
*.swp
|
|
60
|
+
|
|
61
|
+
# vcpkg
|
|
62
|
+
vcpkg_installed/
|
|
63
|
+
|
|
64
|
+
# debug information files
|
|
65
|
+
*.dwo
|
|
66
|
+
|
|
67
|
+
# test output & cache
|
|
68
|
+
Testing/
|
|
69
|
+
.cache/
|
|
70
|
+
|
|
71
|
+
*build*
|
|
72
|
+
.idea
|
|
73
|
+
.junie
|
|
74
|
+
.venv
|
|
75
|
+
*.egg-info
|
|
76
|
+
__pycache__
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.16)
|
|
2
|
+
project(CALF VERSION 0.1.0 LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
# -------------------------------------------------------------------------
|
|
5
|
+
# Options & Defaults
|
|
6
|
+
# -------------------------------------------------------------------------
|
|
7
|
+
option(CALF_LOG "Enable CALF logging globally by default" ON)
|
|
8
|
+
option(CALF_TESTS "Enable CALF unit tests" OFF)
|
|
9
|
+
option(CALF_PYTHON_TESTS "Enable CALF Python binding tests" ${CALF_TESTS})
|
|
10
|
+
option(CALF_BUILD_PYTHON_BINDINGS "Build Python bindings for CALF" OFF)
|
|
11
|
+
|
|
12
|
+
set(CALF_DEFAULT_COMPONENT_NAME "calf" CACHE STRING "Fallback component name")
|
|
13
|
+
set(CALF_DEFAULT_LOG_DIR_NAME "./calf_logs" CACHE STRING "Fallback default log dir name")
|
|
14
|
+
|
|
15
|
+
# ---------------------------------------------------------------------------
|
|
16
|
+
# Helper functions (Now modifying targets directly)
|
|
17
|
+
# ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
function(calf_set_component target)
|
|
20
|
+
if (${ARGC} LESS 1 OR ${ARGC} GREATER 2)
|
|
21
|
+
message(FATAL_ERROR "calf_set_component invoked with incorrect number of arguments")
|
|
22
|
+
endif ()
|
|
23
|
+
|
|
24
|
+
set(val "${CALF_DEFAULT_COMPONENT_NAME}")
|
|
25
|
+
if(${ARGC} EQUAL 2)
|
|
26
|
+
set(val "${ARGV1}")
|
|
27
|
+
endif()
|
|
28
|
+
|
|
29
|
+
# Apply directly to the target scope
|
|
30
|
+
target_compile_definitions(${target} PRIVATE _CALF_COMPONENT_NAME="${val}")
|
|
31
|
+
endfunction()
|
|
32
|
+
|
|
33
|
+
function(calf_set_default_log_dir target)
|
|
34
|
+
if (${ARGC} LESS 1 OR ${ARGC} GREATER 2)
|
|
35
|
+
message(FATAL_ERROR "calf_set_default_log_dir invoked with incorrect number of arguments")
|
|
36
|
+
endif ()
|
|
37
|
+
|
|
38
|
+
set(val "${CALF_DEFAULT_LOG_DIR_NAME}")
|
|
39
|
+
if(${ARGC} EQUAL 2)
|
|
40
|
+
set(val "${ARGV1}")
|
|
41
|
+
endif()
|
|
42
|
+
|
|
43
|
+
# Apply directly to the target scope
|
|
44
|
+
target_compile_definitions(${target} PRIVATE _CALF_DEFAULT_LOG_DIR_NAME="${val}")
|
|
45
|
+
endfunction()
|
|
46
|
+
|
|
47
|
+
function(calf_enable_log target ENABLE)
|
|
48
|
+
if (ENABLE)
|
|
49
|
+
target_compile_definitions(${target} PRIVATE CALF_LOG)
|
|
50
|
+
endif ()
|
|
51
|
+
target_include_directories(${target} PRIVATE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}")
|
|
52
|
+
message(STATUS "calf_enable_log(${target}) -> include dir: ${CMAKE_CURRENT_FUNCTION_LIST_DIR}")
|
|
53
|
+
endfunction()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# ---------------------------------------------------------------------------
|
|
57
|
+
# Tests
|
|
58
|
+
# ---------------------------------------------------------------------------
|
|
59
|
+
if(CALF_TESTS)
|
|
60
|
+
include(FetchContent)
|
|
61
|
+
FetchContent_Declare(
|
|
62
|
+
googletest
|
|
63
|
+
GIT_REPOSITORY https://github.com/google/googletest.git
|
|
64
|
+
GIT_TAG v1.17.0
|
|
65
|
+
GIT_SHALLOW TRUE
|
|
66
|
+
)
|
|
67
|
+
FetchContent_Declare(
|
|
68
|
+
nlohmann_json
|
|
69
|
+
GIT_REPOSITORY https://github.com/nlohmann/json.git
|
|
70
|
+
GIT_TAG v3.12.0
|
|
71
|
+
GIT_SHALLOW TRUE
|
|
72
|
+
)
|
|
73
|
+
FetchContent_MakeAvailable(googletest)
|
|
74
|
+
FetchContent_MakeAvailable(nlohmann_json)
|
|
75
|
+
|
|
76
|
+
enable_testing()
|
|
77
|
+
include(GoogleTest)
|
|
78
|
+
|
|
79
|
+
add_executable(calf_core_tests tests/core_tests.cpp)
|
|
80
|
+
calf_enable_log(calf_core_tests ON)
|
|
81
|
+
target_compile_features(calf_core_tests PRIVATE cxx_std_17)
|
|
82
|
+
target_link_libraries(calf_core_tests PRIVATE GTest::gtest_main nlohmann_json::nlohmann_json)
|
|
83
|
+
gtest_discover_tests(calf_core_tests)
|
|
84
|
+
|
|
85
|
+
add_executable(calf_stl_tests tests/stl_tests.cpp)
|
|
86
|
+
calf_enable_log(calf_stl_tests ON)
|
|
87
|
+
target_compile_features(calf_stl_tests PRIVATE cxx_std_17)
|
|
88
|
+
target_link_libraries(calf_stl_tests PRIVATE GTest::gtest_main nlohmann_json::nlohmann_json)
|
|
89
|
+
gtest_discover_tests(calf_stl_tests)
|
|
90
|
+
|
|
91
|
+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
92
|
+
add_executable(calf_syscall_tests tests/syscall_tests.cpp)
|
|
93
|
+
calf_enable_log(calf_syscall_tests ON)
|
|
94
|
+
target_compile_definitions(calf_syscall_tests PRIVATE __CALF_POSIX)
|
|
95
|
+
target_compile_features(calf_syscall_tests PRIVATE cxx_std_17)
|
|
96
|
+
target_link_libraries(calf_syscall_tests PRIVATE GTest::gtest_main
|
|
97
|
+
nlohmann_json::nlohmann_json)
|
|
98
|
+
gtest_discover_tests(calf_syscall_tests)
|
|
99
|
+
endif()
|
|
100
|
+
|
|
101
|
+
add_executable(calf_disabled_tests tests/disabled_tests.cpp)
|
|
102
|
+
calf_enable_log(calf_disabled_tests OFF)
|
|
103
|
+
target_compile_features(calf_disabled_tests PRIVATE cxx_std_17)
|
|
104
|
+
target_link_libraries(calf_disabled_tests PRIVATE GTest::gtest_main)
|
|
105
|
+
gtest_discover_tests(calf_disabled_tests)
|
|
106
|
+
endif ()
|
|
107
|
+
|
|
108
|
+
# ---------------------------------------------------------------------------
|
|
109
|
+
# Python bindings
|
|
110
|
+
# ---------------------------------------------------------------------------
|
|
111
|
+
if(CALF_BUILD_PYTHON_BINDINGS OR CALF_PYTHON_TESTS)
|
|
112
|
+
include(FetchContent)
|
|
113
|
+
find_package(Python 3.10 COMPONENTS Interpreter Development.Module REQUIRED)
|
|
114
|
+
|
|
115
|
+
FetchContent_Declare(
|
|
116
|
+
pybind11
|
|
117
|
+
GIT_REPOSITORY https://github.com/pybind/pybind11.git
|
|
118
|
+
GIT_TAG v3.0.1
|
|
119
|
+
)
|
|
120
|
+
FetchContent_MakeAvailable(pybind11)
|
|
121
|
+
|
|
122
|
+
pybind11_add_module(_py_calf bindings/python_bindings.cpp)
|
|
123
|
+
target_include_directories(_py_calf PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
124
|
+
target_compile_features(_py_calf PRIVATE cxx_std_17)
|
|
125
|
+
calf_set_component(_py_calf)
|
|
126
|
+
calf_set_default_log_dir(_py_calf)
|
|
127
|
+
|
|
128
|
+
if(CALF_BUILD_PYTHON_BINDINGS)
|
|
129
|
+
install(TARGETS _py_calf LIBRARY DESTINATION calf)
|
|
130
|
+
endif()
|
|
131
|
+
|
|
132
|
+
if(CALF_PYTHON_TESTS)
|
|
133
|
+
if(NOT CALF_TESTS)
|
|
134
|
+
enable_testing()
|
|
135
|
+
endif()
|
|
136
|
+
|
|
137
|
+
if(WIN32)
|
|
138
|
+
set(CALF_TEST_PYTHON ${CMAKE_CURRENT_BINARY_DIR}/calf-python-test-env/Scripts/python.exe)
|
|
139
|
+
else()
|
|
140
|
+
set(CALF_TEST_PYTHON ${CMAKE_CURRENT_BINARY_DIR}/calf-python-test-env/bin/python)
|
|
141
|
+
endif()
|
|
142
|
+
|
|
143
|
+
add_custom_target(
|
|
144
|
+
calf_python_tests
|
|
145
|
+
COMMAND ${Python_EXECUTABLE} -m venv
|
|
146
|
+
${CMAKE_CURRENT_BINARY_DIR}/calf-python-test-env
|
|
147
|
+
COMMAND ${CALF_TEST_PYTHON} -m pip install "${CMAKE_CURRENT_SOURCE_DIR}[test]"
|
|
148
|
+
COMMAND ${CALF_TEST_PYTHON} -m pytest -v
|
|
149
|
+
${CMAKE_CURRENT_SOURCE_DIR}/tests/python_bindings_tests.py
|
|
150
|
+
USES_TERMINAL
|
|
151
|
+
)
|
|
152
|
+
add_test(
|
|
153
|
+
NAME calf_python_bindings_tests
|
|
154
|
+
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}
|
|
155
|
+
--target calf_python_tests
|
|
156
|
+
)
|
|
157
|
+
endif()
|
|
158
|
+
endif ()
|
capio_calf-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 High-Performance-IO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|