Skip to content

Commit 2d0b7ce

Browse files
tmathernTania Matherncrandmck
authored
feat: Enable trust by default, bump c2pa-rs (#111)
* fix: Update C2PA version to 0.71.2 (#110) * fix: Update C2PA version to 0.70.0 * fix: Bump project version to 0.13.0 * fix: Update c2pa-rs version * fix: Nump c2pa-rs c2pa-c-ffi version to 0.71.2 * fix: Version bump * chore: Update c2pa version to v0.72.1 (#115) * chore: Bump to c2pa-rs v0.73.0 (#116) * chore: Update C2PA version to 0.73.1 (#117) * chore: Update C2PA version to 0.73.2 (#121) * fix: Update for move semantics (#123) * fix: Move semantics * fix: Undo some paranoia * fix: COmment * fix: Update for move semantics continu'd (#124) * fix: Move semantics * fix: Undo some paranoia * fix: COmment * fix: More move semantics * chore: Bump C2PA version to 0.74.0 (#125) * Update C2PA version to 0.74.0 * fix: Update test * fix: FOmrat * fix: formatting in documentation comments (#126) * chore: Update C2PA version to 0.75.0 * chore: Update C2PA_VERSION to 0.75.2 * Revert version bump until all things are published * Update C2PA version to 0.75.2 (#127) * fix: Update C2PA version to 0.75.4 (#128) * Update C2PA version to 0.75.3 * fix: Update C2PA version to 0.75.4 * chore: Update C2PA version to 0.75.6 (#129) * fix: Update C2PA version to 0.75.7 (#130) * fix: Update C2PA version to 0.75.8 * feat: Allow building from source in CMakelist (#131) * fix: Update CmakeList * fix: Update comment * Clarify compatibility comment for json library Updated comment to clarify compatibility with older platforms. * fix: Note * feat: Expand OS matrix in CI workflow (#132) * feat: Expand OS matrix in CI workflow * Update CI workflow OS matrix Removed 'windows-2022' and 'ubuntu-slim' from the OS matrix. * Replace filesystem path usage with string conversion * Add filesystem namespace for path handling * Fix test file path for cross-platform compatibility * Update CI workflow to include windows-2022 * Remove namespace alias for filesystem in tests Remove unnecessary namespace alias for filesystem. * Update CI workflow OS matrix Removed 'windows-2022' from the OS matrix in CI workflow. * fix: FIx shadowing (#133) Added new constructor for Signer to take ownership of a signer pointer and updated documentation for clarity. * fix: Additional build flags (#134) * fix: FIx shadowing Added new constructor for Signer to take ownership of a signer pointer and updated documentation for clarity. * feat: Enhance MSVC compiler and linker options Added additional compiler and linker options for MSVC. * fix: Enhance compiler and linker options for c2pa_cpp *nix Added additional compiler and linker options for c2pa_cpp to enhance security and compatibility. * fix: Move linker flags -Wl,-z,relro and -Wl,-z,now to linking Removed linker flags for relro and now. * feat: Adjust linker options for different platforms * fix: Refactorings and additional checks (#135) * fix: Refactor null checks and improve exception handling * Refactor Reader constructor to manage stream lifetime * Update c2pa.cpp * Replace string with std::string in c2pa.cpp * Change type from ofstream to ostream in flusher * Change member functions to const in c2pa.hpp * Fix reserve_size function declaration syntax * Fix supported_mime_types method signature * Change reserve_size method to non-const * Update c2pa.hpp * Update c2pa.cpp * fix: Use EINVAL where it was missed * fix: FOrmat * chore: Bump c2pa-rs version to c2pa-v0.75.10 * fix: Bump to c2pa-rs v0.75.16 (#140) * Update CMakeLists.txt * fix: v0.75.15 * fix: Retrigger all jobs * Update CMakeLists.txt * fix: WinARM runner (#141) * Update CMakeLists.txt * fix: Bump to c2pa-rs v0.75.19 * feat: Context APIs and the related Settings API (#137) * fix: WIP * fix: All my debug * fix: Debug in progress * feat: Refactor (#138) * fix: Skip know bad test * fix: CLean up the example * fix: Clean up header * fix: Header clean up * fix: Renaming to contextCreator * fix: rename * fix: rename * fix: rename and refactor * fix: rename and refactor * fix: rename and refactor --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * fix: More refactors (#139) * fix: Skip know bad test * fix: CLean up the example * fix: Clean up header * fix: Header clean up * fix: Renaming to contextCreator * fix: rename * fix: rename * fix: rename and refactor * fix: rename and refactor * fix: rename and refactor * fix: rename and refactor * fix: rename and refactor * fix: DOn't use deprecated free methods * fix: Start updating the frees * fix: Continue updating the frees * fix: Continue updating the frees * fix: Continue updating the frees * fix: Continue working on the design * fix: Continue working on the design * fix: Continue working on the design * fix: Pointer clean up --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * fix: Refactooooor * fix: Refactooooor * fix: Refactooooor * fix: Refactooooor * fix: Refactooooor * fix: Refactooooor * fix: Refactooooor * fix: Refactooooor for build * fix: Fix WIndows build * fix: Cleaning up * fix: Add TODOs * fix: Update naming, clean up STL * fix: WIP - fix stream handling for files * fix: Tests * fix: Write test for toml and json settings * fix: Add tests for settings combinations * fix: Verify trust * fix: Verify trust * fix: Reader with trust * fix: Clean up list * fix: Update config * fix: Format * fix: Format * fix: Docs * fix: Docs * fix: Docs * fix: Docs * fix: Docs * fix: Docs * fix: TODO dev notes * fix: CLean before rebuild * fix: Refactorings once more * fix: Refactorings * fix: Refactor streams * fix: Streams refacotr * fix: Refactor * fix: Docs * fix: Improvements in progress * fix: Add ASAN, UBSAN * fix: Set up sanitizers * fix: Texts * fix: Update workflow * fix: Update workflow * fix: Update workflow * fix: Reactivate a test * fix: reduce string copies, or try to * ci: Revert "fix: reduce string copies, or try to" This reverts commit 736beb5. * fix: tests moved * fix: Text utils * fix: The refactoring axe is coming out * fix: THe Ubuntu leaks * fix: Bump to use the right c2pa-rs version * fix: Last leak * fix: Mem * fix: Known leak that is not a leak * fix: Clarify suppressor * fix: Clarify suppressor * fix: Add test coverage * fix: Add test coverage for context * fix: Add coverage * fix: A few more tests * fix: Comment on test * fix: Reorg the tests * fix: Reorg the tests * fix: Consistency * fix: Consistency * fix: load archive * fix: Intermediate signing * fix: Multi ingredients * fix: CLean up * fix: Increased test-coveragae on #137 + minor bugfixes (#143) * fix: Add a few todos * fix: Add a few todos 2 * fix: Clean up obsolete debug ref * fix: Add a few todos 3 * fix: WIP test coverage * fix: Test coverage * fix: Test coverage * fix: Notes from API poking * fix: Notes from API poking * fix: Notes from API poking * fix: Notes from API poking * fix: COnvenience API * fix: Refactor text fixtures use * fix: Refactor the teeeeeeests * fix: Refactor * fix: Add the docs * fix: Add the layers merging example * fix: Add a test without relationship * fix: One more test * fix: One more test varation * fix: Undo a final * fix: Flag test as known bad * fix: Rename tests --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * fix: CLean up tests * fix: Extract ingredeints from archives * fix: Extract ingredeints from archives 2 * fix: Add a test * fix: Builder variations * fix: Variations in resources handling * fix: Remove the very ugly string based test * fix: Refactor * fix: Refactor * fix: Cleanup 2 * fix: Reorg * fix: The TODOs are gone * fix: FInish examples clean up * fix: Refactor bytes handling (#144) * refactor * refactor * fix: Refactor --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * fix: Settings reference link * fix: Review comments 1: toml go away! (#145) * fix: Drop from_toml API, fix typos * fix: MOre toml stuffs removed * Update context.test.cpp * fix: Review comments step 2 (#146) * fix: Drop from_toml API, fix typos * fix: MOre toml stuffs removed * Update context.test.cpp * fix: More clean up * fix: Rely more on Rust for pointer clean up * fix: Update coverage and simplify API (#147) * fix: Simplify CMakeList (#148) * fix: Update coverage and simplify API * fix: Simplify CMakeLists * fix: Update docs * fix: Refactor * fix: Shorten docs * fix: Update * fix: Refactored once more and clarified docs * fix: Context verify move * fix: Remove usunsed move * fix: Refactor tests * fix: One more cleanup * fix: Remove the API I said I would * fix: More clean up --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * fix: Clarifying comment * chore: Bump to c2pa-v0.75.21 (#152) * Update CMakeLists.txt * fix: One test is actually invalid * fix: A few other tests are invalid * fix: no archive and embeddable mix * fix: Header docs (#150) * fix: Docs * fix: Clean up docs * fix: Clean up docs * fix: Clean up docs * fix: Typos in header docs * fix: Typos 2 --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * Update c2pa.hpp * Update test.c * fix: Docs * fix: Docs does not belong here * chore: Update C2PA version to 0.76.0 (#163) * fix: Builder::add_ingredient may fail with non-ascii characters in source_path (#161) * fix: utf8 * fix: Add a few tests * fix: Add a few tests 2 * fix: Add a few tests 3 * fix: Add a few tests 3 * fix: Add a few tests 3 * fix: Add a few tests 3 * fix: Add a few tests 3 --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * docs: Context and Settings (#153) * fix: Initial versions * fix: Settings * fix: Context * Update settings.md * Update context.md * Update context.md * Update context.md * minor copy edits * Copy edit * Remove some duplication, add xrefs * clean up edits * Final cleanup edits --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> Co-authored-by: Rand McKinney <crandmck@yahoo.com> * fix: Add a file size limit for settings file read (#162) * fix: Add a file size limit * fix: Enforce more null checks * fix: Enforce more null checks 2 * fix: Typos * fix: Typos * fix: Typos * fix: Typos * fix: Typos * fix: Typos * fix: Typos * fix: Typos --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * fix: Refactor (#165) * fix: Refactor * Delete REFACTORING_PLAN.md * fix: Refactor * fix: Refactor --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * docs: Working stores (#154) * fix: Workin stores * Update working-stores.md * Update working-stores.md * Update working-stores.md * Update working-stores.md * Update working-stores.md * Update working-stores.md * Copy edits, add xrefs * Remove incomplete section * Misc edits and add some more links, add a bit to Mermaid diagram * Add div to xrefs not needed in doc site, other small tweaks --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> Co-authored-by: Rand McKinney <crandmck@yahoo.com> * docs: Re-Builder (#159) * fix: Add docs * docs: Clarify selective manifest construction process Rephrase and clarify the explanation of using Builder and Reader for selective manifest construction, emphasizing the read-only nature and the importance of filtering. * docs: typos Removed section on recording removal actions and related C2PA actions. * Fix formatting issues in selective-manifests.md * Fix formatting in selective-manifests.md * Fix formatting in selective manifests diagram Removed newline characters in ingredient labels and updated the New Builder label for clarity. * Initial copy edit * fix: Refine documentation on selective manifest construction * Fix label in selective-manifests documentation * Update selective-manifests.md * fix: More docs (#164) * fix: More docs * Update selective-manifests.md * fix: Typos * fix: Typos * fix: Typos --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> * fix: typos * Pull Q&A into separate file * Forgot to save files * General edits * More edits, make headings more concise --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> Co-authored-by: Rand McKinney <crandmck@yahoo.com> * docs: Add draft release notes, some minor edits to other docs (#169) * Add initial release notes * Add links to docs from README * Update docs/release-notes.md Co-authored-by: tmathern <60901087+tmathern@users.noreply.github.com> * Update docs/release-notes.md Co-authored-by: tmathern <60901087+tmathern@users.noreply.github.com> * Update release-notes.md --------- Co-authored-by: tmathern <60901087+tmathern@users.noreply.github.com> --------- Co-authored-by: Tania Mathern <tania.mathern@gmail.comn> Co-authored-by: Rand McKinney <crandmck@yahoo.com>
1 parent 3d36978 commit 2d0b7ce

38 files changed

Lines changed: 10221 additions & 1369 deletions

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
strategy:
3030
fail-fast: false
3131
matrix:
32-
os: [windows-latest, macos-latest, ubuntu-latest]
32+
os: [windows-latest, windows-11-arm, macos-latest, macos-15-intel, ubuntu-latest, ubuntu-22.04, ubuntu-22.04-arm, ubuntu-24.04-arm]
3333

3434
steps:
3535
- name: Checkout repository
@@ -46,5 +46,10 @@ jobs:
4646
run: |
4747
which make
4848
make --version
49-
- name: Run tests
49+
50+
- name: Run tests (debug build)
5051
run: make test
52+
53+
- name: Run tests (debug build, with sanitizers)
54+
if: runner.os != 'Windows'
55+
run: make test-san

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/build
2-
/include/c2pa.h
2+
/target
33

44
_deps
55
# CMake files
@@ -16,4 +16,4 @@ CMakeLists.txt.user
1616
.vscode
1717
# Mac OS X files
1818
.DS_Store
19-
.idea
19+
.idea

CMakeLists.txt

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
cmake_minimum_required(VERSION 3.27)
1515

1616
# This is the version of this C++ project
17-
project(c2pa-c VERSION 0.12.1)
17+
project(c2pa-c VERSION 0.13.0)
1818

19-
# Set the version of the c2pa_rs library used here
20-
set(C2PA_VERSION "0.66.0")
19+
# Set the version of the c2pa_rs library used
20+
set(C2PA_VERSION "0.76.0")
2121

2222
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
2323
set(CMAKE_C_STANDARD 17)
24-
set(CMAKE_CXX_STANDARD 20)
24+
set(CMAKE_CXX_STANDARD 17)
2525
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.3")
2626

2727
if(MSVC)
@@ -46,6 +46,64 @@ else()
4646
add_compile_options(-Wall -Wextra -Werror)
4747
endif()
4848

49+
# Sanitizers (for debug/verification builds)
50+
option(ENABLE_SANITIZERS "Enable AddressSanitizer, UndefinedBehaviorSanitizer, and LeakSanitizer" OFF)
51+
option(ENABLE_MSAN "Enable MemorySanitizer (mutually exclusive with ASAN)" OFF)
52+
53+
if(ENABLE_SANITIZERS AND ENABLE_MSAN)
54+
message(FATAL_ERROR "ENABLE_SANITIZERS and ENABLE_MSAN are mutually exclusive - choose one")
55+
endif()
56+
57+
if(ENABLE_SANITIZERS)
58+
if(MSVC)
59+
message(WARNING "Sanitizers are not supported with MSVC in this configuration")
60+
elseif(WIN32)
61+
# MinGW on Windows doesn't have sanitizer libraries available
62+
message(WARNING "Sanitizers are not available on Windows with MinGW - skipping sanitizer build")
63+
else()
64+
# AddressSanitizer, UndefinedBehaviorSanitizer, and LeakSanitizer for GCC/Clang
65+
# Note: LeakSanitizer is not supported on macOS (both x86_64 and ARM64)
66+
# On Linux, LeakSanitizer is integrated with AddressSanitizer
67+
if(APPLE)
68+
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer -g)
69+
add_link_options(-fsanitize=address,undefined)
70+
message(STATUS "Sanitizers enabled on macOS: ASAN and UBSAN (LSan not supported on macOS)")
71+
else()
72+
add_compile_options(-fsanitize=address,undefined,leak -fno-omit-frame-pointer -g)
73+
add_link_options(-fsanitize=address,undefined,leak)
74+
message(STATUS "Sanitizers enabled: ASAN, UBSAN, and LSan")
75+
endif()
76+
# Allow macro redefinition for _FORTIFY_SOURCE which conflicts with sanitizers
77+
add_compile_options(-Wno-macro-redefined)
78+
endif()
79+
endif()
80+
81+
if(ENABLE_MSAN)
82+
if(NOT MSVC)
83+
# MemorySanitizer for detecting uninitialized memory reads
84+
# WARNING: Requires all dependencies to be built with MSan
85+
add_compile_options(-fsanitize=memory -fno-omit-frame-pointer -g)
86+
add_compile_options(-Wno-macro-redefined)
87+
add_link_options(-fsanitize=memory)
88+
message(STATUS "MemorySanitizer enabled (MSan)")
89+
else()
90+
message(WARNING "MemorySanitizer is not supported with MSVC")
91+
endif()
92+
endif()
93+
94+
# Code coverage instrumentation
95+
option(ENABLE_COVERAGE "Enable code coverage instrumentation" OFF)
96+
97+
if(ENABLE_COVERAGE)
98+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
99+
add_compile_options(--coverage -fprofile-arcs -ftest-coverage)
100+
add_link_options(--coverage)
101+
message(STATUS "Code coverage enabled")
102+
else()
103+
message(WARNING "Code coverage is only supported with GCC or Clang")
104+
endif()
105+
endif()
106+
49107
enable_testing()
50108

51109
ADD_SUBDIRECTORY(src)

Makefile

Lines changed: 89 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,112 @@ BUILD_DIR = build
55
DEBUG_BUILD_DIR = build/debug
66
RELEASE_BUILD_DIR = build/release
77

8+
# CMake options (can be overridden via environment)
9+
CMAKE_OPTS :=
10+
ifdef C2PA_BUILD_FROM_SOURCE
11+
CMAKE_OPTS += -DC2PA_BUILD_FROM_SOURCE=$(C2PA_BUILD_FROM_SOURCE)
12+
endif
13+
ifdef C2PA_RS_PATH
14+
CMAKE_OPTS += -DC2PA_RS_PATH=$(C2PA_RS_PATH)
15+
endif
16+
817
# Default target
9-
all: test examples
18+
all: clean test examples
19+
20+
clean:
21+
rm -rf $(BUILD_DIR)
1022

1123
# Debug build
1224
debug:
13-
cmake -S . -B $(DEBUG_BUILD_DIR) -G "Ninja" -DCMAKE_BUILD_TYPE=Debug
25+
cmake -S . -B $(DEBUG_BUILD_DIR) -G "Ninja" -DCMAKE_BUILD_TYPE=Debug $(CMAKE_OPTS)
1426
cmake --build $(DEBUG_BUILD_DIR)
1527

1628
# Release build
1729
release:
18-
cmake -S . -B $(RELEASE_BUILD_DIR) -G "Ninja" -DCMAKE_BUILD_TYPE=Release
30+
cmake -S . -B $(RELEASE_BUILD_DIR) -G "Ninja" -DCMAKE_BUILD_TYPE=Release $(CMAKE_OPTS)
1931
cmake --build $(RELEASE_BUILD_DIR)
2032

2133
# Legacy cmake target (uses release build)
2234
cmake: release
2335

2436
# Test targets
25-
test: debug
37+
test: clean debug
2638
cd $(DEBUG_BUILD_DIR) && ctest --output-on-failure
2739

28-
test-release: release
40+
test-release: clean release
2941
cd $(RELEASE_BUILD_DIR) && ctest --output-on-failure
3042

43+
# Test with sanitizers (ASAN + UBSAN)
44+
test-san: clean
45+
cmake -S . -B $(DEBUG_BUILD_DIR) -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZERS=ON $(CMAKE_OPTS)
46+
cmake --build $(DEBUG_BUILD_DIR)
47+
cd $(DEBUG_BUILD_DIR) && ctest --output-on-failure
48+
49+
# Run only the C test (test.c)
50+
test-c: clean release
51+
@echo "Running C test only..."
52+
ifeq ($(OS),Darwin)
53+
DYLD_LIBRARY_PATH=$(RELEASE_BUILD_DIR)/tests:$$DYLD_LIBRARY_PATH ./$(RELEASE_BUILD_DIR)/tests/ctest
54+
else
55+
LD_LIBRARY_PATH=$(RELEASE_BUILD_DIR)/tests:$$LD_LIBRARY_PATH ./$(RELEASE_BUILD_DIR)/tests/ctest
56+
endif
57+
58+
# Run only the C++ tests
59+
test-cpp: clean release
60+
@echo "Running C++ tests only..."
61+
ifeq ($(OS),Darwin)
62+
DYLD_LIBRARY_PATH=$(RELEASE_BUILD_DIR)/tests:$$DYLD_LIBRARY_PATH ./$(RELEASE_BUILD_DIR)/tests/c2pa_c_tests
63+
else
64+
LD_LIBRARY_PATH=$(RELEASE_BUILD_DIR)/tests:$$LD_LIBRARY_PATH ./$(RELEASE_BUILD_DIR)/tests/c2pa_c_tests
65+
endif
66+
67+
# Run a single test by fully qualified name
68+
# Like this: make run-single-test TEST=BuilderTest.MergingBuildersThenSignMerged
69+
run-single-test: release
70+
@if [ -z "$(TEST)" ]; then echo "Usage: make run-single-test TEST=SuiteName.TestName"; exit 1; fi
71+
@echo "Running single test: $(TEST)"
72+
ifeq ($(OS),Darwin)
73+
DYLD_LIBRARY_PATH=$(RELEASE_BUILD_DIR)/tests:$$DYLD_LIBRARY_PATH ./$(RELEASE_BUILD_DIR)/tests/c2pa_c_tests --gtest_filter="$(TEST)"
74+
else
75+
LD_LIBRARY_PATH=$(RELEASE_BUILD_DIR)/tests:$$LD_LIBRARY_PATH ./$(RELEASE_BUILD_DIR)/tests/c2pa_c_tests --gtest_filter="$(TEST)"
76+
endif
77+
78+
# Test with coverage reporting
79+
# THis verifies necessary tooling for coverage check is also installed
80+
test-coverage: clean
81+
cmake -S . -B build/coverage -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON $(CMAKE_OPTS)
82+
cmake --build build/coverage
83+
cd build/coverage && ctest --output-on-failure
84+
@echo ""
85+
@echo "Generating coverage report..."
86+
@lcov --capture --directory build/coverage --output-file build/coverage/coverage.info \
87+
--ignore-errors mismatch,inconsistent,unsupported,format 2>&1 \
88+
| grep -v "WARNING:" || { echo "Error: lcov capture failed"; exit 1; }
89+
@lcov --remove build/coverage/coverage.info \
90+
'/usr/*' '*/googletest/*' '*/json-src/*' '*/c2pa_prebuilt-src/*' '*/tests/*' \
91+
--output-file build/coverage/coverage_filtered.info \
92+
--ignore-errors unused,mismatch,inconsistent,format 2>&1 \
93+
| grep -v "WARNING:" || { echo "Error: lcov filter failed"; exit 1; }
94+
@echo ""
95+
@echo "=== Coverage Summary ==="
96+
@lcov --summary build/coverage/coverage_filtered.info \
97+
--ignore-errors inconsistent,format 2>&1 \
98+
| grep -E "(lines|functions|branches)" || true
99+
@echo "========================"
100+
@echo ""
101+
@if command -v genhtml > /dev/null 2>&1; then \
102+
genhtml build/coverage/coverage_filtered.info --output-directory build/coverage/html \
103+
--ignore-errors inconsistent,corrupt,unsupported,format,category 2>&1 \
104+
| grep -v "WARNING:" || true; \
105+
if [ -f build/coverage/html/index.html ]; then \
106+
echo "HTML report: build/coverage/html/index.html"; \
107+
else \
108+
echo "Warning: HTML report was not generated (genhtml may have failed)"; \
109+
fi; \
110+
else \
111+
echo "Note: genhtml not found, skipping HTML report (install lcov for HTML reports)"; \
112+
fi
113+
31114
# Demo targets
32115
demo: release
33116
cmake --build $(RELEASE_BUILD_DIR) --target demo
@@ -39,12 +122,8 @@ training: release
39122

40123
examples: training demo
41124

42-
clean:
43-
rm -rf $(BUILD_DIR)
44-
45-
.PHONY: all debug release cmake test test-release demo training examples clean
125+
.PHONY: all debug release cmake test test-release test-san test-c test-cpp test-coverage demo training examples clean
46126

47127
# Build C API docs with Doxygen
48128
docs:
49129
./scripts/generate_api_docs.sh
50-

README.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,21 @@ Although this library works for plain C applications, the documentation assumes
99
<div class="hide-doxygen" >
1010
<div style={{display: 'none'}}>
1111

12-
For the best experience, read the docs on the [CAI Open Source SDK documentation website](https://opensource.contentauthenticity.org/docs/c2pa-c). If you want to view the documentation in GitHub, see:
12+
For the best experience, read the docs on the [CAI Open Source SDK documentation website](https://opensource.contentauthenticity.org/docs/c2pa-c).
13+
14+
If you want to view the documentation in GitHub, see:
1315
- [Using the C++ library](docs/usage.md)
14-
- [Supported formats](https://github.com/contentauth/c2pa-rs/blob/crandmck/reorg-docs/docs/supported-formats.md)
16+
- [Supported formats](https://github.com/contentauth/c2pa-rs/blob/main/docs/supported-formats.md)
17+
- Configuring the SDK using [`Settings`](settings.md).
18+
- [Using `Context`](context.md) to configure `Reader` `Builder`, and other aspects of the SDK.
19+
- Using [working stores and archvies](working-stores.md).
20+
- Using `Builder` and `Reader` together to [selectively construct a manifest by filtering actions and ingredients](selective-manifests.md).
21+
- [Release notes](release-notes.md)
1522

1623
</div>
1724
</div>
1825

19-
## Using c2pa_cpp
26+
## Using c2pa_cpp
2027

2128
The recommended way to use this library in your own CMake project is with [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html):
2229

@@ -34,45 +41,70 @@ add_executable(myapp main.cpp)
3441
target_link_libraries(myapp PRIVATE c2pa_cpp)
3542
```
3643

37-
This will automatically fetch, build, and link the `c2pa_cpp` library and its dependencies.
44+
This will automatically fetch, build, and link the `c2pa_cpp` library and its dependencies.
3845

39-
> **Note:**
46+
> **Note:**
4047
> This project uses pre-built dynamic libraries from the [c2pa-rs](https://github.com/contentauth/c2pa-rs) repository. It should select the correct library for your platform. If your platform is not supported, you can build your own library using the c2pa_rs repo.
4148
4249
### Example usage
4350

44-
See the [`examples/`](examples/) directory for sample applications that demonstrate how to use the library in practice.
51+
See the [`examples/`](examples/) directory for sample applications that demonstrate how to use the library in practice.
4552

4653
## Development
4754

4855
This project has been tested on macOS and should also work on common Linux distributions.
4956

57+
You must install the [Ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) build system to run the unit tests.
5058

51-
You must install the [Ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) build system to run the unit tests.
52-
53-
### Building
59+
### Building using pre-built C FFI libraries
5460

55-
Building the library requires [GNU make](https://www.gnu.org/software/make/), which is installed on most macOS systems.
61+
Building the library holding the C++ SDK requires [GNU make](https://www.gnu.org/software/make/), which is installed on most macOS systems.
5662

57-
Enter this command to build the C library:
63+
Enter this command to build the SDK:
5864

5965
```
6066
make release
6167
```
6268

69+
This will download the [pre-build libraries published with c2pa releases](https://github.com/contentauth/c2pa-rs/releases), build and link the C++ code.
70+
6371
The Makefile has a number of other targets; for example:
64-
- `unit-tests` to run C++ unit tests
72+
- `test` to run unit tests
6573
- `examples` to build and run the C++ examples.
66-
- `all` to run everything.
74+
- `all` to build and run everything.
6775

6876
Results are saved in the `build` directory.
6977

78+
### Building using local sources
79+
80+
This project can also be built entirely from source (without pre-built library download), with the pre-requisite that you will also need [c2pa-rs](https://github.com/contentauth/c2pa-rs) on the local machine, as well as the [Rust toolchain](https://rust-lang.org/tools/install/).
81+
82+
To build in this case, the build scripts need to be able to locate the `c2pa-rs` sources as well as the library this builds for linking. This is done by setting environment variables in the terminal where the builds will run.
83+
84+
```sh
85+
# Enable local c2pa-rs build
86+
export C2PA_BUILD_FROM_SOURCE=ON
87+
88+
# If local build is enabled, set this environment variable to contain the path to c2pa-rs sources
89+
export C2PA_RS_PATH=path_to_c2pa_rs_sources
90+
91+
# Since this is going to build Rust code, the build system needs to locate cargo, the tool to build Rust code
92+
# Add Rust cargo to PATH if not already there
93+
export PATH="$HOME/.cargo/bin:$PATH"
94+
95+
# macOs: Set built library path for running tests
96+
export DYLD_LIBRARY_PATH="$(pwd)/build/release/tests:$DYLD_LIBRARY_PATH"
97+
98+
# Linux: Set built library path for running tests
99+
export LD_LIBRARY_PATH="$(pwd)/build/release/tests:$LD_LIBRARY_PATH"
100+
```
101+
70102
### Testing
71103

72104
Build the [unit tests](https://github.com/contentauth/c2pa-c/tree/main/tests) by entering this `make` command:
73105

74106
```
75-
make unit-test
107+
make test
76108
```
77109

78110
### Building API documentation
@@ -81,7 +113,7 @@ API documentation generated by Doxygen is automatically built on each PR.
81113

82114
To generate API docs locally, these are the main files:
83115

84-
- Configuration file: `c2pa-c/Doxyfile`
116+
- Configuration file: `c2pa-c/Doxyfile`
85117
- Script: `c2pa-c/scripts/generate_api_docs.sh`
86118
- Output directory: `docs/_build/html`
87119

@@ -111,5 +143,3 @@ Note that some components and dependent crates are licensed under different term
111143
### Contributions and feedback
112144

113145
We welcome contributions to this project. For information on contributing, providing feedback, and about ongoing work, see [Contributing](https://github.com/contentauth/c2pa-c/blob/main/CONTRIBUTING.md).
114-
115-

ci-cd/lsan_suppressions.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# LeakSanitizer suppression file for c2pa-c tests.
2+
#
3+
# On first use Tokio allocates process-global singleton state (signal handler
4+
# registry, thread-local handles via OnceLock/Lazy) that is intentionally never
5+
# freed. The allocation is bounded, does not grow, and is reclaimed by the OS on process exit.
6+
#
7+
# Observed on Ubuntu 22.04 aarch64 where LSan classifies the allocation as a
8+
# "direct leak" rather than "still reachable".
9+
#
10+
# Similar if not same as https://github.com/tokio-rs/tokio/issues/4756
11+
# Happens only on some Linxues as it depends on the OS/glibc version too it seems!
12+
#
13+
leak:libc2pa_c

0 commit comments

Comments
 (0)