Giter Club home page Giter Club logo

sanecpplibraries's Introduction

Windows Linux+macOS Coverage

Sane C++ Libraries

YouTube X (formerly Twitter) Follow Discord GitHub Repo stars

Sane C++ Libraries is a set of C++ platform abstraction libraries for macOS, Windows and Linux.

Sane Cpp

Principles:

✅ Fast compile times
✅ Bloat free
✅ Simple readable code
✅ Easy to integrate
⛔️ No C++ Standard Library / Exceptions / RTTI
⛔️ No third party dependencies (prefer OS API)

Visit the documentation website for more information.

Libraries

Library Description
Algorithms 🟥 Placeholder library where templated algorithms will be placed
Async 🟨 Async I/O (files, sockets, timers, processes, fs events, threads wake-up)
Build 🟨 Minimal build system where builds are described in C++
Containers 🟨 Generic containers (SC::Vector, SC::SmallVector, SC::Array etc.)
File 🟩 Synchronous Disk File I/O
File System 🟩 File System operations { exists, copy, delete } for { files and directories }
File System Iterator 🟩 Enumerates files and directories inside a given path
File System Watcher 🟩 Notifications {add, remove, rename, modified} for files and directories
Foundation 🟩 Primitive types, asserts, limits, Function, Span, Result, Tagged Union
Hashing 🟩 Compute MD5, SHA1 or SHA256 hashes for a stream of bytes
Http 🟥 HTTP parser, client and server
Plugin 🟨 Minimal dependency based plugin system with hot-reload
Process 🟩 Create child processes and chain them (also usable with Async library)
Reflection 🟩 Describe C++ types at compile time for serialization
Serialization Binary 🟨 Serialize to and from a binary format using Reflection
Serialization Text 🟨 Serialize to / from text formats (JSON) using Reflection
Socket 🟨 Synchronous socket networking and DNS lookup
Strings 🟩 String formatting / conversion / manipulation (ASCII / UTF8 / UTF16)
Testing 🟨 Simple testing framework used by all of the other libraries
Threading 🟥 Atomic, thread, thread pool, mutex, condition variable
Time 🟨 Time handling (relative, absolute, high resolution)

Each library is color-coded to signal its status:

  • 🟥 Draft (incomplete, work in progress, proof of concept, works on basic case)
  • 🟨 MVP (minimum set of features have been implemented)
  • 🟩 Usable (a reasonable set of features has been implemented to make library useful)
  • 🟦 Complete (all planned features have been implemented)

C Bindings

Some Libraries have C bindings

Binding Description
sc_hashing Bindings for the Hashing Library

Building

Libraries can be used as is, adding a single file to your project and without needing any build system.
See Building (user) to just use the library

