opensource.conf 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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_SEM=
  50. CONAN_REQUIRES_SEM=
  51. CONAN_OPTIONS_SEM=
  52. CONAN_OS_REQUIRES_SEM=
  53. CONAN_OS_OPTIONS_SEM=
  54. macro _OPENSOURCE_EXPORT_REPLACEMENT_CMAKE(CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENT[]) {
  55. SET(CMAKE_PACKAGE_SEM packages-ITEM && packages-name $CMAKE ${pre= && packages-components :CMAKE_COMPONENT} && mpackages-ITEM && mpackages-name $CMAKE ${pre= && mpackages-components :CMAKE_COMPONENT})
  56. SET(CMAKE_LINK_TARGET $CMAKE_TARGET)
  57. }
  58. ### @usage: OPENSOURCE_EXPORT_REPLACEMENT(CMAKE PkgName CMAKE_COMPONENT OptCmakePkgComponent CMAKE_TARGET PkgName::PkgTarget CONAN ConanRequire CONAN ConanOptions CONAN_ADDITIONAL_SEMS ConanAdditionalSems)
  59. ###
  60. ### Use specified conan/system package when exporting cmake build scripts for arcadia C++ project for opensource publication.
  61. macro OPENSOURCE_EXPORT_REPLACEMENT(CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENT[], CONAN[], CONAN_OPTIONS[], CONAN_ADDITIONAL_SEMS[]) {
  62. _OPENSOURCE_EXPORT_REPLACEMENT_CMAKE(CMAKE $CMAKE CMAKE_TARGET $CMAKE_TARGET CMAKE_COMPONENT $CMAKE_COMPONENT)
  63. SET(CONAN_REQUIRES_SEM && conan-requires $CONAN $CONAN_ADDITIONAL_SEMS)
  64. SET(CONAN_OPTIONS_SEM ${pre=&& conan-options :CONAN_OPTIONS})
  65. }
  66. ### @usage: OPENSOURCE_EXPORT_REPLACEMENT_BY_OS(OS Os CMAKE PkgName CMAKE_COMPONENT OptCmakePkgComponent CMAKE_TARGET PkgName::PkgTarget CONAN ConanRequire CONAN ConanOptions CONAN_ADDITIONAL_SEMS ConanAdditionalSems)
  67. ###
  68. ### Use specified conan/system package when exporting cmake build scripts for arcadia C++ project for opensource publication.
  69. macro OPENSOURCE_EXPORT_REPLACEMENT_BY_OS(OS[], CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENT[], CONAN[], CONAN_OPTIONS[], CONAN_ADDITIONAL_SEMS[]) {
  70. _OPENSOURCE_EXPORT_REPLACEMENT_CMAKE(CMAKE $CMAKE CMAKE_TARGET $CMAKE_TARGET CMAKE_COMPONENT $CMAKE_COMPONENT)
  71. SET(CONAN_OS_REQUIRES_SEM && conan-os_depends-ITEM && conan-os_depends-os $OS && conan-os_depends-requires $CONAN $CONAN_ADDITIONAL_SEMS)
  72. SET(CONAN_OS_OPTIONS_SEM && conan-os_depends-ITEM && conan-os_depends-os $OS ${pre=&& conan-os_depends-opts :CONAN_OPTIONS})
  73. }
  74. CMAKE_TARGET_NAME=$REALPRJNAME
  75. CMAKE_TARGET_ARTEFACT_RENAME_RULES=
  76. ### @usage CMAKE_EXPORTED_TARGET_NAME(Name)
  77. ###
  78. ### Forces to use the name given as cmake target name without changing the name of output artefact.
  79. ### This macro should be used to resolve target name conflicts in exported cmake project when
  80. ### changing module name is not applicable. For example both CUDA and non-CUDA py modules for
  81. ### catboost should have same name lib_catboost.so and both of them are defined as PY_ANY_MODULE(_catboost).
  82. ### adding CMAKE_EXPORTED_TARGET_NAME(_catboost_non_cuda) to the non CUDA module ya.make file
  83. ### changes exported cmake target name but preserve generated artefact file name.
  84. macro CMAKE_EXPORTED_TARGET_NAME(Name) {
  85. SET(CMAKE_TARGET_NAME $Name)
  86. SET(CMAKE_TARGET_ARTEFACT_RENAME_RULES && target_properties-ITEM && target_properties-name OUTPUT_NAME && target_properties-value $REALPRJNAME)
  87. }
  88. macro ALLOCATOR_IMPL() {
  89. SET(CPP_LIBRARY_INDUCED_LINKS allocators)
  90. }