Boost.cmake 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # -*- cmake -*-
  2. if (BOOST_CMAKE_INCLUDED)
  3. return()
  4. endif (BOOST_CMAKE_INCLUDED)
  5. set (BOOST_CMAKE_INCLUDED TRUE)
  6. include(Prebuilt)
  7. include(Variables)
  8. if (ARCH STREQUAL "x86_64")
  9. set(ARCH_SUFFIX "-x64")
  10. elseif (ARCH STREQUAL "arm64")
  11. set(ARCH_SUFFIX "-a64")
  12. endif ()
  13. # Disable system libs support for now, since our boost fiber library is
  14. # patched, which is not the case on a standard system.
  15. #if (USESYSTEMLIBS)
  16. # set(Boost_FIND_QUIETLY OFF)
  17. # set(Boost_FIND_REQUIRED ON)
  18. # include(FindBoost)
  19. #
  20. # set(BOOST_CONTEXT_LIBRARY boost_context-mt)
  21. # set(BOOST_FIBER_LIBRARY boost_fiber-mt)
  22. # set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
  23. # set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
  24. # set(BOOST_THREAD_LIBRARY boost_thread-mt)
  25. #else (USESYSTEMLIBS)
  26. set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
  27. if (DARWIN)
  28. use_prebuilt_binary(boost)
  29. set(BOOST_ATOMIC_LIBRARY boost_atomic-mt${ARCH_SUFFIX})
  30. set(BOOST_CONTEXT_LIBRARY boost_context-mt${ARCH_SUFFIX})
  31. set(BOOST_FIBER_LIBRARY boost_fiber-mt${ARCH_SUFFIX})
  32. set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt${ARCH_SUFFIX})
  33. set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt${ARCH_SUFFIX})
  34. set(BOOST_THREAD_LIBRARY boost_thread-mt${ARCH_SUFFIX})
  35. elseif (LINUX)
  36. if (ARCH STREQUAL "x86_64" AND ${GCC_VERSION} GREATER 829 AND NOT (${GCC_VERSION} GREATER 839))
  37. use_prebuilt_binary(boost-static-gcc83)
  38. elseif (ARCH STREQUAL "arm64" AND ${GCC_VERSION} GREATER 1090 AND NOT (${GCC_VERSION} GREATER 1199))
  39. use_prebuilt_binary(boost-static-gcc114)
  40. else ()
  41. # Given how screwed are symbols in static boost libraries, we
  42. # cannot link them properly with objects compiled with a different
  43. # gcc version than the version used to build boost itself (v7.5),
  44. # so let's use their shared libraries counterparts in that case (at
  45. # the cost of a larger distribution package)...
  46. use_prebuilt_binary(boost)
  47. endif ()
  48. set(BOOST_ATOMIC_LIBRARY
  49. optimized boost_atomic-mt${ARCH_SUFFIX}
  50. debug boost_atomic-mt-d${ARCH_SUFFIX})
  51. set(BOOST_CONTEXT_LIBRARY
  52. optimized boost_context-mt${ARCH_SUFFIX}
  53. debug boost_context-mt-d${ARCH_SUFFIX})
  54. set(BOOST_FIBER_LIBRARY
  55. optimized boost_fiber-mt${ARCH_SUFFIX}
  56. debug boost_fiber-mt-d${ARCH_SUFFIX})
  57. set(BOOST_FILESYSTEM_LIBRARY
  58. optimized boost_filesystem-mt${ARCH_SUFFIX}
  59. debug boost_filesystem-mt-d${ARCH_SUFFIX})
  60. set(BOOST_PROGRAM_OPTIONS_LIBRARY
  61. optimized boost_program_options-mt${ARCH_SUFFIX}
  62. debug boost_program_options-mt-d${ARCH_SUFFIX})
  63. set(BOOST_THREAD_LIBRARY
  64. optimized boost_thread-mt${ARCH_SUFFIX}
  65. debug boost_thread-mt-d${ARCH_SUFFIX})
  66. elseif (WINDOWS)
  67. use_prebuilt_binary(boost)
  68. # Do not let Visual Studio try and auto-link boost libraries !
  69. add_definitions(-DBOOST_ALL_NO_LIB)
  70. set(BOOST_ATOMIC_LIBRARY libboost_atomic-mt${ARCH_SUFFIX})
  71. set(BOOST_CONTEXT_LIBRARY libboost_context-mt${ARCH_SUFFIX})
  72. set(BOOST_FIBER_LIBRARY libboost_fiber-mt${ARCH_SUFFIX})
  73. set(BOOST_FILESYSTEM_LIBRARY libboost_filesystem-mt${ARCH_SUFFIX})
  74. set(BOOST_PROGRAM_OPTIONS_LIBRARY libboost_program_options-mt${ARCH_SUFFIX})
  75. set(BOOST_THREAD_LIBRARY libboost_thread-mt${ARCH_SUFFIX})
  76. endif ()
  77. #endif (USESYSTEMLIBS)
  78. include_directories(SYSTEM ${Boost_INCLUDE_DIRS})