Shortly:

  • Add Bindings/cpp/SC.cpp to your build system of choice
  • Define SC_COMPILER_ENABLE_STD_CPP=1 if you plan to use the Standard C++ library
  • Include any public header (Libraries/[Library]/*.h)

Windows

  • Nothing else to link (in addition to default libs)

macOS / iOS

  • Link CoreFoundation.framework
  • Link CoreServices.framework

Linux

  • Link libdl (-ldl)
  • Link libpthread (-lpthread)

Examples

SCExample showcases integration of Sane C++ Libraries together with Dear ImGui and sokol libraries (see Examples page).

macOS

SCExample_04.mp4

iOS

SCExampleIOS_01.mp4

Tests

Tests are built with the self-hosted SC::Build project generator, describing the builds in C++.
Check Building (contributor) to run the tests.

Getting in touch

Alternatively I am also reading the following discords too:

Videos

Blog posts:

You can find some YouTube Videos and Blog posts describing some bits of the development process:

Contributing

Please take some time to read the Principles and Coding Style.

After that you can read the CONTRIBUTING.md guide.

License

Sane C++ Libraries are licensed under the MIT License, see LICENSE.txt for more information.

sanecpplibraries's People

Contributors

jlaumon avatar pagghiu avatar silent-tech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sanecpplibraries's Issues

Web Support Timeline?

Hey! Really loving the direction of this library so far. I see in Platform.h that web/emscripten/wasi support is "planned" and that there are a few references to it throughout the codebase. What does the timeline look like on web support? Is that the current focus? Or is that much farther out?

Create GitHub pipeline to reject code not formatted with clang-format

We should really add a GitHub pipeline that fails if the code is not formatted with clang-format.

The script should be along these lines:

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ROOT_DIR="${SCRIPT_DIR}/.."
SOURCE_DIR="${ROOT_DIR}/../SC"
HOST_TOOLS="${ROOT_DIR}/_Build/HostTools"
CLANG_FORMAT="$HOST_TOOLS/clang/bin/clang-format"
cd "${SOURCE_DIR}" && find . \( -iname \*.h -o -iname \*.cpp -o -iname \*.mm -o -iname \*.m -o -iname \*.inl \) -not \( -path "*/Dependencies/*" -o -path "*/Build/Windows/resource.h"  \) | xargs "${CLANG_FORMAT}" -i

Access violation on windows

Hello, unfortunately I have an issue with SCLib on windows. I got an exception in the Async module.

Details of my environment:

  • VS2022 V17.9.6
  • Win10 22H2
  • Intel Core i3 with 12Gb RAM
  • (I also tested the build on another machine (Core i5) with similar results.)

Details of the error:
"Exception thrown at 0x00007FF7DDFD1536 in SCTest.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF."

Call Stack:
SCTest.exe!SC::detail::AsyncWinOverlapped::getUserDataFromOverlappedSC::AsyncRequest(_OVERLAPPED * lpOverlapped) Line 32 C++
SCTest.exe!SC::AsyncEventLoop::KernelQueue::getAsyncRequest(unsigned int index) Line 200 C++
SCTest.exe!SC::AsyncEventLoop::Private::runStepExecuteCompletions(SC::AsyncEventLoop::KernelQueue & queue) Line 610 C++
SCTest.exe!SC::AsyncEventLoop::Private::runStep(SC::AsyncEventLoop::Private::SyncMode syncMode) Line 573 C++
SCTest.exe!SC::AsyncEventLoop::runNoWait() Line 269 C++
SCTest.exe!SC::AsyncEventLoop::Internal::createSharedWatchers(SC::AsyncEventLoop & eventLoop) Line 134 C++
SCTest.exe!SC::AsyncEventLoop::create(SC::AsyncEventLoop::Options options) Line 261 C++
SCTest.exe!SC::FileSystemWatcherTest::eventLoopSubdirectory(const SC::StringView appDirectory) Line 117 C++
SCTest.exe!SC::FileSystemWatcherTest::FileSystemWatcherTest(SC::TestReport & report) Line 23 C++
SCTest.exe!SC::runFileSystemWatcherTest(SC::TestReport & report) Line 334 C++
SCTest.exe!main(int argc, const char * * argv) Line 157 C++

Locals of the AsyncWinOverlapped::getUserDataFromOverlapped function:
offsetOfOverlapped -> 8
offsetOfAsync -> 0

I hope, it will be enough info to find the problem.

io_uring backend?

Hi there, cool project!

Any plans to support io_uring backends for Async I/O (and event loop)?

Support building and testing the unit test project from VSCode on Windows

Currently VSCode build and run configuration exist only for macOS and Linux.
It would be cool to have a VSCode build / run configuration for Windows.

Ideally it should be possible building using the generated Visual Studio file or the Makefile, that would need to be modified, as it's currently Posix only.

Create GitHub pipelines to run tests

We should really create some GitHub pipelines that are:

  • Bootstrapping the build (Calling SCBuild.bat(windows), SCBuild.sh(Linux / macOS)
  • Building the unit test (SCTest project or makefile)
  • Running the test suite (SCTest executable)

And this should be running on:

  • macOS
  • Windows
  • Linux

so that we can make it a prerequisite for any MR

Unable to build on Linux: different exception specifier

I'm getting the following compilation failure. Looks like the functions in LibC.h are missing noexcept(true).

This is on gcc 13.2.1 on Fedora.

In file included from /home/nimble/dev/example/thirdparty/sc/Libraries/FileSystem/Internal/FileSystemPosix.inl:11,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/FileSystem/FileSystem.cpp:12,
                 from /home/nimble/dev/example/thirdparty/sc/SC.cpp:9:
/usr/include/string.h:43:14: error: declaration of ‘void* memcpy(void*, const void*, size_t) noexcept’ has a different exception specifier
   43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
      |              ^~~~~~
In file included from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/../../File/../Strings/../Strings/../Foundation/Assert.h:6,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/../../File/../Strings/../Strings/StringIterator.h:4,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/../../File/../Strings/StringView.h:4,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/../../File/FileDescriptor.h:7,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/../Async.h:12,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/AsyncPrivate.h:2,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/AsyncLinux.inl:3,
                 from /home/nimble/dev/example/thirdparty/sc/Libraries/Async/Async.cpp:10,
                 from /home/nimble/dev/example/thirdparty/sc/SC.cpp:6:
/home/nimble/dev/example/thirdparty/sc/Libraries/Async/Internal/../../File/../Strings/../Strings/../Foundation/../Foundation/LibC.h:16:11: note: from previous declaration ‘void* memcpy(void*, const void*, SC::size_t)’
   16 |     void* memcpy(void* dst, const void* src, SC::size_t n);
      |           ^~~~~~

Vcpkg support?

Hello, great project you've got going on here.
Are there any plans or intentions to make the libraries easy to install with any popular package managers? Like vcpkg?
Installation could be as easy as vcpkg install sane-cpp-libraries, and would ease adoption.

Code coverage computation

We should compute code coverage for all three supported platform.

It would be cook to display a code coverage badge somewhere in the readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.