NO_CLANG_COMPLETER inverted to USE_CLANG_COMPLETER

This commit is contained in:
Strahinja Val Markovic 2013-01-12 16:38:00 -08:00
parent c9adb9e86e
commit 8c709c2e57
5 changed files with 27 additions and 23 deletions

View File

@ -18,16 +18,19 @@
cmake_minimum_required( VERSION 2.8 ) cmake_minimum_required( VERSION 2.8 )
project( YouCompleteMe ) project( YouCompleteMe )
option( UNIVERSAL "Build universal mac binary" OFF )
# This is needed so that on macs, the library is built in both 32 bit and 64 bit # This is needed so that on macs, the library is built in both 32 bit and 64 bit
# versions. Without this python might refuse to load the module, depending on # versions. Without this python might refuse to load the module, depending on
# how python was built. # how python was built.
# On Mac, boost needs to be compiled universal as well, if used instead of the # On Mac, boost needs to be compiled universal as well, if used instead of the
# included BoostParts lib. For brew, that's # included BoostParts lib. For brew, that's
# "brew install boost --universal" # "brew install boost --universal"
# If the user chose to use the system libclang.dylib on a mac, then we don't # If the user chose to use the system libclang.dylib (or the libclang.dylib
# specify universal binary building since the system libclang on macs is not # binary downloaded from llvm.org) on a mac, then we don't specify universal
# universal (and thus linking would fail with universal). # binary building since the system libclang on macs is not universal (and thus
if ( NOT USE_SYSTEM_LIBCLANG ) # linking would fail with universal).
if ( UNIVERSAL AND NOT USE_SYSTEM_LIBCLANG )
set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" ) set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
endif() endif()
@ -74,7 +77,9 @@ else()
"Your C++ compiler does NOT support C++11, compiling in C++03 mode." ) "Your C++ compiler does NOT support C++11, compiling in C++03 mode." )
endif() endif()
if ( NOT NO_CLANG_COMPLETER AND option( USE_CLANG_COMPLETER "Use Clang semantic completer for C/C++/ObjC" OFF )
if ( USE_CLANG_COMPLETER AND
( NOT EXTERNAL_LIBCLANG_PATH AND NOT USE_SYSTEM_LIBCLANG ) ) ( NOT EXTERNAL_LIBCLANG_PATH AND NOT USE_SYSTEM_LIBCLANG ) )
add_subdirectory( llvm ) add_subdirectory( llvm )
endif() endif()

View File

