modified conan package for gtest:
- uses
git clone - supports sanitizers, see https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo#instrumented-gtest
- uses
llvm_toolsconan package in builds withLLVM_USE_SANITIZER, see https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo#instrumented-gtest - uses
llvm_toolsconan package in builds with libc++ (will be instrumented ifLLVM_USE_SANITIZERenabled) - etc.
See test_package/CMakeLists.txt for usage example
NOTE: use -s llvm_tools:build_type=Release during conan install
sudo apt-get update
# Tested with clang 6.0 and gcc 7
sudo apt-get -y install clang-6.0 g++-7 gcc-7
# llvm-config binary that coresponds to the same clang you are using to compile
export LLVM_CONFIG=/usr/bin/llvm-config-6.0
$LLVM_CONFIG --cxxflagsexport VERBOSE=1
export CONAN_REVISIONS_ENABLED=1
export CONAN_VERBOSE_TRACEBACK=1
export CONAN_PRINT_RUN_COMMANDS=1
export CONAN_LOGGING_LEVEL=10
conan remote add conan-center https://api.bintray.com/conan/conan/conan-center False
export PKG_NAME=conan_gtest/stable@conan/stable
(CONAN_REVISIONS_ENABLED=1 \
conan remove --force $PKG_NAME || true)
conan create . \
conan/stable \
-s build_type=Release \
--profile clang \
--build missing \
--build cascade
conan upload $PKG_NAME \
--all -r=conan-local \
-c --retry 3 \
--retry-wait 10 \
--force
# clean build cache
conan remove "*" --build --forceUse -o llvm_tools:enable_tsan=True and -e *:compile_with_llvm_tools=True like so:
export CC=$(find ~/.conan/data/llvm_tools/master/conan/stable/package/ -path "*bin/clang" | head -n 1)
export CXX=$(find ~/.conan/data/llvm_tools/master/conan/stable/package/ -path "*bin/clang++" | head -n 1)
export TSAN_OPTIONS="handle_segv=0:disable_coredump=0:abort_on_error=1:report_thread_leaks=0"
# make sure that env. var. TSAN_SYMBOLIZER_PATH points to llvm-symbolizer
# conan package llvm_tools provides llvm-symbolizer
# and prints its path during cmake configure step
# echo $TSAN_SYMBOLIZER_PATH
export TSAN_SYMBOLIZER_PATH=$(find ~/.conan/data/llvm_tools/master/conan/stable/package/ -path "*bin/llvm-symbolizer" | head -n 1)
export VERBOSE=1
export CONAN_REVISIONS_ENABLED=1
export CONAN_VERBOSE_TRACEBACK=1
export CONAN_PRINT_RUN_COMMANDS=1
export CONAN_LOGGING_LEVEL=10
# NOTE: NO `--profile` argument cause we use `CXX` env. var
conan create . \
conan/stable \
-s build_type=Debug \
-s compiler=clang \
-s compiler.version=10 \
-s compiler.libcxx=libc++ \
-s llvm_tools:compiler=clang \
-s llvm_tools:compiler.version=6.0 \
-s llvm_tools:compiler.libcxx=libstdc++11 \
--profile clang \
-s llvm_tools:build_type=Release \
-o llvm_tools:enable_tsan=True \
-o llvm_tools:include_what_you_use=False \
-e conan_gtest:compile_with_llvm_tools=True \
-e conan_gtest:enable_llvm_tools=True \
-e conan_gtest_test_package:compile_with_llvm_tools=True \
-e conan_gtest_test_package:enable_llvm_tools=True \
-o conan_gtest:enable_tsan=True
# clean build cache
conan remove "*" --build --forceconan source .
conan install --build missing --profile clang -s build_type=Release .
conan build . --build-folder=.
conan package --build-folder=. .
conan export-pkg . conan/stable --settings build_type=Release --force --profile clang
conan test test_package conan_gtest/stable@conan/stable --settings build_type=Release --profile clang