blob: d17a8f10335cb61671b2d4194f5e636f7719d25c [file] [log] [blame]
# Additional interop for things like macros and inlined functions.
add_library(rust_wrapper STATIC rust_wrapper.c)
target_link_libraries(rust_wrapper crypto)
# Generate architecture-specific wrappers. bindgen must be called from
# ${CMAKE_BINARY_DIR}, with the output path as a relative path. bindgen writes
# the depfile using the same syntax as the command-line argument, and ninja
# requires a path relative to the top-level build directory.
set(wrapper wrapper_${RUST_BINDINGS}.rs)
binary_dir_relative_path(${wrapper} wrapper_relative)
binary_dir_relative_path(${wrapper}.d depfile_relative)
OUTPUT ${wrapper}
-o ${wrapper_relative}
# These regexes need to accept both / and \ to handle Windows file
# path differences, due a bindgen issue. See
# Ideally, we would write [/\\], but
# there are many layers of escaping here. First, CMake interprets
# backslashes. Then CMake generates a Ninja or Make file. That, in
# turn, uses the shell on POSIX, and does something else on Windows.
# It is unlikely that every layer here has sufficiently well-defined
# escaping and correctly handled the next layer's escaping. On top of
# that, we'd likely need to detect Windows vs POSIX hosts and change
# the input. Instead, just use [[:punct:]] which is more permissive
# than necessary, but we only need to exclude unwanted libc headers.
# If bindgen ever supports some file-based config (see
#, we can
# switch to that.
-- # these are LLVM arg passthroughs
DEPENDS wrapper.h
add_custom_target(bssl_sys ALL DEPENDS ${wrapper})