Skip to content

Commit

Permalink
docs: Update README with build instructions
Browse files Browse the repository at this point in the history
As part of this, let's also move the mfc-utils and photonwidgets
submodules into another directory, so that we can check out the
public dependencies more easily.
  • Loading branch information
LeonMatthesKDAB committed Jun 17, 2024
1 parent 1aeccd5 commit d6aeec3
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 26 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/knut-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,7 @@ jobs:
# So we need to conditionally check for the secret key.
- name: Checkout submodules
run: |
git submodule update --init --force --depth=1 --recursive -- '3rdparty/extra-cmake-modules'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/kdalgorithms'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/ksyntaxhighlighting'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/nlohmann-json'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/pugixml'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/spdlog'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/tree-sitter'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/tree-sitter-cpp'
git submodule update --init --force --depth=1 --recursive -- 3rdparty/*
- name: Configure SSH for connection to codereview.kdab.com (main repo only)
uses: shimataro/ssh-key-action@v2
Expand All @@ -94,8 +87,7 @@ jobs:
# So only run this step if that's the case.
if: ${{ github.repository == 'KDAB/knut' && github.event_name == 'push' }}
run: |
git submodule update --init --force --depth=1 --recursive -- '3rdparty/photonwidgets'
git submodule update --init --force --depth=1 --recursive -- '3rdparty/mfc-utils'
git submodule update --init --force --depth=1 --recursive -- 3rdparty-kdab/*
- name: Install ninja-build tool
uses: aseprite/get-ninja@main
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
path = 3rdparty/tree-sitter-cpp
url = https://github.com/tree-sitter/tree-sitter-cpp
[submodule "3rdparty/mfc-utils"]
path = 3rdparty/mfc-utils
path = 3rdparty-kdab/mfc-utils
url = ssh://codereview.kdab.com:29418/kdab/mfc-utils
[submodule "3rdparty/photonwidgets"]
path = 3rdparty/photonwidgets
path = 3rdparty-kdab/photonwidgets
url = ssh://codereview.kdab.com:29418/photonwidgets
9 changes: 9 additions & 0 deletions 3rdparty-kdab/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# mfc-utils
# ##############################################################################
# We don't compile it, we just need it here for the tests
check_optional_submodule(mfc-utils mfc-utils)

# photonwidgets
# ##############################################################################
# We don't compile it, we just need it here for the tests
check_optional_submodule(photonwidgets photonwidgets)
Submodule mfc-utils updated from 000000 to b877c0
Submodule photonwidgets updated from 000000 to 4da55f
10 changes: 0 additions & 10 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,3 @@ target_link_libraries(${PROJECT_NAME} PRIVATE TreeSitter)
# Always build tree-sitter with optimizations enabled. We shouldn't have to
# debug it and it's performance critical.
target_compile_options(${PROJECT_NAME} PRIVATE -O3)

# mfc-utils
# ##############################################################################
# We don't compile it, we just need it here for the tests
check_optional_submodule(mfc-utils mfc-utils)

# photonwidgets
# ##############################################################################
# We don't compile it, we just need it here for the tests
check_optional_submodule(photonwidgets photonwidgets)
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ find_package(
# 3rdparty
# ##############################################################################
add_subdirectory(3rdparty)
add_subdirectory(3rdparty-kdab)

# test_data
# ##############################################################################
Expand Down Expand Up @@ -151,12 +152,12 @@ add_subdirectory(tests)

# mfc-utils and photonwidgets are private to KDAB, so make them optional so that
# non-KDABians can still develop Knut.
if(EXISTS 3rdparty/mfc-utils/tests-scripts)
add_subdirectory(3rdparty/mfc-utils/tests-scripts)
if(EXISTS 3rdparty-kdab/mfc-utils/tests-scripts)
add_subdirectory(3rdparty-kdab/mfc-utils/tests-scripts)
endif()

if(EXISTS 3rdparty/photonwidgets/tests/scripts)
add_subdirectory(3rdparty/photonwidgets/tests/scripts)
if(EXISTS 3rdparty-kdab/photonwidgets/tests/scripts)
add_subdirectory(3rdparty-kdab/photonwidgets/tests/scripts)
endif()

file(
Expand Down
16 changes: 16 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@
}
],
"buildPresets": [
{
"name": "debug",
"configurePreset": "debug"
},
{
"name": "debug-asan",
"configurePreset": "debug-asan"
},
{
"name": "profile",
"configurePreset": "profile"
},
{
"name": "release",
"configurePreset": "release"
},
{
"name": "ci",
"configurePreset": "ci"
Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,52 @@ Contact KDAB at <[email protected]> to inquire about licensing options.

Knut includes different 3rd party software, you can find the list and licenses for them in the [3RDPARTY](3RDPARTY.md) document.

# Building

To build Knut, you will need an up-to-date C++ & Qt toolchain.
This includes:
- A recent C++ compiler (GCC 11+, Clang 15+, MSVC 19.40+)
- [CMake](https://cmake.org) 3.15+
- An installation of [Qt 6](https://www.qt.io/download-open-source)
- (optional: [Ninja build system](https://ninja-build.org/))

## Download Knut

To clone the code, simply run:
```bash
git clone https://github.com/KDAB/knut.git && cd knut
```

If you are a member of KDAB and have access to our private repositories, you may then simply run:
```bash
git submodule update --init --recursive
```
To download all dependencies.

If you are a contributor outside KDAB, you will need to download all submodules in the `3rdparty/` folder, without the private dependencies in the `3rdparty-kdab/` folder.
```bash
git submodule update --init --recursive -- 3rdparty/*
```

## Running CMake

After that you can build Knut with CMake via one of the presets.
E.g.:
```bash
cmake --preset=release
cmake --build --preset=release
```
Take a look at `CMakePreset.json` for a list of available presets.

## Running Knut

After building with CMake, run the knut binary from the bin folder within your build directory.

e.g.:
```bash
./build-release/bin/knut
```

# About KDAB

Knut is written and maintained by Klarälvdalens Datakonsult AB (KDAB).
Expand Down

0 comments on commit d6aeec3

Please sign in to comment.