Merge branch 'feature/reorganization-test' into develop
This commit is contained in:
commit
fa5018ee16
101 changed files with 755 additions and 177 deletions
|
|
@ -4,11 +4,15 @@
|
||||||
# Top-most EditorConfig file
|
# Top-most EditorConfig file
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
# No trailing whitespaces, but with a newline ending every file,
|
# UTF-8 charset, set indent to spaces with width of four,
|
||||||
# UTF-8 charset, set indent to spaces with width of four
|
# with no trailing whitespaces and a newline ending every file.
|
||||||
[*]
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
charset = utf-8
|
|
||||||
|
[*.{ttl,ttl.in}]
|
||||||
|
indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
|
||||||
|
|
|
||||||
12
.gitignore
vendored
12
.gitignore
vendored
|
|
@ -1,9 +1,4 @@
|
||||||
build
|
build*
|
||||||
build-arm
|
|
||||||
build-asan
|
|
||||||
build-release
|
|
||||||
build-reldeb
|
|
||||||
build-debug
|
|
||||||
docs
|
docs
|
||||||
.vscode
|
.vscode
|
||||||
perf.data
|
perf.data
|
||||||
|
|
@ -16,6 +11,7 @@ cmake_install.cmake
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
*.a
|
*.a
|
||||||
*.txt.user
|
*.txt.user
|
||||||
|
*.autosave
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
|
@ -23,11 +19,9 @@ clients/sfizz_jack
|
||||||
clients/sfzprint
|
clients/sfzprint
|
||||||
|
|
||||||
# gh-pages unstaged files:
|
# gh-pages unstaged files:
|
||||||
|
|
||||||
_site/
|
_site/
|
||||||
.bundle/
|
.bundle/
|
||||||
api/
|
api/
|
||||||
assets/
|
assets/
|
||||||
node_modules/
|
node_modules/
|
||||||
Gemfile.lock
|
*.lock
|
||||||
yarn.lock
|
|
||||||
|
|
|
||||||
152
CMakeLists.txt
152
CMakeLists.txt
|
|
@ -1,105 +1,63 @@
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(sfizz VERSION 1.0.0 LANGUAGES CXX)
|
project (sfizz VERSION 1.0.0 LANGUAGES CXX)
|
||||||
|
|
||||||
# Do not override if set to more than 14
|
# External configuration CMake scripts
|
||||||
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14)
|
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
include (SfizzConfig)
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
set (BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests [default: OFF]")
|
||||||
|
|
||||||
|
set (LV2PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/lv2" CACHE STRING
|
||||||
|
"Install destination for LV2 bundle [default: ${CMAKE_INSTALL_PREFIX}/lib/lv2]")
|
||||||
|
|
||||||
|
option (ENABLE_LTO "Enable Link Time Optimization [default: ON]" ON)
|
||||||
|
option (SFIZZ_JACK "Enable JACK stand-alone build [default: ON]" ON)
|
||||||
|
option (SFIZZ_LV2 "Enable LV2 plug-in build [default: ON]" ON)
|
||||||
|
option (SFIZZ_BENCHMARKS "Enable benchmarks build [default: OFF]" OFF)
|
||||||
|
option (SFIZZ_TESTS "Enable tests build [default: OFF]" OFF)
|
||||||
|
option (SFIZZ_SHARED "Enable shared library build [default: ON]" ON)
|
||||||
|
|
||||||
|
# Don't use IPO in non Release builds
|
||||||
|
include (CheckIPO)
|
||||||
|
|
||||||
|
# Add Abseil
|
||||||
|
add_subdirectory (external/abseil-cpp EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
# Add the static library targets and sources
|
||||||
|
add_subdirectory (src)
|
||||||
|
|
||||||
|
# Optional targets
|
||||||
|
if (SFIZZ_JACK)
|
||||||
|
add_subdirectory (clients)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Skip installing all dependencies
|
if (SFIZZ_LV2)
|
||||||
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
|
add_subdirectory (lv2)
|
||||||
|
|
||||||
# Enable LTO
|
|
||||||
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # To override the policy in abseil and benchmark
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
||||||
|
|
||||||
# Enable PIC
|
|
||||||
# set(POSITION_INDEPENDENT_CODE ON)
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID)
|
|
||||||
set(USE_LIBCPP ON CACHE BOOL "Use libc++ with clang")
|
|
||||||
add_compile_options(-stdlib=libc++)
|
|
||||||
# Presumably need the above for linking too, maybe other options missing as well
|
|
||||||
add_link_options(-stdlib=libc++) # New command on CMake master, not in 3.12 release
|
|
||||||
add_link_options(-lc++abi) # New command on CMake master, not in 3.12 release
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
add_compile_options(-fPIC)
|
|
||||||
add_compile_options(-Wall)
|
|
||||||
add_compile_options(-Wextra)
|
|
||||||
add_compile_options(-ffast-math)
|
|
||||||
add_compile_options(-fno-omit-frame-pointer)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
# TODO: Remove when abseil updates (deprecation warning from c++17 onwards)
|
|
||||||
add_compile_options(/wd4996)
|
|
||||||
# add_compile_options(/W3)
|
|
||||||
# add_compile_options(/GR-)
|
|
||||||
# add_compile_options(/permissive-)
|
|
||||||
# add_compile_options(/fp:fast)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message("Cmake flags: ${CMAKE_CXX_FLAGS}")
|
|
||||||
|
|
||||||
# Export the compile_commands.json file
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
|
||||||
# find_package(Git QUIET)
|
|
||||||
# if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
|
||||||
# Update submodules as needed
|
|
||||||
# option(GIT_SUBMODULE "Check submodules during build" ON)
|
|
||||||
# if(GIT_SUBMODULE)
|
|
||||||
# message(STATUS "Submodule update")
|
|
||||||
# execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --remote
|
|
||||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
# RESULT_VARIABLE GIT_SUBMOD_RESULT)
|
|
||||||
# if(NOT GIT_SUBMOD_RESULT EQUAL "0")
|
|
||||||
# message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
|
|
||||||
# endif()
|
|
||||||
# endif()
|
|
||||||
# endif()
|
|
||||||
|
|
||||||
# Build options and includes
|
|
||||||
set(BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests")
|
|
||||||
add_subdirectory(external/abseil-cpp EXCLUDE_FROM_ALL)
|
|
||||||
|
|
||||||
# Download libsndfile
|
|
||||||
if (WIN32)
|
|
||||||
# file(DOWNLOAD https://github.com/bastibe/libsndfile-binaries/raw/master/libsndfile32bit.dll external/libsndfile-win/libsndfile32bit.dll)
|
|
||||||
# file(DOWNLOAD https://github.com/bastibe/libsndfile-binaries/raw/master/libsndfile64bit.dll external/libsndfile-win/libsndfile64bit.dll)
|
|
||||||
# message(STATUS "Downloading libsndfile")
|
|
||||||
# # find_library(sndfile libsndfile-1.lib HINTS ${WIN_SNDFILE_PATH}/lib)
|
|
||||||
set(WIN_SNDFILE_PATH "C:/Program Files/Mega-Nerd/libsndfile")
|
|
||||||
add_library(sndfile STATIC IMPORTED)
|
|
||||||
set_target_properties(sndfile PROPERTIES IMPORTED_LOCATION "${WIN_SNDFILE_PATH}/lib/libsndfile-1.lib")
|
|
||||||
set_target_properties(sndfile PROPERTIES LINKER_LANGUAGE CXX)
|
|
||||||
file(COPY "${WIN_SNDFILE_PATH}/bin/libsndfile-1.dll" DESTINATION ${CMAKE_BINARY_DIR})
|
|
||||||
target_include_directories(sndfile INTERFACE "${WIN_SNDFILE_PATH}/include")
|
|
||||||
elseif(APPLE)
|
|
||||||
find_path(SNDFILE_INCLUDE_DIR NAMES sndfile.hh PATHS "/usr/local/include")
|
|
||||||
find_library(SNDFILE_LIBRARY NAMES sndfile PATHS "/usr/local/lib")
|
|
||||||
message(STATUS "include dir: " ${SNDFILE_INCLUDE_DIR} " lib: " ${SNDFILE_LIBRARY})
|
|
||||||
add_library(sndfile SHARED IMPORTED GLOBAL)
|
|
||||||
target_include_directories(sndfile INTERFACE ${SNDFILE_INCLUDE_DIR})
|
|
||||||
target_link_libraries(sndfile INTERFACE ${SNDFILE_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(sfizz)
|
|
||||||
|
|
||||||
if (SFIZZ_CLIENTS)
|
|
||||||
add_subdirectory(clients)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (SFIZZ_TESTS)
|
|
||||||
add_subdirectory(tests)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SFIZZ_BENCHMARKS)
|
if (SFIZZ_BENCHMARKS)
|
||||||
# Benchmarks
|
add_subdirectory (benchmarks)
|
||||||
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable Google Benchmark tests")
|
|
||||||
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable Google Benchmark install")
|
|
||||||
add_subdirectory(external/benchmark EXCLUDE_FROM_ALL)
|
|
||||||
add_subdirectory(benchmarks)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (SFIZZ_TESTS)
|
||||||
|
add_subdirectory (tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message (STATUS "
|
||||||
|
Project name: ${CMAKE_PROJECT_NAME}
|
||||||
|
Build type: ${CMAKE_BUILD_TYPE}
|
||||||
|
Build using LTO: ${ENABLE_LTO}
|
||||||
|
Build as shared library: ${SFIZZ_SHARED}
|
||||||
|
Build JACK stand-alone client: ${SFIZZ_JACK}
|
||||||
|
Build LV2 plug-in: ${SFIZZ_LV2}
|
||||||
|
Build benchmarks: ${SFIZZ_BENCHMARKS}
|
||||||
|
Build tests: ${SFIZZ_TESTS}
|
||||||
|
|
||||||
|
Install prefix: ${CMAKE_INSTALL_PREFIX}
|
||||||
|
LV2 destination directory: ${LV2PLUGIN_INSTALL_DIR}
|
||||||
|
|
||||||
|
Compiler CXX debug flags: ${CMAKE_CXX_FLAGS_DEBUG}
|
||||||
|
Compiler CXX release flags: ${CMAKE_CXX_FLAGS_RELEASE}
|
||||||
|
Compiler CXX min size flags: ${CMAKE_CXX_FLAGS_MINSIZEREL}
|
||||||
|
")
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include "../sfizz/ADSREnvelope.h"
|
#include "ADSREnvelope.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
@ -35,7 +35,7 @@ constexpr int release = attack;
|
||||||
constexpr int releaseTime = envelopeSize - static_cast<int>(envelopeSize / 4);
|
constexpr int releaseTime = envelopeSize - static_cast<int>(envelopeSize / 4);
|
||||||
|
|
||||||
// Explicitely instantiate class
|
// Explicitely instantiate class
|
||||||
#include "../sfizz/ADSREnvelope.cpp"
|
#include "ADSREnvelope.cpp"
|
||||||
template class sfz::ADSREnvelope<float>;
|
template class sfz::ADSREnvelope<float>;
|
||||||
|
|
||||||
static void Point(benchmark::State& state) {
|
static void Point(benchmark::State& state) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
class AddArray : public benchmark::Fixture {
|
class AddArray : public benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
class CopyArray : public benchmark::Fixture {
|
class CopyArray : public benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
class CumArray : public benchmark::Fixture {
|
class CumArray : public benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "absl/types/span.h"
|
#include "absl/types/span.h"
|
||||||
|
|
||||||
class DiffArray : public benchmark::Fixture {
|
class DiffArray : public benchmark::Fixture {
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "../sfizz/Buffer.h"
|
#include "Buffer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
class GainSingle : public benchmark::Fixture {
|
class GainSingle : public benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <absl/algorithm/container.h>
|
#include <absl/algorithm/container.h>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
// In this one we have an array of jumps
|
// In this one we have an array of jumps
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <absl/algorithm/container.h>
|
#include <absl/algorithm/container.h>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
// In this one we have an array of indices
|
// In this one we have an array of indices
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "absl/types/span.h"
|
#include "absl/types/span.h"
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
class MultiplyAdd : public benchmark::Fixture {
|
class MultiplyAdd : public benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "../sfizz/Config.h"
|
#include "Config.h"
|
||||||
#include "absl/types/span.h"
|
#include "absl/types/span.h"
|
||||||
|
|
||||||
class PanArray : public benchmark::Fixture {
|
class PanArray : public benchmark::Fixture {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <absl/algorithm/container.h>
|
#include <absl/algorithm/container.h>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "absl/types/span.h"
|
#include "absl/types/span.h"
|
||||||
|
|
||||||
constexpr int bigNumber { 2399132 };
|
constexpr int bigNumber { 2399132 };
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "../sfizz/Buffer.h"
|
#include "Buffer.h"
|
||||||
|
|
||||||
|
|
||||||
static void Dummy(benchmark::State& state) {
|
static void Dummy(benchmark::State& state) {
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "../sfizz/Buffer.h"
|
#include "Buffer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <absl/types/span.h>
|
#include <absl/types/span.h>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <absl/algorithm/container.h>
|
#include <absl/algorithm/container.h>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
// In this one we have an array of indices
|
// In this one we have an array of indices
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
|
|
||||||
class SubArray : public benchmark::Fixture {
|
class SubArray : public benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include "../sfizz/SIMDHelpers.h"
|
#include "SIMDHelpers.h"
|
||||||
#include "../sfizz/Buffer.h"
|
#include "Buffer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <absl/types/span.h>
|
#include <absl/types/span.h>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,21 @@
|
||||||
project(sfizz)
|
project(sfizz)
|
||||||
|
|
||||||
|
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable Google Benchmark tests")
|
||||||
|
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable Google Benchmark install")
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(
|
||||||
|
benchmark
|
||||||
|
GIT_REPOSITORY https://github.com/google/benchmark.git
|
||||||
|
GIT_TAG v1.5.0
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(benchmark)
|
||||||
|
if(NOT benchmark_POPULATED)
|
||||||
|
FetchContent_Populate(benchmark)
|
||||||
|
add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Check SIMD
|
# Check SIMD
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
CHECK_INCLUDE_FILES(x86intrin.h HAVE_X86INTRIN_H)
|
CHECK_INCLUDE_FILES(x86intrin.h HAVE_X86INTRIN_H)
|
||||||
|
|
@ -9,83 +25,104 @@ CHECK_INCLUDE_FILES(arm_neon.h HAVE_ARM_NEON_H)
|
||||||
# SIMD checks
|
# SIMD checks
|
||||||
if (HAVE_X86INTRIN_H AND UNIX)
|
if (HAVE_X86INTRIN_H AND UNIX)
|
||||||
add_compile_options(-DHAVE_X86INTRIN_H)
|
add_compile_options(-DHAVE_X86INTRIN_H)
|
||||||
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDSSE.cpp)
|
set(SFIZZ_SIMD_SOURCES ../src/sfizz/SIMDSSE.cpp)
|
||||||
elseif (HAVE_INTRIN_H AND WIN32)
|
elseif (HAVE_INTRIN_H AND WIN32)
|
||||||
add_compile_options(/DHAVE_INTRIN_H)
|
add_compile_options(/DHAVE_INTRIN_H)
|
||||||
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDSSE.cpp)
|
set(SFIZZ_SIMD_SOURCES ../src/sfizz/SIMDSSE.cpp)
|
||||||
elseif (HAVE_ARM_NEON_H AND UNIX)
|
elseif (HAVE_ARM_NEON_H AND UNIX)
|
||||||
add_compile_options(-DHAVE_ARM_NEON_H)
|
add_compile_options(-DHAVE_ARM_NEON_H)
|
||||||
add_compile_options(-mfpu=neon-fp-armv8)
|
add_compile_options(-mfpu=neon-fp-armv8)
|
||||||
add_compile_options(-march=native)
|
add_compile_options(-march=native)
|
||||||
add_compile_options(-mtune=cortex-a53)
|
add_compile_options(-mtune=cortex-a53)
|
||||||
add_compile_options(-funsafe-math-optimizations)
|
add_compile_options(-funsafe-math-optimizations)
|
||||||
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDNEON.cpp)
|
set(SFIZZ_SIMD_SOURCES ../src/sfizz/SIMDDummy.cpp)
|
||||||
else()
|
else()
|
||||||
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDDummy.cpp)
|
set(SFIZZ_SIMD_SOURCES ../src/sfizz/SIMDDummy.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(bm_opf_high_vs_low BM_OPF_high_vs_low.cpp)
|
add_executable(bm_opf_high_vs_low BM_OPF_high_vs_low.cpp)
|
||||||
target_link_libraries(bm_opf_high_vs_low benchmark absl::span)
|
target_link_libraries(bm_opf_high_vs_low benchmark absl::span)
|
||||||
|
target_include_directories(bm_opf_high_vs_low PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_write BM_writeInterleaved.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_write BM_writeInterleaved.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_write benchmark absl::span)
|
target_link_libraries(bm_write benchmark absl::span)
|
||||||
|
target_include_directories(bm_write PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_read BM_readInterleaved.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_read BM_readInterleaved.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_read benchmark absl::span)
|
target_link_libraries(bm_read benchmark absl::span)
|
||||||
|
target_include_directories(bm_read PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_fill BM_fill.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_fill BM_fill.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_fill benchmark absl::span)
|
target_link_libraries(bm_fill benchmark absl::span)
|
||||||
|
target_include_directories(bm_fill PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_mathfuns BM_mathfuns.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_mathfuns BM_mathfuns.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_mathfuns benchmark absl::span)
|
target_link_libraries(bm_mathfuns benchmark absl::span)
|
||||||
|
target_include_directories(bm_mathfuns PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_gain BM_gain.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_gain BM_gain.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_gain benchmark absl::span)
|
target_link_libraries(bm_gain benchmark absl::span)
|
||||||
|
target_include_directories(bm_gain PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_looping BM_looping.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_looping BM_looping.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_looping benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_looping benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_looping PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_saturating BM_saturating.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_saturating BM_saturating.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_saturating benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_saturating benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_saturating PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_ramp BM_ramp.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_ramp BM_ramp.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_ramp benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_ramp benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_ramp PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_ADSR BM_ADSR.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_ADSR BM_ADSR.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_ADSR benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_ADSR benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_ADSR PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_add BM_add.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_add BM_add.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_add benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_add benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_add PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_multiplyAdd BM_multiplyAdd.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_multiplyAdd BM_multiplyAdd.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_multiplyAdd benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_multiplyAdd benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_multiplyAdd PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_subtract BM_subtract.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_subtract BM_subtract.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_subtract benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_subtract benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_subtract PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_copy BM_copy.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_copy BM_copy.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_copy benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_copy benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_copy PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_pan BM_pan.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_pan BM_pan.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_pan benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_pan benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_pan PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_mean BM_mean.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_mean BM_mean.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_mean benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_mean benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_mean PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_meanSquared BM_meanSquared.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_meanSquared BM_meanSquared.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_meanSquared benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_meanSquared benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_meanSquared PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_cumsum BM_cumsum.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_cumsum BM_cumsum.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_cumsum benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_cumsum benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_cumsum PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_diff BM_diff.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_diff BM_diff.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_diff benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_diff benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_diff PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_interpolationCast BM_interpolationCast.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_interpolationCast BM_interpolationCast.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_interpolationCast benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_interpolationCast benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_interpolationCast PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_executable(bm_pointerIterationOrOffsets BM_pointerIterationOrOffsets.cpp ${SFIZZ_SIMD_SOURCES})
|
add_executable(bm_pointerIterationOrOffsets BM_pointerIterationOrOffsets.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
target_link_libraries(bm_pointerIterationOrOffsets benchmark absl::span absl::algorithm)
|
target_link_libraries(bm_pointerIterationOrOffsets benchmark absl::span absl::algorithm)
|
||||||
|
target_include_directories(bm_pointerIterationOrOffsets PRIVATE ../src/sfizz ../src/external)
|
||||||
|
|
||||||
add_custom_target(sfizz_benchmarks)
|
add_custom_target(sfizz_benchmarks)
|
||||||
add_dependencies(sfizz_benchmarks
|
add_dependencies(sfizz_benchmarks
|
||||||
|
|
@ -109,4 +146,4 @@ add_dependencies(sfizz_benchmarks
|
||||||
bm_pan
|
bm_pan
|
||||||
bm_subtract
|
bm_subtract
|
||||||
bm_multiplyAdd
|
bm_multiplyAdd
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,8 @@ project(sfizz)
|
||||||
###############################
|
###############################
|
||||||
add_executable(sfzprint sfzprint.cpp)
|
add_executable(sfzprint sfzprint.cpp)
|
||||||
target_link_libraries(sfzprint sfizz::parser absl::flags_parse)
|
target_link_libraries(sfzprint sfizz::parser absl::flags_parse)
|
||||||
install(TARGETS sfzprint DESTINATION . OPTIONAL)
|
# install(TARGETS sfzprint DESTINATION . OPTIONAL)
|
||||||
|
|
||||||
###############################
|
|
||||||
# Basic command line program
|
|
||||||
if(APPLE)
|
|
||||||
find_path(JACK_INCLUDE_DIR NAMES jack.h PATHS "/usr/local/include/jack")
|
|
||||||
find_library(JACK_LIBRARY NAMES jack PATHS "/usr/local/lib")
|
|
||||||
message(STATUS "include dir: " ${JACK_INCLUDE_DIR} " lib: " ${JACK_LIBRARY})
|
|
||||||
add_library(jack SHARED IMPORTED GLOBAL)
|
|
||||||
target_include_directories(jack INTERFACE ${JACK_INCLUDE_DIR})
|
|
||||||
target_link_libraries(jack INTERFACE ${JACK_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(sfizz_jack jack_client.cpp)
|
add_executable(sfizz_jack jack_client.cpp)
|
||||||
target_link_libraries(sfizz_jack sfizz::sfizz jack absl::flags_parse)
|
target_link_libraries(sfizz_jack sfizz::sfizz jack absl::flags_parse)
|
||||||
install(TARGETS sfizz_jack DESTINATION . OPTIONAL)
|
# install(TARGETS sfizz_jack DESTINATION . OPTIONAL)
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "AudioSpan.h"
|
#include "sfizz.hpp"
|
||||||
#include "Synth.h"
|
|
||||||
#include <absl/flags/parse.h>
|
#include <absl/flags/parse.h>
|
||||||
#include <absl/types/span.h>
|
#include <absl/types/span.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
|
||||||
14
cmake/CheckIPO.cmake
Normal file
14
cmake/CheckIPO.cmake
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Added in CMake 3.9
|
||||||
|
include (CheckIPOSupported)
|
||||||
|
check_ipo_supported (RESULT result OUTPUT output)
|
||||||
|
|
||||||
|
if (result AND ENABLE_LTO AND ${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
||||||
|
message (STATUS "\nLTO enabled.")
|
||||||
|
else()
|
||||||
|
if (${output})
|
||||||
|
message (WARNING "\nIPO disabled: ${output}")
|
||||||
|
else()
|
||||||
|
message (WARNING "\nIPO was disabled, not in a Release build?")
|
||||||
|
endif()
|
||||||
|
set (ENABLE_LTO OFF)
|
||||||
|
endif()
|
||||||
9
cmake/LV2Config.cmake
Normal file
9
cmake/LV2Config.cmake
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Configuration for this plugin
|
||||||
|
# TODO: generate version from git
|
||||||
|
set (LV2PLUGIN_VERSION_MINOR 0)
|
||||||
|
set (LV2PLUGIN_VERSION_MICRO 1)
|
||||||
|
set (LV2PLUGIN_NAME "Sfizz")
|
||||||
|
set (LV2PLUGIN_COMMENT "SFZ sampler")
|
||||||
|
set (LV2PLUGIN_URI "http://sfztools.github.io/sfizz")
|
||||||
|
set (LV2PLUGIN_AUTHOR "Paul Ferrand")
|
||||||
|
set (LV2PLUGIN_SPDX_LICENSE_ID "BSD-2-Clause")
|
||||||
28
cmake/SfizzConfig.cmake
Normal file
28
cmake/SfizzConfig.cmake
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Do not override the C++ standard if set to more than 14
|
||||||
|
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14)
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Export the compile_commands.json file
|
||||||
|
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
# Only install what's explicitely said
|
||||||
|
set (CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
|
||||||
|
|
||||||
|
# Add required flags for the builds
|
||||||
|
if (UNIX)
|
||||||
|
add_compile_options(-Wall)
|
||||||
|
add_compile_options(-Wextra)
|
||||||
|
add_compile_options(-ffast-math)
|
||||||
|
add_compile_options(-fno-omit-frame-pointer) # For debugging purposes
|
||||||
|
add_compile_options(-fPIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If we build with Clang use libc++
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID)
|
||||||
|
set(USE_LIBCPP ON CACHE BOOL "Use libc++ with clang")
|
||||||
|
add_compile_options(-stdlib=libc++)
|
||||||
|
# Presumably need the above for linking too, maybe other options missing as well
|
||||||
|
add_link_options(-stdlib=libc++) # New command on CMake master, not in 3.12 release
|
||||||
|
add_link_options(-lc++abi) # New command on CMake master, not in 3.12 release
|
||||||
|
endif()
|
||||||
28
cmake/SfizzSIMDSourceFilesCheck.cmake
Normal file
28
cmake/SfizzSIMDSourceFilesCheck.cmake
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Check SIMD
|
||||||
|
include (CheckIncludeFiles)
|
||||||
|
CHECK_INCLUDE_FILES(x86intrin.h HAVE_X86INTRIN_H)
|
||||||
|
CHECK_INCLUDE_FILES(intrin.h HAVE_INTRIN_H)
|
||||||
|
|
||||||
|
if (!APPLE)
|
||||||
|
CHECK_INCLUDE_FILES (arm_neon.h HAVE_ARM_NEON_H)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# SIMD checks
|
||||||
|
if (HAVE_X86INTRIN_H AND UNIX)
|
||||||
|
add_compile_options (-DHAVE_X86INTRIN_H)
|
||||||
|
set (SFIZZ_SIMD_SOURCES sfizz/SIMDSSE.cpp)
|
||||||
|
elseif (HAVE_INTRIN_H AND WIN32)
|
||||||
|
add_compile_options (/DHAVE_INTRIN_H)
|
||||||
|
set (SFIZZ_SIMD_SOURCES sfizz/SIMDSSE.cpp)
|
||||||
|
elseif (HAVE_ARM_NEON_H AND UNIX)
|
||||||
|
add_compile_options (-DHAVE_ARM_NEON_H)
|
||||||
|
add_compile_options (-mfpu=neon-fp-armv8)
|
||||||
|
add_compile_options (-march=native)
|
||||||
|
add_compile_options (-mtune=cortex-a53)
|
||||||
|
add_compile_options (-funsafe-math-optimizations)
|
||||||
|
set (SFIZZ_SIMD_SOURCES sfizz/SIMDDummy.cpp)
|
||||||
|
else()
|
||||||
|
set (SFIZZ_SIMD_SOURCES sfizz/SIMDDummy.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (SFIZZ_SOURCES ${SFIZZ_SOURCES} ${SFIZZ_SIMD_SOURCES})
|
||||||
|
|
@ -1,19 +1,46 @@
|
||||||
cmake_minimum_required(VERSION 3.11)
|
project (lv2plugin)
|
||||||
project(sfizz-lv2)
|
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
# CMAKE_PROJECT_NAME is the top level project name, not the current one
|
||||||
pkg_check_modules(sfizz REQUIRED IMPORTED_TARGET sfizz)
|
set (LV2PLUGIN_PRJ_NAME "${CMAKE_PROJECT_NAME}_lv2")
|
||||||
|
|
||||||
# Force add relocation to the flags globally. It's ugly but what can you do...
|
# Set the build directory as <build_dir>/lv2/<plugin_name>.lv2/
|
||||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
set (PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.lv2")
|
||||||
|
|
||||||
# Export the compile_commands.json file
|
# LV2 plugin specific settings
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
include (LV2Config)
|
||||||
|
|
||||||
add_library(sfizz-lv2 SHARED sfizz.c)
|
if (WIN32)
|
||||||
set_target_properties(sfizz-lv2 PROPERTIES PREFIX "")
|
set (LV2PLUGIN_EXT "dll")
|
||||||
set_target_properties(sfizz-lv2 PROPERTIES OUTPUT_NAME "sfizz")
|
elseif (APPLE)
|
||||||
target_link_libraries(sfizz-lv2 sfizz)
|
set (LV2PLUGIN_EXT "dylib")
|
||||||
if(UNIX)
|
else()
|
||||||
target_compile_options(sfizz-lv2 PRIVATE -Wextra -pedantic -Wall -Werror)
|
set (LV2PLUGIN_EXT "so")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Keep non build turtle files in IDE
|
||||||
|
set (LV2PLUGIN_TTL_SRC_FILES
|
||||||
|
manifest.ttl.in
|
||||||
|
${CMAKE_PROJECT_NAME}.ttl.in
|
||||||
|
)
|
||||||
|
add_library (${LV2PLUGIN_PRJ_NAME} SHARED ${CMAKE_PROJECT_NAME}.c ${LV2PLUGIN_TTL_SRC_FILES})
|
||||||
|
target_link_libraries (${LV2PLUGIN_PRJ_NAME} ${CMAKE_PROJECT_NAME}::${CMAKE_PROJECT_NAME})
|
||||||
|
|
||||||
|
if (ENABLE_LTO)
|
||||||
|
set_property (TARGET ${LV2PLUGIN_PRJ_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Remove the "lib" prefix, rename the target name and build it in the .lv build dir
|
||||||
|
# <build_dir>/lv2/<plugin_name>_lv2.<ext> to
|
||||||
|
# <build_dir>/lv2/<plugin_name>.lv2/<plugin_name>.<ext>
|
||||||
|
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES PREFIX "")
|
||||||
|
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}")
|
||||||
|
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# Generate *.ttl files from *.in sources,
|
||||||
|
# create the destination directory if it doesn't exists and copy needed files
|
||||||
|
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||||
|
configure_file (manifest.ttl.in ${PROJECT_BINARY_DIR}/manifest.ttl)
|
||||||
|
configure_file (${CMAKE_PROJECT_NAME}.ttl.in ${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.ttl)
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
install (DIRECTORY ${PROJECT_BINARY_DIR} DESTINATION ${LV2PLUGIN_INSTALL_DIR})
|
||||||
|
|
|
||||||
7
lv2/manifest.ttl.in
Normal file
7
lv2/manifest.ttl.in
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
|
||||||
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||||
|
|
||||||
|
<@LV2PLUGIN_URI@>
|
||||||
|
a lv2:Plugin ;
|
||||||
|
lv2:binary <@CMAKE_PROJECT_NAME@.@LV2PLUGIN_EXT@> ;
|
||||||
|
rdfs:seeAlso <@CMAKE_PROJECT_NAME@.ttl> .
|
||||||
108
lv2/sfizz.ttl.in
Normal file
108
lv2/sfizz.ttl.in
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
|
||||||
|
@prefix bufsize: <http://lv2plug.in/ns/ext/buf-size#> .
|
||||||
|
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
||||||
|
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
||||||
|
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
|
||||||
|
@prefix midi: <http://lv2plug.in/ns/ext/midi#> .
|
||||||
|
@prefix opts: <http://lv2plug.in/ns/ext/options#> .
|
||||||
|
@prefix patch: <http://lv2plug.in/ns/ext/patch#> .
|
||||||
|
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> .
|
||||||
|
@prefix pprop: <http://lv2plug.in/ns/ext/port-props#> .
|
||||||
|
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
||||||
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||||
|
@prefix state: <http://lv2plug.in/ns/ext/state#> .
|
||||||
|
@prefix units: <http://lv2plug.in/ns/extensions/units#> .
|
||||||
|
@prefix urid: <http://lv2plug.in/ns/ext/urid#> .
|
||||||
|
@prefix work: <http://lv2plug.in/ns/ext/worker#> .
|
||||||
|
|
||||||
|
<#config>
|
||||||
|
a pg:Group ;
|
||||||
|
lv2:symbol "config" ;
|
||||||
|
lv2:name "Configuration" .
|
||||||
|
|
||||||
|
<@LV2PLUGIN_URI@:sfzfile>
|
||||||
|
a lv2:Parameter ;
|
||||||
|
rdfs:label "SFZ file" ;
|
||||||
|
rdfs:range atom:Path .
|
||||||
|
|
||||||
|
<@LV2PLUGIN_URI@:numvoices>
|
||||||
|
a lv2:Parameter ;
|
||||||
|
rdfs:label "Polyphony" ;
|
||||||
|
rdfs:range atom:Int .
|
||||||
|
|
||||||
|
<@LV2PLUGIN_URI@>
|
||||||
|
a doap:Project, lv2:Plugin, lv2:InstrumentPlugin ;
|
||||||
|
|
||||||
|
doap:name "@LV2PLUGIN_NAME@" ;
|
||||||
|
doap:license <https://spdx.org/licenses/@LV2PLUGIN_SPDX_LICENSE_ID@> ;
|
||||||
|
doap:maintainer [
|
||||||
|
foaf:name "@LV2PLUGIN_AUTHOR@" ;
|
||||||
|
foaf:homepage <@LV2PLUGIN_URI@> ;
|
||||||
|
] ;
|
||||||
|
rdfs:comment "@LV2PLUGIN_COMMENT@" ;
|
||||||
|
|
||||||
|
lv2:minorVersion @LV2PLUGIN_VERSION_MINOR@ ;
|
||||||
|
lv2:microVersion @LV2PLUGIN_VERSION_MICRO@ ;
|
||||||
|
|
||||||
|
lv2:requiredFeature urid:map, bufsize:boundedBlockLength, work:schedule ;
|
||||||
|
lv2:optionalFeature lv2:hardRTCapable, opts:options ;
|
||||||
|
lv2:extensionData opts:interface, state:interface, work:interface ;
|
||||||
|
|
||||||
|
patch:writable <@LV2PLUGIN_URI@:sfzfile> ;
|
||||||
|
|
||||||
|
lv2:port [
|
||||||
|
a lv2:InputPort, atom:AtomPort ;
|
||||||
|
atom:bufferType atom:Sequence ;
|
||||||
|
atom:supports patch:Message, midi:MidiEvent ;
|
||||||
|
lv2:designation lv2:control ;
|
||||||
|
lv2:index 0 ;
|
||||||
|
lv2:symbol "control" ;
|
||||||
|
lv2:name "Control"
|
||||||
|
] , [
|
||||||
|
a lv2:OutputPort, atom:AtomPort ;
|
||||||
|
atom:bufferType atom:Sequence ;
|
||||||
|
atom:supports patch:Message ;
|
||||||
|
lv2:designation lv2:control ;
|
||||||
|
lv2:index 1 ;
|
||||||
|
lv2:symbol "notify" ;
|
||||||
|
lv2:name "Notify" ;
|
||||||
|
] , [
|
||||||
|
a lv2:AudioPort , lv2:OutputPort ;
|
||||||
|
lv2:index 2 ;
|
||||||
|
lv2:symbol "out_left" ;
|
||||||
|
lv2:name "Left Output"
|
||||||
|
] , [
|
||||||
|
a lv2:AudioPort , lv2:OutputPort ;
|
||||||
|
lv2:index 3 ;
|
||||||
|
lv2:symbol "out_right" ;
|
||||||
|
lv2:name "Right Output"
|
||||||
|
] , [
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 4 ;
|
||||||
|
lv2:symbol "volume" ;
|
||||||
|
lv2:name "Volume" ;
|
||||||
|
lv2:default 0.0 ;
|
||||||
|
lv2:minimum -80.0 ;
|
||||||
|
lv2:maximum 6.0 ;
|
||||||
|
lv2:portProperty pprop:notAutomatic ;
|
||||||
|
units:unit units:db
|
||||||
|
] , [
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 5 ;
|
||||||
|
lv2:symbol "num_voices" ;
|
||||||
|
lv2:name "Polyphony" ;
|
||||||
|
pg:group <#config> ;
|
||||||
|
lv2:portProperty pprop:notAutomatic ;
|
||||||
|
lv2:portProperty pprop:expensive ;
|
||||||
|
lv2:portProperty lv2:integer ;
|
||||||
|
lv2:portProperty lv2:enumeration ;
|
||||||
|
lv2:default 64 ;
|
||||||
|
lv2:minimum 8 ;
|
||||||
|
lv2:maximum 256 ;
|
||||||
|
lv2:scalePoint [ rdfs:label "8 voices"; rdf:value 8 ] ;
|
||||||
|
lv2:scalePoint [ rdfs:label "16 voices"; rdf:value 16 ] ;
|
||||||
|
lv2:scalePoint [ rdfs:label "32 voices"; rdf:value 32 ] ;
|
||||||
|
lv2:scalePoint [ rdfs:label "64 voices"; rdf:value 64 ] ;
|
||||||
|
lv2:scalePoint [ rdfs:label "128 voices"; rdf:value 128 ] ;
|
||||||
|
lv2:scalePoint [ rdfs:label "256 voices"; rdf:value 256 ] ;
|
||||||
|
] .
|
||||||
125
old_cmake/benchmark.txt
Normal file
125
old_cmake/benchmark.txt
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
project(sfizz)
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(
|
||||||
|
benchmark
|
||||||
|
GIT_REPOSITORY https://github.com/google/benchmark.git
|
||||||
|
GIT_TAG v1.5.0
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(benchmark)
|
||||||
|
if(NOT benchmark_POPULATED)
|
||||||
|
FetchContent_Populate(benchmark)
|
||||||
|
add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check SIMD
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
CHECK_INCLUDE_FILES(x86intrin.h HAVE_X86INTRIN_H)
|
||||||
|
CHECK_INCLUDE_FILES(intrin.h HAVE_INTRIN_H)
|
||||||
|
CHECK_INCLUDE_FILES(arm_neon.h HAVE_ARM_NEON_H)
|
||||||
|
|
||||||
|
# SIMD checks
|
||||||
|
if (HAVE_X86INTRIN_H AND UNIX)
|
||||||
|
add_compile_options(-DHAVE_X86INTRIN_H)
|
||||||
|
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDSSE.cpp)
|
||||||
|
elseif (HAVE_INTRIN_H AND WIN32)
|
||||||
|
add_compile_options(/DHAVE_INTRIN_H)
|
||||||
|
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDSSE.cpp)
|
||||||
|
elseif (HAVE_ARM_NEON_H AND UNIX)
|
||||||
|
add_compile_options(-DHAVE_ARM_NEON_H)
|
||||||
|
add_compile_options(-mfpu=neon-fp-armv8)
|
||||||
|
add_compile_options(-march=native)
|
||||||
|
add_compile_options(-mtune=cortex-a53)
|
||||||
|
add_compile_options(-funsafe-math-optimizations)
|
||||||
|
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDNEON.cpp)
|
||||||
|
else()
|
||||||
|
set(SFIZZ_SIMD_SOURCES ../sfizz/SIMDDummy.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(bm_opf_high_vs_low BM_OPF_high_vs_low.cpp)
|
||||||
|
target_link_libraries(bm_opf_high_vs_low benchmark absl::span)
|
||||||
|
|
||||||
|
add_executable(bm_write BM_writeInterleaved.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_write benchmark absl::span)
|
||||||
|
|
||||||
|
add_executable(bm_read BM_readInterleaved.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_read benchmark absl::span)
|
||||||
|
|
||||||
|
add_executable(bm_fill BM_fill.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_fill benchmark absl::span)
|
||||||
|
|
||||||
|
add_executable(bm_mathfuns BM_mathfuns.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_mathfuns benchmark absl::span)
|
||||||
|
|
||||||
|
add_executable(bm_gain BM_gain.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_gain benchmark absl::span)
|
||||||
|
|
||||||
|
add_executable(bm_looping BM_looping.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_looping benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_saturating BM_saturating.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_saturating benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_ramp BM_ramp.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_ramp benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_ADSR BM_ADSR.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_ADSR benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_add BM_add.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_add benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_multiplyAdd BM_multiplyAdd.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_multiplyAdd benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_subtract BM_subtract.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_subtract benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_copy BM_copy.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_copy benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_pan BM_pan.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_pan benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_mean BM_mean.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_mean benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_meanSquared BM_meanSquared.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_meanSquared benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_cumsum BM_cumsum.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_cumsum benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_diff BM_diff.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_diff benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_interpolationCast BM_interpolationCast.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_interpolationCast benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_executable(bm_pointerIterationOrOffsets BM_pointerIterationOrOffsets.cpp ${SFIZZ_SIMD_SOURCES})
|
||||||
|
target_link_libraries(bm_pointerIterationOrOffsets benchmark absl::span absl::algorithm)
|
||||||
|
|
||||||
|
add_custom_target(sfizz_benchmarks)
|
||||||
|
add_dependencies(sfizz_benchmarks
|
||||||
|
bm_opf_high_vs_low
|
||||||
|
bm_write
|
||||||
|
bm_pointerIterationOrOffsets
|
||||||
|
bm_read
|
||||||
|
bm_mean
|
||||||
|
bm_meanSquared
|
||||||
|
bm_fill
|
||||||
|
bm_cumsum
|
||||||
|
bm_diff
|
||||||
|
bm_interpolationCast
|
||||||
|
bm_mathfuns
|
||||||
|
bm_gain
|
||||||
|
bm_looping
|
||||||
|
bm_saturating
|
||||||
|
bm_ramp
|
||||||
|
bm_ADSR
|
||||||
|
bm_add
|
||||||
|
bm_pan
|
||||||
|
bm_subtract
|
||||||
|
bm_multiplyAdd
|
||||||
|
)
|
||||||
21
old_cmake/client.txt
Normal file
21
old_cmake/client.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
project(sfizz)
|
||||||
|
|
||||||
|
###############################
|
||||||
|
add_executable(sfzprint sfzprint.cpp)
|
||||||
|
target_link_libraries(sfzprint sfizz::parser absl::flags_parse)
|
||||||
|
install(TARGETS sfzprint DESTINATION . OPTIONAL)
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Basic command line program
|
||||||
|
if(APPLE)
|
||||||
|
find_path(JACK_INCLUDE_DIR NAMES jack.h PATHS "/usr/local/include/jack")
|
||||||
|
find_library(JACK_LIBRARY NAMES jack PATHS "/usr/local/lib")
|
||||||
|
message(STATUS "include dir: " ${JACK_INCLUDE_DIR} " lib: " ${JACK_LIBRARY})
|
||||||
|
add_library(jack SHARED IMPORTED GLOBAL)
|
||||||
|
target_include_directories(jack INTERFACE ${JACK_INCLUDE_DIR})
|
||||||
|
target_link_libraries(jack INTERFACE ${JACK_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(sfizz_jack jack_client.cpp)
|
||||||
|
target_link_libraries(sfizz_jack sfizz::sfizz jack absl::flags_parse)
|
||||||
|
install(TARGETS sfizz_jack DESTINATION . OPTIONAL)
|
||||||
19
old_cmake/lv2.txt
Normal file
19
old_cmake/lv2.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
cmake_minimum_required(VERSION 3.11)
|
||||||
|
project(sfizz-lv2)
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(sfizz REQUIRED IMPORTED_TARGET sfizz)
|
||||||
|
|
||||||
|
# Force add relocation to the flags globally. It's ugly but what can you do...
|
||||||
|
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||||
|
|
||||||
|
# Export the compile_commands.json file
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
add_library(sfizz-lv2 SHARED sfizz.c)
|
||||||
|
set_target_properties(sfizz-lv2 PROPERTIES PREFIX "")
|
||||||
|
set_target_properties(sfizz-lv2 PROPERTIES OUTPUT_NAME "sfizz")
|
||||||
|
target_link_libraries(sfizz-lv2 sfizz)
|
||||||
|
if(UNIX)
|
||||||
|
target_compile_options(sfizz-lv2 PRIVATE -Wextra -pedantic -Wall -Werror)
|
||||||
|
endif()
|
||||||
105
old_cmake/root.txt
Normal file
105
old_cmake/root.txt
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
project(sfizz VERSION 1.0.0 LANGUAGES CXX)
|
||||||
|
|
||||||
|
# Do not override if set to more than 14
|
||||||
|
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14)
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Skip installing all dependencies
|
||||||
|
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
|
||||||
|
|
||||||
|
# Enable LTO
|
||||||
|
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # To override the policy in abseil and benchmark
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
|
|
||||||
|
# Enable PIC
|
||||||
|
# set(POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID)
|
||||||
|
set(USE_LIBCPP ON CACHE BOOL "Use libc++ with clang")
|
||||||
|
add_compile_options(-stdlib=libc++)
|
||||||
|
# Presumably need the above for linking too, maybe other options missing as well
|
||||||
|
add_link_options(-stdlib=libc++) # New command on CMake master, not in 3.12 release
|
||||||
|
add_link_options(-lc++abi) # New command on CMake master, not in 3.12 release
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
add_compile_options(-fPIC)
|
||||||
|
add_compile_options(-Wall)
|
||||||
|
add_compile_options(-Wextra)
|
||||||
|
add_compile_options(-ffast-math)
|
||||||
|
add_compile_options(-fno-omit-frame-pointer)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
# TODO: Remove when abseil updates (deprecation warning from c++17 onwards)
|
||||||
|
add_compile_options(/wd4996)
|
||||||
|
# add_compile_options(/W3)
|
||||||
|
# add_compile_options(/GR-)
|
||||||
|
# add_compile_options(/permissive-)
|
||||||
|
# add_compile_options(/fp:fast)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message("Cmake flags: ${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
|
# Export the compile_commands.json file
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
# find_package(Git QUIET)
|
||||||
|
# if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||||
|
# Update submodules as needed
|
||||||
|
# option(GIT_SUBMODULE "Check submodules during build" ON)
|
||||||
|
# if(GIT_SUBMODULE)
|
||||||
|
# message(STATUS "Submodule update")
|
||||||
|
# execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --remote
|
||||||
|
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
# RESULT_VARIABLE GIT_SUBMOD_RESULT)
|
||||||
|
# if(NOT GIT_SUBMOD_RESULT EQUAL "0")
|
||||||
|
# message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
|
||||||
|
# endif()
|
||||||
|
# endif()
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
# Build options and includes
|
||||||
|
set(BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests")
|
||||||
|
add_subdirectory(external/abseil-cpp EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
# Download libsndfile
|
||||||
|
if (WIN32)
|
||||||
|
# file(DOWNLOAD https://github.com/bastibe/libsndfile-binaries/raw/master/libsndfile32bit.dll external/libsndfile-win/libsndfile32bit.dll)
|
||||||
|
# file(DOWNLOAD https://github.com/bastibe/libsndfile-binaries/raw/master/libsndfile64bit.dll external/libsndfile-win/libsndfile64bit.dll)
|
||||||
|
# message(STATUS "Downloading libsndfile")
|
||||||
|
# # find_library(sndfile libsndfile-1.lib HINTS ${WIN_SNDFILE_PATH}/lib)
|
||||||
|
set(WIN_SNDFILE_PATH "C:/Program Files/Mega-Nerd/libsndfile")
|
||||||
|
add_library(sndfile STATIC IMPORTED)
|
||||||
|
set_target_properties(sndfile PROPERTIES IMPORTED_LOCATION "${WIN_SNDFILE_PATH}/lib/libsndfile-1.lib")
|
||||||
|
set_target_properties(sndfile PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
|
file(COPY "${WIN_SNDFILE_PATH}/bin/libsndfile-1.dll" DESTINATION ${CMAKE_BINARY_DIR})
|
||||||
|
target_include_directories(sndfile INTERFACE "${WIN_SNDFILE_PATH}/include")
|
||||||
|
elseif(APPLE)
|
||||||
|
find_path(SNDFILE_INCLUDE_DIR NAMES sndfile.hh PATHS "/usr/local/include")
|
||||||
|
find_library(SNDFILE_LIBRARY NAMES sndfile PATHS "/usr/local/lib")
|
||||||
|
message(STATUS "include dir: " ${SNDFILE_INCLUDE_DIR} " lib: " ${SNDFILE_LIBRARY})
|
||||||
|
add_library(sndfile SHARED IMPORTED GLOBAL)
|
||||||
|
target_include_directories(sndfile INTERFACE ${SNDFILE_INCLUDE_DIR})
|
||||||
|
target_link_libraries(sndfile INTERFACE ${SNDFILE_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(sfizz)
|
||||||
|
|
||||||
|
if (SFIZZ_CLIENTS)
|
||||||
|
add_subdirectory(clients)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SFIZZ_TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SFIZZ_BENCHMARKS)
|
||||||
|
# Benchmarks
|
||||||
|
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable Google Benchmark tests")
|
||||||
|
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable Google Benchmark install")
|
||||||
|
add_subdirectory(external/benchmark EXCLUDE_FROM_ALL)
|
||||||
|
add_subdirectory(benchmarks)
|
||||||
|
endif()
|
||||||
40
old_cmake/tests.txt
Normal file
40
old_cmake/tests.txt
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
###############################
|
||||||
|
# Test application
|
||||||
|
|
||||||
|
project(sfizz)
|
||||||
|
|
||||||
|
set(SFIZZ_TEST_SOURCES
|
||||||
|
RegionT.cpp
|
||||||
|
RegexT.cpp
|
||||||
|
HelpersT.cpp
|
||||||
|
HelpersT.cpp
|
||||||
|
AudioBufferT.cpp
|
||||||
|
RangeT.cpp
|
||||||
|
OpcodeT.cpp
|
||||||
|
BufferT.cpp
|
||||||
|
SIMDHelpersT.cpp
|
||||||
|
FilesT.cpp
|
||||||
|
OnePoleFilterT.cpp
|
||||||
|
RegionActivationT.cpp
|
||||||
|
RegionCrossfadesT.cpp
|
||||||
|
ADSREnvelopeT.cpp
|
||||||
|
LinearEnvelopeT.cpp
|
||||||
|
MainT.cpp
|
||||||
|
RegionTriggersT.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
add_library(cnpy cnpy.cpp)
|
||||||
|
target_link_libraries(cnpy PRIVATE ZLIB::ZLIB)
|
||||||
|
|
||||||
|
add_executable(sfizz_tests ${SFIZZ_TEST_SOURCES})
|
||||||
|
target_link_libraries(sfizz_tests PRIVATE sfizz)
|
||||||
|
|
||||||
|
# Per OS properties
|
||||||
|
if(UNIX)
|
||||||
|
target_link_libraries(sfizz_tests PRIVATE atomic)
|
||||||
|
endif(UNIX)
|
||||||
|
target_link_libraries(sfizz_tests PRIVATE absl::strings absl::str_format absl::flat_hash_map sndfile cnpy absl::span absl::algorithm)
|
||||||
|
target_include_directories(sfizz_tests SYSTEM PRIVATE sources)
|
||||||
|
|
||||||
|
file(COPY "." DESTINATION ${CMAKE_BINARY_DIR}/tests)
|
||||||
61
src/CMakeLists.txt
Normal file
61
src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
project(sfizz)
|
||||||
|
|
||||||
|
set (SFIZZ_SOURCES
|
||||||
|
sfizz/Synth.cpp
|
||||||
|
sfizz/FilePool.cpp
|
||||||
|
sfizz/Region.cpp
|
||||||
|
sfizz/Voice.cpp
|
||||||
|
sfizz/ScopedFTZ.cpp
|
||||||
|
sfizz/SfzHelpers.cpp
|
||||||
|
sfizz/FloatEnvelopes.cpp
|
||||||
|
)
|
||||||
|
include (SfizzSIMDSourceFilesCheck)
|
||||||
|
|
||||||
|
# Parser core library
|
||||||
|
add_library (sfizz_parser STATIC)
|
||||||
|
target_sources (sfizz_parser PRIVATE sfizz/Parser.cpp sfizz/Opcode.cpp)
|
||||||
|
target_include_directories (sfizz_parser PUBLIC sfizz)
|
||||||
|
target_include_directories (sfizz_parser PUBLIC external)
|
||||||
|
target_link_libraries (sfizz_parser PRIVATE absl::strings)
|
||||||
|
|
||||||
|
# Sfizz core library
|
||||||
|
add_library (sfizz STATIC ${SFIZZ_SOURCES} sfizz/sfizz_wrapper.cpp)
|
||||||
|
target_include_directories (sfizz PUBLIC sfizz)
|
||||||
|
target_include_directories (sfizz PUBLIC .)
|
||||||
|
target_include_directories (sfizz PUBLIC external)
|
||||||
|
target_link_libraries (sfizz PRIVATE sfizz_parser)
|
||||||
|
find_package (Threads REQUIRED)
|
||||||
|
target_link_libraries (sfizz PUBLIC absl::strings)
|
||||||
|
target_link_libraries (sfizz PRIVATE sndfile absl::flat_hash_map Threads::Threads)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
target_link_libraries (sfizz PUBLIC atomic)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_LTO)
|
||||||
|
set_property (TARGET sfizz_parser PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||||
|
set_property (TARGET sfizz PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library (sfizz::parser ALIAS sfizz_parser)
|
||||||
|
add_library (sfizz::sfizz ALIAS sfizz)
|
||||||
|
|
||||||
|
# install(TARGETS sfizz_parser DESTINATION . EXCLUDE_FROM_ALL)
|
||||||
|
# install(TARGETS sfizz DESTINATION . EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
# Shared library and installation target
|
||||||
|
if (SFIZZ_SHARED)
|
||||||
|
add_library (sfizz_shared SHARED sfizz.h)
|
||||||
|
set_target_properties (sfizz_shared PROPERTIES OUTPUT_NAME sfizz PUBLIC_HEADER sfizz.h)
|
||||||
|
target_link_libraries (sfizz_shared sfizz::sfizz)
|
||||||
|
configure_file (${CMAKE_SOURCE_DIR}/scripts/sfizz.pc.in sfizz.pc @ONLY)
|
||||||
|
if (UNIX)
|
||||||
|
include (GNUInstallDirs)
|
||||||
|
install (TARGETS sfizz_shared
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
install (FILES
|
||||||
|
${CMAKE_BINARY_DIR}/src/sfizz.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@file
|
@file
|
||||||
@brief sfizz public API.
|
@brief sfizz public C API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
2
src/sfizz.hpp
Normal file
2
src/sfizz.hpp
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#include "sfizz/AudioSpan.h"
|
||||||
|
#include "sfizz/Synth.h"
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include "AudioBuffer.h"
|
#include "AudioBuffer.h"
|
||||||
#include "Voice.h"
|
#include "Voice.h"
|
||||||
#include "ghc/fs_std.hpp"
|
#include "ghc/fs_std.hpp"
|
||||||
#include "readerwriterqueue.h"
|
#include "moodycamel/readerwriterqueue.h"
|
||||||
#include <absl/container/flat_hash_map.h>
|
#include <absl/container/flat_hash_map.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <absl/types/optional.h>
|
#include <absl/types/optional.h>
|
||||||
2
src/sfizz_parser.hpp
Normal file
2
src/sfizz_parser.hpp
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#include "sfizz/Parser.h"
|
||||||
|
#include "sfizz/Opcode.h"
|
||||||
|
|
@ -24,11 +24,12 @@ set(SFIZZ_TEST_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
add_library(cnpy cnpy.cpp)
|
add_library(cnpy cnpy/cnpy.cpp)
|
||||||
target_link_libraries(cnpy PRIVATE ZLIB::ZLIB)
|
target_link_libraries(cnpy PRIVATE ZLIB::ZLIB)
|
||||||
|
target_include_directories(cnpy PUBLIC cnpy)
|
||||||
|
|
||||||
add_executable(sfizz_tests ${SFIZZ_TEST_SOURCES})
|
add_executable(sfizz_tests ${SFIZZ_TEST_SOURCES})
|
||||||
target_link_libraries(sfizz_tests PRIVATE sfizz)
|
target_link_libraries(sfizz_tests PRIVATE sfizz::sfizz)
|
||||||
|
|
||||||
# Per OS properties
|
# Per OS properties
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "Synth.h"
|
#include "Synth.h"
|
||||||
#include "catch2/catch.hpp"
|
#include "catch2/catch.hpp"
|
||||||
#include "../sfizz/ghc/fs_std.hpp"
|
#include "ghc/fs_std.hpp"
|
||||||
using namespace Catch::literals;
|
using namespace Catch::literals;
|
||||||
|
|
||||||
TEST_CASE("[Files] Single region (regions_one.sfz)")
|
TEST_CASE("[Files] Single region (regions_one.sfz)")
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "OnePoleFilter.h"
|
#include "OnePoleFilter.h"
|
||||||
#include "catch2/catch.hpp"
|
#include "catch2/catch.hpp"
|
||||||
#include "cnpy.h"
|
#include "cnpy.h"
|
||||||
#include "../sfizz/ghc/fs_std.hpp"
|
#include "ghc/fs_std.hpp"
|
||||||
#include <absl/types/span.h>
|
#include <absl/types/span.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue