Support only one boost build subset, regardless of BUILD_GITHUB_PLUGIN.

This is so builders with multiple out of source build trees can all use
the same common boost install directory.  And the build system will not
vascillate between the fuller and lesser subsets of boost.
This commit is contained in:
Dick Hollenbeck 2013-11-10 18:47:54 -06:00
parent 5cea94089a
commit b3b9e96c9a
1 changed files with 91 additions and 126 deletions

View File

@ -37,26 +37,24 @@ set( BOOST_MD5 15cb8c0803064faef0c4ddf5bc5ca279 ) # re-calc this on every RELE
set( BOOST_ROOT "${PROJECT_SOURCE_DIR}/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.
# Space separated list which indicates the subset of boost libraries to compile. # Chosen libraries are based on AVHTTP requirements, and possibly
# Chosen libraries are based on AVHTTP requirements, and possibly # unit_test_framework for its own worth.
# unit_test_framework for its own worth. set( BOOST_LIBS_BUILT
set( BOOST_LIBS_BUILT #context
#context #coroutine
#coroutine date_time
date_time #exception
#exception filesystem
filesystem iostreams
iostreams locale
locale program_options
program_options regex
regex #signals
#signals system
system thread
thread #unit_test_framework
#unit_test_framework )
)
endif()
#-----</configure>--------------------------------------------------------------- #-----</configure>---------------------------------------------------------------
@ -85,133 +83,100 @@ function( set_boost_lib_names libs output )
endfunction() endfunction()
if( BUILD_GITHUB_PLUGIN ) # (BTW "test" yields "unit_test_framework" when passed to bootstrap.sh ).
#message( STATUS "BOOST_LIBS_BUILT:${BOOST_LIBS_BUILT}" )
string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT}" )
#message( STATUS "REPLACE libs_csv:${boost_libs_list}" )
# It will probably be simpler to make this the only path in the future. if( MINGW )
if( MSYS )
# (BTW "test" yields "unit_test_framework" when passed to bootstrap.sh ). # The Boost system does not build properly on MSYS using bootstrap.sh. Running
#message( STATUS "BOOST_LIBS_BUILT:${BOOST_LIBS_BUILT}" ) # bootstrap.bat with cmd.exe does. It's ugly but it works. At least for Boost
string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT}" ) # version 1.54.
#message( STATUS "REPLACE libs_csv:${boost_libs_list}" ) set( bootstrap cmd.exe /c "bootstrap.bat mingw" )
if( MINGW )
if( MSYS )
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
# bootstrap.bat with cmd.exe does. It's ugly but it works. At least for Boost
# version 1.54.
set( bootstrap cmd.exe /c "bootstrap.bat mingw" )
else()
set( bootstrap ./bootstrap.bat mingw )
endif()
foreach( lib ${boost_libs_list} )
set( b2_libs ${b2_libs} --with-${lib} )
endforeach()
unset( PIC_STUFF )
else() else()
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" ) set( bootstrap ./bootstrap.bat mingw )
#message( STATUS "libs_csv:${libs_csv}" )
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
# pass to *both* C and C++ compilers
set( PIC_STUFF "cflags=${PIC_FLAG}" )
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
unset( b2_libs )
endif() endif()
ExternalProject_Add( boost foreach( lib ${boost_libs_list} )
PREFIX "${PREFIX}" set( b2_libs ${b2_libs} --with-${lib} )
DOWNLOAD_DIR "${DOWNLOAD_DIR}" endforeach()
INSTALL_DIR "${BOOST_ROOT}" unset( PIC_STUFF )
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2 else()
URL_MD5 ${BOOST_MD5} string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
#message( STATUS "libs_csv:${libs_csv}" )
# The patch command executes with the working directory set to <SOURCE_DIR> set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
PATCH_COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost.patch" # pass to *both* C and C++ compilers
set( PIC_STUFF "cflags=${PIC_FLAG}" )
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
unset( b2_libs )
endif()
# [Mis-]use this step to erase all the boost headers and libraries before ExternalProject_Add( boost
# replacing them below. PREFIX "${PREFIX}"
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}" DOWNLOAD_DIR "${DOWNLOAD_DIR}"
INSTALL_DIR "${BOOST_ROOT}"
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
URL_MD5 ${BOOST_MD5}
BINARY_DIR "${PREFIX}/src/boost/" # The patch command executes with the working directory set to <SOURCE_DIR>
CONFIGURE_COMMAND ${bootstrap} PATCH_COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost.patch"
BUILD_COMMAND ./b2 # [Mis-]use this step to erase all the boost headers and libraries before
variant=release # replacing them below.
threading=multi UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}"
toolset=gcc
${PIC_STUFF}
${b2_libs}
#link=static
--prefix=<INSTALL_DIR>
install
INSTALL_COMMAND "" BINARY_DIR "${PREFIX}/src/boost/"
) CONFIGURE_COMMAND ${bootstrap}
if( MINGW ) BUILD_COMMAND ./b2
execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion variant=release
OUTPUT_VARIABLE GCC_VERSION threading=multi
OUTPUT_STRIP_TRAILING_WHITESPACE ) toolset=gcc
${PIC_STUFF}
${b2_libs}
#link=static
--prefix=<INSTALL_DIR>
install
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.[0-9]+.*" "\\1\\2" BOOST_GCC_VERSION ${GCC_VERSION} ) INSTALL_COMMAND ""
#message( STATUS "BOOST_GCC_VERSION: ${BOOST_GCC_VERSION}" ) )
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9])" "\\1_\\2" BOOST_LIB_VERSION ${BOOST_RELEASE} ) if( MINGW )
#message( STATUS "BOOST_LIB_VERSION: ${BOOST_LIB_VERSION}" ) execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE )
# adjust the names of the libraries to suit the build. There's no string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.[0-9]+.*" "\\1\\2" BOOST_GCC_VERSION ${GCC_VERSION} )
# symbolic links provided on the MinGW build to allow us to use #message( STATUS "BOOST_GCC_VERSION: ${BOOST_GCC_VERSION}" )
# generic names for the libs
foreach( lib ${BOOST_LIBS_BUILT} )
set( mingw_boost_libs ${mingw_boost_libs} ${lib}-mgw${BOOST_GCC_VERSION}-mt-${BOOST_LIB_VERSION} )
endforeach()
set( BOOST_LIBS_BUILT ${mingw_boost_libs} ) string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9])" "\\1_\\2" BOOST_LIB_VERSION ${BOOST_RELEASE} )
set( BOOST_INCLUDE "${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION}" ) #message( STATUS "BOOST_LIB_VERSION: ${BOOST_LIB_VERSION}" )
unset( mingw_boost_libs )
endif()
set( boost_libs "" ) # adjust the names of the libraries to suit the build. There's no
set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs ) # symbolic links provided on the MinGW build to allow us to use
# generic names for the libs
foreach( lib ${BOOST_LIBS_BUILT} )
set( mingw_boost_libs ${mingw_boost_libs} ${lib}-mgw${BOOST_GCC_VERSION}-mt-${BOOST_LIB_VERSION} )
endforeach()
set( Boost_LIBRARIES ${boost_libs} CACHE FILEPATH "Boost libraries directory" ) set( BOOST_LIBS_BUILT ${mingw_boost_libs} )
set( Boost_INCLUDE_DIR "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" ) set( BOOST_INCLUDE "${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION}" )
unset( mingw_boost_libs )
endif()
mark_as_advanced( Boost_LIBRARIES Boost_INCLUDE_DIR ) set( boost_libs "" )
set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
#message( STATUS "BOOST_ROOT:${BOOST_ROOT} BOOST_LIBRARIES:${BOOST_LIBRARIES}" ) set( Boost_LIBRARIES ${boost_libs} CACHE FILEPATH "Boost libraries directory" )
#message( STATUS "Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}" ) set( Boost_INCLUDE_DIR "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" )
else( BUILD_GITHUB_PLUGIN ) mark_as_advanced( Boost_LIBRARIES Boost_INCLUDE_DIR )
ExternalProject_Add( boost #message( STATUS "BOOST_ROOT:${BOOST_ROOT} BOOST_LIBRARIES:${BOOST_LIBRARIES}" )
PREFIX "${PREFIX}" #message( STATUS "Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}" )
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.
set( Boost_INCLUDE_DIR "${BOOST_ROOT}/include" CACHE FILEPATH "Boost include directory" )
endif( BUILD_GITHUB_PLUGIN )
ExternalProject_Add_Step( boost bzr_commit_boost ExternalProject_Add_Step( boost bzr_commit_boost