boost.cmake 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # ***** BEGIN GPL LICENSE BLOCK *****
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ***** END GPL LICENSE BLOCK *****
  18. set(BOOST_ADDRESS_MODEL 64)
  19. if(WIN32)
  20. if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
  21. set(PYTHON_ARCH x64)
  22. set(PYTHON_ARCH2 win-AMD64)
  23. set(PYTHON_OUTPUTDIR ${BUILD_DIR}/python/src/external_python/pcbuild/amd64/)
  24. else()
  25. set(PYTHON_ARCH x86)
  26. set(PYTHON_ARCH2 win32)
  27. set(PYTHON_OUTPUTDIR ${BUILD_DIR}/python/src/external_python/pcbuild/win32/)
  28. set(BOOST_ADDRESS_MODEL 32)
  29. endif()
  30. if(MSVC14)
  31. set(BOOST_TOOLSET toolset=msvc-14.0)
  32. set(BOOST_COMPILER_STRING -vc140)
  33. endif()
  34. set(JAM_FILE ${BUILD_DIR}/boost/src/external_boost/user-config.jam)
  35. set(semi_path "${PATCH_DIR}/semi.txt")
  36. FILE(TO_NATIVE_PATH ${semi_path} semi_path)
  37. set(BOOST_CONFIGURE_COMMAND bootstrap.bat &&
  38. echo using python : ${PYTHON_OUTPUTDIR}\\python.exe > "${JAM_FILE}" &&
  39. echo. : ${BUILD_DIR}/python/src/external_python/include ${BUILD_DIR}/python/src/external_python/pc >> "${JAM_FILE}" &&
  40. echo. : ${BUILD_DIR}/python/src/external_python/pcbuild >> "${JAM_FILE}" &&
  41. type ${semi_path} >> "${JAM_FILE}"
  42. )
  43. set(BOOST_BUILD_COMMAND bjam)
  44. #--user-config=user-config.jam
  45. set(BOOST_BUILD_OPTIONS runtime-link=static )
  46. #set(BOOST_WITH_PYTHON --with-python)
  47. set(BOOST_HARVEST_CMD ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/ )
  48. if(BUILD_MODE STREQUAL Release)
  49. set(BOOST_HARVEST_CMD ${BOOST_HARVEST_CMD} && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-1_68/ ${HARVEST_TARGET}/boost/include/)
  50. endif()
  51. elseif(APPLE)
  52. set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
  53. set(BOOST_BUILD_COMMAND ./b2)
  54. set(BOOST_BUILD_OPTIONS toolset=darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} --disable-icu boost.locale.icu=off)
  55. set(BOOST_HARVEST_CMD echo .)
  56. set(BOOST_PATCH_COMMAND echo .)
  57. else()
  58. set(BOOST_HARVEST_CMD echo .)
  59. set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
  60. set(BOOST_BUILD_COMMAND ./b2)
  61. set(BOOST_BUILD_OPTIONS cxxflags=${PLATFORM_CXXFLAGS} --disable-icu boost.locale.icu=off)
  62. set(BOOST_PATCH_COMMAND echo .)
  63. if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
  64. set(BOOST_ADDRESS_MODEL 64)
  65. else()
  66. set(BOOST_ADDRESS_MODEL 32)
  67. endif()
  68. endif()
  69. set(BOOST_OPTIONS
  70. --with-filesystem
  71. --with-locale
  72. --with-thread
  73. --with-regex
  74. --with-system
  75. --with-date_time
  76. --with-wave
  77. --with-atomic
  78. --with-serialization
  79. --with-program_options
  80. --with-iostreams
  81. ${BOOST_WITH_PYTHON}
  82. ${BOOST_TOOLSET}
  83. )
  84. string(TOLOWER ${BUILD_MODE} BOOST_BUILD_TYPE)
  85. ExternalProject_Add(external_boost
  86. URL ${BOOST_URI}
  87. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  88. URL_HASH MD5=${BOOST_HASH}
  89. PREFIX ${BUILD_DIR}/boost
  90. UPDATE_COMMAND ""
  91. PATCH_COMMAND ${BOOST_PATCH_COMMAND}
  92. CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
  93. BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=x86 address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
  94. BUILD_IN_SOURCE 1
  95. INSTALL_COMMAND "${BOOST_HARVEST_CMD}"
  96. )
  97. if(WIN32)
  98. add_dependencies(
  99. external_boost
  100. Make_Python_Environment
  101. )
  102. endif()