Signed-off-by: falkTX <falktx@falktx.com>master
| @@ -6,7 +6,7 @@ | |||
| include dpf/Makefile.base.mk | |||
| all: dgl plugins gen | |||
| all: dgl plugins resources gen | |||
| # -------------------------------------------------------------- | |||
| # Check for system-wide projectM | |||
| @@ -23,6 +23,25 @@ plugins: dgl | |||
| ifneq ($(HAVE_PROJECTM),true) | |||
| resources: plugins | |||
| # LV2 fonts | |||
| install -d bin/ProM.lv2/resources/fonts | |||
| ln -sf $(CURDIR)/plugins/ProM/projectM/fonts/*.ttf bin/ProM.lv2/resources/fonts/ | |||
| # LV2 presets | |||
| install -d bin/ProM.lv2/resources/presets | |||
| ln -sf $(CURDIR)/plugins/ProM/projectM/presets/presets_* bin/ProM.lv2/resources/presets/ | |||
| ifeq ($(MACOS),true) | |||
| # TODO | |||
| else | |||
| # VST directory | |||
| install -d bin/ProM.vst | |||
| mv bin/ProM-vst$(LIB_EXT) bin/ProM.vst/ProM$(LIB_EXT) | |||
| # VST fonts | |||
| install -d bin/ProM.vst/resources/fonts | |||
| ln -sf $(CURDIR)/plugins/ProM/projectM/fonts/*.ttf bin/ProM.vst/resources/fonts/ | |||
| # VST presets | |||
| install -d bin/ProM.vst/resources/presets | |||
| ln -sf $(CURDIR)/plugins/ProM/projectM/presets/presets_* bin/ProM.vst/resources/presets/ | |||
| endif | |||
| else | |||
| resources: | |||
| endif | |||
| @@ -1 +1 @@ | |||
| Subproject commit 168e8a5333c52175a7e94016b3ef994c7b253aa9 | |||
| Subproject commit 05d91f5852f4bccfd2bce1d4d2e2b3036e29db03 | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * DISTRHO ProM Plugin | |||
| * Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2015-2021 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| @@ -24,6 +24,7 @@ | |||
| #define DISTRHO_PLUGIN_HAS_UI 1 | |||
| #define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||
| #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||
| #define DISTRHO_UI_USER_RESIZABLE 1 | |||
| // required by projectM | |||
| #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1 | |||
| @@ -19,10 +19,46 @@ | |||
| #include "libprojectM/projectM.hpp" | |||
| #ifdef DISTRHO_OS_WINDOWS | |||
| # include <shlobj.h> | |||
| #else | |||
| # include <dlfcn.h> | |||
| #endif | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------- | |||
| static String getCurrentExecutableDataDir() | |||
| { | |||
| static String datadir; | |||
| if (datadir.isNotEmpty()) | |||
| return datadir; | |||
| #ifdef DISTRHO_OS_WINDOWS | |||
| CHAR filename[MAX_PATH + 256]; | |||
| filename[0] = 0; | |||
| GetModuleFileName(nullptr, filename, sizeof(filename)); | |||
| datadir = String(filename); | |||
| #else | |||
| Dl_info info; | |||
| dladdr((void*)getCurrentExecutableDataDir, &info); | |||
| datadir = String(info.dli_fname); | |||
| bool hasSlash; | |||
| const std::size_t slashPos = datadir.rfind('/', &hasSlash); | |||
| if (hasSlash) | |||
| datadir.truncate(slashPos); | |||
| #endif | |||
| return datadir; | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| DistrhoUIProM::DistrhoUIProM() | |||
| : UI(512, 512), | |||
| fPM(nullptr), | |||
| @@ -76,6 +112,7 @@ void DistrhoUIProM::uiIdle() | |||
| void DistrhoUIProM::uiReshape(uint width, uint height) | |||
| { | |||
| #if 0 | |||
| glEnable(GL_BLEND); | |||
| glEnable(GL_LINE_SMOOTH); | |||
| glEnable(GL_POINT_SMOOTH); | |||
| @@ -99,17 +136,21 @@ void DistrhoUIProM::uiReshape(uint width, uint height) | |||
| glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | |||
| glLineStipple(2, 0xAAAA); | |||
| #endif | |||
| if (fPM == nullptr) | |||
| { | |||
| #ifdef PROJECTM_DATA_DIR | |||
| fPM = new projectM(PROJECTM_DATA_DIR "/config.inp"); | |||
| #else | |||
| const String datadir(getCurrentExecutableDataDir()); | |||
| d_stdout("ProM datadir: '%s'", datadir.buffer()); | |||
| projectM::Settings settings; | |||
| settings.presetURL = "/Users/falktx/Source/ProM/plugins/ProM/projectM/presets"; | |||
| settings.titleFontURL = "fonts/Vera.ttf"; | |||
| settings.menuFontURL = "fonts/VeraMono.ttf"; | |||
| settings.datadir = "/Users/falktx/Source/ProM/plugins/ProM/projectM"; | |||
| settings.presetURL = datadir + "/resources/presets"; | |||
| settings.titleFontURL = datadir + "/resources/fonts/Vera.ttf"; | |||
| settings.menuFontURL = datadir + "/resources/fonts/VeraMono.ttf"; | |||
| settings.datadir = datadir + "/resources"; | |||
| fPM = new projectM(settings); | |||
| #endif | |||
| } | |||
| @@ -23,6 +23,11 @@ FILES_UI = \ | |||
| HAVE_PROJECTM = $(shell pkg-config --exists libprojectM && echo true) | |||
| # -------------------------------------------------------------- | |||
| # Import base definitions | |||
| include ../../dpf/Makefile.base.mk | |||
| # -------------------------------------------------------------- | |||
| # Use local copy if needed | |||
| @@ -90,7 +95,12 @@ FILES_UI += \ | |||
| projectM/src/libprojectM/Renderer/SOIL2/image_DXT.c \ | |||
| projectM/src/libprojectM/Renderer/SOIL2/etc1_utils.c \ | |||
| projectM/src/libprojectM/Renderer/SOIL2/image_helper.c | |||
| endif | |||
| ifeq ($(WINDOWS),true) | |||
| FILES_UI += \ | |||
| projectM/msvc/dlfcn.c \ | |||
| projectM/msvc/GL/glew.c | |||
| endif # WINDOWS | |||
| endif # !HAVE_PROJECTM | |||
| # -------------------------------------------------------------- | |||
| # Do some magic | |||
| @@ -101,12 +111,27 @@ include ../../dpf/Makefile.plugins.mk | |||
| # Extra flags | |||
| ifeq ($(HAVE_PROJECTM),true) | |||
| BASE_FLAGS += -DPROJECTM_DATA_DIR='"$(shell pkg-config --variable=pkgdatadir libprojectM)"' | |||
| BASE_FLAGS += $(shell pkg-config --cflags libprojectM) | |||
| LINK_FLAGS += $(shell pkg-config --libs libprojectM) | |||
| else # HAVE_PROJECTM | |||
| # compiler macros | |||
| BASE_FLAGS += -DUSE_TEXT_MENU | |||
| ifeq ($(WINDOWS),true) | |||
| BASE_FLAGS += -DDLLEXPORT= | |||
| BASE_FLAGS += -DprojectM_FONT_TITLE='"fonts/Vera.tff"' | |||
| BASE_FLAGS += -DprojectM_FONT_MENU='"fonts/VeraMono.ttf"' | |||
| BASE_FLAGS += -DSTBI_NO_DDS | |||
| # these below do nothing | |||
| BASE_FLAGS += -DUSE_FTGL | |||
| BASE_FLAGS += -DUSE_NATIVE_GLEW | |||
| else # WINDOWS | |||
| BASE_FLAGS += -DDATADIR_PATH='"."' | |||
| endif # WINDOWS | |||
| # include dirs | |||
| BASE_FLAGS += -IprojectM/src | |||
| BASE_FLAGS += -IprojectM/src/libprojectM | |||
| @@ -115,6 +140,10 @@ BASE_FLAGS += -IprojectM/src/libprojectM/Renderer/hlslparser/src | |||
| BASE_FLAGS += -IprojectM/src/libprojectM/MilkdropPresetFactory | |||
| BASE_FLAGS += -IprojectM/src/libprojectM/NativePresetFactory | |||
| BASE_FLAGS += -IprojectM/vendor | |||
| ifeq ($(WINDOWS),true) | |||
| BASE_FLAGS += -IprojectM/msvc | |||
| endif # WINDOWS | |||
| # silence projectM warnings | |||
| BASE_FLAGS += -Wno-ignored-qualifiers | |||
| BASE_FLAGS += -Wno-implicit-fallthrough | |||
| @@ -129,7 +158,12 @@ ifeq ($(MACOS),true) | |||
| BASE_FLAGS += -Wno-constant-conversion | |||
| BASE_FLAGS += -Wno-delete-non-abstract-non-virtual-dtor | |||
| BASE_FLAGS += -Wno-mismatched-tags | |||
| endif | |||
| endif # MACOS | |||
| ifeq ($(WINDOWS),true) | |||
| BASE_FLAGS += -Wno-cast-function-type | |||
| BASE_FLAGS += -Wno-unknown-pragmas | |||
| endif # WIN32 | |||
| # openmp (optional) | |||
| ifeq ($(DISABLE_OPENMP),) | |||
| ifneq ($(MACOS),true) | |||
| @@ -137,10 +171,15 @@ CUSTOM_BUILD_FLAGS += -D_OPENMP -fopenmp | |||
| CUSTOM_LINK_FLAGS += -fopenmp | |||
| endif # MACOS | |||
| endif # DISABLE_OPENMP | |||
| # extra linker flags | |||
| ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true) | |||
| LINK_FLAGS += -ldl | |||
| endif # HAIKU_OR_MACOS_OR_WINDOWS | |||
| endif | |||
| ifeq ($(WINDOWS),true) | |||
| LINK_FLAGS += -lpsapi | |||
| endif | |||
| endif # HAVE_PROJECTM | |||
| LINK_FLAGS += -lpthread | |||
| @@ -17,7 +17,6 @@ | |||
| #pragma once | |||
| #define HAVE_ALIGNED_ALLOC 1 | |||
| #define HAVE_DLFCN_H 1 | |||
| #define HAVE_FTS_H 1 | |||
| #define HAVE_GL 1 | |||
| #define HAVE_GL_GL_H 1 | |||
| @@ -33,10 +32,15 @@ | |||
| #define HAVE_SYS_STAT_H 1 | |||
| #define HAVE_SYS_TYPES_H 1 | |||
| #define HAVE_UNISTD_H 1 | |||
| #define HAVE_WINDOWS_H 1 | |||
| #define STDC_HEADERS 1 | |||
| #define USE_THREADS 1 | |||
| #define HAVE_DLFCN_H 1 | |||
| #ifdef WIN32 | |||
| # define HAVE_WINDOWS_H 1 | |||
| #endif | |||
| // GLES stuff | |||
| /* | |||
| #define HAVE_GLES_GL_H 1 | |||