ya.make 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. LIBRARY()
  2. LICENSE(
  3. Apache-2.0 AND
  4. Apache-2.0 WITH LLVM-exception AND
  5. BSD-2-Clause AND
  6. MIT AND
  7. NCSA
  8. )
  9. LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
  10. VERSION(2022-02-20)
  11. ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/34313583331e5c8cb0d3df28efb6c34c428fd235.tar.gz)
  12. ADDINCL(
  13. GLOBAL contrib/libs/cxxsupp/libcxx/include
  14. contrib/libs/cxxsupp/libcxx/src
  15. )
  16. CXXFLAGS(-D_LIBCPP_BUILDING_LIBRARY)
  17. IF (OS_ANDROID)
  18. DEFAULT(CXX_RT "default")
  19. IF (ARCH_I686 OR ARCH_ARM7)
  20. # 32-bit architectures require additional libandroid_support.so to be linked
  21. # We add --start-group / --end-group statements due to the issue in NDK < r22.
  22. # See: https://github.com/android/ndk/issues/1130
  23. #
  24. # Though these statements are not respected by LLD, they might have sense for other linkers.
  25. LDFLAGS(
  26. -Wl,--start-group
  27. -lc++abi
  28. -landroid_support
  29. -Wl,--end-group
  30. )
  31. ELSE()
  32. LDFLAGS(-lc++abi)
  33. ENDIF()
  34. CFLAGS(
  35. -DLIBCXX_BUILDING_LIBCXXABI
  36. )
  37. ELSEIF (OS_IOS)
  38. # Take cxxabi implementation from system.
  39. LDFLAGS(-lc++abi)
  40. CFLAGS(
  41. -DLIBCXX_BUILDING_LIBCXXABI
  42. )
  43. # Yet take builtins library from Arcadia
  44. PEERDIR(
  45. contrib/libs/cxxsupp/builtins
  46. )
  47. ELSEIF (OS_LINUX OR OS_DARWIN)
  48. IF (ARCH_ARM7)
  49. # XXX: libcxxrt support for ARM is currently broken
  50. DEFAULT(CXX_RT "glibcxx_static")
  51. # ARM7 OS_SDK has old libstdc++ without aligned allocation support
  52. CFLAGS(
  53. GLOBAL -fno-aligned-new
  54. )
  55. ELSE()
  56. DEFAULT(CXX_RT "libcxxrt")
  57. ENDIF()
  58. IF (MUSL)
  59. PEERDIR(
  60. contrib/libs/musl/include
  61. )
  62. ENDIF()
  63. ELSEIF (OS_WINDOWS)
  64. SRCS(
  65. src/support/win32/locale_win32.cpp
  66. src/support/win32/support.cpp
  67. src/support/win32/atomic_win32.cpp
  68. src/support/win32/new_win32.cpp
  69. src/support/win32/thread_win32.cpp
  70. )
  71. CFLAGS(
  72. GLOBAL -D_LIBCPP_VASPRINTF_DEFINED
  73. GLOBAL -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_
  74. )
  75. IF (CLANG_CL)
  76. PEERDIR(
  77. contrib/libs/cxxsupp/builtins
  78. )
  79. ENDIF()
  80. ELSE()
  81. DEFAULT(CXX_RT "glibcxx_static")
  82. CXXFLAGS(
  83. -Wno-unknown-pragmas
  84. -nostdinc++
  85. )
  86. ENDIF()
  87. IF (OS_LINUX)
  88. EXTRALIBS(-lpthread)
  89. ENDIF()
  90. IF (CLANG)
  91. CFLAGS(
  92. GLOBAL -nostdinc++
  93. )
  94. ENDIF()
  95. # The CXX_RT variable controls which C++ runtime is used.
  96. # * libcxxrt - https://github.com/libcxxrt/libcxxrt library stored in Arcadia
  97. # * glibcxx_static - GNU C++ Library runtime with static linkage
  98. # * glibcxx_dynamic - GNU C++ Library runtime with dynamic linkage
  99. # * default - default C++ runtime provided by the compiler driver
  100. #
  101. # All glibcxx* runtimes are taken from system/compiler SDK
  102. DEFAULT(CXX_RT "default")
  103. DISABLE(NEED_GLIBCXX_CXX17_SHIMS)
  104. DISABLE(NEED_CXX_RT_ADDINCL)
  105. IF (CXX_RT == "libcxxrt")
  106. PEERDIR(
  107. contrib/libs/cxxsupp/libcxxabi-parts
  108. contrib/libs/cxxsupp/libcxxrt
  109. contrib/libs/cxxsupp/builtins
  110. )
  111. ADDINCL(
  112. GLOBAL contrib/libs/cxxsupp/libcxxrt/include
  113. )
  114. CFLAGS(
  115. GLOBAL -DLIBCXX_BUILDING_LIBCXXRT
  116. )
  117. # These builtins are equivalent to clang -rtlib=compiler_rt and
  118. # are needed by potentially any code generated by clang.
  119. # With glibcxx runtime, builtins are provided by libgcc
  120. ELSEIF (CXX_RT == "glibcxx_static")
  121. LDFLAGS(
  122. -Wl,-Bstatic
  123. -lsupc++
  124. -lgcc
  125. -lgcc_eh
  126. -Wl,-Bdynamic
  127. )
  128. CXXFLAGS(-D__GLIBCXX__=1)
  129. ENABLE(NEED_GLIBCXX_CXX17_SHIMS)
  130. ENABLE(NEED_CXX_RT_ADDINCL)
  131. CFLAGS(
  132. GLOBAL -DLIBCXX_BUILDING_LIBGCC
  133. )
  134. ELSEIF (CXX_RT == "glibcxx_dynamic")
  135. LDFLAGS(
  136. -lgcc_s
  137. -lstdc++
  138. )
  139. CXXFLAGS(-D__GLIBCXX__=1)
  140. CFLAGS(
  141. GLOBAL -DLIBCXX_BUILDING_LIBGCC
  142. )
  143. ENABLE(NEED_GLIBCXX_CXX17_SHIMS)
  144. ENABLE(NEED_CXX_RT_ADDINCL)
  145. ELSEIF (CXX_RT == "default")
  146. # Do nothing
  147. ELSE()
  148. MESSAGE(FATAL_ERROR "Unexpected CXX_RT value: ${CXX_RT}")
  149. ENDIF()
  150. IF (NEED_GLIBCXX_CXX17_SHIMS)
  151. IF (GCC)
  152. # Assume GCC is bundled with a modern enough version of C++ runtime
  153. ELSEIF (OS_SDK == "ubuntu-12" OR OS_SDK == "ubuntu-14" OR OS_SDK == "ubuntu-16")
  154. # Prior to ubuntu-18, system C++ runtime for C++17 is incomplete
  155. # and requires std::uncaught_exceptions() to be implemented.
  156. SRCS(
  157. glibcxx_eh_cxx17.cpp
  158. )
  159. ENDIF()
  160. ENDIF()
  161. IF (NEED_CXX_RT_ADDINCL)
  162. # FIXME:
  163. # This looks extremely weird and we have to use cxxabi.h from libsupc++ instead.
  164. # This ADDINCL is placed here just to fix the status quo
  165. ADDINCL(
  166. GLOBAL contrib/libs/cxxsupp/libcxxrt/include
  167. )
  168. ENDIF()
  169. NO_UTIL()
  170. NO_RUNTIME()
  171. NO_COMPILER_WARNINGS()
  172. IF (FUZZING)
  173. NO_SANITIZE()
  174. NO_SANITIZE_COVERAGE()
  175. ENDIF()
  176. SRCS(
  177. src/algorithm.cpp
  178. src/any.cpp
  179. src/assert.cpp
  180. src/atomic.cpp
  181. src/barrier.cpp
  182. src/bind.cpp
  183. src/charconv.cpp
  184. src/chrono.cpp
  185. src/condition_variable.cpp
  186. src/condition_variable_destructor.cpp
  187. src/debug.cpp
  188. src/exception.cpp
  189. src/filesystem/directory_iterator.cpp
  190. src/filesystem/operations.cpp
  191. src/functional.cpp
  192. src/future.cpp
  193. src/hash.cpp
  194. src/ios.cpp
  195. src/ios.instantiations.cpp
  196. src/iostream.cpp
  197. src/legacy_pointer_safety.cpp
  198. src/locale.cpp
  199. src/memory.cpp
  200. src/mutex.cpp
  201. src/mutex_destructor.cpp
  202. src/optional.cpp
  203. src/random.cpp
  204. src/random_shuffle.cpp
  205. src/regex.cpp
  206. src/ryu/d2fixed.cpp
  207. src/ryu/d2s.cpp
  208. src/ryu/f2s.cpp
  209. src/shared_mutex.cpp
  210. src/stdexcept.cpp
  211. src/string.cpp
  212. src/strstream.cpp
  213. src/system_error.cpp
  214. src/thread.cpp
  215. src/typeinfo.cpp
  216. src/utility.cpp
  217. src/valarray.cpp
  218. src/variant.cpp
  219. src/vector.cpp
  220. )
  221. IF (NOT GCC)
  222. # compiling src/format.cpp requires -std=c++20,
  223. # yet our GCC version it too auld for this.
  224. SRCS(
  225. src/format.cpp
  226. )
  227. ENDIF()
  228. IF (NOT OS_WINDOWS)
  229. SRCS(
  230. src/new.cpp
  231. )
  232. ENDIF()
  233. END()