Skip to content

Commit

Permalink
Plug-in version is now extracted from back-ends implementation via Ca…
Browse files Browse the repository at this point in the history
…rgo.toml.
  • Loading branch information
hoehermann committed Aug 6, 2024
1 parent 04fb482 commit 1b8c39a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.18) # see submodules/purple-cmake
cmake_minimum_required(VERSION 3.19) # for string(JSON …)
# 3.18 needed for win32 part of submodules/purple-cmake

project("purple-presage")

Expand All @@ -19,7 +20,12 @@ FetchContent_Declare(Corrosion GIT_REPOSITORY https://github.com/corrosion-rs/co
FetchContent_MakeAvailable(Corrosion)
set(Rust_PROFILE "release" CACHE STRING "Rust profile")
set_property(CACHE Rust_PROFILE PROPERTY STRINGS "dev" "release")
corrosion_import_crate(MANIFEST_PATH src/rust/Cargo.toml PROFILE ${Rust_PROFILE})
corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/rust/Cargo.toml PROFILE ${Rust_PROFILE})

# obtain version string from back-end metadata
execute_process(COMMAND ${Rust_CARGO_CACHED} metadata --format-version 1 --no-deps --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/src/rust/Cargo.toml OUTPUT_VARIABLE BACKEND_METADATA)
string(JSON PLUGIN_VERSION GET ${BACKEND_METADATA} packages 0 version)
message(STATUS "PLUGIN_VERSION: ${PLUGIN_VERSION}")

set(TARGET_NAME "presage")
add_library(${TARGET_NAME} SHARED
Expand Down Expand Up @@ -62,7 +68,6 @@ else()
endif()
set_property(TARGET ${TARGET_NAME} PROPERTY COMPILE_WARNING_AS_ERROR ON) # needs cmake 3.24, but is not critical

file(READ "${CMAKE_SOURCE_DIR}/VERSION" PLUGIN_VERSION)
target_compile_definitions(${TARGET_NAME} PRIVATE PLUGIN_VERSION=${PLUGIN_VERSION})
target_include_directories(${TARGET_NAME} PRIVATE ${PURPLE_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} PRIVATE ${PURPLE_LIBRARIES})
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

7 changes: 3 additions & 4 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ name = "purple_presage_backend"
path = "src/lib.rs"
crate-type = ["staticlib"]

# presage needs this, taken from https://github.com/whisperfish/presage/blob/e2392c42a0392397b9db782607fdd7ab2ea91b5f/Cargo.toml
# presage needs this, taken from https://github.com/whisperfish/presage/blob/67d98a3/Cargo.toml
[patch.crates-io]
curve25519-dalek = { git = 'https://github.com/signalapp/curve25519-dalek', tag = 'signal-curve25519-4.1.3' }

[dependencies]
# note: tag = "0.6.1" did not receive any SynchronizeMessage
presage = { git = "https://github.com/whisperfish/presage", rev = "e2392c42a0392397b9db782607fdd7ab2ea91b5f" }
presage-store-sled = { git = "https://github.com/whisperfish/presage", rev = "e2392c42a0392397b9db782607fdd7ab2ea91b5f" }
presage = { git = "https://github.com/whisperfish/presage", rev = "67d98a3" }
presage-store-sled = { git = "https://github.com/whisperfish/presage", rev = "67d98a3" }
mime-sniffer = { git = "https://github.com/kamadorueda/rust-mime-sniffer"}
hex = "*"
chrono = "*"
Expand Down

0 comments on commit 1b8c39a

Please sign in to comment.