2012-05-10 00:45:30 -04:00
|
|
|
# Copyright (C) 2011, 2012 Strahinja Val Markovic <val@markovic.io>
|
|
|
|
#
|
|
|
|
# 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/>.
|
|
|
|
|
|
|
|
# The interesting parts of Boost have been extracted using
|
|
|
|
# the BCP tool:
|
2013-01-13 19:39:53 -05:00
|
|
|
# http://www.boost.org/doc/libs/1_52_0/tools/bcp/doc/html/index.html
|
2012-05-10 00:45:30 -04:00
|
|
|
#
|
2013-05-26 13:35:18 -04:00
|
|
|
# bcp call: bcp boost/utility.hpp boost/python.hpp boost/bind.hpp boost/lambda/lambda.hpp boost/exception/all.hpp boost/tuple/tuple_io.hpp boost/tuple/tuple_comparison.hpp boost/regex.hpp boost/foreach.hpp boost/smart_ptr.hpp boost/algorithm/string_regex.hpp boost/thread.hpp boost/unordered_map.hpp boost/unordered_set.hpp boost/format.hpp boost/ptr_container/ptr_container.hpp boost/filesystem.hpp boost/filesystem/fstream.hpp boost/utility.hpp boost/algorithm/cxx11/any_of.hpp atomic lockfree assign ../BoostParts
|
2012-05-10 00:45:30 -04:00
|
|
|
|
|
|
|
cmake_minimum_required( VERSION 2.8 )
|
|
|
|
|
|
|
|
project( BoostParts )
|
|
|
|
|
2013-02-02 15:11:37 -05:00
|
|
|
set( Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 )
|
2013-02-05 19:48:40 -05:00
|
|
|
find_package( PythonLibs 2.5 REQUIRED )
|
2012-05-10 00:45:30 -04:00
|
|
|
|
2013-02-02 15:22:26 -05:00
|
|
|
if ( NOT PYTHONLIBS_VERSION_STRING VERSION_LESS "3.0.0" )
|
|
|
|
message( FATAL_ERROR
|
|
|
|
"CMake found python3 libs instead of python2 libs. YCM works only with "
|
|
|
|
"python2.\n" )
|
|
|
|
endif()
|
|
|
|
|
2012-05-10 00:45:30 -04:00
|
|
|
file( GLOB_RECURSE SOURCES *.cpp )
|
|
|
|
|
|
|
|
# We need to remove all the thread cpp files and then add them on a per-platform
|
|
|
|
# basis
|
|
|
|
file( GLOB_RECURSE to_remove libs/thread/*.cpp libs/detail/*.cpp )
|
|
|
|
|
|
|
|
if( to_remove )
|
|
|
|
list( REMOVE_ITEM SOURCES ${to_remove} )
|
|
|
|
endif()
|
|
|
|
|
2012-07-21 14:37:40 -04:00
|
|
|
set( COMMON_SOURCES
|
|
|
|
libs/thread/src/future.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set( WIN_SOURCES
|
2012-05-10 00:45:30 -04:00
|
|
|
libs/thread/src/win32/thread.cpp
|
|
|
|
libs/thread/src/win32/timeconv.inl
|
|
|
|
libs/thread/src/win32/tss_dll.cpp
|
|
|
|
libs/thread/src/win32/tss_pe.cpp
|
|
|
|
)
|
|
|
|
|
2012-07-21 14:37:40 -04:00
|
|
|
set( UNIX_SOURCES
|
2012-05-10 00:45:30 -04:00
|
|
|
libs/thread/src/pthread/once.cpp
|
|
|
|
libs/thread/src/pthread/thread.cpp
|
|
|
|
libs/thread/src/pthread/timeconv.inl
|
|
|
|
)
|
|
|
|
|
2012-07-21 14:37:40 -04:00
|
|
|
list( APPEND SOURCES ${COMMON_SOURCES} )
|
|
|
|
|
2012-05-10 00:45:30 -04:00
|
|
|
if ( WIN32 )
|
2012-07-21 14:37:40 -04:00
|
|
|
list( APPEND SOURCES ${WIN_SOURCES} )
|
2012-05-10 00:45:30 -04:00
|
|
|
else()
|
2012-07-21 14:37:40 -04:00
|
|
|
list( APPEND SOURCES ${UNIX_SOURCES} )
|
2012-05-10 00:45:30 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
|
2013-02-16 20:10:01 -05:00
|
|
|
# Due to a bug/misconfiguration/stupidity, boost 1.52 and libc++ don't like each
|
|
|
|
# other much: a compilation error "Constexpr function never produces a constant
|
|
|
|
# expression" pops up when trying to compile anything that uses
|
|
|
|
# boost/chrono/duration.hpp (namely boost/thread for us). This is a workaround
|
|
|
|
# that prevents this from happening. Also present in cpp/ycm/CMakeLists.txt.
|
|
|
|
# See here for more details: https://svn.boost.org/trac/boost/ticket/7671
|
|
|
|
# TODO: remove this when it's fixed upstream (probably boost 1.53).
|
|
|
|
add_definitions( -DBOOST_THREAD_DONT_USE_CHRONO )
|
|
|
|
|
2013-02-15 23:18:09 -05:00
|
|
|
if( MSVC OR CYGWIN )
|
2013-02-05 21:57:49 -05:00
|
|
|
# BOOST_PYTHON_SOURCE makes boost use the correct __declspec and
|
|
|
|
# BOOST_ALL_NO_LIB turns off MSVC library autolinking
|
|
|
|
add_definitions( -DBOOST_PYTHON_SOURCE -DBOOST_ALL_NO_LIB )
|
|
|
|
endif()
|
|
|
|
|
2013-01-13 17:38:19 -05:00
|
|
|
#############################################################################
|
|
|
|
|
2012-05-10 00:45:30 -04:00
|
|
|
include_directories(
|
2012-07-05 00:24:16 -04:00
|
|
|
SYSTEM
|
2012-05-10 00:45:30 -04:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${PYTHON_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library( BoostParts ${SOURCES} )
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
if( CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG )
|
2012-07-05 00:24:16 -04:00
|
|
|
# No warnings. We just use Boost as is so warnings coming from it are just
|
|
|
|
# noise.
|
2012-07-09 16:58:56 -04:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
|
2012-05-10 00:45:30 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
|
2013-05-05 13:00:32 -04:00
|
|
|
if( NOT WIN32 )
|
|
|
|
# Linking fails without this on some platforms, notably anything x64.
|
2012-05-10 13:40:12 -04:00
|
|
|
set_target_properties( BoostParts PROPERTIES COMPILE_FLAGS "-fPIC")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
|
2012-05-10 00:45:30 -04:00
|
|
|
# Special compiler and linker flags for MSVC
|
|
|
|
if( MSVC )
|
|
|
|
add_definitions( /DUNICODE /D_UNICODE /Zc:wchar_t- )
|
|
|
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL" )
|
|
|
|
set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" )
|
|
|
|
endif()
|