Skip to content

c-logger: changes to allow compilation on embedded platforms#10

Open
nicola-lunghi wants to merge 2 commits into
yksz:masterfrom
nicola-lunghi:fixup/fix-warnings
Open

c-logger: changes to allow compilation on embedded platforms#10
nicola-lunghi wants to merge 2 commits into
yksz:masterfrom
nicola-lunghi:fixup/fix-warnings

Conversation

@nicola-lunghi

Copy link
Copy Markdown

Main idea here is to allow building the library on an embedded platform that doesn't have all the features that a normal system has like pthread.
here we allow to have a custom implementation of system functions

…nhancement

## Build System & CMake Modernization
- Modernize CMake build system with proper structure and dependencies
- Add WARNINGS_AS_ERRORS option for strict compilation
- Reorganize CMakeLists.txt with options at top
- Update CMake minimum version to 3.5
- Use GNUInstallDirs for cross-platform install paths
- Improve build configuration with default type and enhanced flags
- Add all source files to track dependencies properly

## Platform Abstraction & Cross-Platform Support
- Implement comprehensive platform abstraction layer
- Create logger_platform.h/c for platform-specific functions
- Add platform abstractions for threading, file operations, and system calls
- Implement cross-platform compatibility using HAVE_* defines
- Add support for alternate platform implementations
- Rename autogenerated config file from config.h to platform_config.h
- Add platform abstraction for error reporting to solve chicken-egg problem

## Compiler & Code Quality Improvements
- Migrate to C99 standard and enable C++ style comments
- Resolve compiler warnings across entire codebase
- Add _GNU_SOURCE define to enable GNU extensions
- Fix sign comparison and truncation warnings
- Fix strncat bound warnings with proper space calculation
- Update examples and tests to resolve compilation warnings

## Cross-Platform Testing Infrastructure
- Add comprehensive cross-platform testing infrastructure
- Create advanced testing scripts for multiple platforms
- Add platform customization instructions and documentation
- Fix cross-platform testing infrastructure issues
- Update test scripts to use build- prefix for directories
- Add CMake cache cleanup to prevent conflicts
- Resolve header include path issues in test builds

## Documentation & Examples
- Add comprehensive multi-platform testing documentation
- Add platform customization instructions to README
- Update examples with proper error handling
- Maintain 100% test success rate across all platforms

## Files Changed
- 26 files modified with 1,390 insertions and 147 deletions
- All tests pass with 100% success rate
- Maintains backward compatibility while adding new features
- Add GitHub Actions workflow to replace Travis CI
  * Tests on both GCC and Clang compilers
  * Runs build.sh debug, make, make test
  * Includes cross-platform compatibility tests
  * Triggers on push/PR to main/master/develop branches

- Fix CMake time.h detection in PlatformChecks.cmake
  * Add check_include_file(time.h HAVE_TIME_H)
  * Update config.h.in template with HAVE_TIME_H define

- Add conditional time.h include in logger.c
  * Prevents implicit function declaration errors
  * Enables proper fallback when time.h is not available

- Improve error handling in all bash scripts
  * Add 'set -euf -o pipefail' to build.sh, advanced-tests.sh,
    test-missing-headers.sh, and glog-install.sh
  * Change shebang from /bin/sh to /bin/bash where needed
  * Ensures scripts fail fast on any error

- Verified all tests pass (5/5) and cross-platform tests work
- All examples run correctly with proper timestamp functionality
@nicola-lunghi nicola-lunghi changed the title A lot of fixes c-logger: changes to allow compilation on embedded platforms Aug 28, 2025
@nicola-lunghi

Copy link
Copy Markdown
Author

Hi @yksz is this repo dead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant