-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathCMakeLists.txt
132 lines (108 loc) · 4.41 KB
/
CMakeLists.txt
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
cmake_minimum_required(VERSION 3.15)
file(STRINGS VERSION CURRENT_VERSION LIMIT_COUNT 1)
project(pluginval VERSION ${CURRENT_VERSION})
if (APPLE)
# Target OS versions down to 10.11
set (CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE INTERNAL "")
# Uncomment to produce a universal binary
# set(CMAKE_OSX_ARCHITECTURES arm64 x86_64)
endif()
# sanitizer options, from https://github.com/sudara/cmake-includes/blob/main/Sanitizers.cmake
# set the corresponding option ON to turn on Address/Thread Sanitizer
option(WITH_ADDRESS_SANITIZER "Enable Address Sanitizer" OFF)
option(WITH_THREAD_SANITIZER "Enable Thread Sanitizer" OFF)
message(STATUS "Sanitizers: ASan=${WITH_ADDRESS_SANITIZER} TSan=${WITH_THREAD_SANITIZER}")
if (WITH_ADDRESS_SANITIZER)
if (MSVC)
add_compile_options(/fsanitize=address)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# also enable UndefinedBehaviorSanitizer
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
link_libraries(-fsanitize=address)
endif ()
message("Address Sanitizer enabled")
endif ()
if (WITH_THREAD_SANITIZER)
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_compile_options(-fsanitize=thread -g -fno-omit-frame-pointer)
link_libraries(-fsanitize=thread)
message("Thread Sanitizer enabled")
endif ()
endif ()
# Adds all the module sources so they appear correctly in the IDE
set_property(GLOBAL PROPERTY USE_FOLDERS YES)
option(JUCE_ENABLE_MODULE_SOURCE_GROUPS "Enable Module Source Groups" ON)
option(PLUGINVAL_FETCH_JUCE "Fetch JUCE along with PluginVal" ON)
if(PLUGINVAL_FETCH_JUCE)
add_subdirectory(modules/juce)
endif()
if (DEFINED ENV{VST2_SDK_DIR})
MESSAGE(STATUS "Building with VST2 SDK: $ENV{VST2_SDK_DIR}")
juce_set_vst2_sdk_path($ENV{VST2_SDK_DIR})
else()
MESSAGE(STATUS "Not building with VST2")
endif()
juce_add_gui_app(pluginval
BUNDLE_ID com.Tracktion.pluginval
COMPANY_NAME Tracktion
ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/Source/binarydata/icon.png"
HARDENED_RUNTIME_ENABLED TRUE
HARDENED_RUNTIME_OPTIONS com.apple.security.cs.allow-unsigned-executable-memory com.apple.security.cs.disable-library-validation com.apple.security.get-task-allow)
juce_generate_juce_header(pluginval)
target_compile_features(pluginval PRIVATE cxx_std_17)
set_target_properties(pluginval PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden)
set(SourceFiles
Source/CommandLine.h
Source/CrashHandler.h
Source/MainComponent.h
Source/PluginTests.h
Source/TestUtilities.h
Source/Validator.h
Source/CommandLine.cpp
Source/CrashHandler.cpp
Source/Main.cpp
Source/MainComponent.cpp
Source/PluginTests.cpp
Source/tests/BasicTests.cpp
Source/tests/BusTests.cpp
Source/tests/ParameterFuzzTests.cpp
Source/TestUtilities.cpp
Source/Validator.cpp)
target_sources(pluginval PRIVATE ${SourceFiles})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Source PREFIX Source FILES ${SourceFiles})
if (DEFINED ENV{VST2_SDK_DIR})
target_compile_definitions(pluginval PRIVATE
JUCE_PLUGINHOST_VST=1)
endif()
target_compile_definitions(pluginval PRIVATE
JUCE_PLUGINHOST_AU=1
JUCE_PLUGINHOST_LADSPA=1
JUCE_PLUGINHOST_VST3=1
JUCE_PLUGINHOST_LV2=1
JUCE_USE_CURL=0
JUCE_WEB_BROWSER=0
JUCE_MODAL_LOOPS_PERMITTED=1
JUCE_GUI_BASICS_INCLUDE_XHEADERS=1
VERSION="${CURRENT_VERSION}")
if(MSVC AND NOT CMAKE_MSVC_RUNTIME_LIBRARY)
# Default to statically linking the runtime libraries
set_property(TARGET pluginval PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_libraries(pluginval PRIVATE
juce::juce_audio_devices
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_recommended_warning_flags)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(pluginval PRIVATE
-static-libstdc++)
endif()
set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR}/docs/Command line options.md")
add_custom_command (OUTPUT "${cmdline_docs_out}"
COMMAND pluginval --help > "${cmdline_docs_out}"
COMMENT "Regenerating Command line options.md..."
USES_TERMINAL)
add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out}")