项目作者: bloomberg

项目描述 :
Tool used to format, improve and verify code to BDE guidelines
高级语言: C++
项目地址: git://github.com/bloomberg/bde_verify.git
创建时间: 2015-02-02T14:26:17Z
项目社区:https://github.com/bloomberg/bde_verify

开源协议:Apache License 2.0

下载


BDE Verify - A Static Checker for C++

Bde_verify is a static analysis tool that verifies that source code adheres
to the BDE coding standards.

The online documentation for bde_verify can be found at
https://bloomberg.github.io/bde_verify

Build Instructions

Supported Platforms:

  • Linux x86
  • SunOS sparc
  • Windows
  • MacOS (Darwin)

Prerequesites:

  • llvm/clang 14.0 (see below for instructions)
  • gcc >= 7 (Linux and SunOS)
  • Clang >= 9 (Darwin/MacOS)
  • Visual Studio >= 2015 (Windows)
  • nsis with large-string overlay (Windows, more details below)
  • cmake >= 3.4.3
  • gnu make
  • aspell (package libaspell-dev)

Bde_verify incorporates llvm/clang-14.0 libraries. These may already be
installed on the build machine. If not, they can be installed (in the
Bloomberg environment) using dpkg, or built from source on Windows.

Bloomberg Environment

Installing bde_verify sources

  1. # We will place bde_verify source code here
  2. export BVSRC=/path/to/bde_verify/source/directory
  3. mkdir -p ${BVSRC}
  4. git clone -b master bbgithub:bde/bde_verify ${BVSRC}

Installing refroot

  1. export DISTRIBUTION_REFROOT=/path/to/refroot
  2. refroot-install --arch=amd64 --refroot-path=${DISTRIBUTION_REFROOT} --config=${BVSRC}/debian/control

Configure bde-verify (bbcmake)

  1. cd $BVSRC
  2. mkdir _build; cd _build
  3. bbcmake -64 -G Ninja -DClang_DIR=${DISTRIBUTION_REFROOT}/opt/bb/lib/llvm-14.0/lib64/cmake/clang/ ../

Alternatively, with plain cmake:

  1. cd $BVSRC
  2. mkdir _build; cd _build
  3. export CXX=${DISTRIBUTION_REFROOT}/opt/bb/bin/g++
  4. export CC=${DISTRIBUTION_REFROOT}/opt/bb/bin/gcc
  5. cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/opt/bb -DClang_DIR=${DISTRIBUTION_REFROOT}/opt/bb/lib/llvm-14.0/lib64/cmake/clang/ -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_BUILD_TYPE=RELEASE ../

Build & install bde-verify

  1. cmake --build .
  2. DESTDIR=/path/to/install/dir cmake --install .

Test bde-verify

  1. cd ${BVSRC}
  2. DESTDIR=/path/to/install/dir/opt/bb/ make -f Makefile.test_only check

Installing LLVM/Clang Sources

If you are doing this on a Bloomberg development machine, follow the
instructions at
http://tutti.prod.bloomberg.com/go-git-go-docs/configuration to
configure git for access to github securely through an https proxy.

Note: this requires a great deal of free disk space.

  1. # We will place LLVM/Clang source code here
  2. export LCSRC=/path/to/llvm/source/directory
  3. mkdir -p ${LCSRC}
  4. # Clone the LLVM/Clang repositories
  5. git clone https://github.com/llvm/llvm-project.git ${LCSRC}
  6. cd ${LCSRC}
  7. # Checkout llvmorg-14.0.1
  8. git checkout tags/llvmorg-14.0.1 -b llvm14

Building LLVM/Clang

External references:

Below is the configuration line that enables clang and clang-tool-extra
projects required by bde-verify:

  1. mkdir _build; cd _build
  2. # This is a configuration line for cmake that contain all relevant information (see description of defines in llvm howto).
  3. # In order to use different compiler, use CXX/CC variables to point to compilers:
  4. cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_BINDINGS=No -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=<install_path> -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_LIBDIR_SUFFIX=64 ../llvm/
  5. cmake --build .
  6. cmake --install .

On Windows

Install the NSIS packaging system:

  1. # We refer to version 3.02.1 here, but newer versions should work.
  2. #
  3. # Navigate to <https://sourceforge.net/projects/nsis/files/NSIS%203/3.02.1></https:>
  4. # The installer is named <nsis-3.02.1-setup.exe>. Download and run it.
  5. #
  6. # Download the large-strings overlay <nsis-3.02.1-strlen_8192.zip>.
  7. # Open that archive and extract its files on top of the installed ones.

Set build directory:

  1. # We will build LLVM/Clang here
  2. export LCBLD=/path/to/build/directory
  3. mkdir -p $LCBLD

Configure and build, and install llvm:

  1. cd $LCBLD
  2. cmake $LCSRC/llvm
  3. cmake --build . --target package --config MinSizeRel
  4. # The result is an executable named LLVM-5.{...}-win32.exe
  5. # Run it to install LLVM/Clang. When asked, set the path for all users.

Building bde_verify

On Windows

Set build directory:

  1. # We will build bde_verify here
  2. export BVBLD=/path/to/bde_verify/build/directory

Configure, build, and install bde_verify

  1. cd $BVBLD
  2. cmake $BVSRC
  3. cmake --build . --target package --config MinSizeRel
  4. # The result is an executable named bde_verify-{...}-win32.exe
  5. # Run it to install bde_verify. When asked, set the path for all users.
  6. # Now build the Visual Studio bde_verify add-in
  7. cmake --build . --target bde_verify_vsix --config MinSizeRel
  8. # The result is $BVBLD/bde-verify-vs/BdeVerify.vsix
  9. # Running that file installs the extension into Visual Studio.
  10. # (It installs its own private copy of the bde_verify executable.)