-
Notifications
You must be signed in to change notification settings - Fork 0
/
sfizz-android.patch
111 lines (104 loc) · 5.6 KB
/
sfizz-android.patch
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
diff --git a/cmake/SfizzDeps.cmake b/cmake/SfizzDeps.cmake
index 44a87134..d81bbf0c 100644
--- a/cmake/SfizzDeps.cmake
+++ b/cmake/SfizzDeps.cmake
@@ -91,8 +91,18 @@ if(SFIZZ_USE_SNDFILE OR SFIZZ_DEMOS OR SFIZZ_DEVTOOLS OR SFIZZ_BENCHMARKS)
target_include_directories(sfizz_sndfile INTERFACE "${SNDFILE_INCLUDE_DIR}")
target_link_libraries(sfizz_sndfile INTERFACE SndFile::sndfile)
else()
+ if (ANDROID)
+ get_filename_component (LV2_INCLUDE "../../../external/lv2/" ABSOLUTE)
+ get_filename_component (SFIZZ_DEPS_DIST "../../../dependencies/sfizz-deps/dist/${CMAKE_ANDROID_ARCH_ABI}" ABSOLUTE)
+ set (ENV{PKG_CONFIG_PATH} "${SFIZZ_DEPS_DIST}/lib/pkgconfig")
+ endif (ANDROID)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SNDFILE "sndfile" REQUIRED)
+ if (ANDROID) # FIXME: it is kind of hack, we should resort to pkg-config...
+ target_include_directories(sfizz_sndfile INTERFACE ${LV2_INCLUDE} ${SFIZZ_DEPS_DIST}/include)
+ target_link_directories(sfizz_sndfile INTERFACE ${SFIZZ_DEPS_DIST}/lib)
+ target_link_libraries(sfizz_sndfile INTERFACE sndfile ogg vorbis vorbisenc vorbisfile FLAC)
+ endif (ANDROID)
target_include_directories(sfizz_sndfile INTERFACE ${SNDFILE_INCLUDE_DIRS})
if(SFIZZ_STATIC_DEPENDENCIES)
target_link_libraries(sfizz_sndfile INTERFACE ${SNDFILE_STATIC_LIBRARIES})
diff --git a/plugins/lv2/CMakeLists.txt b/plugins/lv2/CMakeLists.txt
index 48924d78..96ada60d 100644
--- a/plugins/lv2/CMakeLists.txt
+++ b/plugins/lv2/CMakeLists.txt
@@ -74,12 +74,12 @@ endif()
# <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}/Contents/Binary/$<0:>")
+set_target_properties(${LV2PLUGIN_PRJ_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/$<0:>")
if(SFIZZ_LV2_UI)
set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES PREFIX "")
set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_ui")
- set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Contents/Binary/$<0:>")
+ set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/$<0:>")
endif()
# Generate *.ttl files from *.in sources,
@@ -122,9 +122,22 @@ if(NOT MSVC)
COMPONENT "lv2"
USE_SOURCE_PERMISSIONS)
bundle_dylibs(lv2
- "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2/Contents/Binary/sfizz.so"
+ "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2/sfizz.so"
COMPONENT "lv2")
bundle_dylibs(lv2-ui
- "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2/Contents/Binary/sfizz_ui.so"
+ "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2/sfizz_ui.so"
COMPONENT "lv2")
endif()
+
+
+# Android additional copying
+
+add_custom_command(
+ TARGET ${LV2PLUGIN_PRJ_NAME}
+ POST_BUILD
+ COMMAND mkdir -p "${CMAKE_CURRENT_LIST_DIR}/../../../../app/src/main/assets/lv2"
+ COMMAND cp -R "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/../../../../app/src/main/assets/lv2/"
+ COMMAND mkdir -p "${CMAKE_CURRENT_LIST_DIR}/../../../../app/src/main/jniLibs/${CMAKE_ANDROID_ARCH_ABI}/"
+ COMMAND rm "${CMAKE_CURRENT_LIST_DIR}/../../../../app/src/main/assets/lv2/sfizz.lv2/sfizz.so"
+ COMMAND cp -R "${CMAKE_CURRENT_LIST_DIR}/../../../../external/SplendidGrandPiano" "${CMAKE_CURRENT_LIST_DIR}/../../../../app/src/main/assets/lv2/sfizz.lv2/Contents/Resources/"
+ )
diff --git a/plugins/lv2/manifest.ttl.in b/plugins/lv2/manifest.ttl.in
index 37305afd..c06d359d 100644
--- a/plugins/lv2/manifest.ttl.in
+++ b/plugins/lv2/manifest.ttl.in
@@ -9,10 +9,10 @@
<@LV2PLUGIN_URI@-multi>
a lv2:Plugin ;
- lv2:binary <Contents/Binary/@PROJECT_NAME@@CMAKE_SHARED_MODULE_SUFFIX@> ;
+ lv2:binary <@PROJECT_NAME@@CMAKE_SHARED_MODULE_SUFFIX@> ;
rdfs:seeAlso <@PROJECT_NAME@.ttl>, <controllers.ttl> .
@LV2PLUGIN_IF_ENABLE_UI@<@LV2PLUGIN_URI@#ui>
@LV2PLUGIN_IF_ENABLE_UI@ a ui:@LV2_UI_TYPE@ ;
-@LV2PLUGIN_IF_ENABLE_UI@ ui:binary <Contents/Binary/@PROJECT_NAME@_ui@CMAKE_SHARED_MODULE_SUFFIX@> ;
+@LV2PLUGIN_IF_ENABLE_UI@ ui:binary <@PROJECT_NAME@_ui@CMAKE_SHARED_MODULE_SUFFIX@> ;
@LV2PLUGIN_IF_ENABLE_UI@ rdfs:seeAlso <@PROJECT_NAME@_ui.ttl> .
diff --git a/plugins/lv2/sfizz.ttl.in b/plugins/lv2/sfizz.ttl.in
index e4c6d8b8..b44c0fe8 100644
--- a/plugins/lv2/sfizz.ttl.in
+++ b/plugins/lv2/sfizz.ttl.in
@@ -73,7 +73,7 @@ midnam:update a lv2:Feature .
<@LV2PLUGIN_URI@>
a doap:Project, lv2:Plugin, lv2:InstrumentPlugin ;
- doap:name "@LV2PLUGIN_NAME@" ;
+ doap:name "@LV2PLUGIN_NAME@-multi" ;
doap:license <https://spdx.org/licenses/@LV2PLUGIN_SPDX_LICENSE_ID@> ;
doap:maintainer [
foaf:name "@LV2PLUGIN_AUTHOR@" ;
diff --git a/plugins/lv2/sfizz_lv2_plugin.h b/plugins/lv2/sfizz_lv2_plugin.h
index e6722397..e950e35e 100644
--- a/plugins/lv2/sfizz_lv2_plugin.h
+++ b/plugins/lv2/sfizz_lv2_plugin.h
@@ -19,7 +19,8 @@
#include <mutex>
#define DEFAULT_SCALA_FILE "Contents/Resources/DefaultScale.scl"
-#define DEFAULT_SFZ_FILE "Contents/Resources/DefaultInstrument.sfz"
+#define DEFAULT_SFZ_FILE "Contents/Resources/SplendidGrandPiano/Splendid Grand Piano.sfz"
+
// This assumes that the longest path is the default sfz file; if not, change it
#define MAX_BUNDLE_PATH_SIZE (MAX_PATH_SIZE - sizeof(DEFAULT_SFZ_FILE))