ya.make 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. # Previously, it was imported using devtools/yamaker/ym2. Now it is not under automation
  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
  10. )
  11. LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
  12. VERSION(2022-02-18)
  13. ORIGINAL_SOURCE(https://github.com/llvm/llvm-project/archive/34313583331e5c8cb0d3df28efb6c34c428fd235.tar.gz)
  14. ADDINCL(
  15. GLOBAL contrib/libs/cxxsupp/libcxxmsvc/include
  16. contrib/libs/cxxsupp/libcxxmsvc/src
  17. )
  18. CXXFLAGS(-D_LIBCPP_BUILDING_LIBRARY)
  19. IF (OS_ANDROID)
  20. DEFAULT(CXX_RT "default")
  21. IF (ARCH_I686 OR ARCH_ARM7)
  22. # 32-bit architectures require additional libandroid_support.so to be linked
  23. # We add --start-group / --end-group statements due to the issue in NDK < r22.
  24. # See: https://github.com/android/ndk/issues/1130
  25. #
  26. # Though these statements are not respected by LLD, they might have sense for other linkers.
  27. LDFLAGS(
  28. -Wl,--start-group
  29. -lc++abi
  30. -landroid_support
  31. -Wl,--end-group
  32. )
  33. ELSE()
  34. LDFLAGS(-lc++abi)
  35. ENDIF()
  36. CFLAGS(
  37. -DLIBCXX_BUILDING_LIBCXXABI
  38. )
  39. # Take cxxabi implementation from system.
  40. ELSEIF (OS_IOS)
  41. LDFLAGS(-lc++abi)
  42. CFLAGS(
  43. -DLIBCXX_BUILDING_LIBCXXABI
  44. )
  45. # Yet take builtins library from Arcadia
  46. PEERDIR(
  47. contrib/libs/cxxsupp/builtins
  48. )
  49. ELSEIF (OS_LINUX OR OS_DARWIN)
  50. IF (ARCH_ARM7)
  51. # XXX: libcxxrt support for ARM is currently broken
  52. DEFAULT(CXX_RT "glibcxx_static")
  53. # ARM7 OS_SDK has old libstdc++ without aligned allocation support
  54. CFLAGS(
  55. GLOBAL -fno-aligned-new
  56. )
  57. ELSE()
  58. DEFAULT(CXX_RT "libcxxrt")
  59. ENDIF()
  60. IF (MUSL)
  61. PEERDIR(
  62. contrib/libs/musl/include
  63. )
  64. ENDIF()
  65. ELSEIF (OS_WINDOWS)
  66. SRCS(
  67. src/support/win32/locale_win32.cpp
  68. src/support/win32/support.cpp
  69. src/support/win32/atomic_win32.cpp
  70. src/support/win32/new_win32.cpp
  71. src/support/win32/thread_win32.cpp
  72. )
  73. CFLAGS(
  74. GLOBAL -D_LIBCPP_VASPRINTF_DEFINED
  75. GLOBAL -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_
  76. )
  77. IF (CLANG_CL)
  78. PEERDIR(
  79. contrib/libs/cxxsupp/builtins
  80. )
  81. ENDIF()
  82. ELSE()
  83. DEFAULT(CXX_RT "glibcxx_static")
  84. CXXFLAGS(
  85. -Wno-unknown-pragmas
  86. -nostdinc++
  87. )
  88. ENDIF()
  89. IF (OS_LINUX)
  90. EXTRALIBS(-lpthread)
  91. ENDIF()
  92. IF (CLANG)
  93. CXXFLAGS(GLOBAL -nostdinc++)
  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()