@ -51,18 +51,17 @@ if( to_remove )
list( REMOVE_ITEM SOURCES ${to_remove} ) list( REMOVE_ITEM SOURCES ${to_remove} )
endif() endif()
if ( NO_CLANG_COMPLETER ) if ( USE_CLANG_COMPLETER )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/ClangCompleter" )
add_definitions( -DUSE_CLANG_COMPLETER )
else()
file( GLOB_RECURSE to_remove_clang ClangCompleter/*.h ClangCompleter/*.cpp ) file( GLOB_RECURSE to_remove_clang ClangCompleter/*.h ClangCompleter/*.cpp )
if( to_remove_clang ) if( to_remove_clang )
list( REMOVE_ITEM SOURCES ${to_remove_clang} ) list( REMOVE_ITEM SOURCES ${to_remove_clang} )
endif() endif()
add_definitions( -DNO_CLANG_COMPLETER )
else()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/ClangCompleter" )
endif() endif()
############################################################################# #############################################################################
@ -89,7 +88,7 @@ if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG )
set( LIBCLANG_TARGET ${EXTERNAL_LIBCLANG_PATH} ) set( LIBCLANG_TARGET ${EXTERNAL_LIBCLANG_PATH} )
message( message(
"Using external libclang: ${EXTERNAL_LIBCLANG_PATH}" ) "Using external libclang: ${EXTERNAL_LIBCLANG_PATH}" )
elseif( NOT NO_CLANG_COMPLETER ) elseif( USE_CLANG_COMPLETER )
set( LIBCLANG_TARGET libclang_static ) set( LIBCLANG_TARGET libclang_static )
else() else()
set( LIBCLANG_TARGET ) set( LIBCLANG_TARGET )

View File

@ -22,9 +22,9 @@
#include <boost/thread/locks.hpp> #include <boost/thread/locks.hpp>
#ifndef NO_CLANG_COMPLETER #ifdef USE_CLANG_COMPLETER
# include "CompletionData.h" # include "CompletionData.h"
#endif // NO_CLANG_COMPLETER #endif // USE_CLANG_COMPLETER
namespace YouCompleteMe namespace YouCompleteMe
{ {
@ -77,7 +77,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
return candidates; return candidates;
} }
#ifndef NO_CLANG_COMPLETER #ifdef USE_CLANG_COMPLETER
std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings( std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
const std::vector< CompletionData > &datas ) const std::vector< CompletionData > &datas )
@ -103,7 +103,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings(
return candidates; return candidates;
} }
#endif // NO_CLANG_COMPLETER #endif // USE_CLANG_COMPLETER
CandidateRepository::~CandidateRepository() CandidateRepository::~CandidateRepository()
{ {

View File

@ -44,10 +44,10 @@ public:
std::vector< const Candidate* > GetCandidatesForStrings( std::vector< const Candidate* > GetCandidatesForStrings(
const std::vector< std::string > &strings ); const std::vector< std::string > &strings );
#ifndef NO_CLANG_COMPLETER #ifdef USE_CLANG_COMPLETER
std::vector< const Candidate* > GetCandidatesForStrings( std::vector< const Candidate* > GetCandidatesForStrings(
const std::vector< CompletionData > &datas ); const std::vector< CompletionData > &datas );
#endif // NO_CLANG_COMPLETER #endif // USE_CLANG_COMPLETER
private: private:
CandidateRepository() {}; CandidateRepository() {};

View File

@ -18,12 +18,12 @@
#include "IdentifierCompleter.h" #include "IdentifierCompleter.h"
#include "Future.h" #include "Future.h"
#ifndef NO_CLANG_COMPLETER #ifdef USE_CLANG_COMPLETER
# include "ClangCompleter.h" # include "ClangCompleter.h"
# include "CompletionData.h" # include "CompletionData.h"
# include "Diagnostic.h" # include "Diagnostic.h"
# include "UnsavedFile.h" # include "UnsavedFile.h"
#endif // NO_CLANG_COMPLETER #endif // USE_CLANG_COMPLETER
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
@ -56,7 +56,7 @@ BOOST_PYTHON_MODULE(ycm_core)
.def( "ResultsReady", &Future< void >::ResultsReady ) .def( "ResultsReady", &Future< void >::ResultsReady )
.def( "GetResults", &Future< void >::GetResults ); .def( "GetResults", &Future< void >::GetResults );
#ifndef NO_CLANG_COMPLETER #ifdef USE_CLANG_COMPLETER
class_< Future< AsyncCompletions > >( "FutureCompletions" ) class_< Future< AsyncCompletions > >( "FutureCompletions" )
.def( "ResultsReady", &Future< AsyncCompletions >::ResultsReady ) .def( "ResultsReady", &Future< AsyncCompletions >::ResultsReady )
.def( "GetResults", &Future< AsyncCompletions >::GetResults ); .def( "GetResults", &Future< AsyncCompletions >::GetResults );
@ -112,5 +112,5 @@ BOOST_PYTHON_MODULE(ycm_core)
class_< std::vector< Diagnostic > >( "DiagnosticVec" ) class_< std::vector< Diagnostic > >( "DiagnosticVec" )
.def( vector_indexing_suite< std::vector< Diagnostic > >() ); .def( vector_indexing_suite< std::vector< Diagnostic > >() );
#endif // NO_CLANG_COMPLETER #endif // USE_CLANG_COMPLETER
} }