Merge pull request #539 from jpcima/demos

Separate demos programs and unit tests
This commit is contained in:
JP Cimalando 2020-11-01 11:49:12 +01:00 committed by GitHub
commit 621d46d085
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 456 additions and 2454 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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)

61
demos/CMakeLists.txt Normal file
View file

@ -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)

19
external/cxxopts/LICENSE vendored Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2014 Jarryd Beck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load diff

View file

@ -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)

File diff suppressed because it is too large Load diff