8000 GitHub - RippeR37/libbase: Standalone reimplementation of //base module from Chromium
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

RippeR37/libbase

Repository files navigation

libbase Language Documentation GitHub license GitHub Releases vcpkg release

Branch Ubuntu Windows MacOS Documentation Coverage
master Ubuntu Windows MacOS Docs codecov
develop Ubuntu Windows MacOS Docs codecov

Project description

The libbase is a small library that provides its users with a reimplementation of many useful low-level utilities from Chromium’s //base module as well as other useful utilities (e.g. simplified networking stack based on //net ) without the need to depend on the whole (or parts of the) Chromium itself.

For more details with examples see the documentation.

Building libbase

Dependencies

Dependencies either have to be already installed and CMake has to be able to find them with find_package() or they can be resolved with vcpkg (recommended).

Build with pre-existing vcpkg installation

export VCPKG_ROOT=/path/to/vcpkg/
cmake -S . -B build
cmake --build build [-j <parallel_jobs>] [--config <Release|Debug>]

or

cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build [-j <parallel_jobs>] [--config <Release|Debug>]

Build with internal vcpkg installation

If you don't have (or don't want to use) pre-existing vcpkg installation you can ask libbase to set up its own internal vcpkg installation and use it with:

< 8000 pre>cmake -S . -B build -DLIBBASE_AUTO_VCPKG=1 cmake --build build [-j <parallel_jobs>] [--config <Release|Debug>]

Build with Conan

conan install . --build=missing -s build_type=Release [-o '&:option=value']
cmake --preset conan-release
cmake --build --preset conan-release [-j <parallel_jobs>]

See options and default_options attributes in conanfile.py for available build options.

Build manually

You can also manually build and install all required dependencies and then simply build libbase with:

cmake -S . -B build
cmake --build build [-j <parallel_jobs>] [--config <Release|Debug>]

Running unit tests

Once you've built libbase you can run tests with:

ctest --test-dir build

For more details please refer to the building documentation.

Using libbase in your project

You can install libbase in multiple ways - either by manually building it or using a package manager like vcpkg (recommended) to do it for you. Once you've installed it, you will need to find and link with it.

Install with vcpkg

To install libbase with vcpkg in the manifest mode (recommended) simply add ripper37-libbase dependency in your vcpkg.json file:

{
  "name": "your-project",
  "dependencies": [
    "ripper37-libbase"
  ]
}

Alternatively you can install libbase system-wide in the classic mode by executing vcpkg install command in your terminal:

vcpkg install ripper37-libbase

Import into your CMake project with FetchContent

If you prefer to manually import your dependencies with CMake's FetchContent you can import libbase in your project by adding this to your CMakeFiles.txt script:

include(FetchContent)
FetchContent_Declare(
    libbase
    GIT_REPOSITORY https://github.com/ripper37/libbase.git
    GIT_TAG        <commit_or_tag_to_fetch>
)
FetchContent_MakeAvailable(libbase)

Caution

This doesn't auto-resolve libbase dependencies by itself so you will either have to pre-install them manually (so that find_package() will find them) or declare and make them available earlier in your CMake script with FetchContent as well.

Manual

Lastly you can simply build and install libbase manually. Please refer to the building section above on how to build the library and dependencies. Once built, make sure to install them all with:

cmake --install build_directory [--prefix <install_path_prefix>]

Add to your CMake project

Once you've installed libbase in your system, simply ask CMake to find it and link all with:

find_package(libbase CONFIG REQUIRED [COMPONENTS <optional_component>...])
target_link_libraries(your_target PRIVATE libbase::libbase [<optional_target>...])

Available optional components:

  • net (target: libbase::libbase_net) - networking module (enabled by default)
  • win (target: libbase::libbase_win) - integration with WinAPI
  • wx (target: libbase::libbase_wx) - integration with wxWidgets

For more details please refer to the using documentation or check out the example projects:

Support

Requirements

  • Compiler with C++17 support
  • CMake (>= v3.13)

Platforms tested

  • Linux
  • Windows
  • MacOS

Compilers tested

  • GCC (10 through 14)
  • Clang (13 through 18)
  • MSVC (2022 19.43)

License

This project is licensed under the MIT License.

About

Standalone reimplementation of //base module from Chromium

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  
0