2013-05-31 21:26:08 +00:00
|
|
|
# This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
#
|
|
|
|
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
|
|
|
|
#
|
|
|
|
# This program 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 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program 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 this program; if not, you may find one here:
|
|
|
|
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
# or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
# or you may write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
|
|
|
|
|
2013-05-31 04:46:02 +00:00
|
|
|
|
2013-08-20 18:03:21 +00:00
|
|
|
# Download a particular boost version, and patch it [and build it if BUILD_GITHUB_PLUGIN].
|
|
|
|
# Assumes include( ExternalProject ) was done inline previous to this file
|
|
|
|
# and that set( DOWNLOAD_DIR ... ) was set in a higher context.
|
|
|
|
|
|
|
|
|
|
|
|
#-----<configure>----------------------------------------------------------------
|
2013-05-31 04:46:02 +00:00
|
|
|
|
2013-09-21 07:30:23 +00:00
|
|
|
set( BOOST_RELEASE 1.54.0 )
|
|
|
|
set( BOOST_MD5 15cb8c0803064faef0c4ddf5bc5ca279 ) # re-calc this on every RELEASE change
|
2013-08-20 18:03:21 +00:00
|
|
|
|
|
|
|
# The boost headers [and static libs if built] go here, at the top of KiCad
|
|
|
|
# source tree in boost_root.
|
|
|
|
set( BOOST_ROOT "${PROJECT_SOURCE_DIR}/boost_root" )
|
|
|
|
|
|
|
|
|
|
|
|
if( BUILD_GITHUB_PLUGIN )
|
|
|
|
# Space separated list which indicates the subset of boost libraries to compile.
|
2013-09-21 07:30:23 +00:00
|
|
|
# Chosen libraries are based on pion-net _client_ (not server) requirements. Client
|
|
|
|
# requirements are less demanding.
|
2013-08-20 18:03:21 +00:00
|
|
|
set( BOOST_LIBS_BUILT
|
2013-09-21 07:30:23 +00:00
|
|
|
date_time
|
2013-08-26 20:19:04 +00:00
|
|
|
#exception
|
2013-09-21 07:30:23 +00:00
|
|
|
filesystem
|
|
|
|
iostreams
|
|
|
|
locale
|
|
|
|
program_options
|
|
|
|
regex
|
|
|
|
#signals
|
2013-09-21 16:06:15 +00:00
|
|
|
system
|
2013-09-21 07:30:23 +00:00
|
|
|
thread
|
2013-08-20 18:03:21 +00:00
|
|
|
unit_test_framework
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#-----</configure>---------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2013-05-31 21:22:34 +00:00
|
|
|
|
|
|
|
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
|
2013-05-31 04:46:02 +00:00
|
|
|
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
|
|
|
|
|
2013-06-01 04:04:56 +00:00
|
|
|
# <SOURCE_DIR> = ${PREFIX}/src/boost
|
|
|
|
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
|
|
|
# download, the patch is applied. This lets you regenerate a new patch at any time
|
|
|
|
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
|
|
|
|
2013-08-20 18:03:21 +00:00
|
|
|
# path to the boost headers in the repo.
|
|
|
|
# repo = "${headers_src}/../.bzr" = "<SOURCE_DIR>/.bzr"
|
|
|
|
set( headers_src "${PREFIX}/src/boost/boost" )
|
2013-06-01 04:04:56 +00:00
|
|
|
|
2013-05-31 04:46:02 +00:00
|
|
|
|
2013-08-26 20:19:04 +00:00
|
|
|
function( set_boost_lib_names libs output )
|
|
|
|
foreach( lib ${libs} )
|
2013-09-21 16:06:15 +00:00
|
|
|
|
|
|
|
if( false )
|
|
|
|
set( fullpath_lib, "${BOOST_ROOT}/lib/libboost_${lib}.${CMAKE_STATIC_LIBRARY_SUFFIX}" )
|
2013-08-26 20:19:04 +00:00
|
|
|
message( STATUS "fullpath_lib:${fullpath_lib}" )
|
2013-09-21 16:06:15 +00:00
|
|
|
list( APPEND output ${fullpath_lib} )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message( STATUS "lib:${lib}" )
|
|
|
|
|
2013-08-20 18:03:21 +00:00
|
|
|
endforeach()
|
|
|
|
endfunction()
|
2013-05-31 04:46:02 +00:00
|
|
|
|
|
|
|
|
2013-08-20 18:03:21 +00:00
|
|
|
if( BUILD_GITHUB_PLUGIN )
|
2013-05-31 04:46:02 +00:00
|
|
|
|
2013-09-21 07:30:23 +00:00
|
|
|
# It will probably be simpler to make this the only path in the future.
|
|
|
|
|
2013-08-20 18:03:21 +00:00
|
|
|
# (BTW "test" yields "unit_test_framework" when passed to bootstrap.{sh,bat} ).
|
2013-09-21 07:30:23 +00:00
|
|
|
#message( STATUS "BOOST_LIBS_BUILT:${BOOST_LIBS_BUILT}" )
|
2013-08-20 18:03:21 +00:00
|
|
|
string( REPLACE "unit_test_framework" "test" libs_csv "${BOOST_LIBS_BUILT}" )
|
2013-09-21 07:30:23 +00:00
|
|
|
#message( STATUS "REPLACE libs_csv:${libs_csv}" )
|
2013-08-20 18:03:21 +00:00
|
|
|
|
|
|
|
string( REGEX REPLACE "\\;" "," libs_csv "${libs_csv}" )
|
2013-09-21 07:30:23 +00:00
|
|
|
#message( STATUS "libs_csv:${libs_csv}" )
|
2013-08-20 18:03:21 +00:00
|
|
|
|
|
|
|
if( MINGW )
|
|
|
|
set( bootstrap "bootstart.bat mingw" )
|
|
|
|
else()
|
|
|
|
set( bootstrap bootstrap.sh )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ExternalProject_Add( boost
|
|
|
|
PREFIX "${PREFIX}"
|
|
|
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
2013-09-21 14:48:37 +00:00
|
|
|
INSTALL_DIR "${BOOST_ROOT}"
|
2013-08-20 18:03:21 +00:00
|
|
|
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
|
|
|
|
URL_MD5 ${BOOST_MD5}
|
|
|
|
|
|
|
|
# The patch command executes with the working directory set to <SOURCE_DIR>
|
|
|
|
PATCH_COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost.patch"
|
|
|
|
|
|
|
|
# [Mis-]use this step to erase all the boost headers and libraries before
|
|
|
|
# replacing them below.
|
|
|
|
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}"
|
|
|
|
|
|
|
|
BINARY_DIR "${PREFIX}/src/boost/"
|
|
|
|
CONFIGURE_COMMAND ${bootstrap}
|
|
|
|
--with-libraries=${libs_csv}
|
|
|
|
|
|
|
|
BUILD_COMMAND b2
|
|
|
|
variant=release
|
|
|
|
threading=multi
|
|
|
|
toolset=gcc
|
2013-09-21 07:30:23 +00:00
|
|
|
#link=static
|
2013-09-21 14:48:37 +00:00
|
|
|
--prefix=<INSTALL_DIR>
|
2013-08-20 18:03:21 +00:00
|
|
|
install
|
|
|
|
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
)
|
|
|
|
|
2013-09-21 16:06:15 +00:00
|
|
|
#file( GLOB boost_libs "${BOOST_ROOT}/lib/*${CMAKE_STATIC_LIBRARY_SUFFIX}" )
|
|
|
|
set_boost_lib_names( ${BOOST_LIBS_BUILT} boost_libs )
|
2013-09-21 14:48:37 +00:00
|
|
|
|
2013-09-21 16:06:15 +00:00
|
|
|
message( STATUS "BOOST_ROOT:${BOOST_ROOT} boost_libs:${boost_libs}" )
|
2013-08-26 20:19:04 +00:00
|
|
|
set( Boost_LIBRARIES ${boost_libs} CACHE FILEPATH "Boost libraries directory" )
|
|
|
|
set( Boost_INCLUDE_DIR "${BOOST_ROOT}/include" CACHE FILEPATH "Boost include directory" )
|
|
|
|
|
2013-08-20 18:03:21 +00:00
|
|
|
|
|
|
|
else( BUILD_GITHUB_PLUGIN )
|
|
|
|
|
|
|
|
|
|
|
|
ExternalProject_Add( boost
|
|
|
|
PREFIX "${PREFIX}"
|
|
|
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
|
|
|
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
|
|
|
|
URL_MD5 ${BOOST_MD5}
|
|
|
|
|
|
|
|
# The patch command executes with the working directory set to <SOURCE_DIR>
|
|
|
|
PATCH_COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost.patch"
|
|
|
|
|
|
|
|
# Dick 18-Aug-2013:
|
|
|
|
# [mis-]use this UPDATE_COMMAND opportunity to remove the old place of boost headers.
|
|
|
|
# Can eventually remove this step after headers are moved from <kicad_src>/include/boost
|
|
|
|
# to <kicad_src>/boost_root/include/boost over the next several months.
|
|
|
|
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PROJECT_SOURCE_DIR}/include/boost"
|
|
|
|
|
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
|
|
|
|
# remove then re-copy into the include/boost directory during next two steps:
|
|
|
|
BUILD_COMMAND ${CMAKE_COMMAND} -E remove_directory ${BOOST_ROOT}
|
|
|
|
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory "${headers_src}" "${BOOST_ROOT}/include/boost"
|
|
|
|
)
|
|
|
|
|
|
|
|
# Until my find_package() support is done for my boost.
|
2013-08-26 20:19:04 +00:00
|
|
|
set( Boost_INCLUDE_DIR "${BOOST_ROOT}/include" CACHE FILEPATH "Boost include directory" )
|
2013-08-20 18:03:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
endif( BUILD_GITHUB_PLUGIN )
|
2013-05-31 04:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
ExternalProject_Add_Step( boost bzr_commit_boost
|
|
|
|
COMMAND bzr ci -q -m pristine <SOURCE_DIR>
|
2013-05-31 21:22:34 +00:00
|
|
|
COMMENT "committing pristine boost files to 'boost scratch repo'"
|
2013-05-31 04:46:02 +00:00
|
|
|
DEPENDERS patch
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
ExternalProject_Add_Step( boost bzr_add_boost
|
2013-08-20 18:03:21 +00:00
|
|
|
# add only the headers to the scratch repo, repo = "../.bzr" from ${headers_src}
|
|
|
|
COMMAND bzr add -q ${headers_src}
|
2013-05-31 21:22:34 +00:00
|
|
|
COMMENT "adding pristine boost files to 'boost scratch repo'"
|
2013-05-31 04:46:02 +00:00
|
|
|
DEPENDERS bzr_commit_boost
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
ExternalProject_Add_Step( boost bzr_init_boost
|
|
|
|
COMMAND bzr init -q <SOURCE_DIR>
|
|
|
|
COMMENT "creating 'boost scratch repo' specifically for boost to track boost patches"
|
2013-05-31 21:22:34 +00:00
|
|
|
DEPENDERS bzr_add_boost
|
2013-05-31 04:46:02 +00:00
|
|
|
DEPENDEES download
|
|
|
|
)
|
2013-08-20 18:03:21 +00:00
|
|
|
|