Skip to content

Commit ec50aec

Browse files
authored
Merge pull request #982 from simoninns/issue967-202512
Drop Qt5 from ld-decode-tools and enforce out-of-source building via cmake
2 parents 2c5bafd + 5b1b8a4 commit ec50aec

File tree

11 files changed

+1112
-115
lines changed

11 files changed

+1112
-115
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,7 @@ on:
66
release:
77

88
jobs:
9-
qt5:
10-
name: Build with Qt 5
11-
runs-on: ubuntu-22.04
12-
steps:
13-
14-
- uses: actions/checkout@v2
15-
with:
16-
submodules: true
17-
fetch-depth: 0
18-
19-
- uses: actions/checkout@v2
20-
with:
21-
repository: happycube/ld-decode-testdata
22-
path: testdata
23-
24-
- name: Install dependencies
25-
timeout-minutes: 10
26-
run: |
27-
sudo apt-get update
28-
# Based on: https://github.com/happycube/ld-decode/wiki/Installation
29-
# Added: cmake libqt5opengl5-dev libqt5svg5-dev
30-
sudo apt-get install -y --no-install-recommends git cmake make python3-setuptools python3-numpy python3-scipy python3-matplotlib git libqt5opengl5-dev libqt5svg5-dev libqwt-qt5-dev libfftw3-dev python3-numba libavformat-dev libavcodec-dev libavutil-dev ffmpeg libsqlite3-dev libqt5sql5-sqlite
31-
32-
- name: Set up build dir
33-
timeout-minutes: 1
34-
run: mkdir obj
35-
36-
- name: Configure
37-
timeout-minutes: 5
38-
run: cd obj && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_QT_VERSION=5 ..
39-
40-
- name: Build
41-
timeout-minutes: 15
42-
run: make -C obj VERBOSE=1
43-
44-
- name: Install
45-
timeout-minutes: 5
46-
run: make -C obj install DESTDIR=/tmp/staging && ls -lR /tmp/staging
47-
48-
- name: Run tests
49-
timeout-minutes: 10
50-
run: cd obj && ctest --output-on-failure
51-
529
qt6:
53-
# XXX This builds without Qwt as Ubuntu 22.04 doesn't have it for Qt 6
5410
name: Build with Qt 6
5511
runs-on: ubuntu-22.04
5612
steps:
@@ -75,20 +31,20 @@ jobs:
7531
7632
- name: Set up build dir
7733
timeout-minutes: 1
78-
run: mkdir obj
34+
run: mkdir build
7935

8036
- name: Configure
8137
timeout-minutes: 5
82-
run: cd obj && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_QT_VERSION=6 -DUSE_QWT=OFF ..
38+
run: cd build && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
8339

8440
- name: Build
8541
timeout-minutes: 15
86-
run: make -C obj VERBOSE=1
42+
run: make -C build VERBOSE=1
8743

8844
- name: Install
8945
timeout-minutes: 5
90-
run: make -C obj install DESTDIR=/tmp/staging && ls -lR /tmp/staging
46+
run: make -C build install DESTDIR=/tmp/staging && ls -lR /tmp/staging
9147

9248
- name: Run tests
9349
timeout-minutes: 10
94-
run: cd obj && ctest --output-on-failure
50+
run: cd build && ctest --output-on-failure

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,26 @@ __pycache__
5454
testdata
5555
testout
5656

57+
# Temporary files
58+
*.tmp
59+
5760
# Profiling results
5861
Benchfile*
5962
perf.data*
6063

6164
# CMake related things
65+
build/
66+
build-*/
6267
*-qt/
6368
*.depends
6469
*.ninja
6570
*_autogen/
6671
.ninja_*
6772
.qt/
73+
CMakeLists.txt.user
6874
CMakeCache.txt
6975
CMakeFiles/
70-
CMakeLists.txt.user
7176
CTestTestfile.cmake
72-
DartConfiguration.tcl
73-
Makefile
74-
Testing/
75-
build-*/
7677
cmake_install.cmake
7778
compile_commands.json
7879
install_manifest.txt

