2019-08-01 01:03:05 +02:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2019-07-29 02:13:03 +02:00
|
|
|
# You need to generate the AppConfig.h and the JuceHeader.h through the Projucer; the rest is more or less here
|
|
|
|
|
|
|
|
|
|
project(sfizz VERSION 1.0.0 LANGUAGES CXX)
|
|
|
|
|
|
|
|
|
|
# Set the highest possible standard
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID)
|
|
|
|
|
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
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-08-03 18:14:58 +02:00
|
|
|
if (UNIX)
|
|
|
|
|
add_compile_options(-Wall)
|
|
|
|
|
add_compile_options(-Wextra)
|
|
|
|
|
# add_compile_options(-fno-exceptions)
|
|
|
|
|
add_compile_options(-ffast-math)
|
|
|
|
|
add_compile_options(-fno-rtti)
|
|
|
|
|
add_compile_options(-fno-omit-frame-pointer)
|
|
|
|
|
endif()
|
2019-08-01 17:16:43 +02:00
|
|
|
|
2019-08-03 18:14:58 +02:00
|
|
|
message("Cmake flags: ${CMAKE_CXX_FLAGS}")
|
2019-08-01 17:16:43 +02:00
|
|
|
|
2019-08-03 18:14:58 +02:00
|
|
|
# Check SIMD files
|
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
|
CHECK_INCLUDE_FILES(x86intrin.h HAVE_X86INTRIN_H)
|
|
|
|
|
CHECK_INCLUDE_FILES(arm_neon.h HAVE_ARM_NEON_H)
|
|
|
|
|
if (HAVE_X86INTRIN_H)
|
|
|
|
|
if(UNIX)
|
|
|
|
|
add_compile_options(-DHAVE_X86INTRIN_H)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
if (HAVE_ARM_NEON_H)
|
|
|
|
|
if(UNIX)
|
|
|
|
|
add_compile_options(-DHAVE_ARM_NEON_H)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# Build options and includes
|
2019-07-30 16:58:47 +02:00
|
|
|
set(BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests")
|
2019-08-03 18:14:58 +02:00
|
|
|
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable Google Benchmark tests")
|
|
|
|
|
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable Google Benchmark install")
|
2019-07-29 02:13:03 +02:00
|
|
|
add_subdirectory(external/abseil-cpp)
|
|
|
|
|
add_subdirectory(external/spdlog)
|
|
|
|
|
add_subdirectory(external/Catch2)
|
|
|
|
|
add_subdirectory(external/cxxopts)
|
2019-07-30 01:04:12 +02:00
|
|
|
add_subdirectory(external/benchmark)
|
|
|
|
|
|
2019-08-03 18:14:58 +02:00
|
|
|
# Export the compile_commands.json file
|
2019-07-29 02:13:03 +02:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
|
2019-08-03 18:14:58 +02:00
|
|
|
|
2019-07-29 02:13:03 +02:00
|
|
|
set(COMMON_SOURCES
|
|
|
|
|
sources/Opcode.cpp
|
|
|
|
|
sources/Synth.cpp
|
2019-07-30 00:29:23 +02:00
|
|
|
sources/FilePool.cpp
|
2019-07-29 02:13:03 +02:00
|
|
|
sources/Region.cpp
|
2019-08-03 18:14:58 +02:00
|
|
|
sources/StereoBuffer.cpp
|
2019-07-29 02:13:03 +02:00
|
|
|
sources/Parser.cpp
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set(TEST_SOURCES
|
2019-08-03 18:14:58 +02:00
|
|
|
tests/RegexT.cpp
|
|
|
|
|
tests/HelpersT.cpp
|
|
|
|
|
tests/RegionT.cpp
|
|
|
|
|
tests/RangeT.cpp
|
|
|
|
|
tests/OpcodeT.cpp
|
|
|
|
|
tests/BufferT.cpp
|
|
|
|
|
tests/StereoBufferT.cpp
|
|
|
|
|
tests/FilesT.cpp
|
|
|
|
|
tests/MainT.cpp
|
2019-07-29 02:13:03 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
add_executable(sfzprint sources/ParserMain.cpp ${COMMON_SOURCES})
|
|
|
|
|
# Per OS properties
|
|
|
|
|
if(UNIX)
|
|
|
|
|
target_link_libraries(sfzprint stdc++fs)
|
|
|
|
|
endif(UNIX)
|
|
|
|
|
target_link_libraries(sfzprint absl::strings cxxopts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
# Basic command line program
|
|
|
|
|
add_executable(sfizz sources/Main.cpp ${COMMON_SOURCES})
|
|
|
|
|
# Per OS properties
|
|
|
|
|
if(UNIX)
|
|
|
|
|
target_link_libraries(sfizz stdc++fs)
|
|
|
|
|
endif(UNIX)
|
2019-08-04 01:38:44 +02:00
|
|
|
target_link_libraries(sfizz absl::stlrings cxxopts sndfile absl::flat_hash_map)
|
2019-07-29 02:13:03 +02:00
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
# Test application
|
|
|
|
|
add_executable(sfizz_tests ${TEST_SOURCES} ${COMMON_SOURCES})
|
|
|
|
|
# Per OS properties
|
|
|
|
|
if(UNIX)
|
|
|
|
|
target_link_libraries(sfizz_tests stdc++fs)
|
|
|
|
|
endif(UNIX)
|
|
|
|
|
target_link_libraries(sfizz_tests Catch2::Catch2 absl::strings)
|
|
|
|
|
target_include_directories(sfizz_tests SYSTEM PRIVATE sources)
|
2019-07-30 01:04:12 +02:00
|
|
|
file(COPY "tests" DESTINATION ${CMAKE_BINARY_DIR})
|
|
|
|
|
|
|
|
|
|
###############################
|
2019-08-03 18:14:58 +02:00
|
|
|
add_executable(bench_fill benchmarks/Stereo_Fill.cpp ${COMMON_SOURCES})
|
2019-07-30 01:04:12 +02:00
|
|
|
# Per OS properties
|
|
|
|
|
if(UNIX)
|
2019-08-03 18:14:58 +02:00
|
|
|
target_link_libraries(bench_fill stdc++fs)
|
2019-07-30 01:04:12 +02:00
|
|
|
endif(UNIX)
|
2019-08-03 18:14:58 +02:00
|
|
|
target_link_libraries(bench_fill absl::strings benchmark)
|
2019-08-01 01:03:05 +02:00
|
|
|
|
|
|
|
|
###############################
|
2019-08-03 18:14:58 +02:00
|
|
|
add_executable(bench_read benchmarks/Stereo_Read_Interleaved.cpp ${COMMON_SOURCES})
|
2019-08-01 01:03:05 +02:00
|
|
|
# Per OS properties
|
|
|
|
|
if(UNIX)
|
2019-08-03 18:14:58 +02:00
|
|
|
target_link_libraries(bench_read stdc++fs)
|
2019-08-01 01:03:05 +02:00
|
|
|
endif(UNIX)
|
2019-08-03 18:14:58 +02:00
|
|
|
target_link_libraries(bench_read absl::strings benchmark)
|