You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
737 B
25 lines
737 B
_SHARED_LIB_SUFFIX = { |
|
"//conditions:default": ".so", |
|
"//:windows": ".dll", |
|
} |
|
|
|
def py_extension(name, srcs, hdrs = [], copts = [], features = [], deps = []): |
|
for shared_lib_suffix in _SHARED_LIB_SUFFIX.values(): |
|
shared_lib_name = name + shared_lib_suffix |
|
native.cc_binary( |
|
name = shared_lib_name, |
|
linkshared = 1, |
|
linkstatic = 1, |
|
srcs = srcs + hdrs, |
|
copts = copts, |
|
features = features, |
|
deps = deps, |
|
) |
|
|
|
return native.py_library( |
|
name = name, |
|
data = select({ |
|
platform: [name + shared_lib_suffix] |
|
for platform, shared_lib_suffix in _SHARED_LIB_SUFFIX.items() |
|
}), |
|
)
|
|
|