forked from nicklan/drmr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (81 loc) · 2.98 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
#CMake file for DrMr
cmake_minimum_required(VERSION 2.6)
project (DrMr)
set(LV2_INSTALL_DIR lib/lv2 CACHE PATH "Specifies where the LV2 libraries should be installed")
set(CMAKE_C_FLAGS "-Wall")
# Availble options
option(USE_NKNOB "Use custom NKnob widgets for gain/pan instead of Gtk sliders" ON)
SET(SAMP_ZERO_POS "0" CACHE STRING "Default sample zero position 0=top left (tl) 1=bl 2=tr 3=br")
# check for our various libraries
find_package(PkgConfig)
pkg_check_modules(LV2 REQUIRED lv2>=.0.1.0)
pkg_check_modules(SNDFILE REQUIRED sndfile>=1.0.20)
pkg_check_modules(SAMPLERATE REQUIRED samplerate>=0.1.5)
pkg_check_modules (GTK2 REQUIRED gtk+-2.0>=2.22.0)
find_package (EXPAT REQUIRED)
include_directories (${LV2_INCLUDE_DIRS} ${EXPAT_INCLUDE_DIRS} ${SNDFILE_INCLUDE_DIRS} ${SAMPLERATE_INCLUDE_DIRS} ${GTK2_INCLUDE_DIRS})
link_directories (${LV2_LIBRARY_DIRS} ${EXPAT_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS} ${GTK2_LIBRARY_DIRS})
# config libraries
add_library(drmr SHARED
drmr.c
drmr_hydrogen.c
drmr.h
drmr_hydrogen.h
)
add_library(drmr_ui SHARED
drmr_ui.c
drmr_hydrogen.c
nknob.c
drmr_hydrogen.h
nknob.h
)
set_target_properties(drmr PROPERTIES PREFIX "")
set_target_properties(drmr_ui PROPERTIES PREFIX "")
set_target_properties(drmr_ui
PROPERTIES
LINK_FLAGS "-Wl,-znodelete"
)
target_link_libraries(drmr ${LV2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m)
target_link_libraries(drmr_ui ${LV2_LIBRARIES} ${GTK2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m)
add_definitions ( -DPIC )
if (NOT USE_NKNOB)
set (ui_compile_flags "-DNO_NKNOB")
endif (NOT USE_NKNOB)
if (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4")
set (ui_compile_flags "${ui_compile_flags} -DDRMR_UI_ZERO_SAMP=${SAMP_ZERO_POS}")
else (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4")
message(WARNING "Invalid SAMP_ZERO_POS, defaulting to 0 \(top left\). Valid values are 0,1,2,3")
set (ui_compile_flags "${ui_compile_flags} -DDRMR_UI_ZERO_SAMP=0")
endif (SAMP_ZERO_POS GREATER "-1" AND SAMP_ZERO_POS LESS "4")
set_target_properties (drmr_ui
PROPERTIES
COMPILE_FLAGS ${ui_compile_flags}
)
# Custom test commands
add_executable ( htest
EXCLUDE_FROM_ALL
drmr_hydrogen.c
)
add_executable ( knobt
EXCLUDE_FROM_ALL
nknob.c
)
# config test executables
target_link_libraries(htest ${LV2_LIBRARIES} ${GTK2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m)
set_target_properties ( htest
PROPERTIES
COMPILE_FLAGS "-D_TEST_HYDROGEN_PARSER"
)
target_link_libraries(knobt ${LV2_LIBRARIES} ${GTK2_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${EXPAT_LIBRARIES} m)
set_target_properties ( knobt
PROPERTIES
COMPILE_FLAGS "-D_TEST_N_KNOB"
)
# config install
install(TARGETS drmr drmr_ui
LIBRARY
DESTINATION ${CMAKE_INSTALL_PREFIX}/${LV2_INSTALL_DIR}/drmr.lv2
)
install (FILES manifest.ttl drmr.ttl knob.png
DESTINATION ${CMAKE_INSTALL_PREFIX}/${LV2_INSTALL_DIR}/drmr.lv2
)