mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
Rust: build libnotcurses-sys from CMake #320
This commit is contained in:
parent
e6637e81cc
commit
b2210f0cf9
@ -576,16 +576,32 @@ if(${USE_PYTHON})
|
||||
)
|
||||
endif()
|
||||
|
||||
# Rust bindings
|
||||
# Rust bindings + colloquy
|
||||
if(${USE_RUST})
|
||||
file(GLOB RUSTSRC CONFIGURE_DEPENDS src/colloquy/*.rs)
|
||||
file(GLOB COLLOQUYSRC CONFIGURE_DEPENDS rust/src/*.rs rust/src/*.yaml)
|
||||
file(GLOB LIBNCRSSRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/rust/libnotcurses-sys/src/*.rs ${CMAKE_CURRENT_SOURCE_DIR}/rust/libnotcurses-sys/src/*.rs)
|
||||
file(GLOB COLLOQUYSRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/colloquy/src/*.rs ${CMAKE_CURRENT_SOURCE_DIR}/src/colloquy/src/*.yml)
|
||||
set(LIBNOTCURSESSYS ${CMAKE_CURRENT_BINARY_DIR}/rust/debug/liblibnotcurses_sys.rlib)
|
||||
set(COLLOQUY ${CMAKE_CURRENT_BINARY_DIR}/rust/debug/colloquy)
|
||||
find_program(CARGO cargo REQUIRED)
|
||||
set(CARGO_ARGS "--verbose")
|
||||
if(NOT ${USE_NETWORK})
|
||||
set(CARGO_ARGS "${CARGO_ARGS}" --frozen)
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${LIBNOTCURSESSYS}
|
||||
COMMAND
|
||||
PKG_CONFIG_PATH=${CMAKE_CURRENT_BINARY_DIR} CARGO_HOME=${CMAKE_CURRENT_BINARY_DIR}/rust CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}/rust ${CARGO} build ${CARGO_ARGS}
|
||||
DEPENDS
|
||||
${COLLOQUYSRC}
|
||||
COMMENT "Building rust crate libnotcurses-sys"
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rust/libnotcurses-sys
|
||||
)
|
||||
add_custom_target(libnotcurses-sys ALL
|
||||
DEPENDS
|
||||
${LIBNOTCURSESSYS}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${COLLOQUY}
|
||||
|
@ -21,6 +21,7 @@ fn main() {
|
||||
// to bindgen, and lets you build up options for
|
||||
// the resulting bindings.
|
||||
let bindings = bindgen::Builder::default()
|
||||
.clang_arg("-I../../include") // FIXME pass via envvar?
|
||||
// The input header we would like to generate
|
||||
// bindings for.
|
||||
.header("wrapper.h")
|
||||
|
@ -1 +1 @@
|
||||
#include <notcurses.h>
|
||||
#include <notcurses/notcurses.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user