Migrated from Make to CMake.

This commit is contained in:
Johannes Findeisen 2026-11-06 19:05:14 +01:00
commit b6ba093000
52 changed files with 1276 additions and 1210 deletions

57
cmake/Developer.cmake Normal file
View file

@ -0,0 +1,57 @@
get_target_property(xtc_sources xtc-core SOURCES)
add_custom_target(analyze COMMAND ${Python3_EXECUTABLE} tools/analyze.py ${xtc_sources}
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
if(BUILD_TESTING)
xtc_executable(benchmark_graph tests/integration/benchmark_graph.c)
set(XTC_BENCHMARK_BLOCKS 300 CACHE STRING "Benchmark iterations")
set(XTC_BENCHMARK_MAX_REGRESSION 1.5 CACHE STRING "Benchmark regression limit")
set(XTC_STRESS_ROUNDS 3 CACHE STRING "Stress iterations")
set(XTC_BENCHMARK_BASELINE "${PROJECT_SOURCE_DIR}/docs/performance-baseline.json" CACHE FILEPATH "Graph benchmark baseline")
set(XTC_PROJECT_BENCHMARK_BASELINE "${PROJECT_SOURCE_DIR}/docs/project-performance-baseline.json" CACHE FILEPATH "Project benchmark baseline")
foreach(workload graph project)
if(workload STREQUAL graph)
set(binary benchmark_graph)
set(stem benchmark)
set(baseline "${XTC_BENCHMARK_BASELINE}")
set(report performance.json)
else()
set(binary test_performance)
set(stem benchmark-project)
set(baseline "${XTC_PROJECT_BENCHMARK_BASELINE}")
set(report project-performance.json)
endif()
foreach(compare "" "-compare")
set(extra)
if(compare)
set(extra --baseline "${baseline}" --max-regression ${XTC_BENCHMARK_MAX_REGRESSION})
endif()
add_custom_target(${stem}${compare}
COMMAND ${Python3_EXECUTABLE} tools/benchmark.py --workload ${workload}
--binary $<TARGET_FILE:${binary}> --output "${CMAKE_CURRENT_BINARY_DIR}/${report}"
--compiler "${CMAKE_C_COMPILER}" --flags "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}"
--blocks ${XTC_BENCHMARK_BLOCKS} ${extra}
DEPENDS ${binary} WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
endforeach()
endforeach()
set(stress_deps test_realtime test_reliability test_scale test_portability test_project_diagnostics test_soak)
if(TARGET test_backend)
list(APPEND stress_deps test_backend)
endif()
set(gui_arg)
if(TARGET test_gui)
set(gui_arg --gui)
list(APPEND stress_deps test_gui)
endif()
add_custom_target(test-stress COMMAND ${Python3_EXECUTABLE} tools/stress.py
--build-dir "${CMAKE_CURRENT_BINARY_DIR}" --rounds ${XTC_STRESS_ROUNDS} ${gui_arg}
DEPENDS ${stress_deps} WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
if(XTC_LADSPA_AVAILABLE)
add_custom_target(test-stress-plugins COMMAND ${Python3_EXECUTABLE} tools/stress.py
--build-dir "${CMAKE_CURRENT_BINARY_DIR}" --rounds ${XTC_STRESS_ROUNDS} --plugin $<TARGET_FILE:plugin-fixture>
DEPENDS ${stress_deps} test_plugins plugin-fixture WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
endif()
add_custom_target(test-plugins-real
COMMAND test_plugins /usr/lib/ladspa/amp.so
COMMAND test_plugins /usr/lib/ladspa/inv_1429.so
COMMAND test_plugins /usr/lib/ladspa/sine.so 3 DEPENDS test_plugins VERBATIM)
endif()

87
cmake/Gui.cmake Normal file
View file

@ -0,0 +1,87 @@
if(NOT XTC_BUILD_GUI)
return()
endif()
if(PkgConfig_FOUND)
pkg_check_modules(FLTK QUIET IMPORTED_TARGET fltk)
endif()
if(FLTK_FOUND)
set(xtc_fltk PkgConfig::FLTK)
else()
find_program(XTC_FLTK_CONFIG fltk-config)
if(NOT XTC_FLTK_CONFIG)
message(STATUS "FLTK unavailable: building core and offline tests only")
return()
endif()
execute_process(COMMAND ${XTC_FLTK_CONFIG} --cxxflags OUTPUT_VARIABLE fltk_flags OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND ${XTC_FLTK_CONFIG} --ldflags OUTPUT_VARIABLE fltk_libs OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
separate_arguments(fltk_flags UNIX_COMMAND "${fltk_flags}")
separate_arguments(fltk_libs UNIX_COMMAND "${fltk_libs}")
# Distribution flags must not override this project's debug/release settings.
list(FILTER fltk_flags INCLUDE REGEX "^(-I|-D|-pthread)")
add_library(xtc-fltk INTERFACE)
target_compile_options(xtc-fltk INTERFACE ${fltk_flags})
target_link_libraries(xtc-fltk INTERFACE ${fltk_libs})
set(xtc_fltk xtc-fltk)
endif()
enable_language(CXX)
set(XTC_GUI_AVAILABLE TRUE)
add_library(xtc-gui STATIC src/gui/main_window.cpp src/gui/graph_widget.cpp
src/gui/sequencer_widget.cpp src/gui/piano_roll.cpp src/gui/mixer_widget.cpp
src/gui/plugin_dialog.cpp src/gui/sample_editor.cpp)
xtc_warnings(xtc-gui)
target_link_libraries(xtc-gui PUBLIC xtc-core ${xtc_fltk})
add_executable(xtc src/gui/main.cpp)
xtc_warnings(xtc)
target_link_libraries(xtc PRIVATE xtc-gui)
add_custom_target(gui DEPENDS xtc)
find_program(XTC_XVFB_RUN xvfb-run)
add_executable(capture_screenshots EXCLUDE_FROM_ALL tools/capture_screenshots.cpp)
xtc_warnings(capture_screenshots)
target_link_libraries(capture_screenshots PRIVATE xtc-gui)
if(XTC_XVFB_RUN AND BUILD_TESTING)
if(XTC_LADSPA_AVAILABLE)
add_custom_target(screenshots COMMAND ${XTC_XVFB_RUN} -a -s "-screen 0 1440x960x24"
$<TARGET_FILE:capture_screenshots> "${PROJECT_SOURCE_DIR}/screenshots"
DEPENDS capture_screenshots plugin-fixture clap-synth-fixture vst2-synth-fixture vst3-synth-fixture
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
endif()
add_executable(test_gui tests/integration/test_gui.cpp)
xtc_warnings(test_gui)
target_link_libraries(test_gui PRIVATE xtc-gui)
xtc_wrap(test_gui xtc_history_reserve)
function(xtc_gui_test name)
add_test(NAME ${name} COMMAND ${XTC_XVFB_RUN} -a -s "-screen 0 1440x960x24" $<TARGET_FILE:test_gui>)
set_tests_properties(${name} PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" LABELS gui ENVIRONMENT "${ARGN}")
endfunction()
xtc_gui_test(gui)
if(XTC_LADSPA_AVAILABLE)
xtc_gui_test(gui-plugins "XTC_TEST_PLUGIN=$<TARGET_FILE:plugin-fixture>")
endif()
xtc_gui_test(gui-modern-plugins "XTC_TEST_CLAP=$<TARGET_FILE:clap-fixture>" "XTC_TEST_VST2=$<TARGET_FILE:vst2-fixture>" "XTC_TEST_VST3=$<TARGET_FILE:vst3-fixture>")
xtc_gui_test(gui-instruments "XTC_TEST_SYNTH_CLAP=$<TARGET_FILE:clap-synth-fixture>" "XTC_TEST_SYNTH_VST2=$<TARGET_FILE:vst2-synth-fixture>" "XTC_TEST_SYNTH_VST3=$<TARGET_FILE:vst3-synth-fixture>")
foreach(pair "modern-editing|MODERN_EDITING" "next-daw|NEXT_DAW" "sample|SAMPLE_EDITOR" "creative|CREATIVE" "midi-workflows|MIDI_WORKFLOWS" "midi-labels|MIDI_LABELS")
string(REPLACE "|" ";" pair "${pair}")
list(GET pair 0 name)
list(GET pair 1 env)
xtc_gui_test(gui-${name} "XTC_TEST_${env}_ONLY=1")
endforeach()
set_property(TEST gui-next-daw APPEND PROPERTY ENVIRONMENT XTC_TEST_MODERN_EDITING_ONLY=1)
if(XTC_LADSPA_AVAILABLE)
xtc_gui_test(gui-track-fx "XTC_TEST_TRACK_FX_ONLY=1" "XTC_TEST_PLUGIN=$<TARGET_FILE:plugin-fixture>" "XTC_TEST_CLAP=$<TARGET_FILE:clap-fixture>" "XTC_TEST_VST2=$<TARGET_FILE:vst2-fixture>" "XTC_TEST_VST3=$<TARGET_FILE:vst3-fixture>")
endif()
add_test(NAME configuration-startup COMMAND ${XTC_XVFB_RUN} -a -s "-screen 0 1440x960x24" ${Python3_EXECUTABLE}
"${PROJECT_SOURCE_DIR}/tests/integration/test_configuration_startup.py" $<TARGET_FILE:xtc>)
set_tests_properties(configuration-startup PROPERTIES LABELS gui)
if(JACK_FOUND AND XTC_WITH_JACK)
foreach(kind gui_jack workflow)
add_executable(test_${kind} tests/integration/test_${kind}.cpp)
xtc_warnings(test_${kind})
target_link_libraries(test_${kind} PRIVATE xtc-gui)
if(XTC_ENABLE_LIVE_TESTS)
string(REPLACE "_" "-" name "${kind}")
add_test(NAME ${name} COMMAND ${XTC_XVFB_RUN} -a $<TARGET_FILE:test_${kind}>)
set_tests_properties(${name} PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" LABELS live RUN_SERIAL TRUE)
endif()
endforeach()
endif()
endif()

46
cmake/Install.cmake Normal file
View file

@ -0,0 +1,46 @@
# Retain the audited owned-file inventory and symlink-safe staging implementation.
set(XTC_INSTALL_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "Directory containing built install inputs")
option(XTC_INSTALL_GUI "Include the GUI in installation" ${XTC_GUI_AVAILABLE})
set(XTC_INSTALL_LICENSEDIR "${CMAKE_INSTALL_DATAROOTDIR}/licenses/xtc" CACHE STRING "License install directory")
set(XTC_INSTALL_EXAMPLESDIR "${CMAKE_INSTALL_DATAROOTDIR}/xtc/examples" CACHE STRING "Example install directory")
set(XTC_INSTALL_DESKTOPDIR "${CMAKE_INSTALL_DATAROOTDIR}/applications" CACHE STRING "Desktop entry directory")
set(XTC_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" CACHE STRING "pkg-config directory")
configure_file(cmake/InstallDriver.cmake.in xtc-install.cmake @ONLY)
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/xtc-install.cmake")
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -DXTC_UNINSTALL=ON -P "${CMAKE_CURRENT_BINARY_DIR}/xtc-install.cmake" VERBATIM)
add_custom_target(dist COMMAND ${Python3_EXECUTABLE} tools/dist.py --output "${CMAKE_CURRENT_BINARY_DIR}/xtc-${PROJECT_VERSION}.tar.gz"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
set(gui_arg)
if(XTC_GUI_AVAILABLE)
set(gui_arg --gui)
endif()
if(BUILD_TESTING)
foreach(layout "" "-layout")
set(extra)
if(layout)
set(extra --custom-layout)
endif()
add_custom_target(test-install${layout} COMMAND ${Python3_EXECUTABLE} tests/integration/test_install.py
--build-dir "${CMAKE_CURRENT_BINARY_DIR}" ${gui_arg} ${extra}
DEPENDS xtc-core xtc-check
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
if(XTC_GUI_AVAILABLE)
add_dependencies(test-install${layout} xtc)
endif()
endforeach()
add_custom_target(test-release COMMAND ${Python3_EXECUTABLE} tests/integration/test_release.py
"${CMAKE_CURRENT_BINARY_DIR}/xtc-${PROJECT_VERSION}.tar.gz" --generator "${CMAKE_GENERATOR}" ${gui_arg}
DEPENDS dist WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
endif()
set(package_file "${CMAKE_CURRENT_BINARY_DIR}/xtc-${PROJECT_VERSION}-linux-${CMAKE_SYSTEM_PROCESSOR}.tar.gz")
add_custom_target(package-binary COMMAND ${Python3_EXECUTABLE} tools/package.py
--build-dir "${CMAKE_CURRENT_BINARY_DIR}" --output "${package_file}" ${gui_arg}
DEPENDS xtc-core xtc-check WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
if(XTC_GUI_AVAILABLE)
add_dependencies(package-binary xtc)
endif()
add_custom_target(test-package COMMAND ${Python3_EXECUTABLE} tests/integration/test_package.py
"${package_file}" --build-dir "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS package-binary WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
add_custom_target(package DEPENDS package-binary)

View file

@ -0,0 +1,41 @@
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
endif()
set(layout --prefix "${CMAKE_INSTALL_PREFIX}" --destdir "$ENV{DESTDIR}")
set(keys bindir libdir includedir docdir licensedir examplesdir desktopdir pkgconfigdir)
set(dirs "@CMAKE_INSTALL_BINDIR@" "@CMAKE_INSTALL_LIBDIR@" "@CMAKE_INSTALL_INCLUDEDIR@" "@CMAKE_INSTALL_DOCDIR@"
"@XTC_INSTALL_LICENSEDIR@" "@XTC_INSTALL_EXAMPLESDIR@" "@XTC_INSTALL_DESKTOPDIR@" "@XTC_INSTALL_PKGCONFIGDIR@")
foreach(index RANGE 0 7)
list(GET keys ${index} key)
list(GET dirs ${index} dir)
if(NOT IS_ABSOLUTE "${dir}")
set(dir "${CMAKE_INSTALL_PREFIX}/${dir}")
endif()
list(APPEND layout --${key} "${dir}")
endforeach()
if(XTC_UNINSTALL)
set(operation uninstall)
set(extra)
else()
set(operation install)
set(extra --build-dir "@XTC_INSTALL_BUILD_DIR@")
if("@XTC_INSTALL_GUI@")
list(APPEND extra --gui)
endif()
set(jack)
if("@JACK_FOUND@" AND "@XTC_WITH_JACK@")
set(jack jack)
endif()
list(GET dirs 1 libdir)
list(GET dirs 2 includedir)
foreach(key libdir includedir)
if(NOT IS_ABSOLUTE "${${key}}")
set(${key} "${CMAKE_INSTALL_PREFIX}/${${key}}")
endif()
endforeach()
execute_process(COMMAND "@Python3_EXECUTABLE@" tools/pkgconfig.py --prefix "${CMAKE_INSTALL_PREFIX}"
--libdir "${libdir}" --includedir "${includedir}" --jack "${jack}" --output "@XTC_INSTALL_BUILD_DIR@/xtc.pc"
WORKING_DIRECTORY "@PROJECT_SOURCE_DIR@" COMMAND_ERROR_IS_FATAL ANY)
endif()
execute_process(COMMAND "@Python3_EXECUTABLE@" "tools/${operation}.py" ${layout} ${extra}
WORKING_DIRECTORY "@PROJECT_SOURCE_DIR@" COMMAND_ERROR_IS_FATAL ANY)

144
cmake/Tests.cmake Normal file
View file

@ -0,0 +1,144 @@
# Every test runs from the source root: fixtures/project paths are source-relative.
function(xtc_test name binary)
add_test(NAME ${name} COMMAND ${binary} ${ARGN})
set_tests_properties(${name} PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
endfunction()
function(xtc_wrap target)
foreach(symbol IN LISTS ARGN)
target_link_options(${target} PRIVATE "LINKER:--wrap=${symbol}")
endforeach()
endfunction()
if(NOT BUILD_TESTING)
return()
endif()
xtc_executable(test_offline tests/unit/test_offline.c)
xtc_test(offline test_offline)
xtc_executable(test_realtime tests/unit/test_realtime.c)
xtc_test(realtime test_realtime)
xtc_executable(test_graph_edits tests/unit/test_graph_edits.c)
xtc_test(graph-edits test_graph_edits)
xtc_executable(test_project tests/unit/test_project.c)
xtc_test(project test_project)
xtc_executable(test_audio tests/unit/test_audio.c)
xtc_test(audio test_audio)
xtc_executable(test_midi tests/unit/test_midi.c)
xtc_test(midi test_midi)
xtc_executable(test_mixer tests/unit/test_mixer.c)
xtc_test(mixer test_mixer)
xtc_executable(test_native tests/unit/test_native.c)
xtc_test(native test_native)
xtc_executable(test_performance tests/integration/test_performance.c)
xtc_test(performance test_performance)
xtc_executable(test_recovery tests/integration/test_recovery.c)
xtc_test(recovery test_recovery)
xtc_executable(test_reliability tests/integration/test_reliability.c)
xtc_wrap(test_reliability malloc calloc realloc free fopen fread fwrite read write pthread_mutex_lock pthread_cond_wait)
xtc_test(reliability test_reliability)
xtc_executable(test_quality tests/unit/test_quality.c)
xtc_test(quality test_quality)
xtc_executable(test_recording tests/integration/test_recording.c)
xtc_test(recording test_recording)
xtc_executable(test_processor tests/unit/test_processor.c examples/processors.c)
xtc_test(processor test_processor)
xtc_executable(test_plugins tests/integration/test_plugins.c)
xtc_wrap(test_plugins malloc calloc realloc free dlopen dlclose)
xtc_executable(test_control tests/unit/test_control.c)
xtc_test(control test_control)
xtc_executable(test_editing tests/unit/test_editing.c)
xtc_test(editing test_editing)
xtc_executable(test_portability tests/integration/test_portability.c)
xtc_test(portability test_portability)
xtc_executable(test_scale tests/integration/test_scale.c)
xtc_test(scale test_scale)
xtc_executable(test_composition tests/unit/test_composition.c)
xtc_test(composition test_composition)
xtc_executable(test_audio_editing tests/unit/test_audio_editing.c)
xtc_test(audio-editing test_audio_editing)
xtc_executable(test_routing tests/unit/test_routing.c)
xtc_test(routing test_routing)
xtc_executable(test_buses tests/unit/test_buses.c)
xtc_test(buses test_buses)
xtc_executable(test_parameters tests/unit/test_parameters.c)
xtc_test(parameters test_parameters)
xtc_executable(test_project_diagnostics tests/unit/test_project_diagnostics.c)
xtc_wrap(test_project_diagnostics fflush fclose fsync rename)
xtc_test(project-diagnostics test_project_diagnostics)
xtc_executable(test_soak tests/integration/test_soak.c)
xtc_test(soak test_soak)
xtc_executable(test_modern_plugins tests/integration/test_modern_plugins.c)
xtc_wrap(test_modern_plugins malloc calloc realloc free dlopen dlclose)
xtc_executable(test_instruments tests/integration/test_instruments.c)
xtc_wrap(test_instruments malloc calloc realloc free dlopen dlclose)
xtc_executable(test_settings tests/unit/test_settings.c)
xtc_test(settings test_settings)
xtc_executable(test_builtin tests/unit/test_builtin.c)
xtc_test(builtin test_builtin)
xtc_executable(test_modern_editing tests/unit/test_modern_editing.c)
xtc_test(modern-editing test_modern_editing)
xtc_executable(test_next_daw tests/unit/test_next_daw.c)
xtc_test(next-daw test_next_daw)
xtc_executable(test_sample tests/unit/test_sample.c)
xtc_test(sample test_sample)
xtc_executable(test_track_fx tests/unit/test_track_fx.c)
xtc_test(track-fx test_track_fx)
xtc_executable(test_creative tests/unit/test_creative.c)
xtc_test(creative test_creative)
xtc_executable(test_midi_file tests/unit/test_midi_file.c)
xtc_test(midi-file test_midi_file)
xtc_executable(test_plugin_module_path tests/unit/test_plugin_module_path.c)
xtc_test(plugin-module-path test_plugin_module_path)
xtc_executable(test_core tests/unit/test_core.c)
xtc_test(core test_core)
if(XTC_LADSPA_AVAILABLE)
add_library(plugin-fixture MODULE tests/plugins/fixture.c)
xtc_warnings(plugin-fixture)
set_target_properties(plugin-fixture PROPERTIES PREFIX "" SUFFIX ".so")
target_include_directories(plugin-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
endif()
add_library(clap-fixture MODULE tests/plugins/clap_fixture.c)
xtc_warnings(clap-fixture)
set_target_properties(clap-fixture PROPERTIES PREFIX "" SUFFIX ".clap")
target_include_directories(clap-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
add_library(vst2-fixture MODULE tests/plugins/vst2_fixture.c)
xtc_warnings(vst2-fixture)
set_target_properties(vst2-fixture PROPERTIES PREFIX "" SUFFIX ".so")
target_include_directories(vst2-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
add_library(vst3-fixture MODULE tests/plugins/vst3_fixture.c)
xtc_warnings(vst3-fixture)
set_target_properties(vst3-fixture PROPERTIES PREFIX "" SUFFIX ".so")
target_include_directories(vst3-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
add_library(clap-synth-fixture MODULE tests/plugins/clap_synth_fixture.c)
xtc_warnings(clap-synth-fixture)
set_target_properties(clap-synth-fixture PROPERTIES PREFIX "" SUFFIX ".clap")
target_include_directories(clap-synth-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
add_library(vst2-synth-fixture MODULE tests/plugins/vst2_synth_fixture.c)
xtc_warnings(vst2-synth-fixture)
set_target_properties(vst2-synth-fixture PROPERTIES PREFIX "" SUFFIX ".so")
target_include_directories(vst2-synth-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
add_library(vst3-synth-fixture MODULE tests/plugins/vst3_synth_fixture.c)
xtc_warnings(vst3-synth-fixture)
set_target_properties(vst3-synth-fixture PROPERTIES PREFIX "" SUFFIX ".so")
target_include_directories(vst3-synth-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
if(XTC_LADSPA_AVAILABLE)
xtc_test(plugins test_plugins $<TARGET_FILE:plugin-fixture> fixture)
endif()
xtc_test(modern-plugins test_modern_plugins $<TARGET_FILE:clap-fixture> $<TARGET_FILE:vst2-fixture> $<TARGET_FILE:vst3-fixture>)
xtc_test(instruments test_instruments $<TARGET_FILE:clap-synth-fixture> $<TARGET_FILE:vst2-synth-fixture> $<TARGET_FILE:vst3-synth-fixture>)
xtc_test(startup xtc-check)
xtc_test(native-example native-gain)
add_test(NAME project-inspection COMMAND ${Python3_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/integration/test_project_inspection.py" $<TARGET_FILE:xtc-check>)
set_tests_properties(project-inspection PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
add_test(NAME benchmark-tools COMMAND ${Python3_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/tools/test_benchmark.py")
set_tests_properties(benchmark-tools PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
if(JACK_FOUND AND XTC_WITH_JACK)
xtc_executable(test_backend tests/unit/test_backend.c)
xtc_test(backend test_backend)
foreach(kind jack jack_audio jack_midi)
xtc_executable(test_${kind} tests/integration/test_${kind}.c)
if(XTC_ENABLE_LIVE_TESTS)
string(REPLACE "_" "-" name "${kind}")
xtc_test(${name} test_${kind})
set_tests_properties(${name} PROPERTIES LABELS live RUN_SERIAL TRUE)
endif()
endforeach()
endif()

29
cmake/Variants.cmake Normal file
View file

@ -0,0 +1,29 @@
# Each compiler/flag variant has its own cache and products.
foreach(variant debug release sanitize)
set(extra)
if(CMAKE_CXX_COMPILER)
list(APPEND extra "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
endif()
if(variant STREQUAL debug)
set(kind Debug)
else()
set(kind Release)
list(APPEND extra -DXTC_REPRODUCIBLE=ON)
endif()
if(variant STREQUAL sanitize)
set(kind Debug)
list(APPEND extra -DXTC_SANITIZE=ON -DXTC_BUILD_GUI=OFF -DCMAKE_C_COMPILER=clang)
set(target test-sanitize)
else()
set(target ${variant})
endif()
add_custom_target(${target}
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -S "${PROJECT_SOURCE_DIR}" -B "${CMAKE_CURRENT_BINARY_DIR}/${variant}"
-DCMAKE_BUILD_TYPE=${kind} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DXTC_WITH_JACK=${XTC_WITH_JACK} -DXTC_WITH_LADSPA=${XTC_WITH_LADSPA}
-DXTC_BUILD_GUI=${XTC_BUILD_GUI} ${extra}
COMMAND ${CMAKE_COMMAND} --build "${CMAKE_CURRENT_BINARY_DIR}/${variant}" --parallel 3
COMMAND ${CMAKE_CTEST_COMMAND} --test-dir "${CMAKE_CURRENT_BINARY_DIR}/${variant}" --output-on-failure
USES_TERMINAL VERBATIM)
endforeach()
add_custom_target(check-development DEPENDS check analyze test-sanitize)