Branch | Ubuntu | Windows | MacOS | Documentation | Coverage |
---|---|---|---|---|---|
master |
|||||
develop |
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.
- GLOG
- (Optional) libcurl - for networking module
- (Optional) wxWidgets - for
wxWidgets
integration - (Optional) GTest and GMock - for unit tests
- (Optional) Google Benchmark - for performance tests
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).
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>]
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:
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.
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>]
Once you've built libbase
you can run tests with:
ctest --test-dir build
For more details please refer to the building documentation.
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.
To install libbase
with vcpkg
in the
manifest mode
(recommended) simply add ripper37-libbase
dependency in your vcpkg.json
file:
Alternatively you can install libbase
system-wide in the
classic mode
by executing
vcpkg install
command
in your terminal:
vcpkg install ripper37-libbase
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.
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>]
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 WinAPIwx
(target:libbase::libbase_wx
) - integration with wxWidgets
For more details please refer to the using documentation or check out the example projects:
- Example project using
vcpkg
- Example project using CMake's
FetchContent
- Example project using Git submodules and CMake's
add_subdirectory()
- Compiler with C++17 support
- CMake (>= v3.13)
- Linux
- Windows
- MacOS
- GCC (10 through 14)
- Clang (13 through 18)
- MSVC (2022 19.43)
This project is licensed under the MIT License.