f88c9feb4f
This change should fix the random hangs and segfaults when using the clang completer. Also, assertion errors printed to the console on vim exit should go away too, same thing with segfaults on vim exit. These "on exit" errors were caused by not cleanly shutting down the background threads; both the identifier completer and the clang one now join the threads on destruction. This results in a clean shutdown. The new clang completer architecture now uses only one clang thread (again) instead of a completion and parsing thread. Since the parsing task needs to wait on the completion task if it was started first (and vice-versa) there's no point to using two threads. The desired "simplicity" of using two threads for these two tasks actually created needless complexity (and bugs). Sigh. Such is life. A TranslationUnit abstraction was also created and this in turn also reduces the complexity of the clang completer. The clang completer now also has some (very) basic tests.
65 lines
1.9 KiB
CMake
65 lines
1.9 KiB
CMake
# Copyright (C) 2011 Strahinja Markovic <strahinja.markovic@gmail.com>
|
|
#
|
|
# This file is part of YouCompleteMe.
|
|
#
|
|
# YouCompleteMe is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# YouCompleteMe is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
project( ycm_core_tests )
|
|
cmake_minimum_required( VERSION 2.8 )
|
|
|
|
# The gtest library triggers these silly warnings, so we turn them off
|
|
if ( COMPILER_IS_CLANG )
|
|
set( CMAKE_CXX_FLAGS
|
|
"${CMAKE_CXX_FLAGS} -Wno-long-long -Wno-variadic-macros" )
|
|
endif()
|
|
|
|
add_subdirectory( gmock )
|
|
|
|
include_directories(
|
|
${ycm_core_SOURCE_DIR}
|
|
)
|
|
|
|
include_directories(
|
|
SYSTEM
|
|
${gtest_ycm_SOURCE_DIR}
|
|
${gtest_ycm_SOURCE_DIR}/include
|
|
${gmock_SOURCE_DIR}
|
|
${gmock_SOURCE_DIR}/include
|
|
)
|
|
|
|
link_directories(
|
|
${Boost_LIBRARY_DIRS}
|
|
${PYTHON_LIBRARIES}
|
|
)
|
|
|
|
file( GLOB SOURCES *.h *.cpp )
|
|
|
|
add_executable( ${PROJECT_NAME}
|
|
${SOURCES}
|
|
)
|
|
|
|
target_link_libraries( ${PROJECT_NAME}
|
|
ycm_core
|
|
gmock_main )
|
|
|
|
# The test executable expects a "testdata" dir in its working directory. Why?
|
|
# Because there's NO reliable, cross-platform way of getting the directory in
|
|
# which the executable is located.
|
|
add_custom_target( copy_testdata
|
|
COMMAND cmake -E copy_directory
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata
|
|
${CMAKE_CURRENT_BINARY_DIR}/testdata )
|
|
|
|
add_dependencies( ${PROJECT_NAME} copy_testdata )
|