forked from Celemony/ARA_Library
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
196 lines (164 loc) · 6.64 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# ======================
# ARA Library CMake Integration
#
# Copyright (c) 2020-2022, Celemony Software GmbH, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ======================
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
if(ARA_API_DIR)
# normalize path if provided (and if relative path, assume it's relative to the top-level project)
get_filename_component(ARA_API_DIR "${ARA_API_DIR}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
else()
# if no path provided, assume ARA_API is right next to our ARA_Library directory
get_filename_component(ARA_API_DIR ../ARA_API ABSOLUTE "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
set(ARA_API_DIR "${ARA_API_DIR}" CACHE PATH "directory of the ARA_API project")
include("${ARA_API_DIR}/ARA_API_Helpers.cmake")
include("${ARA_API_DIR}/ARA_Version.cmake")
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE STRING "Generate compile commands" FORCE)
# ======================
project(ARA_Library
DESCRIPTION "ARA Audio Random Access: Implementation Library"
#only added in CMake 3.12:
#HOMEPAGE_URL https://www.celemony.com/ara
VERSION ${ARA_MAJOR_VERSION}.${ARA_MINOR_VERSION}.${ARA_PATCH_VERSION}.${ARA_BUILD_VERSION}
LANGUAGES C CXX
)
# ======================
add_subdirectory("${ARA_API_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/ARA_API.build" EXCLUDE_FROM_ALL)
set_target_properties(ARA_API PROPERTIES
XCODE_GENERATE_SCHEME OFF
)
# ======================
function(configure_ARA_Library_target target)
# file grouping
ara_group_target_files(${target})
# language standards
target_compile_features(${target}
PUBLIC
cxx_std_11
c_std_11
)
# ARA_API dependency
ara_link_ARA_API(${target} PUBLIC)
# include paths
target_include_directories(${target}
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/.."
)
# defines
# \todo: add proper external configuration of the ARADebug options!
target_compile_definitions(${target}
# \todo is PRIVATE really appropriate here, or should it rather be PUBLIC?
PRIVATE
$<$<NOT:$<CONFIG:Debug>>: -DNDEBUG>
)
# platform-specific settings
if(WIN32)
target_compile_definitions(${target}
PRIVATE
-DNOMINMAX=1
)
elseif(APPLE)
if(XCODE)
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES
)
else()
set_target_properties(${target} PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
endif()
elseif(UNIX AND NOT APPLE)
set_target_properties(${target} PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
endif()
# default settings
ara_disable_unwanted_warnings(${target})
endfunction()
# ======================
# files used in both host and plug-in target
set(ARA_Library_Common_Files
"${CMAKE_CURRENT_SOURCE_DIR}/Debug/ARADebug.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Debug/ARADebug.c"
"${CMAKE_CURRENT_SOURCE_DIR}/Debug/ARAContentLogger.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Debug/ARAContentValidator.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/ARADispatchBase.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/ARAContentReader.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ARAChannelArrangement.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ARAChannelArrangement.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ARAStdVectorUtilities.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ARASamplePositionConversion.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ARATimelineConversion.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ARAPitchInterpretation.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ARAPitchInterpretation.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ARA_Library.html"
"${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt"
)
# ======================
# test if we can use object targets or must fall back to or static targets
# older CMake can't link to object targets, must build static lib instead
# \todo when building universal binaries for macOS, the paths to the object files are broken...
# to work around, we need to stick with static libs for now.
# CMake 3.20 promises a fix for the issue...
#if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
# set(ARA_LIBRARY_TARGET_TYPE OBJECT)
#else()
set(ARA_LIBRARY_TARGET_TYPE STATIC)
#endif()
# ======================
add_library(ARA_Host_Library ${ARA_LIBRARY_TARGET_TYPE}
${ARA_Library_Common_Files}
"${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/ARAHostDispatch.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/ARAHostDispatch.cpp"
)
configure_ARA_Library_target(ARA_Host_Library)
# ======================
add_library(ARA_PlugIn_Library ${ARA_LIBRARY_TARGET_TYPE}
${ARA_Library_Common_Files}
"${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/ARAPlugInDispatch.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Dispatch/ARAPlugInDispatch.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/PlugIn/ARAPlug.h"
"${CMAKE_CURRENT_SOURCE_DIR}/PlugIn/ARAPlug.cpp"
)
configure_ARA_Library_target(ARA_PlugIn_Library)
# ======================
add_library(ARA_IPC_Library ${ARA_LIBRARY_TARGET_TYPE}
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPC.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCEncoding.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCLockingContext.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCLockingContext.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCProxyHost.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCProxyHost.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCProxyPlugIn.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCProxyPlugIn.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCProxyHost.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCProxyHost.cpp"
)
if(APPLE)
target_sources(ARA_IPC_Library PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCCFEncoding.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IPC/ARAIPCCFEncoding.cpp"
)
endif()
target_link_libraries(ARA_IPC_Library PRIVATE
ARA_Host_Library
ARA_PlugIn_Library
)
configure_ARA_Library_target(ARA_IPC_Library)