diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..d269ab07 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: cpp +compiler: + - gcc + - clang +script: ./install.sh +env: + - YCM_TESTRUN=1 EXTRA_CMAKE_ARGS="" + - YCM_TESTRUN=1 EXTRA_CMAKE_ARGS="-DUSE_CLANG_COMPLETER=ON" diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 909f8de1..ed2a362c 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -41,7 +41,11 @@ endif() if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) set( COMPILER_IS_CLANG true ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" ) + + # The Travis CI build machines don't have libc++ installed + if ( NOT DEFINED ENV{TRAVIS} ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" ) + endif() endif() if ( CMAKE_GENERATOR STREQUAL Xcode ) diff --git a/install.sh b/install.sh index b499d94c..81730d6d 100755 --- a/install.sh +++ b/install.sh @@ -82,6 +82,20 @@ function install { rm -rf $build_dir } +function testrun { + ycm_dir=`pwd` + build_dir=`mktemp -d -t ycm_build.XXXXXX` + pushd $build_dir + + cmake -G "Unix Makefiles" $1 . $ycm_dir/cpp + make -j $(num_cores) ycm_core_tests + cd ycm/tests + LD_LIBRARY_PATH=$ycm_dir/python ./ycm_core_tests + + popd + rm -rf $build_dir +} + function linux_cmake_install { echo "Please install CMake using your package manager and retry." exit 1 @@ -112,4 +126,10 @@ if ! command_exists cmake; then echo "CMake is required to build YouCompleteMe." cmake_install fi -install $cmake_args + +if [ -z "$YCM_TESTRUN" ]; then + install $cmake_args $EXTRA_CMAKE_ARGS +else + testrun $cmake_args $EXTRA_CMAKE_ARGS +fi +