ya.make 6.4 KB

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