1
0
Fork 0
forked from hanez/xtc
This commit is contained in:
Johannes Findeisen 2026-10-26 23:03:17 +01:00
commit 0578b6243c
5 changed files with 118 additions and 10 deletions

View file

@ -1,6 +1,7 @@
CC ?= cc CC ?= cc
CXX ?= c++ CXX ?= c++
PKG_CONFIG ?= pkg-config PKG_CONFIG ?= pkg-config
FLTK_CONFIG ?= fltk-config
BUILD_DIR ?= build BUILD_DIR ?= build
PREFIX ?= /usr/local PREFIX ?= /usr/local
@ -13,10 +14,21 @@ LDFLAGS ?=
CORE_SOURCES := src/core/xtlite.c src/graph/graph.c src/dsp/gain.c src/engine/offline_engine.c CORE_SOURCES := src/core/xtlite.c src/graph/graph.c src/dsp/gain.c src/engine/offline_engine.c
CORE_OBJECTS := $(CORE_SOURCES:%.c=$(BUILD_DIR)/%.o) CORE_OBJECTS := $(CORE_SOURCES:%.c=$(BUILD_DIR)/%.o)
TEST_OBJECT := $(BUILD_DIR)/tests/unit/test_core.o TEST_OBJECT := $(BUILD_DIR)/tests/unit/test_core.o
GUI_AVAILABLE := $(shell $(PKG_CONFIG) --exists fltk 2>/dev/null && echo yes) ifeq ($(shell $(PKG_CONFIG) --exists fltk 2>/dev/null && echo yes),yes)
FLTK_CXXFLAGS := $(shell $(PKG_CONFIG) --cflags fltk)
FLTK_LIBS := $(shell $(PKG_CONFIG) --libs fltk)
GUI_AVAILABLE := yes
else ifeq ($(shell $(FLTK_CONFIG) --version >/dev/null 2>&1 && echo yes),yes)
FLTK_CXXFLAGS := $(shell $(FLTK_CONFIG) --cxxflags)
FLTK_LIBS := $(shell $(FLTK_CONFIG) --ldflags)
GUI_AVAILABLE := yes
endif
.PHONY: all clean test gui install .PHONY: all clean test debug gui install
all: $(BUILD_DIR)/libxtlite.a all: $(BUILD_DIR)/libxtlite.a $(BUILD_DIR)/xtlite-check
$(BUILD_DIR)/xtlite-check: $(BUILD_DIR)/src/main.o $(BUILD_DIR)/libxtlite.a
$(CC) $(LDFLAGS) -o $@ $^ -lm
$(BUILD_DIR)/libxtlite.a: $(CORE_OBJECTS) $(BUILD_DIR)/libxtlite.a: $(CORE_OBJECTS)
@mkdir -p $(@D) @mkdir -p $(@D)
@ -24,30 +36,34 @@ $(BUILD_DIR)/libxtlite.a: $(CORE_OBJECTS)
$(BUILD_DIR)/%.o: %.c $(BUILD_DIR)/%.o: %.c
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -MMD -MP -c $< -o $@
$(BUILD_DIR)/%.o: %.cpp $(BUILD_DIR)/%.o: %.cpp
@mkdir -p $(@D) @mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(shell $(PKG_CONFIG) --cflags fltk 2>/dev/null) -c $< -o $@ $(CXX) $(CXXFLAGS) $(FLTK_CXXFLAGS) -MMD -MP -c $< -o $@
$(TEST_OBJECT): tests/unit/test_core.c $(TEST_OBJECT): tests/unit/test_core.c
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -MMD -MP -c $< -o $@
$(BUILD_DIR)/test_core: $(TEST_OBJECT) $(BUILD_DIR)/libxtlite.a $(BUILD_DIR)/test_core: $(TEST_OBJECT) $(BUILD_DIR)/libxtlite.a
$(CC) $(LDFLAGS) -o $@ $(TEST_OBJECT) $(BUILD_DIR)/libxtlite.a -lm $(CC) $(LDFLAGS) -o $@ $(TEST_OBJECT) $(BUILD_DIR)/libxtlite.a -lm
test: $(BUILD_DIR)/test_core test: $(BUILD_DIR)/test_core $(BUILD_DIR)/xtlite-check
./$(BUILD_DIR)/test_core ./$(BUILD_DIR)/test_core
./$(BUILD_DIR)/xtlite-check
debug:
$(MAKE) BUILD_DIR="$(BUILD_DIR)/debug" CFLAGS="$(CFLAGS) -O0 -g3" CXXFLAGS="$(CXXFLAGS) -O0 -g3" all test
ifeq ($(GUI_AVAILABLE),yes) ifeq ($(GUI_AVAILABLE),yes)
gui: $(BUILD_DIR)/xtlite gui: $(BUILD_DIR)/xtlite
$(BUILD_DIR)/xtlite: $(BUILD_DIR)/src/gui/main.o $(BUILD_DIR)/src/gui/main_window.o $(BUILD_DIR)/libxtlite.a $(BUILD_DIR)/xtlite: $(BUILD_DIR)/src/gui/main.o $(BUILD_DIR)/src/gui/main_window.o $(BUILD_DIR)/libxtlite.a
$(CXX) $(LDFLAGS) -o $@ $^ $(shell $(PKG_CONFIG) --libs fltk) -lm $(CXX) $(LDFLAGS) -o $@ $^ $(FLTK_LIBS) -lm
else else
gui: gui:
@echo "FLTK was not found by pkg-config. Install FLTK development files to build the GUI." @echo "FLTK was not found by pkg-config or fltk-config. GUI requires FLTK development files."
@exit 1 @exit 1
endif endif
@ -58,3 +74,6 @@ install: all
clean: clean:
rm -rf "$(BUILD_DIR)" rm -rf "$(BUILD_DIR)"
-include $(CORE_OBJECTS:.o=.d) $(TEST_OBJECT:.o=.d) $(BUILD_DIR)/src/main.d \
$(BUILD_DIR)/src/gui/main.d $(BUILD_DIR)/src/gui/main_window.d

