This repository was archived by the owner on Jul 31, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
100 lines (87 loc) · 2.83 KB
/
Copy pathCMakeLists.txt
File metadata and controls
100 lines (87 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 3.15.0)
project(synthcore VERSION 0.1.0 LANGUAGES C CXX)
include(CTest)
include(FetchContent)
enable_testing()
find_package(Threads)
# Do this first; some things will quietly pick it up and it's
# really hard to tell which.
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(deps)
set(SZC_DEPS
boost_partial
concurrentqueue
cpp11-on-multicore
dr_libs
hedley
miniaudio
pdqsort
)
# We handle this as a Synthizer option a few levels above, which propagates down if set globally. Disables tests etc.
# for bindings integrations.
if(NOT "${SYZ_INTEGRATING}")
set(SZC_TEST_DEPS catch2)
endif()
FetchContent_MakeAvailable(${SZC_DEPS} ${SZC_TEST_DEPS})
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Xclang -fno-caret-diagnostics
-Wno-deprecated-declarations
-Wno-logical-op-parentheses
-Wno-unknown-pragmas
# We have warning pragmas that are GCC specific.
-Wno-unknown-warning-option
)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(
# Lets us use Clang pragmas.
/wd4068
# Lets us use non-MSVC attributes.
/wd5030
# allows implicit casts to smaller types. We need this because we can't i.e. std::copy(double, float) without
# hitting it.
/wd4244
/wd4267
# Lets property generation work, namely property_impl.hpp
/Zc:preprocessor
# And now we need to silence a winbase.h warning because it's got a macro expanding to undefined somehow. Noe that
# this isn't our code:
/wd5105
# Not all compilers give us constexpr if, but MSVC likes to warn us when we can use it.
/wd4127
# Documented here: https://devblogs.microsoft.com/cppblog/broken-warnings-theory/
# By using this and putting Synthizer dependency headers behind <>, we can suppress warnings in dependencies.
/experimental:external
/external:W0
/external:anglebrackets
# Apparently we have to globally disable unreachable code warnings; MSVC isn't letting us do it in a
# targeted fashion.
/wd4702
)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
ADD_COMPILE_OPTIONS(-Wno-unknown-pragmas)
endif()
add_library(synthcore STATIC
src/check_all_headers.cpp
src/data/primes.cpp
)
target_include_directories(synthcore PUBLIC include)
target_link_libraries(synthcore ${SZC_DEPS} Threads::Threads)
if(MSVC)
target_compile_options(synthcore PRIVATE /W4 /WX)
else()
target_compile_options(synthcore PRIVATE -Wall -Wextra -pedantic -Werror)
endif()
if(NOT SYZ_INTEGRATING)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
INCLUDE(Catch)
add_executable(tests
tests/block_delay_line.cpp
tests/generation_thread.cpp
tests/latch.cpp
tests/math.cpp
tests/mod_pointer.cpp
tests/random_float.cpp
)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain synthcore)
catch_discover_tests(tests)
endif()