forked from madronalabs/soundplane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
230 lines (171 loc) · 7.33 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
# soundplane/CMakeLists.txt
# root CMake file for soundplane project.
#
#--------------------------------------------------------------------
# set min version and deployment target -- before project
#--------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.12)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "Minimum OS X deployment version")
#--------------------------------------------------------------------
# project and version
#--------------------------------------------------------------------
project(soundplane)
set(PROJECT_NAME Soundplane)
set(SP_VERSION_MAJOR 1)
set(SP_VERSION_MINOR 8)
set(SP_VERSION_UPDATE 4)
set(SP_VERSION "${SP_VERSION_MAJOR}.${SP_VERSION_MINOR}.${SP_VERSION_UPDATE}")
if(APPLE)
set(EXECUTABLE_NAME Soundplane)
else(APPLE)
set(EXECUTABLE_NAME soundplane)
endif()
#--------------------------------------------------------------------
# Compiler flags
#--------------------------------------------------------------------
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3")
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
add_definitions(
-DDEBUG
)
endif()
#--------------------------------------------------------------------
# Preprocessor macros
#--------------------------------------------------------------------
# enable JUCE compatibility for Timers
add_compile_definitions(MADRONALIB_TIMERS_USE_JUCE)
#--------------------------------------------------------------------
# Setup paths
#--------------------------------------------------------------------
# set Juce header path(required by external/juce)
set(ML_JUCE_HEADER_PATH "${CMAKE_SOURCE_DIR}/Source")
#--------------------------------------------------------------------
# Enforce out of source build
#--------------------------------------------------------------------
if(CMAKE_BINARY_DIR EQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "Soundplane requires an out of source build")
endif()
#--------------------------------------------------------------------
# Add include directories
#--------------------------------------------------------------------
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ml-juce)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ml-juce/deprecated)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ml-juce/JuceApp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ml-juce/JuceLookAndFeel)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/juce)
# madronalib headers
# TODO Windows - use find_package?
include_directories(/usr/local/include/madronalib)
# soundplanelib headers
# TODO Windows - use find_package?
include_directories(/usr/local/include/soundplane)
# oscpack headers (TEMP)
# TODO Windows - use find_package?
include_directories(/usr/local/include/madronalib/oscpack)
include_directories(data/SoundplaneBinaryData)
#--------------------------------------------------------------------
# Add sources
#--------------------------------------------------------------------
file(GLOB SP_SOURCES "source/*.cpp")
file(GLOB SP_HEADERS "source/*.h")
list(APPEND SP_SOURCES
"data/SoundplaneBinaryData/SoundplaneBinaryData.cpp"
)
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/juce)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ml-juce)
#--------------------------------------------------------------------
# Add executable code signing and icon
#--------------------------------------------------------------------
set(ICON_FULL_PATH "data/soundplane.icns")
set(PLIST_FULL_PATH "data/Info.plist.in")
set(SP_DATA
${ICON_FULL_PATH}
${PLIST_FULL_PATH}
)
set(SP_CODE_SIGN_IDENTITY "" CACHE STRING "Code sign identity")
#--------------------------------------------------------------------
# Add executable
#--------------------------------------------------------------------
add_executable(
${EXECUTABLE_NAME}
MACOSX_BUNDLE
${SP_DATA}
${SP_SOURCES}
${SP_HEADERS})
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${ML_JUCE_DIR}")
target_include_directories(${EXECUTABLE_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/SoundplaneLib/")
set_source_files_properties(${ICON_FULL_PATH} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set_target_properties(${EXECUTABLE_NAME}
PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${SP_CODE_SIGN_IDENTITY}"
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/${PLIST_FULL_PATH}"
MACOSX_BUNDLE_ICON_FILE soundplane.icns
MACOSX_BUNDLE_GUI_IDENTIFIER "com.madronalabs.soundplane"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${SP_VERSION}"
MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}"
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES
)
#--------------------------------------------------------------------
# Link with libraries
#--------------------------------------------------------------------
# madronalib
find_library(MADRONA_LIB madrona)
target_link_libraries("${EXECUTABLE_NAME}" "${MADRONA_LIB}")
#TEMP
message("madronalib:" ${MADRONA_LIB} )
# soundplanelib
find_library(SOUNDPLANE_LIB soundplane)
target_link_libraries("${EXECUTABLE_NAME}" "${SOUNDPLANE_LIB}")
# ml-juce adapters
target_link_libraries("${EXECUTABLE_NAME}" "ml-juce")
# platform frameworks not included by ml-juce
if(APPLE)
target_link_libraries("${EXECUTABLE_NAME}" "-framework IOKit")
target_link_libraries("${EXECUTABLE_NAME}" "-framework GLUT")
else(APPLE)
#target_link_libraries("${EXECUTABLE_NAME}" ${DNSSD_LIBRARIES})
endif()
# juce
target_link_libraries("${EXECUTABLE_NAME}" juce_audio_basics)
target_link_libraries("${EXECUTABLE_NAME}" juce_audio_devices)
target_link_libraries("${EXECUTABLE_NAME}" juce_core)
target_link_libraries("${EXECUTABLE_NAME}" juce_graphics)
target_link_libraries("${EXECUTABLE_NAME}" juce_gui_basics)
target_link_libraries("${EXECUTABLE_NAME}" juce_gui_extra)
target_link_libraries("${EXECUTABLE_NAME}" juce_opengl)
#--------------------------------------------------------------------
# Install
#--------------------------------------------------------------------
if(APPLE)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION ~/Applications)
elseif(WINDOWS)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION ????)
else()
install(TARGETS ${EXECUTABLE_NAME} DESTINATION /usr/bin)
endif()
#--------------------------------------------------------------------
# Linux package generation
#--------------------------------------------------------------------
install(FILES data/59-soundplane.rules DESTINATION /lib/udev/rules.d)
install(
FILES data/postinst
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION DEBIAN)
set(PACKAGE_NAME ${PROJECT_NAME})
set(PACKAGE_VERSION "${SP_VERSION}")
set(PACKAGE_RELEASE 0)
set(PACKAGE_MAINTAINER_NAME "Randy Jones")
set(PACKAGE_MAINTAINER_EMAIL "randy@madronalabs.com")
set(PACKAGE_DESCRIPTION "Client Software for the Madrona Labs Soundplane")
set(PACKAGE_DESCRIPTION_SUMMARY "Soundplane Client")
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"libx11-6 (>= 1.6.2), libusb-1.0-0 (>= 1.0.17), libfreetype6 (>= 2.5.2), libxrandr2 (>= 1.4.2), libxinerama1 (>= 1.1.3), libxcursor1 (>= 1.1.14), libasound2 (>= 1.0.27), freeglut3 (>= 2.8.1), libavahi-compat-libdnssd1 (>= 0.6.31)")
include(CPack)
# Debian packages
include(cmake/DpkgDeb.cmake)
if(DPKG_FOUND)
add_debian_package(${PROJECT_NAME})
endif()