aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/opensource.conf
blob: 6712e03aef1dcf4a1e5b4dfcbfd0feb6d76d781e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
EXPORT_CMAKE=no
EXPORT_GRADLE=no

when ($OPENSOURCE == "yes" || $OPENSOURCE_PROJECT == "ymake" || $OPENSOURCE_PROJECT == "ya") {
    YA_OPENSOURCE=yes
}

when ($CATBOOST_OPENSOURCE == "yes") {
    OPENSOURCE=yes
    CFLAGS+=-DCATBOOST_OPENSOURCE=yes
    CXXFLAGS+=-DCATBOOST_OPENSOURCE=yes
}

when ($OPENSOURCE == "yes") {
    CATBOOST_OPENSOURCE=yes
    DISABLE_FLAKE8_MIGRATIONS=yes
    GO_VET=no
    HAVE_MKL=no
    LOCAL_YDB_DOCKER_PUBLIC_BUILD=yes
    NON_FATAL_ADDINCL_TO_MISSING=yes
    SO_OUTPUTS=yes
    UDF_NO_PROBE=yes
    USE_ASMLIB=no
    USE_DYNAMIC_LIBFUSE=yes
    USE_MKL=no
    VALIDATE_DATA=no
    _USE_AIO=dynamic
    _USE_ICONV=dynamic
    _USE_IDN=dynamic
}

# Extra macros to control how gradle export works

when ($OPENSOURCE == "yes" && $EXPORT_GRADLE == "yes") {
    RECURSIVE_ADD_PEERS_TESTS=yes
    EXPORT_SEM=yes
    EXPORTED_BUILD_SYSTEM_SOURCE_ROOT=${"$"}{PROJECT_SOURCE_DIR}
    EXPORTED_BUILD_SYSTEM_BUILD_ROOT=${"$"}{PROJECT_BINARY_DIR}
}

# Extra macros to control how cmake export works

when ($OPENSOURCE == "yes" && $EXPORT_CMAKE == "yes") {
    # Python version is not acttually used in exported cmake's rigth now.
    # The only reason to set it is to avoid any deps on contrib/python|contrib/libs/python when
    # exporting PY_*_MODULE and force dependency to build/platform/python there.
    USE_SYSTEM_PYTHON=3.10
    USE_ARCADIA_PYTHON=no
    # YMAKE-477. yexport does not support USE_GLOBAL_CMD=no and crashes with OOM.
    # USE_GLOBAL_CMD=yes does not work for Windows with ya make builds but works with exported CMake files: YMAKE-657.
    USE_GLOBAL_CMD=yes
    EXPORT_SEM=yes
    EXPORTED_BUILD_SYSTEM_SOURCE_ROOT="${PROJECT_SOURCE_DIR}"
    EXPORTED_BUILD_SYSTEM_BUILD_ROOT="${PROJECT_BINARY_DIR}"
}

CMAKE_PACKAGE_SEM=
CONAN_REQUIRES_SEM=
CONAN_OPTIONS_SEM=
CONAN_OS_REQUIRES_SEM=
CONAN_OS_OPTIONS_SEM=
macro _OPENSOURCE_EXPORT_REPLACEMENT_CMAKE(CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENT[]) {
    SET(CMAKE_PACKAGE_SEM packages-ITEM && packages-name $CMAKE ${pre= && packages-components :CMAKE_COMPONENT} && mpackages-ITEM && mpackages-name $CMAKE ${pre= && mpackages-components :CMAKE_COMPONENT})
    SET(CMAKE_LINK_TARGET $CMAKE_TARGET)
}

### @usage: OPENSOURCE_EXPORT_REPLACEMENT(CMAKE PkgName CMAKE_COMPONENT OptCmakePkgComponent CMAKE_TARGET PkgName::PkgTarget CONAN ConanRequire CONAN ConanOptions CONAN_ADDITIONAL_SEMS ConanAdditionalSems)
###
### Use specified conan/system package when exporting cmake build scripts for arcadia C++ project for opensource publication.
macro OPENSOURCE_EXPORT_REPLACEMENT(CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENT[], CONAN[], CONAN_OPTIONS[], CONAN_ADDITIONAL_SEMS[]) {
    _OPENSOURCE_EXPORT_REPLACEMENT_CMAKE(CMAKE $CMAKE CMAKE_TARGET $CMAKE_TARGET CMAKE_COMPONENT $CMAKE_COMPONENT)
    SET(CONAN_REQUIRES_SEM && conan-requires $CONAN $CONAN_ADDITIONAL_SEMS)
    SET(CONAN_OPTIONS_SEM ${pre=&& conan-options :CONAN_OPTIONS})
}

### @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)
###
### Use specified conan/system package when exporting cmake build scripts for arcadia C++ project for opensource publication.
macro OPENSOURCE_EXPORT_REPLACEMENT_BY_OS(OS[], CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENT[], CONAN[], CONAN_OPTIONS[], CONAN_ADDITIONAL_SEMS[]) {
    _OPENSOURCE_EXPORT_REPLACEMENT_CMAKE(CMAKE $CMAKE CMAKE_TARGET $CMAKE_TARGET CMAKE_COMPONENT $CMAKE_COMPONENT)
    SET(CONAN_OS_REQUIRES_SEM && conan-os_depends-ITEM && conan-os_depends-os $OS && conan-os_depends-requires $CONAN $CONAN_ADDITIONAL_SEMS)
    SET(CONAN_OS_OPTIONS_SEM && conan-os_depends-ITEM && conan-os_depends-os $OS ${pre=&& conan-os_depends-opts :CONAN_OPTIONS})
}

CMAKE_TARGET_NAME=$REALPRJNAME
CMAKE_TARGET_ARTEFACT_RENAME_RULES=
### @usage CMAKE_EXPORTED_TARGET_NAME(Name)
###
### Forces to use the name given as cmake target name without changing the name of output artefact.
### This macro should be used to resolve target name conflicts in  exported cmake project when
### changing module name is not applicable. For example both CUDA and non-CUDA py modules for
### catboost should have same name lib_catboost.so and both of them are defined as PY_ANY_MODULE(_catboost).
### adding CMAKE_EXPORTED_TARGET_NAME(_catboost_non_cuda) to the non CUDA module ya.make file
### changes exported cmake target name but preserve generated artefact file name.
macro CMAKE_EXPORTED_TARGET_NAME(Name) {
    SET(CMAKE_TARGET_NAME $Name)
    SET(CMAKE_TARGET_ARTEFACT_RENAME_RULES && target_properties-ITEM && target_properties-name OUTPUT_NAME && target_properties-value $REALPRJNAME)
}

macro ALLOCATOR_IMPL() {
    SET(CPP_LIBRARY_INDUCED_LINKS allocators)
}