Skip to content

Commit

Permalink
- Updated CMake configuration
Browse files Browse the repository at this point in the history
  + Add preprocessor definition to ensure Boost does not use rvalue references (this allows the integration tests to build without c++11).
  + Added a check to validate CMAKE_CXX_COMPILER_VERSION variable existence and added a workaround to get the compiler version from gcc (CMAKE_CXX_COMPILER variables were not added until 2.8.x)
  + Ensured the LIBUV_INCLUDE_DIR discovered by the parent was used for the unit tests (fixes unit test build)
- Changed INT64_MAX/MIN to use c++ numeric limits
- Updating TavisCI configuration
  + Install libssh2 and build Boost v1.55 from source
  + Build tests and run unit tests (increases build status information)

NOTE: CMake configuration needs some more TLC to work properly on CentOS5.  The LIBSSH2 package available by the default yum repositories is v1.0.0 and method calls used by the integration tests were not available until v1.2.5.  CMake configuration should check for LIBSSH2_ROOT_DIR similar to LIBUV_ROOT_DIR.
  • Loading branch information
Michael Fero committed Sep 18, 2014
1 parent cb905f9 commit d027227
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ lib/libuv/include/**
!lib/libuv/include/README
lib/libuv/lib/**
!lib/libuv/lib/README
boost_1_*


config*.txt
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ language: c++
compiler: gcc
before_install:
- sudo apt-get update -qq
- sudo apt-get install libssl-dev -qq
- wget http://libuv.org/dist/v0.10.28/libuv-v0.10.28.tar.gz
- sudo apt-get install libssl-dev libssh2-1-dev -qq
- wget -q http://libuv.org/dist/v0.10.28/libuv-v0.10.28.tar.gz
- wget -q http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download -O boost_1_55_0.tar.gz
install:
- tar xzf libuv-v0.10.28.tar.gz
- cd libuv-v0.10.28 && make && cd - && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && cp -r libuv-v0.10.28/include/* lib/libuv/include
- cd libuv-v0.10.28 && make && cd - && cp -r libuv-v0.10.28/libuv.a libuv-v0.10.28/libuv.so lib/libuv/lib && ln -s lib/libuv/lib/libuv.so lib/libuv/lib/libuv.so.0.10 && cp -r libuv-v0.10.28/include/* lib/libuv/include
- tar xzf boost_1_55_0.tar.gz
- cd boost_1_55_0 && ./bootstrap.sh --with-libraries=chrono,date_time,log,program_options,system,thread,test && sudo ./b2 install --prefix=/usr && cd -
before_script: cmake -DLIBUV_ROOT_DIR=lib/libuv/ .
script: make
script:
- make
- test/unit_tests/cassandra_unit_tests
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ endif()
set(MULTICORE_CORES_NUMBER "3" CACHE STRING "Number of cores (for multicore compilation)")
option(MULTICORE_COMPILATION "Enable multicore compilation" OFF)

set(TEST_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_THREAD_USES_MOVE")
set(TEST_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_THREAD_USES_MOVE -DBOOST_NO_CXX11_RVALUE_REFERENCES")

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if(MULTICORE_COMPILATION)
Expand Down Expand Up @@ -125,6 +125,12 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(-DBOOST_ALL_NO_LIB)
add_definitions(-DNOMINMAX)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# CMAKE_CXX_COMPILER variables do not exist in 2.6.4 (min version)
# Parse the -dumpversion argument into the variable not already set
if ("${CMAKE_CXX_COMPILER_VERSION}" STREQUAL "")
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION)
endif()

# GCC specific compiler options
# I disabled long-long warning because boost generates about 50 such warnings
set(WARNING_COMPILER_FLAGS "-Wall -pedantic -Wextra -Werror -Wno-long-long -Wno-deprecated-declarations -Wno-unused-parameter")
Expand Down
4 changes: 2 additions & 2 deletions test/integration_tests/src/prepared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE(test_bound_all_types_different_values)
all_types[0].id = test_utils::generate_time_uuid();
all_types[0].text_sample = cass_string_init("first");
all_types[0].int_sample = 10;
all_types[0].bigint_sample = INT64_MAX - 1L;
all_types[0].bigint_sample = std::numeric_limits<int64_t>::max() - 1L;
all_types[0].float_sample = 1.999f;
all_types[0].double_sample = 32.002;
all_types[0].decimal_sample = cass_decimal_init(1, cass_bytes_init(varint1, sizeof(varint1)));
Expand All @@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(test_bound_all_types_different_values)
all_types[2].id = test_utils::generate_time_uuid();
all_types[2].text_sample = cass_string_init("third");
all_types[2].int_sample = -100;
all_types[2].bigint_sample = INT64_MIN + 1;
all_types[2].bigint_sample = std::numeric_limits<int64_t>::min() + 1;
all_types[2].float_sample = -150.111f;
all_types[2].double_sample = -5.12342;
all_types[2].decimal_sample = cass_decimal_init(3, cass_bytes_init(varint3, sizeof(varint3)));
Expand Down
1 change: 1 addition & 0 deletions test/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ file(GLOB UNIT_TESTS_SRC_FILES ${PROJECT_SOURCE_DIR}/test/unit_tests/src/*.cpp)
set(INCLUDES ${PROJECT_INCLUDE_DIR})
set(INCLUDES ${INCLUDES} "${PROJECT_SOURCE_DIR}/src")
set(INCLUDES ${INCLUDES} ${Boost_INCLUDE_DIRS})
set(INCLUDES ${INCLUDES} ${LIBUV_INCLUDE_DIR})

# Create source groups - this is only needed to create
# neat folder structure in Visual Studio...
Expand Down

0 comments on commit d027227

Please sign in to comment.