From: khizmax Date: Fri, 23 Sep 2016 13:10:37 +0000 (+0300) Subject: Fixed search algo for gtest in cmake script X-Git-Tag: v2.2.0~122 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=39abc7398158e353b8aab234c6cc2574479ac05e;p=libcds.git Fixed search algo for gtest in cmake script Fixed minor gcc warnings --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 139d5b8e..d6096271 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,9 +83,9 @@ if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_TARGET_ARCHITECTURE STREQUAL "x86_64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcx16") endif() - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0") -# gcc 4.8: disable noise -Wunused-local-typedefs - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs -Wno-unused-parameter") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0.0") +# gcc 4.8: disable noise -Wunused-local-typedefs -Wno-unused-parameter + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs") endif() endif() diff --git a/build/cmake/readme.md b/build/cmake/readme.md index f229a5df..6a5aa6a1 100644 --- a/build/cmake/readme.md +++ b/build/cmake/readme.md @@ -11,20 +11,25 @@ Compiling and testing ---------- **Building out-of-source in "RELEASE" mode ("DEBUG" is default)** -- Wherever create empty directory for building, for instance *libcds-debug* -- Prepare: *cmake -DCMAKE_BUILD_TYPE=RELEASE * -- Compile: *make -j4* +- Wherever create empty directory for building, for instance `libcds-debug` +- Prepare: `cmake -DCMAKE_BUILD_TYPE=RELEASE ` +- Compile: `make -j4` - As a result you'll see shared and static cds libraries in the build directory **Warning**: We strongly recommend not to use static cds library. Static library is not tested and not maintained. You can use it on own risk. -After using command *cmake -L * one can see some additional variables, that can activate additional features: +After using command cmake -L one can see some additional variables, that can activate additional features: + +- `WITH_TESTS:BOOL=OFF`: if you want to build library with unit testing support use *-DWITH_TESTS=ON* on prepare step. Be careful with this flag, because compile time will dramatically increase +- `WITH_TESTS_COVERAGE:BOOL=OFF`: Analyze test coverage using gcov (only for gcc) +- `WITH_BOOST_ATOMIC:BOOL=OFF`: Use boost atomics (only for boost >= 1.54) +- `WITH_ASAN:BOOL=OFF`: compile libcds with AddressSanitizer instrumentation +- `WITH_TSAN:BOOL=OFF`: compile libcds with ThreadSanitizer instrumentation + +Additional gtest hints (for unit and stress tests only): +- `GTEST_INCLUDE_DIRS=path`: gives full `path` to gtest include dir. +- `GTEST_LIBRARY=path`: gives full `path` to `libgtest.a`. -- *WITH_TESTS:BOOL=OFF*: if you want to build library with unit testing support use *-DWITH_TESTS=ON* on prepare step. Be careful with this flag, because compile time will dramatically increase -- *WITH_TESTS_COVERAGE:BOOL=OFF*: Analyze test coverage using gcov (only for gcc) -- *WITH_BOOST_ATOMIC:BOOL=OFF*: Use boost atomics (only for boost >= 1.54) -- *WITH_ASAN:BOOL=OFF*: compile libcds with AddressSanitizer instrumentation -- *WITH_TSAN:BOOL=OFF*: compile libcds with ThreadSanitizer instrumentation Packaging ---------- @@ -38,10 +43,10 @@ In order to package library *CPack* is used, command *cpack -G * shou "Live" building and packaging example ---------- -- git clone https://github.com/khizmax/libcds.git -- mkdir libcds-release -- cd libcds-release -- cmake -DWITH\_TESTS=ON -DCMAKE\_BUILD_TYPE=RELEASE ../libcds +- `git clone https://github.com/khizmax/libcds.git` +- `mkdir libcds-release` +- `cd libcds-release` +- `cmake -DWITH\_TESTS=ON -DCMAKE\_BUILD_TYPE=RELEASE ../libcds` ``` -- The C compiler identification is GNU 4.8.3 -- The CXX compiler identification is GNU 4.8.3 @@ -56,7 +61,7 @@ In order to package library *CPack* is used, command *cpack -G * shou -- Generating done -- Build files have been written to: <...>/libcds-release ``` -- make -j4 +- `make -j4` ``` Scanning dependencies of target cds Scanning dependencies of target test-common @@ -65,10 +70,9 @@ In order to package library *CPack* is used, command *cpack -G * shou [ 1%] Building CXX object CMakeFiles/cds-s.dir/src/hp_gc.cpp.o ... [100%] Built target test-hdr - gmake: выход из каталога «/home/kel/projects_cds/libcds-debug» ``` -- ctest +- `ctest` ``` Test project /home/kel/projects_cds/libcds-debug Start 1: test-hdr @@ -79,7 +83,7 @@ In order to package library *CPack* is used, command *cpack -G * shou ... ``` -- cpack -G RPM +- `cpack -G RPM` ``` CPack: Create package using RPM CPack: Install projects diff --git a/cds/algo/flat_combining/wait_strategy.h b/cds/algo/flat_combining/wait_strategy.h index f16c6d7f..f0e23312 100644 --- a/cds/algo/flat_combining/wait_strategy.h +++ b/cds/algo/flat_combining/wait_strategy.h @@ -248,7 +248,7 @@ namespace cds { namespace algo { namespace flat_combining { /// Calls condition variable function \p notify_all() template - void notify( FCKernel& fc, PublicationRecord& rec ) + void notify( FCKernel& /*fc*/, PublicationRecord& /*rec*/ ) { m_condvar.notify_all(); } @@ -313,7 +313,7 @@ namespace cds { namespace algo { namespace flat_combining { /// Calls condition variable function \p notify_one() template - void notify( FCKernel& fc, PublicationRecord& rec ) + void notify( FCKernel& /*fc*/, PublicationRecord& rec ) { rec.m_condvar.notify_one(); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fce8ea13..7cf48759 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,8 @@ -find_package(GTest REQUIRED) -message("GTest: ${GTEST_INCLUDE_DIRS}") +if (NOT GTEST_INCLUDE_DIRS) + find_package(GTest REQUIRED) +endif() +message("GTest: ${GTEST_INCLUDE_DIRS}, lib: ${GTEST_LIBRARY}") include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include diff --git a/test/unit/map/test_map.h b/test/unit/map/test_map.h index 5aee1d10..658a2269 100644 --- a/test/unit/map/test_map.h +++ b/test/unit/map/test_map.h @@ -130,7 +130,7 @@ namespace cds_test { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); } )); - EXPECT_FALSE( m.insert_with( i, []( map_pair& v ) { + EXPECT_FALSE( m.insert_with( i, []( map_pair& ) { EXPECT_TRUE( false ); } )); break; @@ -139,7 +139,7 @@ namespace cds_test { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); } )); - EXPECT_FALSE( m.insert_with( i.nKey, []( map_pair& v ) { + EXPECT_FALSE( m.insert_with( i.nKey, []( map_pair& ) { EXPECT_TRUE( false ); } )); break; @@ -148,7 +148,7 @@ namespace cds_test { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); } )); - EXPECT_FALSE( m.insert_with( val.strVal, []( map_pair& v ) { + EXPECT_FALSE( m.insert_with( val.strVal, []( map_pair& ) { EXPECT_TRUE( false ); } )); break;