Change to out-of source build, Update build instructions (#3271)

* update build instructions

Usage of "modern" CMake syntax and using specific out of source build.
Further add example on how to build in parallel, build a specific target
and how to change the compiler.

This closes #3236.
This commit is contained in:
Felix Schurk 2024-02-25 19:27:52 +02:00 committed by GitHub
parent 34c0e67469
commit 8dd29e0a8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 75 additions and 379 deletions

View file

@ -16,26 +16,46 @@ See the [TaskChampion CONTRIBUTING guide](../../../taskchampion/CONTRIBUTING.md)
* Rust 1.64.0 or higher (hint: use https://rustup.rs/ instead of using your system's package manager)
## Obtain and Build Code:
```
$ git clone --recursive https://github.com/GothenburgBitFactory/taskwarrior taskwarrior.git
$ cd taskwarrior.git
$ git checkout develop # Latest dev branch
$ git submodule init # This is now done by cmake as a test
$ git submodule update # Update the libhsared.git submodule
$ cmake -DCMAKE_BUILD_TYPE=debug . # debug or release. Default: neither
$ make VERBOSE=1 -j4 # Shows details, builds using 4 jobs
# Alternately 'export MAKEFLAGS=-j 4'
```
The following documentation works with CMake 3.14 and later.
Here are the minimal steps to get started, using an out of source build directory and calling the underlying build tool over the CMake interface.
See the general CMake man pages or the [cmake-documentation](https://cmake.org/cmake/help/latest/manual/cmake.1.html) for more,
This will build several executables, but the one you want is probably `src/task`.
## Basic Building
```sh
git clone https://github.com/GothenburgBitFactory/taskwarrior
cd taskwarrior
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
Other possible build types can be `Release` and `Debug`.
This will build several executables, but the one you want is probably `src/task`, located in the `build` directory.
When you make changes, just run the last line again.
## Run the Test Suite:
### Building a specific target
For **only** building the `task` executable, use
```sh
cmake --build build --target task_executable
```
### Building in parallel
If a parallel build is wanted use
```sh
cmake --build build -j <number-of-jobs>
```
### Building with clang as compiler
```sh
cmake -S . -B build-clang\
-DCMAKE_C_COMPILER=clang\
-DCMAKE_CXX_COMPILER=clang++
cmake --build build-clang
```
## Run the Test Suite:
First switch to the test directory:
```
$ cd test
$ cd build/test
```
Then you can run all tests, showing details, with
```