BUILD.md

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Building ld-decode
2+
3+
This project uses CMake and enforces out-of-source builds. All build artifacts are kept in a separate `build/` directory, keeping the source tree clean.
4+
5+
## Quick Start
6+
7+
```bash
8+
mkdir build
9+
cd build
10+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
11+
make -j8
12+
ctest --output-on-failure
13+
```
14+
15+
## Step-by-Step Instructions
16+
17+
### 1. Create a Build Directory
18+
19+
```bash
20+
mkdir build
21+
cd build
22+
```
23+
24+
Keep the build directory separate from the source tree. This is a CMake best practice.
25+
26+
### 2. Configure the Build
27+
28+
```bash
29+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
30+
```
31+
32+
This configures the build with:
33+
- **RelWithDebInfo**: Release build with debug symbols for better profiling and debugging
34+
- **..**: Points to the source directory (parent directory)
35+
36+
The cmake step will:
37+
- Detect your system's compiler and libraries
38+
- Find Qt6 libraries
39+
- Configure build files for your platform
40+
41+
### 3. Build the Project
42+
43+
```bash
44+
make -j8
45+
```
46+
47+
Builds all targets using 8 parallel jobs. Adjust the number based on your CPU core count.
48+
49+
**Single-threaded build** (if parallel builds cause issues):
50+
```bash
51+
make
52+
```
53+
54+
### 4. Run Tests
55+
56+
```bash
57+
ctest --output-on-failure
58+
```
59+
60+
Runs all tests sequentially. Tests must run sequentially due to shared testout directory.
61+
62+
**Run specific test**:
63+
```bash
64+
ctest -R chroma --output-on-failure
65+
```
66+
67+
### 5. Install (Optional)
68+
69+
```bash
70+
make install DESTDIR=/tmp/staging
71+
```
72+
73+
Installs built binaries and libraries to the staging directory.
74+
75+
## Building Individual Tools
76+
77+
You can build specific tools or libraries without building the entire project:
78+
79+
```bash
80+
# Build a single tool
81+
make ld-analyse
82+
make ld-chroma-decoder
83+
make ld-json-converter
84+
```
85+
86+
**Common tool targets:**
87+
- `ld-analyse` - GUI analysis tool
88+
- `ld-chroma-decoder` - Chroma decoder
89+
- `ld-chroma-encoder` - Chroma encoder
90+
- `ld-json-converter` - JSON to SQLite converter
91+
- `ld-process-vbi` - VBI processor
92+
- `ld-process-vits` - VITS processor
93+
- `ld-cut` - Cut/segment tool
94+
- `ld-ldf-reader` - LDF file reader
95+
- `ld-discmap` - Disc mapper
96+
- `ld-dropout-correct` - Dropout corrector
97+
98+
**Library targets:**
99+
- `lddecode-library` - Core library
100+
- `lddecode-chroma` - Chroma decoder library
101+
102+
**Test targets:**
103+
- `testfilter` - Filter tests
104+
- `testlinenumber` - Line number tests
105+
- `testmetadata` - Metadata tests
106+
- `testvbidecoder` - VBI decoder tests
107+
- `testvitcdecoder` - VITC decoder tests
108+
109+
**View all available targets:**
110+
```bash
111+
make help | grep "^ [a-z]"
112+
```
113+
114+
## Build Options
115+
116+
You can customize the build with additional CMake variables:
117+
118+
```bash
119+
cmake -DCMAKE_BUILD_TYPE=Release ..
120+
```
121+
122+
**Available build types:**
123+
- `Debug` - Debug symbols, no optimization
124+
- `Release` - Optimized, no debug symbols
125+
- `RelWithDebInfo` - Optimized with debug symbols (recommended)
126+
- `MinSizeRel` - Minimized size
127+
128+
### Qt Debug Symbols
129+
130+
To include Qt debug symbols for debugging Qt-related issues:
131+
132+
**Option 1: Debug build (full debug, no optimization)**
133+
```bash
134+
cd build
135+
cmake -DCMAKE_BUILD_TYPE=Debug ..
136+
make -j8
137+
```
138+
139+
**Option 2: Optimized build with Qt debug symbols**
140+
```bash
141+
cd build
142+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQT_DEBUG=ON ..
143+
make -j8
144+
```
145+
146+
**Option 3: Reconfigure existing build**
147+
If you already have a build directory, you can reconfigure:
148+
```bash
149+
cd build
150+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQT_DEBUG=ON ..
151+
make -j8
152+
```
153+
154+
Debug builds will be larger and slower but provide better debugging information for stepping through code and inspecting Qt internals.
155+
156+
## Troubleshooting
157+
158+
### Rebuilding After Source Changes
159+
160+
If you make changes to `CMakeLists.txt`, cmake will automatically reconfigure during the next `make` invocation.
161+
162+
### Clean Build
163+
164+
To perform a clean build:
165+
166+
```bash
167+
rm -rf build
168+
mkdir build
169+
cd build
170+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
171+
make -j8
172+
```
173+
174+
### In-Source Build Error
175+
176+
If you accidentally run cmake in the source directory, you'll see:
177+
178+
```
179+
In-source builds are not allowed. Please create a build directory and run:
180+
mkdir build
181+
cd build
182+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
183+
```
184+
185+
Simply follow those instructions to fix it.
186+
187+
## Dependencies
188+
189+
The project requires:
190+
- CMake 3.16 or later
191+
- Qt6 (Core, Gui, Widgets, Sql)
192+
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2019+)
193+
- FFTW3
194+
- FFmpeg (libavcodec, libavformat, libavutil)
195+
- Python 3.6+
196+
- SQLite3
197+
198+
### Ubuntu/Debian
199+
200+
```bash
201+
sudo apt-get install cmake qt6-base-dev libgl-dev libfftw3-dev libavformat-dev \
202+
libavcodec-dev libavutil-dev ffmpeg libsqlite3-dev libqt6sql6-sqlite
203+
```
204+
205+
### macOS (Homebrew)
206+
207+
```bash
208+
brew install cmake qt6 fftw ffmpeg sqlite3
209+
```
210+
211+
## Build Output
212+
213+
All build artifacts are placed in the `build/` directory:
214+
- `build/` - All CMake files, object files, and executables
215+
- Source tree remains clean
216+
217+
The root directory only contains:
218+
- Source code (`lddecode/`, `tools/`, `scripts/`, etc.)
219+
- Configuration files (`CMakeLists.txt`, `setup.py`, etc.)
220+
- Documentation
221+
222+
## For CI/CD
223+
224+
The GitHub Actions workflow uses:
225+
226+
```yaml
227+
- name: Configure
228+
run: cd build && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
229+
230+
- name: Build
231+
run: make -C build VERBOSE=1
232+
233+
- name: Run tests
234+
run: cd build && ctest --output-on-failure
235+
```
236+
237+
Tests run sequentially (no `-j` flag) to avoid race conditions in the shared testout directory.

0 commit comments

Comments
 (0)