Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adjustments for building juce7 as static lib
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Jul 12, 2022
1 parent b4b9135 commit 2c3ff26
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libs/juce5/meson.build
Expand Up @@ -50,7 +50,7 @@ lib_juce5 = static_library('juce5',
include_directories('.'),
include_directories('source'),
include_directories('source' / 'modules'),
include_directories('..' / 'juced' / 'source' / 'dependancies' / 'ladspa_sdk' / 'src'),
include_directories('../juced/source/dependancies/ladspa_sdk/src'),
],
cpp_args: build_flags_cpp + juce5_extra_cpp_args,
dependencies: dependencies,
Expand Down
2 changes: 1 addition & 1 deletion libs/juce6/meson.build
Expand Up @@ -58,7 +58,7 @@ lib_juce6 = static_library('juce6',
include_directories('.'),
include_directories('source'),
include_directories('source/modules'),
include_directories('..' / 'juced' / 'source' / 'dependancies' / 'ladspa_sdk' / 'src'),
include_directories('../juced/source/dependancies/ladspa_sdk/src'),
],
cpp_args: build_flags_cpp + juce6_extra_cpp_args,
dependencies: dependencies,
Expand Down
24 changes: 12 additions & 12 deletions libs/juce7/meson.build
@@ -1,7 +1,7 @@
###############################################################################

if linux_embed
juce6_srcs = [
juce7_srcs = [
'source/modules/juce_audio_basics/juce_audio_basics.cpp',
'source/modules/juce_audio_formats/juce_audio_formats.cpp',
'source/modules/juce_audio_processors/juce_audio_processors.cpp',
Expand All @@ -13,7 +13,7 @@ if linux_embed
'source/modules/juce_events/juce_events.cpp',
]
else
juce6_srcs = [
juce7_srcs = [
'source/modules/juce_audio_basics/juce_audio_basics.cpp',
'source/modules/juce_audio_formats/juce_audio_formats.cpp',
'source/modules/juce_audio_processors/juce_audio_processors.cpp',
Expand All @@ -30,45 +30,45 @@ else
]
endif

juce6_devices_srcs = [
juce7_devices_srcs = [
'source/modules/juce_audio_devices/juce_audio_devices.cpp',
]

juce6_extra_cpp_args = [
juce7_extra_cpp_args = [
'-std=gnu++14',
'-Wno-non-virtual-dtor',
]

if os_windows
if host_machine.cpu() == 'x86'
juce6_extra_cpp_args += [
juce7_extra_cpp_args += [
'-mpreferred-stack-boundary=2',
]
endif
endif

lib_juce6 = static_library('juce6',
sources: juce6_srcs,
lib_juce7 = static_library('juce7',
sources: juce7_srcs,
include_directories: [
include_directories('.'),
include_directories('source'),
include_directories('source/modules'),
include_directories('..' / 'juced' / 'source' / 'dependancies' / 'ladspa_sdk' / 'src'),
include_directories('../juced/source/dependancies/ladspa_sdk/src'),
],
cpp_args: build_flags_cpp + juce6_extra_cpp_args,
cpp_args: build_flags_cpp + juce7_extra_cpp_args,
dependencies: dependencies,
pic: true,
install: false,
)

lib_juce6_device = static_library('juce6-devices',
sources: juce6_devices_srcs,
lib_juce7_device = static_library('juce7-devices',
sources: juce7_devices_srcs,
include_directories: [
include_directories('.'),
include_directories('source'),
include_directories('source/modules'),
],
cpp_args: build_flags_cpp + juce6_extra_cpp_args + ['-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1'],
cpp_args: build_flags_cpp + juce7_extra_cpp_args + ['-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1'],
dependencies: dependencies_devices,
pic: true,
install: false,
Expand Down
35 changes: 35 additions & 0 deletions libs/lv2-ttl-generator/lv2_ttl_generator.cpp
Expand Up @@ -16,7 +16,32 @@
#define nullptr (0)
#endif

// Replicating some of the LV2 header here so that we don't have to set up any
// custom include paths for this file.
// Normally this would be a bad idea, but the LV2 API has to keep these definitions
// in order to remain backwards-compatible.

extern "C" {

typedef struct LV2_Descriptor {
const void* a;
const void* b;
const void* c;
const void* d;
const void* e;
const void* f;
const void* g;
const void* (*extension_data)(const char* uri);
} LV2_Descriptor;

typedef struct RecallFeature {
int (*doRecall)(const char*);
} RecallFeature;

}

typedef void (*TTL_Generator_Function)(const char* basename);
typedef const LV2_Descriptor* (*LV2_Descriptor_Function)(unsigned index);

int main(int argc, char* argv[])
{
Expand Down Expand Up @@ -44,8 +69,10 @@ int main(int argc, char* argv[])

#ifdef TTL_GENERATOR_WINDOWS
const TTL_Generator_Function ttlFn = (TTL_Generator_Function)GetProcAddress(handle, "lv2_generate_ttl");
const LV2_Descriptor_Function lv2Fn = (LV2_Descriptor_Function)GetProcAddress(handle, "lv2_descriptor");
#else
const TTL_Generator_Function ttlFn = (TTL_Generator_Function)dlsym(handle, "lv2_generate_ttl");
const LV2_Descriptor_Function lv2Fn = (LV2_Descriptor_Function)dlsym(handle, "lv2_descriptor");
#endif

if (ttlFn != NULL)
Expand Down Expand Up @@ -81,8 +108,16 @@ int main(int argc, char* argv[])

ttlFn(basename);
}
else if (lv2Fn != nullptr)
{
if (const LV2_Descriptor* const descriptor = lv2Fn(0))
if (const RecallFeature* const recallFeature = (const RecallFeature*)descriptor->extension_data("https://lv2-extensions.juce.com/turtle_recall"))
recallFeature->doRecall(argv[1]);
}
else
{
printf("Failed to find 'lv2_generate_ttl' function\n");
}

#ifdef TTL_GENERATOR_WINDOWS
FreeLibrary(handle);
Expand Down
4 changes: 4 additions & 0 deletions libs/meson.build
Expand Up @@ -12,4 +12,8 @@ if not (build_juce5_only or build_juce7_only)
subdir('juce6')
endif

if not (build_juce5_only or build_juce6_only)
subdir('juce7')
endif

###############################################################################
4 changes: 4 additions & 0 deletions meson.build
Expand Up @@ -321,6 +321,10 @@ if not (build_juce5_only or build_juce7_only)
subdir('ports-juce6')
endif

if not (build_juce5_only or build_juce6_only)
subdir('ports-juce7')
endif

###############################################################################
# extra files to install

Expand Down

0 comments on commit 2c3ff26

Please sign in to comment.