From 8c709c2e57bc034b68a8dd2096cd81992bc51663 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sat, 12 Jan 2013 16:38:00 -0800 Subject: [PATCH] NO_CLANG_COMPLETER inverted to USE_CLANG_COMPLETER --- cpp/CMakeLists.txt | 15 ++++++++++----- cpp/ycm/CMakeLists.txt | 15 +++++++-------- cpp/ycm/CandidateRepository.cpp | 8 ++++---- cpp/ycm/CandidateRepository.h | 4 ++-- cpp/ycm/ycm_core.cpp | 8 ++++---- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f739ccaa..157350e6 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -18,16 +18,19 @@ cmake_minimum_required( VERSION 2.8 ) 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 # versions. Without this python might refuse to load the module, depending on # how python was built. # On Mac, boost needs to be compiled universal as well, if used instead of the # included BoostParts lib. For brew, that's # "brew install boost --universal" -# If the user chose to use the system libclang.dylib on a mac, then we don't -# specify universal binary building since the system libclang on macs is not -# universal (and thus linking would fail with universal). -if ( NOT USE_SYSTEM_LIBCLANG ) +# If the user chose to use the system libclang.dylib (or the libclang.dylib +# binary downloaded from llvm.org) on a mac, then we don't specify universal +# binary building since the system libclang on macs is not universal (and thus +# linking would fail with universal). +if ( UNIVERSAL AND NOT USE_SYSTEM_LIBCLANG ) set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" ) endif() @@ -74,7 +77,9 @@ else() "Your C++ compiler does NOT support C++11, compiling in C++03 mode." ) 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 ) ) add_subdirectory( llvm ) endif() diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt index 9f4e7175..2cc2f56d 100644 --- a/cpp/ycm/CMakeLists.txt +++ b/cpp/ycm/CMakeLists.txt @@ -51,18 +51,17 @@ if( to_remove ) list( REMOVE_ITEM SOURCES ${to_remove} ) 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 ) if( to_remove_clang ) list( REMOVE_ITEM SOURCES ${to_remove_clang} ) endif() - - add_definitions( -DNO_CLANG_COMPLETER ) -else() - include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - "${CMAKE_CURRENT_SOURCE_DIR}/ClangCompleter" ) endif() ############################################################################# @@ -89,7 +88,7 @@ if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG ) set( LIBCLANG_TARGET ${EXTERNAL_LIBCLANG_PATH} ) message( "Using external libclang: ${EXTERNAL_LIBCLANG_PATH}" ) -elseif( NOT NO_CLANG_COMPLETER ) +elseif( USE_CLANG_COMPLETER ) set( LIBCLANG_TARGET libclang_static ) else() set( LIBCLANG_TARGET ) diff --git a/cpp/ycm/CandidateRepository.cpp b/cpp/ycm/CandidateRepository.cpp index 53fa24a2..5cfb62f6 100644 --- a/cpp/ycm/CandidateRepository.cpp +++ b/cpp/ycm/CandidateRepository.cpp @@ -22,9 +22,9 @@ #include -#ifndef NO_CLANG_COMPLETER +#ifdef USE_CLANG_COMPLETER # include "CompletionData.h" -#endif // NO_CLANG_COMPLETER +#endif // USE_CLANG_COMPLETER namespace YouCompleteMe { @@ -77,7 +77,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings( return candidates; } -#ifndef NO_CLANG_COMPLETER +#ifdef USE_CLANG_COMPLETER std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings( const std::vector< CompletionData > &datas ) @@ -103,7 +103,7 @@ std::vector< const Candidate* > CandidateRepository::GetCandidatesForStrings( return candidates; } -#endif // NO_CLANG_COMPLETER +#endif // USE_CLANG_COMPLETER CandidateRepository::~CandidateRepository() { diff --git a/cpp/ycm/CandidateRepository.h b/cpp/ycm/CandidateRepository.h index 93b99dfa..c5bf7cf7 100644 --- a/cpp/ycm/CandidateRepository.h +++ b/cpp/ycm/CandidateRepository.h @@ -44,10 +44,10 @@ public: std::vector< const Candidate* > GetCandidatesForStrings( const std::vector< std::string > &strings ); -#ifndef NO_CLANG_COMPLETER +#ifdef USE_CLANG_COMPLETER std::vector< const Candidate* > GetCandidatesForStrings( const std::vector< CompletionData > &datas ); -#endif // NO_CLANG_COMPLETER +#endif // USE_CLANG_COMPLETER private: CandidateRepository() {}; diff --git a/cpp/ycm/ycm_core.cpp b/cpp/ycm/ycm_core.cpp index 2424fea4..1f6aa306 100644 --- a/cpp/ycm/ycm_core.cpp +++ b/cpp/ycm/ycm_core.cpp @@ -18,12 +18,12 @@ #include "IdentifierCompleter.h" #include "Future.h" -#ifndef NO_CLANG_COMPLETER +#ifdef USE_CLANG_COMPLETER # include "ClangCompleter.h" # include "CompletionData.h" # include "Diagnostic.h" # include "UnsavedFile.h" -#endif // NO_CLANG_COMPLETER +#endif // USE_CLANG_COMPLETER #include #include @@ -56,7 +56,7 @@ BOOST_PYTHON_MODULE(ycm_core) .def( "ResultsReady", &Future< void >::ResultsReady ) .def( "GetResults", &Future< void >::GetResults ); -#ifndef NO_CLANG_COMPLETER +#ifdef USE_CLANG_COMPLETER class_< Future< AsyncCompletions > >( "FutureCompletions" ) .def( "ResultsReady", &Future< AsyncCompletions >::ResultsReady ) .def( "GetResults", &Future< AsyncCompletions >::GetResults ); @@ -112,5 +112,5 @@ BOOST_PYTHON_MODULE(ycm_core) class_< std::vector< Diagnostic > >( "DiagnosticVec" ) .def( vector_indexing_suite< std::vector< Diagnostic > >() ); -#endif // NO_CLANG_COMPLETER +#endif // USE_CLANG_COMPLETER }