-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
125 lines (108 loc) · 4.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
cmake_minimum_required(VERSION 3.16)
project(suloea)
# External configuration CMake scripts
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include (SuloeaConfig)
set(AEOLUS_DIR third_party/aeolus-0.9.9)
### LV2
set (LV2PLUGIN_PRJ_NAME "${PROJECT_NAME}_lv2")
# Set the build directory as <build_dir>/lv2/<plugin_name>.lv2/
set (PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.lv2")
# LV2 plugin specific settings
include (LV2Config)
add_library (${LV2PLUGIN_PRJ_NAME} MODULE
lv2/suloea.cpp
${AEOLUS_DIR}/source/addsynth.cc
${AEOLUS_DIR}/source/rankwave.cc
${AEOLUS_DIR}/source/division.cc
${AEOLUS_DIR}/source/asection.cc
${AEOLUS_DIR}/source/scales.cc
${AEOLUS_DIR}/source/reverb.cc
${AEOLUS_DIR}/source/rngen.cc
${AEOLUS_DIR}/source/exp2ap.cc
)
target_include_directories(${LV2PLUGIN_PRJ_NAME} PRIVATE ${AEOLUS_DIR}/source)
target_include_directories(${LV2PLUGIN_PRJ_NAME} PRIVATE third_party/)
if (MSVC)
# Use `M_PI`
target_compile_definitions(${LV2PLUGIN_PRJ_NAME} PRIVATE _USE_MATH_DEFINES)
# endian.h doesn't exist in msvc, so we just fake and assume little endian
target_include_directories(${LV2PLUGIN_PRJ_NAME} PRIVATE third_party/fake_endian)
endif()
# Explicitely strip all symbols on Linux but lv2_descriptor()
# MacOS linker does not support this apparently https://bugs.webkit.org/show_bug.cgi?id=144555
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
file(COPY lv2/lv2.version DESTINATION ${CMAKE_BINARY_DIR})
target_link_libraries(${LV2PLUGIN_PRJ_NAME} "-Wl,--version-script=lv2.version")
endif()
if (MINGW)
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES LINK_FLAGS "-static")
endif()
# Remove the "lib" prefix, rename the target name and build it in the .lv build dir
# <build_dir>/lv2/<plugin_name>_lv2.<ext> to
# <build_dir>/lv2/<plugin_name>.lv2/<plugin_name>.<ext>
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES PREFIX "")
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/$<0:>")
# Generate *.ttl files from *.in sources,
# create the destination directory if it doesn't exists and copy needed files
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR})
configure_file (lv2/manifest.ttl.in ${PROJECT_BINARY_DIR}/manifest.ttl)
configure_file (lv2/${PROJECT_NAME}.ttl.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.ttl)
configure_file (lv2/modgui.ttl.in ${PROJECT_BINARY_DIR}/modgui.ttl)
add_custom_command(TARGET ${LV2PLUGIN_PRJ_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/third_party/stops-0.3.0"
"${PROJECT_BINARY_DIR}/stops"
)
add_custom_command(TARGET ${LV2PLUGIN_PRJ_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/lv2/modgui"
"${PROJECT_BINARY_DIR}/modgui"
)
# Installation
if (NOT MSVC)
install (DIRECTORY ${PROJECT_BINARY_DIR} DESTINATION ${LV2PLUGIN_INSTALL_DIR}
COMPONENT "lv2")
endif()
### Aeolus
# find_package(Freetype REQUIRED)
# find_package(ALSA REQUIRED)
# find_package(Threads REQUIRED)
# add_library(aeolus_x11 SHARED
# ${AEOLUS_DIR}/source/styles.cc
# ${AEOLUS_DIR}/source/mainwin.cc
# ${AEOLUS_DIR}/source/midiwin.cc
# ${AEOLUS_DIR}/source/audiowin.cc
# ${AEOLUS_DIR}/source/instrwin.cc
# ${AEOLUS_DIR}/source/editwin.cc
# ${AEOLUS_DIR}/source/midimatrix.cc
# ${AEOLUS_DIR}/source/multislider.cc
# ${AEOLUS_DIR}/source/functionwin.cc
# ${AEOLUS_DIR}/source/xiface.cc
# ${AEOLUS_DIR}/source/addsynth.cc
# )
# target_link_libraries(aeolus_x11 PRIVATE Xft X11 Freetype::Freetype clxclient)
# target_compile_definitions(aeolus_x11 PRIVATE VERSION="\\"0.9.9\\"")
# target_compile_definitions(aeolus_x11 PRIVATE LIBDIR=".")
# set_target_properties(aeolus_x11 PROPERTIES PREFIX "")
# add_executable(aeolus)
# target_sources(aeolus PRIVATE
# ${AEOLUS_DIR}/source/main.cc
# ${AEOLUS_DIR}/source/audio.cc
# ${AEOLUS_DIR}/source/model.cc
# ${AEOLUS_DIR}/source/slave.cc
# ${AEOLUS_DIR}/source/imidi.cc
# ${AEOLUS_DIR}/source/addsynth.cc
# ${AEOLUS_DIR}/source/scales.cc
# ${AEOLUS_DIR}/source/reverb.cc
# ${AEOLUS_DIR}/source/asection.cc
# ${AEOLUS_DIR}/source/division.cc
# ${AEOLUS_DIR}/source/rankwave.cc
# ${AEOLUS_DIR}/source/rngen.cc
# ${AEOLUS_DIR}/source/exp2ap.cc
# ${AEOLUS_DIR}/source/lfqueue.cc
# )
# target_link_libraries(aeolus PRIVATE zita-alsa-pcmi clthreads dl ALSA::ALSA Threads::Threads jack)
# target_compile_definitions(aeolus PRIVATE VERSION="\\"0.9.9\\"")
# target_compile_definitions(aeolus PRIVATE LIBDIR=".")