Git Product home page Git Product logo

buck-yeh / bux Goto Github PK

View Code? Open in Web Editor NEW
4.0 0.0 0.0 477 KB

Static library of whatever are seen required in general purpose but not directly supported from Modern C++. Or whatever reusable originated from my side projects.

Home Page: https://buck-yeh.github.io/bux/html/

License: MIT License

C++ 94.74% CMake 3.76% C 0.52% Dockerfile 0.49% Shell 0.50%
gereral-purposed argv-parser lr1-parser glr-parser logger partial-ordering unicode-converter atomic-lock cpp20-library exceptions

bux's Introduction

  • bux is not Buck's. It could be box!

  • Supplemental static library of whatever are seen required in sense of general purpose but not directly supported from Modern C++. Or whatever is deemed reusable from my side projects.

  • Doxygen-generated API reference is here. ๐Ÿ’ก Doxygen has been known for being insensitive to Modern C++ for so many years. Keywords like any of attributes, ... etc can be misinterpreted or simply dropped. Viewer's discretion is advised.

Table of Contents

(Created by gh-md-toc)

Installation & Usage

  1. Make sure you have installed yay or any other pacman wrapper

  2. yay -Ss bux
  3. To define target executable foo using bux in CMakeLists.txt

    add_executable(foo foo.cpp)
    target_compile_options(foo PRIVATE -std=c++2a)
    target_link_libraries(foo bux)
  4. Include the header files by prefixing header name with bux/, for example:

    #include <bux/Logger.h>

    p.s. Header files are in /usr/include/bux and compiler is expected to search /usr/include by default.

  5. If directly using gcc or clang is intended, the required compiler flags are -std=c++23 -lbux

from github in any of Linux distros

  1. Make sure you have installed cmake(3.18 or newer) make gcc(13 or newer) git, or the likes.

  2. git clone -b main --single-branch https://github.com/buck-yeh/bux.git .
    cmake .
    make -j
    BUX_DIR="/full/path/to/current/dir"

    p.s. You can install a tagged version by replacing main with tag name.

  3. To define target executable foo using bux in CMakeLists.txt

    add_executable(foo foo.cpp)
    target_compile_options(foo PRIVATE -std=c++2a)
    target_include_directories(foo PRIVATE "$env{BUX_DIR}/include") 
    target_link_directories(foo PRIVATE "$env{BUX_DIR}/src") 
    target_link_libraries(foo bux)
  4. Include the header files by prefixing header name with bux/, for example:

    #include <bux/Logger.h>
  5. If directly using command gcc or clang is intended, the required compiler flags are -std=c++23 -I$BUX_DIR/include -L$BUX_DIR/src -lbux

  6. Subdirectory test/ is excluded by default. To build with it, reconfigure cmake with:

    rm CMakeCache.txt
    cmake . -DBUILD_TEST=1
    make

    And test all of them:

    cd test
    ctest .

from vcpkg in Windows

  1. PS F:\vcpkg> .\vcpkg.exe search bux
    buck-yeh-bux             1.6.8#2          A supplemental C++ library with functionalities not directly supported fro...
    buck-yeh-bux-mariadb-client 1.0.3#1       Loose-coupled throw-on-error C++20 wrapper classes and utilities over mysq...
    buck-yeh-bux-sqlite      1.0.1            Modern C++ wrapper classes and utilities of the original sqlite3 API
    The result may be outdated. Run `git pull` to get the latest results.
    If your port is not listed, please open an issue at and/or consider making a pull request.  -  https://github.com/Microsoft/vcpkg/issues
    PS F:\vcpkg>
  2. Available triplets are:

    buck-yeh-bux:x64-windows
    buck-yeh-bux:x64-windows-static
    buck-yeh-bux:x64-windows-static-md
    buck-yeh-bux:x86-windows
    buck-yeh-bux:x86-windows-static
    
  3. Include the header files by prefixing header name with bux/, for example:

    #include <bux/Logger.h>

Header Intros

Containers

Input/Output

Logger

  • FileLog.h - bux::C_PathFmtLogSnap can be configured to automatically change the output path, IOW to output to different files, according to the current timestamp. The object is a plugin to bux::C_ReenterableOstreamSnap and bux::C_ParaLog
  • Logger.h - Log macros for various needs with singleton bux::logger() in mind.
  • LogLevel.h - LL_FATAL, LL_ERROR, LL_WARNING, LL_INFO, LL_VERBOSE
  • ParaLog.h - bux::C_ParaLog is a logger facade to reroute log lines to multiple child loggers
  • SyncLog.h - Basic classes to give variety of thread-safe loggers.

Parser/scanner related

System

Thread Safety

Misc.

bux's People

Contributors

buck-yeh avatar

Stargazers

 avatar  avatar  avatar  avatar

bux's Issues

Clang link error

When I configure the repo to build with Clang like this:

rm CMakeCaches.txt
CXX=clang CC=clang cmake .
make clean
make -j

I got:

/usr/bin/ld: ../src/libbux.a(StrUtil.cpp.o): undefined reference to symbol '_ZSt20__throw_length_errorPKc@@GLIBCXX_3.4'
/usr/bin/ld: /usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [_deps/fetchedbux-build/test/CMakeFiles/test_expand_env.dir/build.make:104: _deps/fetchedbux-build/test/test_expand_env] Error 1
make[1]: *** [CMakeFiles/Makefile2:208: _deps/fetchedbux-build/test/CMakeFiles/test_expand_env.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

Please advice

Buck-yeh-bux build failed with error C7595 in MSVC

Hello, I'm a member of Microsoft VCPKG, when I built this port in an internal version of Visual Studio, it failed with following errors:
src\XException.cpp(49): error C7595: 'fmt::v8::basic_format_string<char,int,const char (&)[30],const DWORD &,const DWORD &,void *,void *,const DWORD &>::basic_format_string': call to immediate function is not a constant expression
This error is because of the format string is incorrect, it could be fixed by change the following codes in XException.cpp:

        if (const EXCEPTION_RECORD *er =pInfo->ExceptionRecord)
            RUNTIME_ERROR("code 0x{:x}, flags 0x{:x}, extra 0x{:x}, ip 0x{:x}, arg#{:x}",
                er->ExceptionCode,
                er->ExceptionFlags,
                static_cast<void*>(er->ExceptionRecord),
                static_cast<void*>(er->ExceptionAddress),
                er->NumberParameters);

Changed to:

        if (const EXCEPTION_RECORD *er =pInfo->ExceptionRecord)
            RUNTIME_ERROR("code 0x{:x}, flags 0x{:x}, extra 0x{:x}, ip 0x{:x}, arg#{:x}",
                er->ExceptionCode,
                er->ExceptionFlags,
                (size_t)static_cast<void*>(er->ExceptionRecord),
                (size_t)static_cast<void*>(er->ExceptionAddress),
                er->NumberParameters);

Could you please fix this problem? If you need any information, please contact me directly. Thanks in advance.

Logger.cpp needs a rehaul to have (new) parallel logger module

  • New C_ParaLog as container of any log objects.
  • Log level per contained logger outlet.
  • C_FileLog able to write to new file for size limit in addition to time format string.
  • Create unit test cases. Create sample program for each variation type of logger instead.
  • Port bux to Windows (Targeting only VS2019) and prepare PR from vcpkg

`bux::C_EZArgs` wish list

  1. Provide a switch to use '/' to start a flag instead of '-' (long/short name rule may have to switch with it)
  2. Provide a switch to enable case-ignored flag names.

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.