forked from flucoma/flucoma-max
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
197 lines (162 loc) · 6.94 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
197
# Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/)
# Copyright University of Huddersfield.
# Licensed under the BSD-3 License.
# See license.md file in the project root for full license information.
# This project has received funding from the European Research Council (ERC)
# under the European Union’s Horizon 2020 research and innovation programme
# (grant agreement No 725899).
cmake_minimum_required(VERSION 3.18)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/release-packaging" CACHE PATH "")
################################################################################
# Paths
set(MAX_TARGET_NAMESPACE "" CACHE STRING "Optional namesapce to prepend to targets to prevent collision in superbuilds")
set(MAX_SDK_PATH "" CACHE PATH "Path to the Max SDK")
if(NOT MAX_SDK_PATH)
message(FATAL_ERROR "Max SDK Path is not set")
endif()
set(FLUID_PATH "" CACHE PATH "Optional path to the Fluid Decomposition repo")
set(FLUID_BRANCH "origin/main" CACHE STRING "Branch to pull flucoma dependencies from")
option(DOCS "Generate Max XML documentation" OFF)
set(FLUID_DOCS_PATH "" CACHE PATH "Optional path to flucoma-docs (needed for docs)")
if (APPLE)
set(CMAKE_XCODE_GENERATE_SCHEME ON)
set(CMAKE_XCODE_SCHEME_EXECUTABLE "/Applications/Max.app")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "")
#A consequence of targetting 10.8. Needs to be set globally from 10.15 onwards in order for the test program to compile successfully during configure
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
endif()
################################################################################
# Main Action
project (flucoma-max LANGUAGES C CXX)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY ON)
set(AUTHOR_DOMAIN "org.flucoma")
string(TIMESTAMP "%Y" THISYEAR)
set(COPYRIGHT_STRING "Copyright (c) 2017-${THISYEAR} University of Huddersfield")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(MAX_INSTALL_PREFIX "." CACHE PATH "Prefix for assembling max package")
set(FLUID_PACKAGE_NAME "FluidCorpusManipulation" CACHE STRING "Name for published package")
set(MAX_PACKAGE_ROOT ${MAX_INSTALL_PREFIX}/${FLUID_PACKAGE_NAME})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/source/script")
################################################################################
# Fetch / link to dependencies
include(FetchContent)
FetchContent_Declare(
flucoma-core
GIT_REPOSITORY https://github.com/flucoma/flucoma-core.git
GIT_PROGRESS TRUE
GIT_TAG ${FLUID_BRANCH}
)
FetchContent_Declare(
flucoma-docs
GIT_REPOSITORY https://github.com/flucoma/flucoma-docs.git
GIT_PROGRESS TRUE
GIT_TAG ${FLUID_BRANCH}
)
if(FLUID_PATH)
get_filename_component(
FETCHCONTENT_SOURCE_DIR_FLUCOMA-CORE ${FLUID_PATH} ABSOLUTE
)
endif()
FetchContent_MakeAvailable(flucoma-core)
file(GLOB FLUCOMA_CORE_RESOURCES "${flucoma-core_SOURCE_DIR}/Resources/Data/*.*")
file(COPY ${FLUCOMA_CORE_RESOURCES} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/misc")
include(flucoma_version)
include(flucoma-buildtools)
include(flucoma-buildtype)
get_property(FLUCOMA_VERSION_TAG GLOBAL PROPERTY FLUCOMA_VERSION_SHA)
configure_file(package-info.json.in "${CMAKE_CURRENT_SOURCE_DIR}/package-info.json")
set_if_toplevel(VAR CMAKE_LIBRARY_OUTPUT_DIRECTORY
TOPLEVEL "${CMAKE_CURRENT_SOURCE_DIR}/externals"
SUPERBUILD "${CMAKE_SOURCE_DIR}/max_externals")
if(DOCS)
set(MAX_DOC_OUT "${CMAKE_SOURCE_DIR}/docs" CACHE PATH "")
if(FLUID_DOCS_PATH)
get_filename_component(
FETCHCONTENT_SOURCE_DIR_FLUCOMA-DOCS ${FLUID_DOCS_PATH} ABSOLUTE
)
endif()
FetchContent_MakeAvailable(flucoma-docs)
include(FlucomaDocs)
set(MAX_DOC_OUT "${CMAKE_BINARY_DIR}/max_ref")
add_ref_target(max "Making Max ref")
# endif()
add_custom_target(MAX_MAKE_DOCS ALL DEPENDS MAKE_MAX_REF)
endif()
FetchContent_Declare(
fluid_waveform
URL https://github.com/flucoma/fluid.waveform/releases/download/build/fluid.waveform.tar.gz
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)
FetchContent_MakeAvailable(fluid_waveform)
################################################################################
# Max Wrapper
add_library( FLUID_MAX INTERFACE )
target_sources(
FLUID_MAX INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/source/include/FluidMaxWrapper.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/include/MaxBufferAdaptor.hpp"
)
target_include_directories(FLUID_MAX INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/source/include"
)
include(MakeMaxSources)
include(SetupMaxSDK)
# generate targets for standalone clients
get_client_group(NONE client_list)
foreach(client ${client_list})
get_core_client_header(${client} header)
get_core_client_class(${client} class)
generate_max_source(
CLIENTS ${client}
HEADERS ${header}
CLASSES ${class}
)
endforeach()
#generate target for MANIPULATION group
get_client_group(MANIPULATION client_list)
foreach(client ${client_list})
get_core_client_header(${client} header)
get_core_client_class(${client} class)
list(APPEND MANIPULATION_CLIENTS ${client})
list(APPEND MANIPULATION_HEADERS ${header})
list(APPEND MANIPULATION_CLASSES ${class})
endforeach()
generate_max_source(
CLIENTS ${MANIPULATION_CLIENTS}
HEADERS ${MANIPULATION_HEADERS}
CLASSES ${MANIPULATION_CLASSES}
FILENAME fluid.libmanipulation
)
add_max_external(fluid.list2buf "${CMAKE_CURRENT_SOURCE_DIR}/source/projects/fluid.list2buf/fluid.list2buf.cpp")
add_max_external(fluid.buf2list "${CMAKE_CURRENT_SOURCE_DIR}/source/projects/fluid.buf2list/fluid.buf2list.cpp")
#install bits. Max packages bundle Windows and Mac builds together
foreach(PACKAGE_DIRECTORY examples;extras;help;init;patchers;interfaces;javascript;jsui;misc)
install(DIRECTORY ${PACKAGE_DIRECTORY} DESTINATION ${MAX_PACKAGE_ROOT})
endforeach(PACKAGE_DIRECTORY)
install(DIRECTORY "${flucoma-core_SOURCE_DIR}/Resources/AudioFiles/"
DESTINATION "${MAX_PACKAGE_ROOT}/media")
install(DIRECTORY "${flucoma-core_SOURCE_DIR}/Resources/Data/"
DESTINATION "${MAX_PACKAGE_ROOT}/misc")
install(FILES icon.png package-info.json QuickStart.md
DESTINATION ${MAX_PACKAGE_ROOT})
install(FILES ${flucoma-core_SOURCE_DIR}/distribution.lic
DESTINATION ${MAX_PACKAGE_ROOT}
RENAME LICENSE.md)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/local_docs/"
DESTINATION "${MAX_PACKAGE_ROOT}/docs")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/vignettes"
DESTINATION "${MAX_PACKAGE_ROOT}/docs")
if(DOCS)
install(DIRECTORY "${MAX_DOC_OUT}/"
DESTINATION "${MAX_PACKAGE_ROOT}/docs"
PATTERN "*.xml")
install(FILES "${MAX_DOC_OUT}/../interfaces/flucoma-obj-qlookup.json"
"${MAX_DOC_OUT}/../interfaces/max.db.json"
DESTINATION "${MAX_PACKAGE_ROOT}/interfaces")
endif()
install(DIRECTORY "${fluid_waveform_SOURCE_DIR}/" DESTINATION ${MAX_PACKAGE_ROOT})