Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches: [ main ]

jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches: [ main ]

jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: macos-latest
if: github.event.pull_request.draft == false || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches: [ main ]

jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: windows-latest
if: github.event.pull_request.draft == false || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
include:
# Windows with MSVC
- name: "Windows MSVC"
compiler: msvc
cmake-generator: 'Visual Studio 17 2022'
cmake-options: ''

cmake-generator: 'Ninja'
cmake-options: >-
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded

# Windows with MinGW (GCC)
- name: "Windows MinGW"
compiler: gcc
Expand All @@ -42,6 +48,10 @@ jobs:
fi
shell: bash

- name: Setup MSVC dev environment
if: matrix.compiler == 'msvc'
uses: ilammy/msvc-dev-cmd@v1.13.0

- name: Configure CMake
run: |
cmake -B build -G "${{ matrix.cmake-generator }}" ${{ matrix.cmake-options }}
Expand All @@ -66,6 +76,6 @@ jobs:
./all_tests.exe
else # MSVC
echo "Running tests"
./tests/Release/all_tests.exe
./tests/all_tests.exe
fi
shell: bash
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ option(BUILD_TESTS "Build the test suite" ON)
add_subdirectory(external/cryptopp-cmake)
add_subdirectory(external/json)

if(MSVC)
# CryptoPP 8.9.0 fails to build on newer MSVC - integer.cpp and zdeflate.cpp both use a
# removed helper function for CRYPTOPP_MSC_VERSION >= 1500/1600 with no upper bound. Upstream
# fixed both by capping them at < 1938; patch it in until they release a version with the fix.
function(datacoe_patch_cryptopp_msc_guard relative_file old_guard new_guard)
set(file "${CMAKE_CURRENT_BINARY_DIR}/external/cryptopp-cmake/${CRYPTOPP_INCLUDE_PREFIX}/${relative_file}")
if(EXISTS "${file}")
file(READ "${file}" contents)
string(REPLACE "${old_guard}" "${new_guard}" contents "${contents}")
file(WRITE "${file}" "${contents}")
endif()
endfunction()

datacoe_patch_cryptopp_msc_guard(integer.cpp
"#if (CRYPTOPP_MSC_VERSION >= 1500)"
"#if (CRYPTOPP_MSC_VERSION >= 1500) && (CRYPTOPP_MSC_VERSION < 1938)")
datacoe_patch_cryptopp_msc_guard(zdeflate.cpp
"#if CRYPTOPP_MSC_VERSION >= 1600"
"#if (CRYPTOPP_MSC_VERSION >= 1600) && (CRYPTOPP_MSC_VERSION < 1938)")
endif()

# project directories
add_subdirectory(include)
add_subdirectory(src)
Expand Down
50 changes: 29 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ It provides functionalities for data persistence, serialization, and encryption.
[![Linux](https://github.com/nircoe/datacoe/actions/workflows/ci-linux.yml/badge.svg?branch=main&event=push)](https://github.com/nircoe/datacoe/actions/workflows/ci-linux.yml)
[![macOS](https://github.com/nircoe/datacoe/actions/workflows/ci-macos.yml/badge.svg?branch=main&event=push)](https://github.com/nircoe/datacoe/actions/workflows/ci-macos.yml)

## Current State - Refactoring towards a Generic Data API

This README describes the current `main` branch. datacoe is being refactored towards a generic,
templated save/load API (in the `refactor/generic_data` branch), so parts of this README will be
stale until that refactor lands.

---

## Table of Contents
- [Overview](#overview)
- [Features](#features)
Expand All @@ -29,7 +37,7 @@ The library offers a base implementation for data management tasks, including:
- Reading and writing game data to files
- Serialization and deserialization of game data using [nlohmann/json](https://github.com/nlohmann/json)
- Encryption and decryption of data using [CryptoPP](https://github.com/weidai11/cryptopp) (With the help of [CryptoPP-CMake](https://github.com/abdes/cryptopp-cmake))
- Comprehensive test suite using [Google Test](https://github.com/google/googletest)
- Test suite using [Google Test](https://github.com/google/googletest)

[Back to top](#table-of-contents)

Expand Down Expand Up @@ -286,7 +294,7 @@ FetchContent_Declare(

## Testing

The project includes a comprehensive test suite built with Google Test. Tests cover:
The project includes a test suite built with Google Test. Tests cover:

- Basic data operations
- Error handling and recovery
Expand Down Expand Up @@ -406,7 +414,7 @@ Game-specific implementations will have their own tags (e.g., `worm-v1.0.0`) to
- JSON serialization using nlohmann/json
- AES encryption/decryption using CryptoPP
- Optional encryption with automatic format detection
- Comprehensive test suite with Google Test
- Test suite with Google Test
- Proper installation targets and CMake configuration
- Cross-platform support (Windows, macOS, Linux)

Expand Down Expand Up @@ -435,26 +443,26 @@ If you'd like to contribute, please:
## Roadmap

### Implemented Features
- ✅ Basic file input/output operations
- ✅ JSON serialization using nlohmann/json
- ✅ AES encryption/decryption using CryptoPP
- ✅ Comprehensive test suite with Google Test
- ✅ Automated dependency management
- ✅ Optional encryption (ability to disable encryption if not needed)
- Basic file input/output operations
- JSON serialization using nlohmann/json
- AES encryption/decryption using CryptoPP
- Test suite with Google Test
- Automated dependency management
- Optional encryption (ability to disable encryption if not needed)

### Planned Improvements
- ⏳ Secure encryption key management (replacing fixed keys with secure storage and derivation)
- ⏳ Graceful recovery from corrupted files with backup system
- ⏳ Thread-safe operations for concurrent data access
- ⏳ Asynchronous save/load operations
- ⏳ Performance optimizations for large data sets
- ⏳ Auto-save functionality with configurable intervals
- ⏳ Save data compression
- ⏳ Save data versioning and migration
- ⏳ Multiple save slot system with profile management
- ⏳ Support for additional build systems (Make, Visual Studio, Meson, etc.)
- ⏳ Cloud save integration capabilities
- ⏳ Save data analytics and statistics
- Secure encryption key management (replacing fixed keys with secure storage and derivation)
- Graceful recovery from corrupted files with backup system
- Thread-safe operations for concurrent data access
- Asynchronous save/load operations
- Performance optimizations for large data sets
- Auto-save functionality with configurable intervals
- Save data compression
- Save data versioning and migration
- Multiple save slot system with profile management
- Support for additional build systems (Make, Visual Studio, Meson, etc.)
- Cloud save integration capabilities
- Save data analytics and statistics

[Back to top](#table-of-contents)

Expand Down
Loading