check-cpp-api can be tried out on the libbitcoin libraries using the phitsc/check-libbitcoin-api Docker image. On any system with Docker installed, run the following command to start a Bash shell in a Docker container based on the phitsc/check-libbitcoin-api Docker image.
docker run -it --rm phitsc/check-libbitcoin-api:1.3 /bin/bash
Then, within the Bash shell in the newly started Docker container, run:
cd ~/libbitcoin-all
find . -name '*.hpp' -exec check-cpp-api -kc-1-1-case-type=snake {} +
-
Follow the build instructions on https://clang.llvm.org/get_started.html . Make sure to include step 4 'extra Clang tools'.
-
Clone the check-cpp-api repository into
llvm/tools/clang/tools/extra/. -
Add
add_subdirectory(check-cpp-api)at the bottom ofllvm/tools/clang/tools/extra/CMakeLists.txt -
Build everything as described in step 7 'Build LLVM and Clang' on https://clang.llvm.org/get_started.html .
-
Clone the check-cpp-api repository into a directory of your choice and change into that directory.
git clone --recursive https://github.com/phitsc/check-cpp-api.git cd check-cpp-api -
Create the libtooling docker image for building Clang tools.
sudo docker build -t libtooling api-utils-common/Docker -
Run the make script.
./make
-
Change into
check-cpp-api/test/integration_tests.cd test/integration_tests -
Create the
builddirdirectory and change into it.mkdir builddir cd builddir -
Create the compilation database.
cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..Make sure the
compile_commands.jsonfile has been created in theintegration_tests/builddirdirectory. -
Change back into the
check-cpp-apidirectory and run check-cpp-api.cd ../../.. ./check-cpp-api -p test/integration_tests/builddir test/integration_tests/src/main.cppNote that check-cpp-api must be executed on the same host platform on which the compilation database was created or the script will not be able to map the source file paths from the host filesystem to to container filesystem.