forked from openvinotoolkit/model_server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common_settings.bzl
177 lines (170 loc) · 5.62 KB
/
common_settings.bzl
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################
# bazel config settings
###############################
#To build without mediapipe use flags - bazel build --config=linux --define MEDIAPIPE_DISABLE=1 --cxxopt=-DMEDIAPIPE_DISABLE=1 //src:ovms
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@mediapipe//mediapipe/framework:more_selects.bzl", "more_selects")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("//:distro.bzl", "distro_flag")
def create_config_settings():
distro_flag()
native.config_setting(
name = "disable_mediapipe",
define_values = {
"MEDIAPIPE_DISABLE": "1",
},
visibility = ["//visibility:public"],
)
more_selects.config_setting_negation(
name = "not_disable_mediapipe",
negate = ":disable_mediapipe",
)
native.config_setting(
name = "disable_cloud",
define_values = {
"CLOUD_DISABLE": "1",
},
visibility = ["//visibility:public"],
)
more_selects.config_setting_negation(
name = "not_disable_cloud",
negate = ":disable_cloud",
)
#To build without python use flags - bazel build --config=linux --define PYTHON_DISABLE=1 //src:ovms
native.config_setting(
name = "disable_python",
define_values = {
"PYTHON_DISABLE": "1",
},
visibility = ["//visibility:public"],
)
more_selects.config_setting_negation(
name = "not_disable_python",
negate = ":disable_python",
)
native.config_setting(
name = "disable_ov_trace",
define_values = {
"OV_TRACE": "0",
},
visibility = ["//visibility:public"],
)
more_selects.config_setting_negation(
name = "not_disable_ov_trace",
negate = ":disable_ov_trace",
)
native.config_setting(
name = "fuzzer_build",
define_values = {
"FUZZER_BUILD": "1",
},
visibility = ["//visibility:public"],
)
more_selects.config_setting_negation(
name = "not_fuzzer_build",
negate = ":fuzzer_build",
)
# is windows or mediapipe is disabled (no_http dependency)
selects.config_setting_group(
name = "is_windows_or_mediapipe_is_disabled_no_http",
match_any = ["//src:windows", "//:disable_mediapipe"]
)
# is windows or python is disabled"(no llm dependency)
selects.config_setting_group(
name = "is_windows_or_python_is_disabled_no_llm",
match_any = ["//src:windows", "//:disable_python"]
)
###############################
# compilation settings
###############################
COMMON_STATIC_LIBS_COPTS = select({
"//conditions:default": [
"-Wall",
# TODO: was in ovms bin "-Wconversion",
"-Wno-unknown-pragmas",
"-Wno-sign-compare",
"-fvisibility=hidden", # Needed for pybind targets
"-Werror",
],
"//src:windows" : [
"-Wall",
],
})
COMMON_STATIC_TEST_COPTS = select({
"//conditions:default": [
"-Wall",
"-Wno-unknown-pragmas",
"-Werror",
"-Isrc",
"-fconcepts", # for gmock related utils
"-fvisibility=hidden",# Needed for pybind targets
],
"//src:windows" : [
"-W0",
"-Isrc",
],
})
COMMON_STATIC_LIBS_COPTS_VISIBLE = select({
"//conditions:default": [
"-Wall",
# TODO: was in ovms bin "-Wconversion",
"-Wno-unknown-pragmas",
"-Wno-sign-compare",
"-Werror",
],
"//src:windows" : [
"-Wall",
],
})
COMMON_STATIC_LIBS_LINKOPTS = select({
"//conditions:default": [
"-lxml2",
"-luuid",
"-lstdc++fs",
"-lssl",
"-lcrypto",
# "-lovms_shared", # Use for dynamic linking when necessary
],
"//src:windows" : [
"",
],
})
COPTS_PYTHON = select({
"//conditions:default": ["-DPYTHON_DISABLE=1"],
"//:not_disable_python" : ["-DPYTHON_DISABLE=0"],
})
COPTS_MEDIAPIPE = select({
"//conditions:default": ["-DMEDIAPIPE_DISABLE=1"],
"//:not_disable_mediapipe" : ["-DMEDIAPIPE_DISABLE=0"],
})
COMMON_FUZZER_COPTS = [
"-fsanitize=address",
"-fprofile-generate",
"-ftest-coverage",
]
COMMON_FUZZER_LINKOPTS = [
"-fprofile-generate",
"-fsanitize=address",
"-fsanitize-coverage=trace-pc",
"-static-libasan",
]
COMMON_LOCAL_DEFINES = ["SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE"]
PYBIND_DEPS = [
"//third_party:python3",
"@pybind11//:pybind11_embed",
]