opensource.conf 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. EXPORT_CMAKE=no
  2. EXPORT_GRADLE=no
  3. when ($OPENSOURCE == "yes" || $OPENSOURCE_PROJECT == "ymake" || $OPENSOURCE_PROJECT == "ya") {
  4. YA_OPENSOURCE=yes
  5. }
  6. when ($CATBOOST_OPENSOURCE == "yes") {
  7. OPENSOURCE=yes
  8. CFLAGS+=-DCATBOOST_OPENSOURCE=yes
  9. CXXFLAGS+=-DCATBOOST_OPENSOURCE=yes
  10. }
  11. when ($OPENSOURCE == "yes") {
  12. CATBOOST_OPENSOURCE=yes
  13. DISABLE_FLAKE8_MIGRATIONS=yes
  14. GO_VET=no
  15. HAVE_MKL=no
  16. LOCAL_YDB_DOCKER_PUBLIC_BUILD=yes
  17. NON_FATAL_ADDINCL_TO_MISSING=yes
  18. SO_OUTPUTS=yes
  19. UDF_NO_PROBE=yes
  20. USE_ASMLIB=no
  21. USE_DYNAMIC_LIBFUSE=yes
  22. USE_MKL=no
  23. VALIDATE_DATA=no
  24. _USE_AIO=dynamic
  25. _USE_ICONV=dynamic
  26. _USE_IDN=dynamic
  27. }
  28. # Extra macros to control how gradle export works
  29. when ($OPENSOURCE == "yes" && $EXPORT_GRADLE == "yes") {
  30. RECURSIVE_ADD_PEERS_TESTS=yes
  31. EXPORT_SEM=yes
  32. EXPORTED_BUILD_SYSTEM_SOURCE_ROOT=${"$"}{PROJECT_SOURCE_DIR}
  33. EXPORTED_BUILD_SYSTEM_BUILD_ROOT=${"$"}{PROJECT_BINARY_DIR}
  34. }
  35. # Extra macros to control how cmake export works
  36. when ($OPENSOURCE == "yes" && $EXPORT_CMAKE == "yes") {
  37. # Python version is not acttually used in exported cmake's rigth now.
  38. # The only reason to set it is to avoid any deps on contrib/python|contrib/libs/python when
  39. # exporting PY_*_MODULE and force dependency to build/platform/python there.
  40. USE_SYSTEM_PYTHON=3.10
  41. USE_ARCADIA_PYTHON=no
  42. # YMAKE-477. yexport does not support USE_GLOBAL_CMD=no and crashes with OOM.
  43. # USE_GLOBAL_CMD=yes does not work for Windows with ya make builds but works with exported CMake files: YMAKE-657.
  44. USE_GLOBAL_CMD=yes
  45. EXPORT_SEM=yes
  46. EXPORTED_BUILD_SYSTEM_SOURCE_ROOT="${PROJECT_SOURCE_DIR}"
  47. EXPORTED_BUILD_SYSTEM_BUILD_ROOT="${PROJECT_BINARY_DIR}"
  48. }
  49. CMAKE_PACKAGE=
  50. CMAKE_PACKAGE_COMPONENT=
  51. CMAKE_PACKAGE_TARGET=
  52. CONAN_REFERENCE=
  53. CONAN_PKG_OPTS=
  54. ### @usage: OPENSOURCE_EXPORT_REPLACEMENT(CMAKE PkgName CMAKE_TARGET PkgName::PkgTarget CONAN ConanRef CMAKE_COMPONENT OptCmakePkgComponent)
  55. ###
  56. ### Use specified conan/system pacakcge when exporting cmake build scripts for arcadia C++ project
  57. ### for opensource publication.
  58. macro OPENSOURCE_EXPORT_REPLACEMENT(CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENT[], CONAN[], CONAN_OPTIONS[]) {
  59. SET(CMAKE_PACKAGE $CMAKE)
  60. SET(CMAKE_PACKAGE_COMPONENT $CMAKE_COMPONENT)
  61. SET(CMAKE_LINK_TARGET $CMAKE_TARGET)
  62. SET(CONAN_REFERENCE $CONAN)
  63. SET(CONAN_PKG_OPTS $CONAN_OPTIONS)
  64. }
  65. CMAKE_TARGET_NAME=$REALPRJNAME
  66. CMAKE_TARGET_ARTEFACT_RENAME_RULES=
  67. ### @usage CMAKE_EXPORTED_TARGET_NAME(Name)
  68. ###
  69. ### Forces to use the name given as cmake target name without changing the name of output artefact.
  70. ### This macro should be used to resolve target name conflicts in exported cmake project when
  71. ### changing module name is not applicable. For example both CUDA and non-CUDA py modules for
  72. ### catboost should have same name lib_catboost.so and both of them are defined as PY_ANY_MODULE(_catboost).
  73. ### adding CMAKE_EXPORTED_TARGET_NAME(_catboost_non_cuda) to the non CUDA module ya.make file
  74. ### changes exported cmake target name but preserve generated artefact file name.
  75. macro CMAKE_EXPORTED_TARGET_NAME(Name) {
  76. SET(CMAKE_TARGET_NAME $Name)
  77. SET(CMAKE_TARGET_ARTEFACT_RENAME_RULES && set_target_property OUTPUT_NAME $REALPRJNAME && target_properties-ITEM && target_properties-name OUTPUT_NAME && target_properties-value $REALPRJNAME)
  78. }
  79. macro ALLOCATOR_IMPL() {
  80. SET(CPP_LIBRARY_INDUCED_SEM_PROPERTY target_allocator)
  81. SET(CPP_LIBRARY_INDUCED_LINKS allocators)
  82. }