Awl
AWL - A Working Library
AWL is a small cross-platform C++ library that includes:
- A simple binary serialization framework.
- Memory stream, buffered stream, hashing stream.
- A set that finds an element by both key and index with O(logN) time.
- A doubly linked list with static insert and erase methods.
- An observable with movable observers.
- A pool of reusable objects managed with std::shared_ptr.
- Bitset based on enum.
- A circular buffer with an interface similar to std::queue.
- Other simple classes like CompositeCompare, ReverseCompare, scope_guard, etc...
- A simple testing framework.
Theoretically, the master branch should compile with C++20 and work, at least it is periodically built with MSVC 19.37.32825
, GCC 12.3.0
and Android CLang 17.0.2
.
There is also cpp17 branch that partially compiles with C++17.
Version compatibility is not guaranteed and there is no warranty of any kind.
Feel free to use it or fork it, report a bug by opening an issue.
To leave the author a message fill the form on his website.
Compiling on Windows with CMake and MSVC 2022:
cmake ..\..\Awl -G "Visual Studio 17 2022" -A x64
cmake --build . --target AwlTest --config Release
or
msbuild AwlTest.sln /p:Configuration=Release /p:Platform=x64
It also builds for x86 using the following command:
cmake ..\..\Awl -G "Visual Studio 17 2022" -A win32
but with couple warnings related to std::streamsize that are not fixed yet.
Compiling on Linux with CMake and GCC:
cmake ../../Awl/ -DCMAKE_BUILD_TYPE=Release
cmake --build . --parallel
or
cmake ../../Awl/ -DCMAKE_BUILD_TYPE=Debug
cmake --build . --parallel
Compiling on Ubuntu 22.04:
sudo apt install build-essential
sudo apt install cmake
mkdir repos
cd repos
git clone https://github.com/dmitriano/Awl
mkdir -p build/awl
cd build/awl
cmake ../../Awl/ -DCMAKE_BUILD_TYPE=Release
cmake --build . --parallel
Compiling with Ninja generator
cmake ../../repos/Awl/ -G Ninja
cmake --build . --parallel --target AwlTest --config RelWithDebInfo
Compiling a separate source file (by example of VtsTest.cpp
):
cmake --build . --parallel --target CMakeFiles/AwlTest.dir/Tests/VtsTest.cpp.o
Using GCC sanitizer
To enable GCC sanitizer uncomment corresponding lines in CMake\AwlConfig.cmake
.
Running the tests on Windows and Linux
Remove ./
prefix on Windows and do not forget quotes on Linux:
./AwlTest
of
./AwlTest --filter ".*_Test"
Running the benchmarks:
./AwlTest --filter ".*_Benchmark" --output all
Running the examples:
./AwlTest --filter ".*_Example" --output all
Do not run the commands below:
./AwlTest --filter ".*_Unstable"
or
./AwlTest --filter ".*"
they potentially can format your hard drive.
Running the tests on Android device
Built AWL for Android with -DAWL_STATIC_RUNTIME:BOOL=ON
CMake option, upload the executable file to the device:
adb push AwlTest /data/local/tmp
and run it with the same options as on Linux:
adb shell
cd /data/local/tmp
chmod a+x AwlTest
./AwlTest
or with a single command:
adb shell "cd /data/local/tmp && chmod a+x AwlTest && ./AwlTest"
or
adb shell "cd /data/local/tmp && chmod a+x AwlTest && ./AwlTest --filter .*CompositeCompare.*"