Skip to content

Commit

Permalink
start integrating rust into build #101
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Feb 18, 2020
1 parent 832b906 commit dd2dfb8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(NOTCURSES_SHARE ${CMAKE_INSTALL_PREFIX}/share/notcurses)

###################### USER-SELECTABLE OPTIONS ###########################
option(BUILD_PYTHON "Build Python wrappers" ON)
option(BUILD_RUST "Build Rust wrappers/colloquy" ON)
option(BUILD_RUST "Build Rust wrappers/colloquy (experimental)" OFF)
option(DFSG_BUILD "DFSG build (no non-free media/code)" OFF)
option(DISABLE_FFMPEG "Disable FFmpeg image/video support, not recommended" OFF)
option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
Expand Down Expand Up @@ -575,6 +575,20 @@ if(${BUILD_PYTHON})
)
endif()

# Rust bindings
if(${BUILD_RUST})
file(GLOB RUSTSRC CONFIGURE_DEPENDS src/colloquy/*.rs)
add_custom_target(colloquy ALL
COMMAND CARGO_HOME=${CMAKE_CURRENT_BINARY_DIR}/rust CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}/rust cargo build --offline --verbose
DEPENDS
${COLLOQUYSRC}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/colloquy
)
set_target_properties(colloquy
PROPERTIES LOCATION ${CMAKE_CURRENT_BINARY_DIR}
)
endif()

# Installation
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfig.cmake
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ that fine library.
* (OPTIONAL) (testing) [Doctest](https://github.com/onqtam/doctest) 2.3.6+
* (OPTIONAL) (documentation) [pandoc](https://pandoc.org/index.html) 1.19.2+
* (OPTIONAL) (python bindings): Python 3.7+, CFFI 1.13.2+
* (OPTIONAL) (rust bindings, colloquy): rust 1.40.0+, cargo 0.40.0+
* (OPTIONAL) (rust bindings, colloquy): rust 1.40.0+, cargo 0.40.0+, cmake-rs 0.1.42+

### Building

Expand Down
9 changes: 9 additions & 0 deletions src/colloquy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "colloquy"
version = "0.1.0"
authors = ["nick black <dankamongmen@gmail.com>"]
edition = "2018"
repository = "https://github.com/dankamongmen/notcurses"

[dependencies]
notcurses = ">= 1.2.0"

0 comments on commit dd2dfb8

Please sign in to comment.