-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
388 lines (374 loc) · 16.7 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#(C) 2023-2024 Серый MLGamer. All freedoms preserved.
#Дзен: <https://dzen.ru/seriy_mlgamer>
#SoundCloud: <https://soundcloud.com/seriy_mlgamer>
#YouTube: <https://www.youtube.com/@Seriy_MLGamer>
#GitHub: <https://github.com/Seriy-MLGamer>
#E-mail: <Seriy-MLGamer@yandex.ru>
#
#This file is part of Modularis Core.
#Modularis Core is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
#Modularis Core is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#You should have received a copy of the GNU General Public License along with Modularis Core. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.25)
include(./configuration.cmake)
if(BUILD_TARGET STREQUAL host)
if(COMPILER STREQUAL GCC)
set(MSVC NO)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
endif()
else()
if(BUILD_TARGET STREQUAL x86_64-linux-gnu)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR amd64)
elseif(BUILD_TARGET STREQUAL i386-linux-gnu OR BUILD_TARGET STREQUAL i686-linux-gnu)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i386)
elseif(BUILD_TARGET STREQUAL aarch64-linux-gnu)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm64)
elseif(BUILD_TARGET STREQUAL arm-linux-gnu)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
elseif(BUILD_TARGET STREQUAL arm-linux-gnueabi)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armel)
elseif(BUILD_TARGET STREQUAL arm-linux-gnueabihf)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armhf)
elseif(BUILD_TARGET STREQUAL x86_64-w64-mingw32)
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR amd64)
elseif(BUILD_TARGET STREQUAL i686-w64-mingw32)
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)
endif()
if(BUILD_TARGET STREQUAL i686-linux-gnu)
set(MULTIARCH i386-linux-gnu)
if(COMPILER STREQUAL GCC)
set(MSVC NO)
set(CMAKE_C_COMPILER i686-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER i686-linux-gnu-g++)
endif()
else()
set(MULTIARCH ${BUILD_TARGET})
if(COMPILER STREQUAL GCC)
set(MSVC NO)
set(CMAKE_C_COMPILER ${MULTIARCH}-gcc)
set(CMAKE_CXX_COMPILER ${MULTIARCH}-g++)
endif()
endif()
endif()
project(Modularis_Core
HOMEPAGE_URL https://github.com/Seriy-MLGamer/Modularis_Core
LANGUAGES C CXX
)
if(BUILD_TARGET STREQUAL host)
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL AMD64)
set(CMAKE_SYSTEM_PROCESSOR amd64)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(MULTIARCH x86_64-linux-gnu)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(MULTIARCH x86_64-w64-mingw32)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i386)
set(CMAKE_SYSTEM_PROCESSOR i386)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(MULTIARCH i386-linux-gnu)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i686)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(CMAKE_SYSTEM_PROCESSOR i386)
set(MULTIARCH i386-linux-gnu)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)
set(MULTIARCH i686-w64-mingw32)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL aarch64)
set(CMAKE_SYSTEM_PROCESSOR arm64)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(MULTIARCH aarch64-linux-gnu)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL arm)
set(CMAKE_SYSTEM_PROCESSOR arm)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(MULTIARCH arm-linux-gnu)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL armeabi)
set(CMAKE_SYSTEM_PROCESSOR armel)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(MULTIARCH arm-linux-gnueabi)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL armeabihf)
set(CMAKE_SYSTEM_PROCESSOR armhf)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(MULTIARCH arm-linux-gnueabihf)
endif()
else()
set(CMAKE_SYSTEM_PROCESSOR amd64)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(MULTIARCH x86_64-linux-gnu)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(MULTIARCH x86_64-w64-mingw32)
endif()
endif()
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(CMAKE_INSTALL_PREFIX "${GNU_INSTALLATION_FOLDER}")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_INSTALL_PREFIX "${WINDOWS_INSTALLATION_FOLDER}")
endif()
set(CMAKE_INSTALL_DOCDIR share/doc)
set(CPACK_PACKAGE_NAME libmodularis)
set(CPACK_PACKAGE_VERSION 0.0.0pre-alpha)
set(CPACK_PACKAGE_VENDOR "Серый MLGamer <Seriy-MLGamer@yandex.ru>")
set(CPACK_RESOURCE_FILE_LICENSE ../COPYING.md)
set(DESCRIPTION_SUMMARY "Modularis Core modular sound synthesis framework")
set(DESCRIPTION "This is a free (as in freedom) modular synthesis framework for creation of free digital audio workstations (DAW) and other free programs. Modularis free modular DAW is based on it. Framework is fully crossplatform between mobile and desktop devices, supports various programming languages.
Framework essence
* Freedom
Aim of this framework development is to make music art accessible for users of very different devices. Framework architecture is designed with flexibility and extensibility in mind to make possible developing wide range of programs based on this framework. Free license allows users to have benefits from natural information properties: permission to use the framework for any purpose, study and change its work, share the framework.
* Modular synthesis
Synthesizers, effects and control tools are modules that can be connected to other modules at input and output ports. It is more efficient and flexible architecture for music writing than multitrack architecture. Modular synthesis architecture has more potential of performance, multithreading and memory economy.
Features
* Use in your programs!
Modularis Core framework can be used as player of music compositions made in programs based on this framework. You can interact with them as you programmed it.
* Make your DAW!
Modularis Core framework architecture makes it possible to create very different music editors, be it sequencer DAW, modular synthesizer, tracker or even drum machine!
* Program music!
It is possible to make music using Modularis Core framework without any DAW. Choose the programming language supported by the framework, create an instance of Modularis class, instances of modules, connect them with each other, configure them and make sound!
* Connect plugins! (not implemented yet)
Modularis Core framework supports VST3 and LV2 plugins. It also has its own flexible and extensible plugin system.
* Save your compositions to files! (also not implemented)
Modularis Core framework implements extensible Modularis project file format based on JSON for possibility of manual editing (just in case). A file contains information about settings and connections of modules. It also can contain information for the DAW the project was created in (or something else). You can create either light file with external dependencies on plugins, samples or something else or heavy, but portable file with embedded dependencies.")
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${MULTIARCH})
set(CPACK_COMPONENT_LIBMODULARIS0_DISPLAY_NAME "Runtime library")
set(CPACK_COMPONENT_LIBMODULARIS0_DESCRIPTION "${DESCRIPTION_SUMMARY}
${DESCRIPTION}
This package provides runtime shared library of the framework.")
set(CPACK_COMPONENT_LIBMODULARIS-DEV_DISPLAY_NAME "Development files")
set(CPACK_COMPONENT_LIBMODULARIS-DEV_DEPENDS libmodularis0)
set(CPACK_COMPONENT_LIBMODULARIS-DEV_DESCRIPTION "${DESCRIPTION_SUMMARY} - development files
${DESCRIPTION}
This package provides files for software development on the framework.")
set(CPACK_COMPONENT_LIBMODULARIS-CPP-DEV_DISPLAY_NAME "Development files")
set(CPACK_COMPONENT_LIBMODULARIS-CPP-DEV_DEPENDS libmodularis0 libmodularis-dev)
set(CPACK_COMPONENT_LIBMODULARIS-CPP-DEV_DESCRIPTION "Modularis Core C++ - development files for C++
${DESCRIPTION}
This package provides a C++ language binding to Modularis Core library written in C for software development in C++ language.")
if(PACKAGE_TYPE STREQUAL host)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(PACKAGE_TYPE tar.gz)
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
set(PACKAGE_TYPE zip)
endif()
endif()
if(PACKAGE_TYPE STREQUAL tar.gz)
set(CPACK_GENERATOR TGZ)
add_custom_target(changelog.gz ALL
COMMAND gzip -kf9 ../src/packaging/deb/changelog
BYPRODUCTS ../src/packaging/deb/changelog.gz
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog.gz
COMPONENT libmodularis0
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis0
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog.gz
COMPONENT libmodularis-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-dev
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog.gz
COMPONENT libmodularis-cpp-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-cpp-dev
)
elseif(PACKAGE_TYPE STREQUAL zip)
set(CPACK_GENERATOR ZIP)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog
COMPONENT libmodularis0
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis0
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog
COMPONENT libmodularis-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-dev
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog
COMPONENT libmodularis-cpp-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-cpp-dev
)
elseif(PACKAGE_TYPE STREQUAL deb)
set(CPACK_GENERATOR DEB)
set(CPACK_DEBIAN_PACKAGE_SOURCE libmodularis)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Серый MLGamer <Seriy-MLGamer@yandex.ru>")
set(CPACK_DEBIAN_PACKAGE_PRIORITY optional)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_LIBMODULARIS0_PACKAGE_NAME libmodularis0)
set(CPACK_DEBIAN_LIBMODULARIS0_PACKAGE_SECTION libs)
set(CPACK_DEBIAN_LIBMODULARIS0_PACKAGE_DEPENDS libc6)
set(CPACK_DEBIAN_LIBMODULARIS0_PACKAGE_CONTROL_EXTRA
../src/packaging/deb/shlibs
../src/packaging/deb/triggers
)
set(CPACK_DEBIAN_LIBMODULARIS-DEV_PACKAGE_NAME libmodularis-dev)
set(CPACK_DEBIAN_LIBMODULARIS-DEV_PACKAGE_SECTION libdevel)
set(CPACK_DEBIAN_LIBMODULARIS-DEV_PACKAGE_DEPENDS libmodularis0)
set(CPACK_DEBIAN_LIBMODULARIS-CPP-DEV_PACKAGE_NAME libmodularis-cpp-dev)
set(CPACK_DEBIAN_LIBMODULARIS-CPP-DEV_PACKAGE_SECTION libdevel)
set(CPACK_DEBIAN_LIBMODULARIS-CPP-DEV_PACKAGE_DEPENDS "libmodularis0, libmodularis-dev")
add_custom_target(changelog.Debian.gz ALL
COMMAND gzip -kf9 ../src/packaging/deb/changelog
COMMAND mv ../src/packaging/deb/changelog.gz ../src/packaging/deb/changelog.Debian.gz
BYPRODUCTS ../src/packaging/deb/changelog.Debian.gz
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog.Debian.gz
COMPONENT libmodularis0
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis0
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog.Debian.gz
COMPONENT libmodularis-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-dev
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog.Debian.gz
COMPONENT libmodularis-cpp-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-cpp-dev
)
set(CMAKE_INSTALL_LIBDIR lib/${MULTIARCH})
elseif(PACKAGE_TYPE STREQUAL NSIS)
set(CPACK_GENERATOR NSIS)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog
COMPONENT libmodularis0
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis0
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog
COMPONENT libmodularis-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-dev
)
install(FILES
src/packaging/deb/copyright
src/packaging/deb/changelog
COMPONENT libmodularis-cpp-dev
DESTINATION ${CMAKE_INSTALL_DOCDIR}/libmodularis-cpp-dev
)
endif()
include(GNUInstallDirs)
if(NOT MSVC)
add_compile_options(-O -s -fms-extensions)
add_link_options(-O -s)
endif()
include_directories(include)
add_library(modularis SHARED
src/framework/libmodularis0/modules/effects/note/Note_chorus.c
src/framework/libmodularis0/modules/effects/note/Transpose.c
src/framework/libmodularis0/modules/effects/sound/Amplifier.c
src/framework/libmodularis0/modules/effects/sound/Delay.c
src/framework/libmodularis0/modules/effects/sound/Modulator.c
src/framework/libmodularis0/modules/players/Sequencer.c
src/framework/libmodularis0/modules/synthesizers/Oscillator.c
src/framework/libmodularis0/modules/synthesizers/Sampler.c
src/framework/libmodularis0/ports/controllers/ADSR.c
src/framework/libmodularis0/ports/controllers/Integer_controller.c
src/framework/libmodularis0/ports/controllers/Real_controller.c
src/framework/libmodularis0/ports/Note.c
src/framework/libmodularis0/ports/Ports_folder.c
src/framework/libmodularis0/ports/Sound.c
src/framework/libmodularis0/system/modules/synthesizers/Oscillator/Pressed_oscillations.c
src/framework/libmodularis0/system/modules/synthesizers/Oscillator/Released_oscillations.c
src/framework/libmodularis0/system/modules/synthesizers/Sampler/Pressed_samples.c
src/framework/libmodularis0/system/modules/synthesizers/Sampler/Released_samples.c
src/framework/libmodularis0/system/modules/synthesizers/Sampler/Sample.c
src/framework/libmodularis0/system/modules/Module.c
src/framework/libmodularis0/system/modules/Output.c
src/framework/libmodularis0/system/ports/Port.c
src/framework/libmodularis0/user/modules/players/Sequencer/Pattern_none.c
src/framework/libmodularis0/user/modules/players/Sequencer/Pattern.c
src/framework/libmodularis0/Modularis.c
)
set_property(TARGET modularis PROPERTY SOVERSION 0)
add_library(modularis-cpp STATIC
src/framework/libmodularis-cpp-dev/modules/effects/note/Note_chorus.cpp
src/framework/libmodularis-cpp-dev/modules/effects/note/Transpose.cpp
src/framework/libmodularis-cpp-dev/modules/effects/sound/Amplifier.cpp
src/framework/libmodularis-cpp-dev/modules/effects/sound/Delay.cpp
src/framework/libmodularis-cpp-dev/modules/effects/sound/Modulator.cpp
src/framework/libmodularis-cpp-dev/modules/players/Sequencer.cpp
src/framework/libmodularis-cpp-dev/modules/synthesizers/Oscillator.cpp
src/framework/libmodularis-cpp-dev/modules/synthesizers/Sampler.cpp
src/framework/libmodularis-cpp-dev/ports/controllers/ADSR.cpp
src/framework/libmodularis-cpp-dev/ports/controllers/Integer_controller.cpp
src/framework/libmodularis-cpp-dev/ports/controllers/Real_controller.cpp
src/framework/libmodularis-cpp-dev/ports/Note.cpp
src/framework/libmodularis-cpp-dev/ports/Ports_folder.cpp
src/framework/libmodularis-cpp-dev/ports/Sound.cpp
src/framework/libmodularis-cpp-dev/system/modules/synthesizers/Oscillator/Pressed_oscillations.cpp
src/framework/libmodularis-cpp-dev/system/modules/synthesizers/Oscillator/Released_oscillations.cpp
src/framework/libmodularis-cpp-dev/system/modules/synthesizers/Sampler/Pressed_samples.cpp
src/framework/libmodularis-cpp-dev/system/modules/synthesizers/Sampler/Released_samples.cpp
src/framework/libmodularis-cpp-dev/system/modules/synthesizers/Sampler/Sample.cpp
src/framework/libmodularis-cpp-dev/system/modules/Module.cpp
src/framework/libmodularis-cpp-dev/system/modules/Output.cpp
src/framework/libmodularis-cpp-dev/system/ports/Port.cpp
src/framework/libmodularis-cpp-dev/user/modules/players/Sequencer/Pattern_none.cpp
src/framework/libmodularis-cpp-dev/user/modules/players/Sequencer/Pattern.cpp
src/framework/libmodularis-cpp-dev/Modularis.cpp
)
install(TARGETS modularis
RUNTIME
COMPONENT libmodularis0
LIBRARY
COMPONENT libmodularis0
NAMELINK_COMPONENT libmodularis-dev
ARCHIVE
COMPONENT libmodularis-dev
)
install(DIRECTORY "include/Modularis_Core"
COMPONENT libmodularis-dev
TYPE INCLUDE
)
install(TARGETS modularis-cpp
COMPONENT libmodularis-cpp-dev
)
install(DIRECTORY "include/Modularis_Core_C++"
COMPONENT libmodularis-cpp-dev
TYPE INCLUDE
)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
add_custom_target(uninstall
COMMAND -rm "${CMAKE_INSTALL_FULL_LIBDIR}/libmodularis-cpp.a"
COMMAND -rm -r "${CMAKE_INSTALL_FULL_INCLUDEDIR}/Modularis_Core_C++"
COMMAND -rm -r "${CMAKE_INSTALL_FULL_DOCDIR}/libmodularis-cpp-dev"
COMMAND -rm "${CMAKE_INSTALL_FULL_LIBDIR}/libmodularis.so"
COMMAND -rm -r "${CMAKE_INSTALL_FULL_INCLUDEDIR}/Modularis_Core"
COMMAND -rm -r "${CMAKE_INSTALL_FULL_DOCDIR}/libmodularis0"
COMMAND -rm "${CMAKE_INSTALL_FULL_LIBDIR}/libmodularis.so.0"
COMMAND -rm -r "${CMAKE_INSTALL_FULL_DOCDIR}/libmodularis-dev"
)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_SHARED_LIBRARY_SUFFIX -0.dll)
add_custom_target(uninstall
COMMAND -rmdir /S /Q "${CMAKE_INSTALL_PREFIX}"
)
endif()
include(CPack)