aboutsummaryrefslogtreecommitdiffstats
path: root/build/platform/python/ya.make
blob: 5f187ee90b463c8fb9c0c3f1705320bb15155823 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
RESOURCES_LIBRARY()

OWNER(
    g:contrib
    g:yatool
)

INCLUDE(resources.inc)

IF (USE_SYSTEM_PYTHON)
    IF (OS_LINUX)
        IF (ARCH_ARM64 OR ARCH_AARCH64)
            IF (_SYSTEM_PYTHON27)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_LINUX_ARM64})
            ELSE()
                ENABLE(PYTHON_NOT_FOUND)
            ENDIF()
        ELSEIF (ARCH_X86_64)
            IF (_SYSTEM_PYTHON27)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_LINUX})
            ELSEIF (_SYSTEM_PYTHON34)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON34_LINUX})
            ELSEIF (_SYSTEM_PYTHON35)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON35_LINUX})
            ELSEIF (_SYSTEM_PYTHON36)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON36_LINUX})
            ELSEIF (_SYSTEM_PYTHON37)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON37_LINUX})
            ELSEIF (_SYSTEM_PYTHON38)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_LINUX})
            ELSEIF (_SYSTEM_PYTHON39)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_LINUX})
            ELSEIF (_SYSTEM_PYTHON310)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_LINUX})
            ELSE()
                ENABLE(PYTHON_NOT_FOUND)
            ENDIF()
        ELSE()
            ENABLE(PYTHON_NOT_FOUND)
        ENDIF()
        CFLAGS(
            GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include"
            GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include/python${PY_VERSION}"
        )
    ELSEIF (OS_DARWIN)
        IF (PYTHON_DISTR == "macos-brew")
            IF (ARCH_X86_64)
                IF (_SYSTEM_PYTHON27)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON sbr:562720527)
                ELSEIF (_SYSTEM_PYTHON36)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON sbr:562721643)
                ELSE()
                    ENABLE(PYTHON_NOT_FOUND)
                ENDIF()
            ELSE()
                ENABLE(PYTHON_NOT_FOUND)
            ENDIF()
        ELSE()
            IF (ARCH_X86_64)
                IF (_SYSTEM_PYTHON27)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_DARWIN})
                ELSEIF (_SYSTEM_PYTHON34)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON34_DARWIN})
                ELSEIF (_SYSTEM_PYTHON35)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON35_DARWIN})
                ELSEIF (_SYSTEM_PYTHON36)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON36_DARWIN})
                ELSEIF (_SYSTEM_PYTHON37)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON37_DARWIN})
                ELSEIF (_SYSTEM_PYTHON38)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_DARWIN})
                ELSEIF (_SYSTEM_PYTHON39)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_DARWIN})
                ELSEIF (_SYSTEM_PYTHON310)
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_DARWIN})
                ELSE()
                    ENABLE(PYTHON_NOT_FOUND)
                ENDIF()
            ELSEIF(ARCH_ARM64) 
                IF (_SYSTEM_PYTHON38) 
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_DARWIN_ARM64}) 
                ELSEIF(_SYSTEM_PYTHON39) 
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_DARWIN_ARM64}) 
                ELSEIF(_SYSTEM_PYTHON310) 
                    DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_DARWIN_ARM64}) 
                ELSE() 
                    ENABLE(PYTHON_NOT_FOUND) 
                ENDIF() 
            ELSE()
                ENABLE(PYTHON_NOT_FOUND)
            ENDIF()
        ENDIF()
        CFLAGS(GLOBAL "-isystem$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/Python.framework/Versions/${PY_FRAMEWORK_VERSION}/include/python${PY_VERSION}")
    ELSEIF (OS_WINDOWS)
        IF (ARCH_X86_64)
            IF (_SYSTEM_PYTHON27)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON27_WINDOWS})
            ELSEIF (_SYSTEM_PYTHON34)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON34_WINDOWS})
            ELSEIF (_SYSTEM_PYTHON35)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON35_WINDOWS})
            ELSEIF (_SYSTEM_PYTHON36)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON36_WINDOWS})
            ELSEIF (_SYSTEM_PYTHON37)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON37_WINDOWS})
            ELSEIF (_SYSTEM_PYTHON38)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON38_WINDOWS})
            ELSEIF (_SYSTEM_PYTHON39)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON39_WINDOWS})
            ELSEIF (_SYSTEM_PYTHON310)
                DECLARE_EXTERNAL_RESOURCE(EXTERNAL_PYTHON ${PYTHON310_WINDOWS})
            ELSE()
                ENABLE(PYTHON_NOT_FOUND)
            ENDIF()
        ELSE()
            ENABLE(PYTHON_NOT_FOUND)
        ENDIF()
        CFLAGS(GLOBAL "/I$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/include")
        LDFLAGS("/LIBPATH:$EXTERNAL_PYTHON_RESOURCE_GLOBAL/python/libs")
    ENDIF()

    IF (PYTHON_NOT_FOUND)
        MESSAGE(FATAL_ERROR "No system Python ${USE_SYSTEM_PYTHON} for the selected platform")
    ENDIF()
ELSEIF (NOT USE_ARCADIA_PYTHON)
    CFLAGS(GLOBAL $PYTHON_FLAGS)
    IF (OS_WINDOWS)
        LDFLAGS($PYTHON_LDFLAGS $PYTHON_LIBRARIES)
    ENDIF()
ENDIF()

END()

RECURSE_FOR_TESTS(
    tests
)