mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
If user specifies build directory, respect this instead of building inside the target/ directory. Also remove outdated comment about Rust 1.50.0 support. Current MSRV is 1.70.0 and we use 2021 edition which implies version 2 resolver.
41 lines
1.4 KiB
CMake
41 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(deltachat LANGUAGES C)
|
|
include(GNUInstallDirs)
|
|
|
|
find_program(CARGO cargo)
|
|
|
|
if(APPLE)
|
|
set(DYNAMIC_EXT "dylib")
|
|
elseif(UNIX)
|
|
set(DYNAMIC_EXT "so")
|
|
else()
|
|
set(DYNAMIC_EXT "dll")
|
|
endif()
|
|
|
|
add_custom_command(
|
|
OUTPUT
|
|
"${CMAKE_BINARY_DIR}/target/release/libdeltachat.a"
|
|
"${CMAKE_BINARY_DIR}/target/release/libdeltachat.${DYNAMIC_EXT}"
|
|
"${CMAKE_BINARY_DIR}/target/release/pkgconfig/deltachat.pc"
|
|
COMMAND
|
|
PREFIX=${CMAKE_INSTALL_PREFIX}
|
|
LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
|
|
INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR}
|
|
${CARGO} build --target-dir=${CMAKE_BINARY_DIR}/target --release --no-default-features --features jsonrpc
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deltachat-ffi
|
|
)
|
|
|
|
add_custom_target(
|
|
lib_deltachat
|
|
ALL
|
|
DEPENDS
|
|
"${CMAKE_BINARY_DIR}/target/release/libdeltachat.a"
|
|
"${CMAKE_BINARY_DIR}/target/release/libdeltachat.${DYNAMIC_EXT}"
|
|
"${CMAKE_BINARY_DIR}/target/release/pkgconfig/deltachat.pc"
|
|
)
|
|
|
|
install(FILES "deltachat-ffi/deltachat.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
install(FILES "${CMAKE_BINARY_DIR}/target/release/libdeltachat.a" DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
install(FILES "${CMAKE_BINARY_DIR}/target/release/libdeltachat.${DYNAMIC_EXT}" DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
install(FILES "${CMAKE_BINARY_DIR}/target/release/pkgconfig/deltachat.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|