Various random files I've been saving as gists, all submoduled in one big repo.
This is a collection of C++ headers (header only libraries?) for doing useful
things. Such as printing human readable type names or converting string_view
s
to numbers.
All files are in individual directories under include
.
Documentation can be found at the top of each file.
The easiest way to include libut
in your CMake
project is with
fetch_content
.
Simply add the following to your CMakeLists.txt
:
include(FetchContent)
# Set the directory to download dependencies to. Avoids putting them in $buildDir
set(FETCHCONTENT_BASE_DIR "${PROJECT_SOURCE_DIR}/_deps")
FetchContent_Declare(
libut
GIT_REPOSITORY https://github.com/dk949/libut/
GIT_TAG trunk # alternatively you can use a hash to pin exact venison to use
)
FetchContent_MakeAvailable(libut)
# assuming MY_TARGET is a valid target (executable or library)
target_link_libraries(MY_TARGET UT::target_name)
UT::ptr_containers
UT::check
UT::pair
UT::add_noexcept
UT::sv_to_num
UT::copy_traits
UT::realloc_unique_ptr
UT::assert
UT::resource
UT::demangle
UT::constexpr_hash
UT::trim
UT::pack_loops
UT::static_string
UT::curry
UT::defer
UT::print
A special target UT::all
is also available, combining all of the above.
Test can be ran using Catch2
git clone https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
./vcpkg/vcpkg install catch2
cmake --preset local
cmake --build build
./build/tests/libut_tests
# or
ctest --output-on-failure --test-dir build/tests
NOTE: you can use the local
preset to build with
ninja, or default
to build with the default
generator (e.g. "Unix Makefiles" on linux)
Each header file has a license (usually at the bottom). For files which don't
(such as scripts and CMakeLists.txt
s), see LICENSE
file in the root of this
repo.