From 3332687a4167fd9889024ccbb489fba92d297415 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sun, 1 Nov 2020 10:56:49 +0100 Subject: [PATCH] Move feature out of tests and in their own directory --- CMakeLists.txt | 5 +++ clients/CMakeLists.txt | 2 +- cmake/SfizzConfig.cmake | 6 ++- demos/CMakeLists.txt | 61 ++++++++++++++++++++++++++ {tests => demos}/DemoFilters.cpp | 0 {tests => demos}/DemoFilters.ui | 0 {tests => demos}/DemoParser.cpp | 0 {tests => demos}/DemoParser.ui | 0 {tests => demos}/DemoSmooth.cpp | 0 {tests => demos}/DemoSmooth.ui | 0 {tests => demos}/DemoStereo.cpp | 0 {tests => demos}/DemoStereo.ui | 0 {tests => demos}/DemoStretchTuning.cpp | 0 {tests => demos}/DemoStretchTuning.ui | 0 {tests => demos}/DemoWavetables.cpp | 0 {tests => demos}/DemoWavetables.ui | 0 {tests => demos}/EQ.cpp | 0 {tests => demos}/FileInstrument.cpp | 0 {tests => demos}/FileWavetable.cpp | 0 {tests => demos}/Filter.cpp | 0 {tests => demos}/PlotCurve.cpp | 0 {tests => demos}/PlotLFO.cpp | 0 {tests => demos}/PlotWavetables.cpp | 0 {tests => demos}/Tuning.cpp | 0 tests/CMakeLists.txt | 60 ------------------------- 25 files changed, 72 insertions(+), 62 deletions(-) create mode 100644 demos/CMakeLists.txt rename {tests => demos}/DemoFilters.cpp (100%) rename {tests => demos}/DemoFilters.ui (100%) rename {tests => demos}/DemoParser.cpp (100%) rename {tests => demos}/DemoParser.ui (100%) rename {tests => demos}/DemoSmooth.cpp (100%) rename {tests => demos}/DemoSmooth.ui (100%) rename {tests => demos}/DemoStereo.cpp (100%) rename {tests => demos}/DemoStereo.ui (100%) rename {tests => demos}/DemoStretchTuning.cpp (100%) rename {tests => demos}/DemoStretchTuning.ui (100%) rename {tests => demos}/DemoWavetables.cpp (100%) rename {tests => demos}/DemoWavetables.ui (100%) rename {tests => demos}/EQ.cpp (100%) rename {tests => demos}/FileInstrument.cpp (100%) rename {tests => demos}/FileWavetable.cpp (100%) rename {tests => demos}/Filter.cpp (100%) rename {tests => demos}/PlotCurve.cpp (100%) rename {tests => demos}/PlotLFO.cpp (100%) rename {tests => demos}/PlotWavetables.cpp (100%) rename {tests => demos}/Tuning.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3896ef5..83c8c5a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option (SFIZZ_VST "Enable VST plug-in build [default: OFF]" OFF) option (SFIZZ_AU "Enable AU plug-in build [default: OFF]" OFF) option (SFIZZ_BENCHMARKS "Enable benchmarks build [default: OFF]" OFF) option (SFIZZ_TESTS "Enable tests build [default: OFF]" OFF) +option (SFIZZ_DEMOS "Enable feature demos build [default: OFF]" OFF) option (SFIZZ_DEVTOOLS "Enable developer tools build [default: OFF]" OFF) option (SFIZZ_SHARED "Enable shared library build [default: ON]" ON) option (SFIZZ_USE_SNDFILE "Enable use of the sndfile library [default: ON]" ON) @@ -75,6 +76,10 @@ if (SFIZZ_TESTS) add_subdirectory (tests) endif() +if (SFIZZ_DEMOS) + add_subdirectory (demos) +endif() + if (SFIZZ_DEVTOOLS) add_subdirectory (devtools) endif() diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt index 80502f42..ae3080a3 100644 --- a/clients/CMakeLists.txt +++ b/clients/CMakeLists.txt @@ -21,7 +21,7 @@ if (SFIZZ_RENDER) target_compile_definitions(sfizz-fmidi PUBLIC "FMIDI_STATIC=1" "FMIDI_DISABLE_DESCRIBE_API=1") add_executable(sfizz_render MidiHelpers.h sfizz_render.cpp) - target_link_libraries(sfizz_render PRIVATE sfizz::sfizz sfizz-fmidi sfizz-sndfile) + target_link_libraries(sfizz_render PRIVATE sfizz::sfizz sfizz-fmidi sfizz-sndfile sfizz-cxxopts) sfizz_enable_lto_if_needed (sfizz_render) install (TARGETS sfizz_render DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT "render" OPTIONAL) endif() diff --git a/cmake/SfizzConfig.cmake b/cmake/SfizzConfig.cmake index b10a7a6f..20c9660a 100644 --- a/cmake/SfizzConfig.cmake +++ b/cmake/SfizzConfig.cmake @@ -88,8 +88,12 @@ endfunction() add_library(sfizz-jsl INTERFACE) target_include_directories(sfizz-jsl INTERFACE "external/jsl/include") +# The cxxopts library +add_library(sfizz-cxxopts INTERFACE) +target_include_directories(sfizz-cxxopts INTERFACE "external/cxxopts") + # The sndfile library -if (SFIZZ_USE_SNDFILE OR SFIZZ_TESTS OR SFIZZ_BENCHMARKS OR SFIZZ_RENDER) +if (SFIZZ_USE_SNDFILE OR SFIZZ_DEMOS OR SFIZZ_BENCHMARKS OR SFIZZ_RENDER) add_library(sfizz-sndfile INTERFACE) if (SFIZZ_USE_VCPKG OR CMAKE_CXX_COMPILER_ID MATCHES "MSVC") find_package(SndFile CONFIG REQUIRED) diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt new file mode 100644 index 00000000..16ebcce6 --- /dev/null +++ b/demos/CMakeLists.txt @@ -0,0 +1,61 @@ +find_package(PkgConfig) +if(PKGCONFIG_FOUND) + pkg_check_modules(JACK "jack") +endif() +find_package(Qt5 COMPONENTS Widgets) + +if(TARGET Qt5::Widgets) + if(JACK_FOUND) + add_executable(sfizz_demo_filters DemoFilters.cpp) + target_include_directories(sfizz_demo_filters PRIVATE ${JACK_INCLUDE_DIRS}) + target_link_libraries(sfizz_demo_filters PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) + set_target_properties(sfizz_demo_filters PROPERTIES AUTOUIC ON) + + add_executable(sfizz_demo_smooth DemoSmooth.cpp) + target_include_directories(sfizz_demo_smooth PRIVATE ${JACK_INCLUDE_DIRS}) + target_link_libraries(sfizz_demo_smooth PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) + set_target_properties(sfizz_demo_smooth PROPERTIES AUTOUIC ON) + + add_executable(sfizz_demo_stereo DemoStereo.cpp) + target_include_directories(sfizz_demo_stereo PRIVATE ${JACK_INCLUDE_DIRS}) + target_link_libraries(sfizz_demo_stereo PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) + set_target_properties(sfizz_demo_stereo PROPERTIES AUTOUIC ON) + + add_executable(sfizz_demo_wavetables DemoWavetables.cpp) + target_include_directories(sfizz_demo_wavetables PRIVATE ${JACK_INCLUDE_DIRS}) + target_link_libraries(sfizz_demo_wavetables PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) + set_target_properties(sfizz_demo_wavetables PROPERTIES AUTOUIC ON) + endif() + + add_executable(sfizz_demo_parser DemoParser.cpp) + target_link_libraries(sfizz_demo_parser PRIVATE sfizz_parser Qt5::Widgets) + set_target_properties(sfizz_demo_parser PROPERTIES AUTOUIC ON) + + add_executable(sfizz_demo_stretch_tuning DemoStretchTuning.cpp) + target_link_libraries(sfizz_demo_stretch_tuning PRIVATE sfizz::sfizz Qt5::Widgets) + set_target_properties(sfizz_demo_stretch_tuning PROPERTIES AUTOUIC ON) +endif() + +add_executable(eq_apply EQ.cpp) +target_link_libraries(eq_apply PRIVATE sfizz::sfizz sfizz-sndfile sfizz-cxxopts) + +add_executable(filter_apply Filter.cpp) +target_link_libraries(filter_apply PRIVATE sfizz::sfizz sfizz-sndfile sfizz-cxxopts) + +add_executable(sfizz_plot_curve PlotCurve.cpp) +target_link_libraries(sfizz_plot_curve PRIVATE sfizz::sfizz) + +add_executable(sfizz_plot_wavetables PlotWavetables.cpp) +target_link_libraries(sfizz_plot_wavetables PRIVATE sfizz::sfizz) + +add_executable(sfizz_plot_lfo PlotLFO.cpp) +target_link_libraries(sfizz_plot_lfo PRIVATE sfizz::sfizz sfizz-sndfile sfizz-cxxopts) + +add_executable(sfizz_file_instrument FileInstrument.cpp) +target_link_libraries(sfizz_file_instrument PRIVATE sfizz::sfizz sfizz-sndfile) + +add_executable(sfizz_file_wavetable FileWavetable.cpp) +target_link_libraries(sfizz_file_wavetable PRIVATE sfizz::sfizz) + +add_executable(sfizz_tuning Tuning.cpp) +target_link_libraries(sfizz_tuning PRIVATE sfizz::sfizz sfizz-cxxopts) diff --git a/tests/DemoFilters.cpp b/demos/DemoFilters.cpp similarity index 100% rename from tests/DemoFilters.cpp rename to demos/DemoFilters.cpp diff --git a/tests/DemoFilters.ui b/demos/DemoFilters.ui similarity index 100% rename from tests/DemoFilters.ui rename to demos/DemoFilters.ui diff --git a/tests/DemoParser.cpp b/demos/DemoParser.cpp similarity index 100% rename from tests/DemoParser.cpp rename to demos/DemoParser.cpp diff --git a/tests/DemoParser.ui b/demos/DemoParser.ui similarity index 100% rename from tests/DemoParser.ui rename to demos/DemoParser.ui diff --git a/tests/DemoSmooth.cpp b/demos/DemoSmooth.cpp similarity index 100% rename from tests/DemoSmooth.cpp rename to demos/DemoSmooth.cpp diff --git a/tests/DemoSmooth.ui b/demos/DemoSmooth.ui similarity index 100% rename from tests/DemoSmooth.ui rename to demos/DemoSmooth.ui diff --git a/tests/DemoStereo.cpp b/demos/DemoStereo.cpp similarity index 100% rename from tests/DemoStereo.cpp rename to demos/DemoStereo.cpp diff --git a/tests/DemoStereo.ui b/demos/DemoStereo.ui similarity index 100% rename from tests/DemoStereo.ui rename to demos/DemoStereo.ui diff --git a/tests/DemoStretchTuning.cpp b/demos/DemoStretchTuning.cpp similarity index 100% rename from tests/DemoStretchTuning.cpp rename to demos/DemoStretchTuning.cpp diff --git a/tests/DemoStretchTuning.ui b/demos/DemoStretchTuning.ui similarity index 100% rename from tests/DemoStretchTuning.ui rename to demos/DemoStretchTuning.ui diff --git a/tests/DemoWavetables.cpp b/demos/DemoWavetables.cpp similarity index 100% rename from tests/DemoWavetables.cpp rename to demos/DemoWavetables.cpp diff --git a/tests/DemoWavetables.ui b/demos/DemoWavetables.ui similarity index 100% rename from tests/DemoWavetables.ui rename to demos/DemoWavetables.ui diff --git a/tests/EQ.cpp b/demos/EQ.cpp similarity index 100% rename from tests/EQ.cpp rename to demos/EQ.cpp diff --git a/tests/FileInstrument.cpp b/demos/FileInstrument.cpp similarity index 100% rename from tests/FileInstrument.cpp rename to demos/FileInstrument.cpp diff --git a/tests/FileWavetable.cpp b/demos/FileWavetable.cpp similarity index 100% rename from tests/FileWavetable.cpp rename to demos/FileWavetable.cpp diff --git a/tests/Filter.cpp b/demos/Filter.cpp similarity index 100% rename from tests/Filter.cpp rename to demos/Filter.cpp diff --git a/tests/PlotCurve.cpp b/demos/PlotCurve.cpp similarity index 100% rename from tests/PlotCurve.cpp rename to demos/PlotCurve.cpp diff --git a/tests/PlotLFO.cpp b/demos/PlotLFO.cpp similarity index 100% rename from tests/PlotLFO.cpp rename to demos/PlotLFO.cpp diff --git a/tests/PlotWavetables.cpp b/demos/PlotWavetables.cpp similarity index 100% rename from tests/PlotWavetables.cpp rename to demos/PlotWavetables.cpp diff --git a/tests/Tuning.cpp b/demos/Tuning.cpp similarity index 100% rename from tests/Tuning.cpp rename to demos/Tuning.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 522042dd..f6f25d9c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -51,64 +51,4 @@ sfizz_enable_lto_if_needed(sfizz_tests) sfizz_enable_fast_math(sfizz_tests) # target_link_libraries(sfizz_tests PRIVATE absl::strings absl::str_format absl::flat_hash_map cnpy absl::span absl::algorithm) -find_package(PkgConfig) -if(PKGCONFIG_FOUND) -pkg_check_modules(JACK "jack") -endif() -find_package(Qt5 COMPONENTS Widgets) - -if(JACK_FOUND AND TARGET Qt5::Widgets) - add_executable(sfizz_demo_filters DemoFilters.cpp) - target_include_directories(sfizz_demo_filters PRIVATE ${JACK_INCLUDE_DIRS}) - target_link_libraries(sfizz_demo_filters PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) - set_target_properties(sfizz_demo_filters PROPERTIES AUTOUIC ON) - - add_executable(sfizz_demo_smooth DemoSmooth.cpp) - target_include_directories(sfizz_demo_smooth PRIVATE ${JACK_INCLUDE_DIRS}) - target_link_libraries(sfizz_demo_smooth PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) - set_target_properties(sfizz_demo_smooth PROPERTIES AUTOUIC ON) - - add_executable(sfizz_demo_stereo DemoStereo.cpp) - target_include_directories(sfizz_demo_stereo PRIVATE ${JACK_INCLUDE_DIRS}) - target_link_libraries(sfizz_demo_stereo PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) - set_target_properties(sfizz_demo_stereo PROPERTIES AUTOUIC ON) - - add_executable(sfizz_demo_wavetables DemoWavetables.cpp) - target_include_directories(sfizz_demo_wavetables PRIVATE ${JACK_INCLUDE_DIRS}) - target_link_libraries(sfizz_demo_wavetables PRIVATE sfizz::sfizz Qt5::Widgets ${JACK_LIBRARIES}) - set_target_properties(sfizz_demo_wavetables PROPERTIES AUTOUIC ON) - - add_executable(sfizz_demo_parser DemoParser.cpp) - target_link_libraries(sfizz_demo_parser PRIVATE sfizz_parser Qt5::Widgets) - set_target_properties(sfizz_demo_parser PROPERTIES AUTOUIC ON) - - add_executable(sfizz_demo_stretch_tuning DemoStretchTuning.cpp) - target_link_libraries(sfizz_demo_stretch_tuning PRIVATE sfizz::sfizz Qt5::Widgets) - set_target_properties(sfizz_demo_stretch_tuning PROPERTIES AUTOUIC ON) -endif() - -add_executable(eq_apply EQ.cpp) -target_link_libraries(eq_apply PRIVATE sfizz::sfizz sfizz-sndfile) - -add_executable(filter_apply Filter.cpp) -target_link_libraries(filter_apply PRIVATE sfizz::sfizz sfizz-sndfile) - -add_executable(sfizz_plot_curve PlotCurve.cpp) -target_link_libraries(sfizz_plot_curve PRIVATE sfizz::sfizz) - -add_executable(sfizz_plot_wavetables PlotWavetables.cpp) -target_link_libraries(sfizz_plot_wavetables PRIVATE sfizz::sfizz) - -add_executable(sfizz_plot_lfo PlotLFO.cpp) -target_link_libraries(sfizz_plot_lfo PRIVATE sfizz::sfizz sfizz-sndfile) - -add_executable(sfizz_file_instrument FileInstrument.cpp) -target_link_libraries(sfizz_file_instrument PRIVATE sfizz::sfizz sfizz-sndfile) - -add_executable(sfizz_file_wavetable FileWavetable.cpp) -target_link_libraries(sfizz_file_wavetable PRIVATE sfizz::sfizz) - -add_executable(sfizz_tuning Tuning.cpp) -target_link_libraries(sfizz_tuning PRIVATE sfizz::sfizz) - file(COPY "." DESTINATION ${CMAKE_BINARY_DIR}/tests)