View file

@ -1,4 +1,4 @@
# xtlite — a lightweight, modular DAW # xtc — a lightweight, modular DAW
`xtlite` is a new, energyXT-inspired digital audio workstation project. It is not a clone and contains no energyXT source code or assets. `xtlite` is a new, energyXT-inspired digital audio workstation project. It is not a clone and contains no energyXT source code or assets.
@ -31,6 +31,10 @@ make
make test make test
``` ```
`make` also builds `build/xtlite-check`, a headless core startup/shutdown
check. Use `make debug` for a separate debug build and test run. See
[docs/BUILD.md](docs/BUILD.md) for the inspected toolchain and baseline limits.
Build the optional FLTK GUI if FLTK is installed: Build the optional FLTK GUI if FLTK is installed:
```sh ```sh

57
docs/BUILD.md Normal file
View file

@ -0,0 +1,57 @@
# Build baseline
Phase 0 retains the existing layout: public C headers in `include/xtlite`,
C implementation modules under `src`, optional C++ GUI under `src/gui`, and
tests under `tests`. `src/main.c` is a minimal headless startup/shutdown check;
it does not initialize audio devices or open a GUI.
## Commands
```sh
make clean all test
./build/xtlite-check
make debug
make gui
```
`all` builds the static C library and startup check. `test` runs the existing
core test and startup check. `debug` builds and tests separately in
`build/debug`. `gui` builds the existing placeholder shell; it does not produce
audio. Generated files remain under `build` and header changes trigger rebuilds.
Compiler, flags, `BUILD_DIR`, `PKG_CONFIG`, `FLTK_CONFIG`, and installation
`PREFIX` can be overridden through Make variables. C uses C99; GUI uses C++17.
## Inspected Linux toolchain (2026-10-26)
| Component | Available version | Role |
| --- | --- | --- |
| GCC / G++ | 16.2.1 | C core and optional C++ GUI |
| GNU Make | 4.4.1 | Build and test driver |
| pkg-config | 3.0.10 | Development package discovery |
| FLTK | 1.4.5 | Optional GUI; discovered through `fltk-config` |
| JACK | 3.1609.0 (pkg-config) | Candidate backend; not linked yet |
| ALSA | 1.2.16.1 (pkg-config) | Future MIDI candidate; not linked yet |
| Clang | 23.1.3 | Alternative compiler / diagnostics |
Valgrind is also available. The core tests use a small in-tree C test harness
and require no external test framework. FLTK has no `fltk.pc` on this host;
the Makefile tries pkg-config first, then `fltk-config`.
## Dependencies and licensing
No new dependencies are introduced. The core needs the C runtime and math
library. The repository is MIT licensed. The optional GUI uses maintained
FLTK 1.4 (LGPL with FLTK's static-linking exception); its platform link flags
come from the installed package. Distribution still requires review of all
linked dependencies and notices. JACK and ALSA remain candidates only; backend
selection and license review belong to Phase 2. No packages or system settings
are changed by these build commands.
## Next milestone
Phase 1 must replace insertion-order gain processing with a validated,
topologically scheduled offline plan, preallocated buffers, oscillator, gain,
meter and output nodes, and deterministic routing tests. The current gain
prototype is not a real-time engine. Public project persistence declarations
also remain unimplemented. Hardware playback and interactive GUI behavior are
outside this baseline.

View file

@ -4,6 +4,10 @@
Inspect repository/toolchain, verify Makefile and minimal executable, document Inspect repository/toolchain, verify Makefile and minimal executable, document
dependencies. No system changes without permission. dependencies. No system changes without permission.
Baseline implementation: headless startup/shutdown executable, core tests,
separate debug build, optional FLTK shell build, and header dependencies.
See [BUILD.md](BUILD.md) for toolchain, commands, licensing and limitations.
## Phase 1 — C core and offline processing ## Phase 1 — C core and offline processing
Graph data structures, validation, cycle detection, topological ordering, Graph data structures, validation, cycle detection, topological ordering,
preallocated buffers, test oscillator, gain and offline render tests. preallocated buffers, test oscillator, gain and offline render tests.

24
src/main.c Normal file
View file

@ -0,0 +1,24 @@
#include "xtlite/xtlite.h"
#include "xtlite/xtlite_version.h"
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
xt_app *app = NULL;
xt_result result = xt_app_create(&app);
if (result != XT_OK) {
(void)fprintf(stderr, "Application initialization failed: %s\n",
xt_result_string(result));
return EXIT_FAILURE;
}
xt_app_destroy(app);
if (printf("%s %s: core startup/shutdown OK\n",
XTLITE_PROJECT_NAME, XTLITE_VERSION_STRING) < 0) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}