aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-02-23 23:06:50 +0300
committerlink2xt <link2xt@testrun.org>2021-02-24 00:34:33 +0300
commita320ff2ae7cd38045113218d83fbdfd19c0a64b1 (patch)
treed46b72090c3a40b257e1239b0abe05257eb091a6
parent93abc90557131ed1679a78f91be92cbfcc38f91f (diff)
downloadkdeltachat-a320ff2ae7cd38045113218d83fbdfd19c0a64b1.tar.gz
kdeltachat-a320ff2ae7cd38045113218d83fbdfd19c0a64b1.zip
Do not build libdeltachat as ExternalProject
deltachat-core-rust has CMakeLists.txt now and can be used as a module within `kdesrc-build`. The recommended way for building KDeltaChat is using `kdesrc-build` now, README is updated accordingly.
-rw-r--r--CMakeLists.txt20
-rw-r--r--README.md92
2 files changed, 57 insertions, 55 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e380217..7585475 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,19 +13,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Widgets Quick REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets Quick REQUIRED)
-
-include(ExternalProject)
-ExternalProject_Add(
- deltachat-core-rust
- SOURCE_DIR "${CMAKE_SOURCE_DIR}/../deltachat-core-rust"
- BUILD_IN_SOURCE 1
- BUILD_COMMAND env PREFIX=<INSTALL_DIR> cargo build -p deltachat_ffi -j 1
- BUILD_ALWAYS 1
- BUILD_BYPRODUCTS <SOURCE_DIR>/target/debug/libdeltachat.a
- CONFIGURE_COMMAND ""
- INSTALL_COMMAND cp <SOURCE_DIR>/target/debug/libdeltachat.a <INSTALL_DIR>/libdeltachat.a
- COMMAND cp <SOURCE_DIR>/deltachat-ffi/deltachat.h <INSTALL_DIR>/deltachat.h
-)
+find_package(PkgConfig REQUIRED)
add_executable(kdeltachat
main.cpp
@@ -41,9 +29,9 @@ add_executable(kdeltachat
qml.qrc
)
-add_dependencies(kdeltachat deltachat-core-rust)
find_package(Threads REQUIRED)
find_package(KF5Kirigami2)
+pkg_check_modules(DeltaChat IMPORTED_TARGET deltachat)
target_compile_definitions(kdeltachat
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
@@ -51,7 +39,5 @@ target_link_libraries(kdeltachat
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Widgets
PRIVATE Threads::Threads
PRIVATE KF5::Kirigami2
- PRIVATE "${CMAKE_BINARY_DIR}/deltachat-core-rust-prefix/libdeltachat.a"
+ PRIVATE PkgConfig::DeltaChat
m dl)
-target_include_directories(kdeltachat
- PRIVATE "${CMAKE_BINARY_DIR}/deltachat-core-rust-prefix/")
diff --git a/README.md b/README.md
index 1775ace..1b08f03 100644
--- a/README.md
+++ b/README.md
@@ -4,30 +4,70 @@ KDeltaChat is a [Delta Chat](https://delta.chat/) client using [Kirigami](https:
# Dependencies
-KDeltaChat build depends on Rust for core building, Kirigami framework and several QML modules.
+KDeltaChat build depends on
+[libdeltachat](https://github.com/deltachat/deltachat-core-rust/),
+Kirigami framework and several QML modules.
+
+## kdesrc-build
+
+It's recommended to build KDeltaChat with [kdesrc-build](https://kdesrc-build.kde.org/).
+This allows to avoid installing `libdeltachat` system-wide and use
+upstream Kirigami instead of usually outdated packaged versions.
+
+Install it with:
+```
+mkdir -p ~/kde/src
+cd ~/kde/src
+git clone https://invent.kde.org/sdk/kdesrc-build.git
+cd kdesrc-build
+./kdesrc-build-setup
+./kdesrc-build kirigami
+```
+
+Run
+```
+source ~/.config/kde-env-master.sh
+```
+in your shell to enter `kdesrc-build` environment.
## Rust
-Install Rust from https://rustup.rs/ with
+Building `libdeltachat` requires Rust.
+Install it from https://rustup.rs/ with
+```
+$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
+```
+
+## libdeltachat
+
+If you are using [`kdesrc-build`](https://kdesrc-build.kde.org/),
+add module into `~/.kdesrc-buildrc` as follows
```
-curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
+module deltachat
+ repository https://github.com/deltachat/deltachat-core-rust.git
+end module
```
+Then build `libdeltachat` with `kdesrc-build deltachat`.
-Clone [`deltachat-core-rust` repository](https://github.com/deltachat/deltachat-core-rust/) alongside
-`kdeltachat` repository, for example into `~/src/deltachat-core-rust/` if `kdeltachat` is checked out at `~/src/kdeltachat`:
+Alternatively, if you are not using `kdesrc-build`, install `libdeltachat` system-wide:
```
-git clone https://github.com/deltachat/deltachat-core-rust.git
+$ git clone https://github.com/deltachat/deltachat-core-rust.git
+$ cd deltachat-core-rust
+$ mkdir build
+$ cd build
+$ cmake ..
+$ make
+$ sudo make install
```
-## Kirigami and Qt
+## Qt
-Install Kirigami and required QML modules from your distribution repositories.
+Install QtQuick and required QML modules using your system package manager.
### Debian
Build time dependencies:
- `qtdeclarative5-dev` (for `/usr/lib/x86_64-linux-gnu/cmake/Qt5Quick/Qt5QuickConfig.cmake`)
-- `kirigami2-dev`
Runtime dependencies:
- `qml-module-qtquick-controls`
@@ -39,9 +79,6 @@ Runtime dependencies:
Install FileDialog:
- `pacman -S qt5-quickcontrols`
-Install kirigami2:
-- `pacman -S kirigami2`
-
### OpenSUSE
OpenSUSE Leap 15.2:
@@ -52,33 +89,15 @@ zypper install -y libopenssl-devel perl-FindBin-Real
# Install KDeltaChat dependencies
zypper install -y cmake gcc-c++
-zypper install -y libqt5-qtbase-devel libQt5QuickControls2-devel kirigami2-devel libqt5-quickcontrols
+zypper install -y libqt5-qtbase-devel libQt5QuickControls2-devel libqt5-quickcontrols
```
-### Building with upstream Kirigami
-
-If you want to use upstream Kirigami, for example to avoid bugs fixed
-upstream but not in the packaged version, you can use
-[kdesrc-build](https://kdesrc-build.kde.org/).
-
-Install it with:
-```
-mkdir -p ~/kde/src
-cd ~/kde/src
-git clone https://invent.kde.org/sdk/kdesrc-build.git
-cd kdesrc-build
-./kdesrc-build-setup
-./kdesrc-build kirigami
-```
+## Kirigami
-Then, run
-```
-source ~/.config/kde-env-master.sh
-```
-in your shell and rebuild the app, starting with a complete removal of
-the `build` directory.
+Build Kirigami with `kdesrc-build kirigami`.
-The source of Kirigami will be available in `~/kde/src/kirigami` then.
+Alternatively, if you are not using `kdesrc-build`, install system package for Kirigami,
+such as `kirigami2-dev` on Debian or Ubuntu, `kirigami2` on Arch Linux or `kirigami2-devel` on OpenSUSE.
# Building
@@ -90,9 +109,6 @@ cmake ..
make
```
-This will build `deltachat-core-rust` and install core library into
-build directory automatically.
-
# Running
Run `./kdeltachat`. Import existing account from backup or setup a