From fded93d7984e42c369c572d5b953b1afe06f8ced Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 10 May 2020 01:57:29 +0100 Subject: [PATCH 01/26] Use -fno-finite-math-only when building DGL --- Makefile.base.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.base.mk b/Makefile.base.mk index e1422c88..d8623e60 100644 --- a/Makefile.base.mk +++ b/Makefile.base.mk @@ -239,6 +239,9 @@ HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true) # --------------------------------------------------------------------------------------------------------------------- # Set Generic DGL stuff +# needed because reasons (specifically, libc broke ABI) +DGL_FLAGS = -fno-finite-math-only + ifeq ($(HAIKU),true) DGL_SYSTEM_LIBS += -lbe endif From fb3cd6372592f37b064f770adfccc02dead5f1ae Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 14 May 2020 21:40:16 +0100 Subject: [PATCH 02/26] Revert "Use -fno-finite-math-only when building DGL" This reverts commit fded93d7984e42c369c572d5b953b1afe06f8ced. --- Makefile.base.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile.base.mk b/Makefile.base.mk index d8623e60..e1422c88 100644 --- a/Makefile.base.mk +++ b/Makefile.base.mk @@ -239,9 +239,6 @@ HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true) # --------------------------------------------------------------------------------------------------------------------- # Set Generic DGL stuff -# needed because reasons (specifically, libc broke ABI) -DGL_FLAGS = -fno-finite-math-only - ifeq ($(HAIKU),true) DGL_SYSTEM_LIBS += -lbe endif From 08669d1bc30c6e971fde800eade4ca40104ba8b2 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sat, 18 Jul 2020 12:13:24 +1000 Subject: [PATCH 03/26] Link all plugins to math lib because math functions are used in part of DGL --- Makefile.plugins.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk index 7c1e5540..83cce2a8 100644 --- a/Makefile.plugins.mk +++ b/Makefile.plugins.mk @@ -98,7 +98,7 @@ DGL_FLAGS += -DDGL_EXTERNAL HAVE_DGL = true endif -DGL_LIBS += $(DGL_SYSTEM_LIBS) +DGL_LIBS += $(DGL_SYSTEM_LIBS) -lm ifneq ($(HAVE_DGL),true) dssi_ui = From 9243625aacb9fb8dd9fe4bd479b227149eb37959 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 13 Dec 2020 16:47:42 +0000 Subject: [PATCH 04/26] Small makefile tweaks --- Makefile.base.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile.base.mk b/Makefile.base.mk index e1422c88..42423ffd 100644 --- a/Makefile.base.mk +++ b/Makefile.base.mk @@ -63,6 +63,10 @@ ifneq (,$(filter arm%,$(TARGET_PROCESSOR))) CPU_ARM=true CPU_ARM_OR_AARCH64=true endif +ifneq (,$(filter arm64%,$(TARGET_PROCESSOR))) +CPU_ARM64=true +CPU_ARM_OR_AARCH64=true +endif ifneq (,$(filter aarch64%,$(TARGET_PROCESSOR))) CPU_AARCH64=true CPU_ARM_OR_AARCH64=true @@ -132,12 +136,14 @@ BASE_FLAGS = -Wall -Wextra -pipe -MD -MP BASE_OPTS = -O3 -ffast-math -fdata-sections -ffunction-sections ifeq ($(CPU_I386_OR_X86_64),true) -BASE_OPTS += -mtune=generic -msse -msse2 +BASE_OPTS += -mtune=generic -msse -msse2 -mfpmath=sse endif ifeq ($(CPU_ARM),true) +ifneq ($(CPU_ARM64),true) BASE_OPTS += -mfpu=neon-vfpv4 -mfloat-abi=hard endif +endif ifeq ($(MACOS),true) # MacOS linker flags @@ -285,6 +291,7 @@ OPENGL_LIBS = $(shell $(PKG_CONFIG) --libs gl) endif ifeq ($(MACOS),true) +OPENGL_FLAGS = -DGL_SILENCE_DEPRECATION=1 OPENGL_LIBS = -framework OpenGL endif From d710959d072382839b39eec5a8a322b1872bf231 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 27 Dec 2020 20:55:34 +0000 Subject: [PATCH 05/26] Allow to use EXE_WRAPPER as makefile option --- Makefile | 8 +++++++- utils/generate-ttl.sh | 16 ++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d16647c0..8f0281e2 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,12 @@ all: dgl examples gen # -------------------------------------------------------------- +ifneq ($(CROSS_COMPILING),true) +CAN_GENERATE_TTL = true +else ifeq ($(EXE_WRAPPER),) +CAN_GENERATE_TTL = true +endif + dgl: $(MAKE) -C dgl @@ -35,7 +41,7 @@ ifneq ($(MACOS_OR_WINDOWS),true) install -m 755 examples/ExternalUI/ExternalLauncher.sh bin/d_extui.lv2/d_extui.sh endif -ifneq ($(CROSS_COMPILING),true) +ifneq ($(CAN_GENERATE_TTL),true) gen: examples utils/lv2_ttl_generator @$(CURDIR)/utils/generate-ttl.sh ifeq ($(MACOS),true) diff --git a/utils/generate-ttl.sh b/utils/generate-ttl.sh index 7522b262..26cf663d 100755 --- a/utils/generate-ttl.sh +++ b/utils/generate-ttl.sh @@ -9,13 +9,13 @@ else exit fi -PWD="$(dirname "$0")" +PWD="$(dirname "${0}")" -if [ -f "$PWD/lv2_ttl_generator.exe" ]; then - GEN="$PWD/lv2_ttl_generator.exe" +if [ -f "${PWD}/lv2_ttl_generator.exe" ]; then + GEN="${PWD}/lv2_ttl_generator.exe" EXT=dll else - GEN="$PWD/lv2_ttl_generator" + GEN="${PWD}/lv2_ttl_generator" if [ -d /Library/Audio ]; then EXT=dylib else @@ -25,9 +25,9 @@ fi FOLDERS=`find . -type d -name \*.lv2` -for i in $FOLDERS; do - cd $i - FILE="$(ls *.$EXT | sort | head -n 1)" - "$GEN" "./$FILE" +for i in ${FOLDERS}; do + cd ${i} + FILE="$(ls *.${EXT} | sort | head -n 1)" + "${EXE_WRAPPER}" "${GEN}" "./${FILE}" cd .. done From a97a009abd44c2d93de70736a7e28298fdcbd8e2 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 27 Dec 2020 21:02:16 +0000 Subject: [PATCH 06/26] Fix last commit --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8f0281e2..e573a456 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ all: dgl examples gen ifneq ($(CROSS_COMPILING),true) CAN_GENERATE_TTL = true -else ifeq ($(EXE_WRAPPER),) +else ifneq ($(EXE_WRAPPER),) CAN_GENERATE_TTL = true endif @@ -41,7 +41,7 @@ ifneq ($(MACOS_OR_WINDOWS),true) install -m 755 examples/ExternalUI/ExternalLauncher.sh bin/d_extui.lv2/d_extui.sh endif -ifneq ($(CAN_GENERATE_TTL),true) +ifeq ($(CAN_GENERATE_TTL),true) gen: examples utils/lv2_ttl_generator @$(CURDIR)/utils/generate-ttl.sh ifeq ($(MACOS),true) From ba139eb31d5e509a98e532a580388c5aa5e66f1e Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 27 Dec 2020 21:11:18 +0000 Subject: [PATCH 07/26] Fix previous commit --- utils/generate-ttl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/generate-ttl.sh b/utils/generate-ttl.sh index 26cf663d..3e8cab1b 100755 --- a/utils/generate-ttl.sh +++ b/utils/generate-ttl.sh @@ -28,6 +28,6 @@ FOLDERS=`find . -type d -name \*.lv2` for i in ${FOLDERS}; do cd ${i} FILE="$(ls *.${EXT} | sort | head -n 1)" - "${EXE_WRAPPER}" "${GEN}" "./${FILE}" + ${EXE_WRAPPER} "${GEN}" "./${FILE}" cd .. done From 68ca91217df12cfab582cbe51e1f0d449ba25b72 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Thu, 31 Dec 2020 12:37:27 +1100 Subject: [PATCH 08/26] Make mousewheel delta independent of window size, fixes #95 --- dgl/src/ImageWidgets.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dgl/src/ImageWidgets.cpp b/dgl/src/ImageWidgets.cpp index de94ca02..94bf58a1 100644 --- a/dgl/src/ImageWidgets.cpp +++ b/dgl/src/ImageWidgets.cpp @@ -612,8 +612,9 @@ bool ImageKnob::onScroll(const ScrollEvent& ev) if (! contains(ev.pos)) return false; + const float dir = (ev.delta.getY() > 0.f) ? 1.f : -1.f; const float d = (ev.mod & kModifierControl) ? 2000.0f : 200.0f; - float value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * ev.delta.getY()); + float value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * dir); if (fUsingLog) value = _logscale(value); From 89cbdbba5320c8f8822885b510307bef0c7a428f Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 28 Feb 2021 15:41:05 +0000 Subject: [PATCH 09/26] Add FUNDING.yml Signed-off-by: falkTX --- .github/FUNDING.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..aafd6f5d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +github: falkTX +liberapay: falkTX +patreon: falkTX +custom: "https://paypal.me/falkTX" From 48db099d1fc4e754421941eecabe9379ff886ecd Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 00:32:11 +0200 Subject: [PATCH 10/26] Helpers to build plugins with CMake, and examples --- CMakeLists.txt | 23 ++ cmake/DPF-plugin.cmake | 471 +++++++++++++++++++++++++++ examples/CairoUI/CMakeLists.txt | 15 + examples/FileHandling/CMakeLists.txt | 14 + examples/Info/CMakeLists.txt | 13 + examples/Latency/CMakeLists.txt | 10 + examples/Meters/CMakeLists.txt | 13 + examples/MidiThrough/CMakeLists.txt | 10 + examples/Parameters/CMakeLists.txt | 13 + examples/States/CMakeLists.txt | 13 + 10 files changed, 595 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/DPF-plugin.cmake create mode 100644 examples/CairoUI/CMakeLists.txt create mode 100644 examples/FileHandling/CMakeLists.txt create mode 100644 examples/Info/CMakeLists.txt create mode 100644 examples/Latency/CMakeLists.txt create mode 100644 examples/Meters/CMakeLists.txt create mode 100644 examples/MidiThrough/CMakeLists.txt create mode 100644 examples/Parameters/CMakeLists.txt create mode 100644 examples/States/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..d9d11d39 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.7) + +project(DPF) + +option(DPF_EXAMPLES "Build the examples" OFF) + +set(DPF_ROOT_DIR "${PROJECT_SOURCE_DIR}" CACHE INTERNAL + "Root directory of the DISTRHO Plugin Framework.") + +list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") +include(DPF-plugin) + +if(DPF_EXAMPLES) + add_subdirectory("examples/CairoUI") + #add_subdirectory("examples/ExternalUI") + add_subdirectory("examples/FileHandling") + add_subdirectory("examples/Info") + add_subdirectory("examples/Latency") + add_subdirectory("examples/Meters") + add_subdirectory("examples/MidiThrough") + add_subdirectory("examples/Parameters") + add_subdirectory("examples/States") +endif() diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake new file mode 100644 index 00000000..3a93dec2 --- /dev/null +++ b/cmake/DPF-plugin.cmake @@ -0,0 +1,471 @@ +include(CMakeParseArguments) + +# ------------------------------------------------------------------------------ +# DPF public functions +# ------------------------------------------------------------------------------ + +# dpf_add_plugin(name ) +# ------------------------------------------------------------------------------ +# +# Add a plugin built using the DISTRHO Plugin Framework. +# +# ------------------------------------------------------------------------------ +# Created targets: +# +# `` +# static library: the common part of the plugin +# The public properties set on this target apply to both DSP and UI. +# +# `-dsp` +# static library: the DSP part of the plugin +# The public properties set on this target apply to the DSP only. +# +# `-ui` +# static library: the UI part of the plugin +# The public properties set on this target apply to the UI only. +# +# `-` for each target specified with the `TARGETS` argument. +# This is target-dependent and not intended for public use. +# +# ------------------------------------------------------------------------------ +# Arguments: +# +# `TARGETS` ... +# a list of one of more of the following target types: +# `jack`, `ladspa`, `dssi`, `lv2`, `vst` +# +# `UI_TYPE` +# the user interface type, if any: `cairo`, `opengl` +# +# `MONOLITHIC` +# build LV2 as a single binary for UI and DSP +# +# `FILES_DSP` ... +# list of sources which are part of the DSP +# +# `FILES_UI` ... +# list of sources which are part of the UI +# +# `FILES_COMMON` ... +# list of sources which are part of both DSP and UI +# +function(dpf_add_plugin NAME) + set(options MONOLITHIC) + set(oneValueArgs UI_TYPE) + set(multiValueArgs TARGETS FILES_DSP FILES_UI) + cmake_parse_arguments(_dpf_plugin "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT _dpf_plugin_UI_TYPE) + set(_dgl_library) + elseif(_dpf_plugin_UI_TYPE STREQUAL "cairo") + dpf__add_dgl_cairo() + set(_dgl_library dgl-cairo) + elseif(_dpf_plugin_UI_TYPE STREQUAL "opengl") + dpf__add_dgl_opengl() + set(_dgl_library dgl-opengl) + else() + message(FATAL_ERROR "Unrecognized UI type for plugin: ${UI_TYPE}") + endif() + + ### + dpf__ensure_sources_non_empty(_dpf_plugin_FILES_COMMON) + dpf__ensure_sources_non_empty(_dpf_plugin_FILES_DSP) + dpf__ensure_sources_non_empty(_dpf_plugin_FILES_UI) + + ### + dpf__add_static_library("${NAME}" ${_dpf_plugin_FILES_COMMON}) + target_include_directories("${NAME}" PUBLIC + "${DPF_ROOT_DIR}/distrho") + + if(_dgl_library) + # make sure that all code will see DGL_* definitions + target_link_libraries("${NAME}" PUBLIC "${_dgl_library}-definitions") + endif() + + dpf__add_static_library("${NAME}-dsp" ${_dpf_plugin_FILES_DSP}) + target_link_libraries("${NAME}-dsp" PUBLIC "${NAME}") + + if(_dgl_library) + dpf__add_static_library("${NAME}-ui" ${_dpf_plugin_FILES_UI}) + target_link_libraries("${NAME}-ui" PUBLIC "${NAME}" ${_dgl_library}) + else() + add_library("${NAME}-ui" INTERFACE) + endif() + + ### + foreach(_target ${_dpf_plugin_TARGETS}) + if(_target STREQUAL "jack") + dpf__build_jack("${NAME}" "${_dgl_library}") + elseif(_target STREQUAL "ladspa") + dpf__build_ladspa("${NAME}") + elseif(_target STREQUAL "dssi") + dpf__build_dssi("${NAME}" "${_dgl_library}") + elseif(_target STREQUAL "lv2") + dpf__build_lv2("${NAME}" "${_dgl_library}" "${_dpf_plugin_MONOLITHIC}") + elseif(_target STREQUAL "vst") + dpf__build_vst("${NAME}" "${_dgl_library}") + endif() + endforeach() +endfunction() + +# ------------------------------------------------------------------------------ +# DPF private functions (prefixed with `dpf__`) +# ------------------------------------------------------------------------------ + +# Note: The $<0:> trick is to prevent MSVC from appending the build type +# to the output directory. +# + +# dpf__build_jack +# ------------------------------------------------------------------------------ +# +# Add build rules for a JACK program. +# +function(dpf__build_jack NAME DGL_LIBRARY) + dpf__add_executable("${NAME}-jack") + dpf__add_plugin_main("${NAME}-jack" "jack") + dpf__add_ui_main("${NAME}-jack" "jack" "${DGL_LIBRARY}") + target_link_libraries("${NAME}-jack" PRIVATE "${NAME}-dsp" "${NAME}-ui") + set_target_properties("${NAME}-jack" PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/$<0:>" + OUTPUT_NAME "${NAME}") + + find_package(PkgConfig) + pkg_check_modules(JACK "jack" REQUIRED) + + target_include_directories("${NAME}-jack" PRIVATE ${JACK_INCLUDE_DIRS}) + target_link_libraries("${NAME}-jack" PRIVATE ${JACK_LIBRARIES}) + link_directories(${JACK_LIBRARY_DIRS}) +endfunction() + +# dpf__build_ladspa +# ------------------------------------------------------------------------------ +# +# Add build rules for a DSSI plugin. +# +function(dpf__build_ladspa NAME) + dpf__add_module("${NAME}-ladspa") + dpf__add_plugin_main("${NAME}-ladspa" "ladspa") + target_link_libraries("${NAME}-ladspa" PRIVATE "${NAME}-dsp") + set_target_properties("${NAME}-ladspa" PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/$<0:>" + OUTPUT_NAME "${NAME}-ladspa" + PREFIX "") +endfunction() + +# dpf__build_dssi +# ------------------------------------------------------------------------------ +# +# Add build rules for a DSSI plugin. +# +function(dpf__build_dssi NAME DGL_LIBRARY) + # -- build for DSSI + dpf__add_module("${NAME}-dssi") + dpf__add_plugin_main("${NAME}-dssi" "dssi") + target_link_libraries("${NAME}-dssi" PRIVATE "${NAME}-dsp") + set_target_properties("${NAME}-dssi" PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/$<0:>" + OUTPUT_NAME "${NAME}-dssi" + PREFIX "") + + if(DGL_LIBRARY) + dpf__add_executable("${NAME}-dssi-ui") + dpf__add_ui_main("${NAME}-dssi-ui" "dssi" "${DGL_LIBRARY}") + target_link_libraries("${NAME}-dssi-ui" PRIVATE "${NAME}-ui") + set_target_properties("${NAME}-dssi-ui" PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}-dssi/$<0:>" + OUTPUT_NAME "${NAME}_ui") + + find_package(PkgConfig) + pkg_check_modules(LIBLO "liblo" REQUIRED) + + target_include_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_INCLUDE_DIRS}) + target_link_libraries("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARIES}) + link_directories(${LIBLO_LIBRARY_DIRS}) + endif() +endfunction() + +# dpf__build_lv2 +# ------------------------------------------------------------------------------ +# +# Add build rules for a LV2 plugin. +# +function(dpf__build_lv2 NAME DGL_LIBRARY MONOLITHIC) + dpf__add_module("${NAME}-lv2") + dpf__add_plugin_main("${NAME}-lv2" "lv2") + target_link_libraries("${NAME}-lv2" PRIVATE "${NAME}-dsp") + set_target_properties("${NAME}-lv2" PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}.lv2/$<0:>" + OUTPUT_NAME "${NAME}_dsp" + PREFIX "") + + if(DGL_LIBRARY) + if(MONOLITHIC) + dpf__add_ui_main("${NAME}-lv2" "lv2" "${DGL_LIBRARY}") + target_link_libraries("${NAME}-lv2" PRIVATE "${NAME}-ui") + set_target_properties("${NAME}-lv2" PROPERTIES + OUTPUT_NAME "${NAME}") + else() + dpf__add_module("${NAME}-lv2-ui") + dpf__add_ui_main("${NAME}-lv2-ui" "lv2" "${DGL_LIBRARY}") + target_link_libraries("${NAME}-lv2-ui" PRIVATE "${NAME}-ui") + set_target_properties("${NAME}-lv2-ui" PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}.lv2/$<0:>" + OUTPUT_NAME "${NAME}_ui" + PREFIX "") + endif() + endif() + + dpf__add_lv2_ttl_generator() + add_dependencies("${NAME}-lv2" lv2_ttl_generator) + + add_custom_command(TARGET "${NAME}-lv2" POST_BUILD + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} + "$" + "$" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}.lv2") +endfunction() + +# dpf__build_vst +# ------------------------------------------------------------------------------ +# +# Add build rules for a VST plugin. +# +function(dpf__build_vst NAME DGL_LIBRARY) + dpf__add_module("${NAME}-vst") + dpf__add_plugin_main("${NAME}-vst" "vst") + dpf__add_ui_main("${NAME}-vst" "vst" "${DGL_LIBRARY}") + target_link_libraries("${NAME}-vst" PRIVATE "${NAME}-dsp" "${NAME}-ui") + set_target_properties("${NAME}-vst" PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/$<0:>" + OUTPUT_NAME "${NAME}-vst" + PREFIX "") +endfunction() + +# dpf__add_dgl_cairo +# ------------------------------------------------------------------------------ +# +# Add the Cairo variant of DGL, if not already available. +# +function(dpf__add_dgl_cairo) + if(TARGET dgl-cairo) + return() + endif() + + find_package(PkgConfig) + pkg_check_modules(CAIRO "cairo" REQUIRED) + + dpf__add_static_library(dgl-cairo EXCLUDE_FROM_ALL + "${DPF_ROOT_DIR}/dgl/src/Application.cpp" + "${DPF_ROOT_DIR}/dgl/src/Color.cpp" + "${DPF_ROOT_DIR}/dgl/src/Geometry.cpp" + "${DPF_ROOT_DIR}/dgl/src/ImageBase.cpp" + "${DPF_ROOT_DIR}/dgl/src/Resources.cpp" + "${DPF_ROOT_DIR}/dgl/src/Widget.cpp" + "${DPF_ROOT_DIR}/dgl/src/Cairo.cpp" + "${DPF_ROOT_DIR}/dgl/src/WidgetPrivateData.cpp") + if(NOT APPLE) + target_sources(dgl-cairo PRIVATE + "${DPF_ROOT_DIR}/dgl/src/Window.cpp") + else() + target_sources(dgl-cairo PRIVATE + "${DPF_ROOT_DIR}/dgl/src/Window.mm") + endif() + target_include_directories(dgl-cairo PUBLIC + "${DPF_ROOT_DIR}/dgl") + + dpf__add_dgl_system_libs() + target_link_libraries(dgl-cairo PRIVATE dgl-system-libs) + + add_library(dgl-cairo-definitions INTERFACE) + target_compile_definitions(dgl-cairo-definitions INTERFACE "DGL_CAIRO" "HAVE_CAIRO") + + target_include_directories(dgl-cairo PUBLIC ${CAIRO_INCLUDE_DIRS}) + target_link_libraries(dgl-cairo PRIVATE dgl-cairo-definitions ${CAIRO_LIBRARIES}) + link_directories(${CAIRO_LIBRARY_DIRS}) +endfunction() + +# dpf__add_dgl_opengl +# ------------------------------------------------------------------------------ +# +# Add the OpenGL variant of DGL, if not already available. +# +function(dpf__add_dgl_opengl) + if(TARGET dgl-opengl) + return() + endif() + + if(NOT OpenGL_GL_PREFERENCE) + set(OpenGL_GL_PREFERENCE "LEGACY") + endif() + + find_package(OpenGL REQUIRED) + + dpf__add_static_library(dgl-opengl EXCLUDE_FROM_ALL + "${DPF_ROOT_DIR}/dgl/src/Application.cpp" + "${DPF_ROOT_DIR}/dgl/src/Color.cpp" + "${DPF_ROOT_DIR}/dgl/src/Geometry.cpp" + "${DPF_ROOT_DIR}/dgl/src/ImageBase.cpp" + "${DPF_ROOT_DIR}/dgl/src/Resources.cpp" + "${DPF_ROOT_DIR}/dgl/src/Widget.cpp" + "${DPF_ROOT_DIR}/dgl/src/OpenGL.cpp" + "${DPF_ROOT_DIR}/dgl/src/Image.cpp" + "${DPF_ROOT_DIR}/dgl/src/ImageWidgets.cpp" + "${DPF_ROOT_DIR}/dgl/src/NanoVG.cpp" + "${DPF_ROOT_DIR}/dgl/src/WidgetPrivateData.cpp") + if(NOT APPLE) + target_sources(dgl-opengl PRIVATE + "${DPF_ROOT_DIR}/dgl/src/Window.cpp") + else() + target_sources(dgl-opengl PRIVATE + "${DPF_ROOT_DIR}/dgl/src/Window.mm") + endif() + target_include_directories(dgl-opengl PUBLIC + "${DPF_ROOT_DIR}/dgl") + + dpf__add_dgl_system_libs() + target_link_libraries(dgl-opengl PRIVATE dgl-system-libs) + + add_library(dgl-opengl-definitions INTERFACE) + target_compile_definitions(dgl-opengl-definitions INTERFACE "DGL_OPENGL" "HAVE_OPENGL") + + target_include_directories(dgl-opengl PUBLIC "${OPENGL_INCLUDE_DIR}") + target_link_libraries(dgl-opengl PRIVATE dgl-opengl-definitions "${OPENGL_gl_LIBRARY}") +endfunction() + +# dpf__add_dgl_system_libs +# ------------------------------------------------------------------------------ +# +# Find system libraries required by DGL and add them as an interface target. +# +function(dpf__add_dgl_system_libs) + if(TARGET dgl-system-libs) + return() + endif() + add_library(dgl-system-libs INTERFACE) + if(HAIKU) + target_link_libraries(dgl-system-libs INTERFACE "be") + elseif(WIN32) + target_link_libraries(dgl-system-libs INTERFACE "gdi32" "comdlg32") + elseif(APPLE) + find_library(APPLE_COCOA_FRAMEWORK "Cocoa") + target_link_libraries(dgl-system-libs INTERFACE "${APPLE_COCOA_FRAMEWORK}") + else() + find_package(X11 REQUIRED) + target_include_directories(dgl-system-libs INTERFACE "${X11_INCLUDE_DIR}") + target_link_libraries(dgl-system-libs INTERFACE "${X11_X11_LIB}") + endif() +endfunction() + +# dpf__add_executable +# ------------------------------------------------------------------------------ +# +# Adds an executable target, and set some default properties on the target. +# +function(dpf__add_executable NAME) + add_executable("${NAME}" ${ARGN}) + set_target_properties("${NAME}" PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + C_VISIBILITY_PRESET "hidden" + CXX_VISIBILITY_PRESET "hidden" + VISIBILITY_INLINES_HIDDEN TRUE) +endfunction() + +# dpf__add_module +# ------------------------------------------------------------------------------ +# +# Adds a module target, and set some default properties on the target. +# +function(dpf__add_module NAME) + add_library("${NAME}" MODULE ${ARGN}) + set_target_properties("${NAME}" PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + C_VISIBILITY_PRESET "hidden" + CXX_VISIBILITY_PRESET "hidden" + VISIBILITY_INLINES_HIDDEN TRUE) + if ((NOT WIN32 AND NOT APPLE) OR MINGW) + target_link_libraries("${NAME}" PRIVATE "-Wl,--no-undefined") + endif() +endfunction() + +# dpf__add_static_library +# ------------------------------------------------------------------------------ +# +# Adds a module target, and set some default properties on the target. +# +function(dpf__add_static_library NAME) + add_library("${NAME}" STATIC ${ARGN}) + set_target_properties("${NAME}" PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + C_VISIBILITY_PRESET "hidden" + CXX_VISIBILITY_PRESET "hidden" + VISIBILITY_INLINES_HIDDEN TRUE) +endfunction() + +# dpf__add_plugin_main +# ------------------------------------------------------------------------------ +# +# Adds plugin code to the given target. +# +function(dpf__add_plugin_main NAME TARGET) + target_sources("${NAME}" PRIVATE + "${DPF_ROOT_DIR}/distrho/DistrhoPluginMain.cpp") + dpf__add_plugin_target_definition("${NAME}" "${TARGET}") +endfunction() + +# dpf__add_ui_main +# ------------------------------------------------------------------------------ +# +# Adds UI code to the given target (only if the target has UI). +# +function(dpf__add_ui_main NAME TARGET HAS_UI) + if(HAS_UI) + target_sources("${NAME}" PRIVATE + "${DPF_ROOT_DIR}/distrho/DistrhoUIMain.cpp") + dpf__add_plugin_target_definition("${NAME}" "${TARGET}") + endif() +endfunction() + +# dpf__add_plugin_target_definition +# ------------------------------------------------------------------------------ +# +# Adds the plugins target macro definition. +# This selects which entry file is compiled according to the target type. +# +function(dpf__add_plugin_target_definition NAME TARGET) + string(TOUPPER "${TARGET}" _upperTarget) + target_compile_definitions("${NAME}" PRIVATE "DISTRHO_PLUGIN_TARGET_${_upperTarget}") +endfunction() + +# dpf__add_lv2_ttl_generator +# ------------------------------------------------------------------------------ +# +# Build the LV2 TTL generator. +# +function(dpf__add_lv2_ttl_generator) + if(TARGET lv2_ttl_generator) + return() + endif() + add_executable(lv2_ttl_generator "${DPF_ROOT_DIR}/utils/lv2-ttl-generator/lv2_ttl_generator.c") + if(NOT WINDOWS AND NOT APPLE AND NOT HAIKU) + target_link_libraries(lv2_ttl_generator "dl") + endif() +endfunction() + +# dpf__ensure_sources_non_empty +# ------------------------------------------------------------------------------ +# +# Ensure the given source list contains at least one file. +# The function appends an empty source file to the list if necessary. +# This is useful when CMake does not permit to add targets without sources. +# +function(dpf__ensure_sources_non_empty VAR) + if(NOT "" STREQUAL "${${VAR}}") + return() + endif() + set(_file "${CMAKE_CURRENT_BINARY_DIR}/_dpf_empty.cpp") + if(NOT EXISTS "${_file}") + file(WRITE "${_file}" "") + endif() + set("${VAR}" "${_file}" PARENT_SCOPE) +endfunction() diff --git a/examples/CairoUI/CMakeLists.txt b/examples/CairoUI/CMakeLists.txt new file mode 100644 index 00000000..1c98394c --- /dev/null +++ b/examples/CairoUI/CMakeLists.txt @@ -0,0 +1,15 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_cairoui + TARGETS jack ladspa dssi lv2 vst + UI_TYPE cairo + FILES_DSP + CairoExamplePlugin.cpp + FILES_UI + DemoWidgetBanner.cpp + DemoWidgetClickable.cpp + CairoExampleUI.cpp) + +target_include_directories( + d_cairoui PUBLIC ".") diff --git a/examples/FileHandling/CMakeLists.txt b/examples/FileHandling/CMakeLists.txt new file mode 100644 index 00000000..a6b1e594 --- /dev/null +++ b/examples/FileHandling/CMakeLists.txt @@ -0,0 +1,14 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_files + TARGETS jack lv2 vst + UI_TYPE opengl + FILES_DSP + FileHandlingPlugin.cpp + FILES_UI + FileHandlingUI.cpp + NanoButton.cpp) + +target_include_directories( + d_files PUBLIC ".") diff --git a/examples/Info/CMakeLists.txt b/examples/Info/CMakeLists.txt new file mode 100644 index 00000000..e92a0221 --- /dev/null +++ b/examples/Info/CMakeLists.txt @@ -0,0 +1,13 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_info + TARGETS jack lv2 vst + UI_TYPE opengl + FILES_DSP + InfoExamplePlugin.cpp + FILES_UI + InfoExampleUI.cpp) + +target_include_directories( + d_info PUBLIC ".") diff --git a/examples/Latency/CMakeLists.txt b/examples/Latency/CMakeLists.txt new file mode 100644 index 00000000..aa6183ef --- /dev/null +++ b/examples/Latency/CMakeLists.txt @@ -0,0 +1,10 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_latency + TARGETS ladspa dssi lv2 vst + FILES_DSP + LatencyExamplePlugin.cpp) + +target_include_directories( + d_latency PUBLIC ".") diff --git a/examples/Meters/CMakeLists.txt b/examples/Meters/CMakeLists.txt new file mode 100644 index 00000000..cc2062e9 --- /dev/null +++ b/examples/Meters/CMakeLists.txt @@ -0,0 +1,13 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_meters + TARGETS jack dssi lv2 vst + UI_TYPE opengl + FILES_DSP + ExamplePluginMeters.cpp + FILES_UI + ExampleUIMeters.cpp) + +target_include_directories( + d_meters PUBLIC ".") diff --git a/examples/MidiThrough/CMakeLists.txt b/examples/MidiThrough/CMakeLists.txt new file mode 100644 index 00000000..1f77d56e --- /dev/null +++ b/examples/MidiThrough/CMakeLists.txt @@ -0,0 +1,10 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_midiThrough + TARGETS jack lv2 vst + FILES_DSP + MidiThroughExamplePlugin.cpp) + +target_include_directories( + d_midiThrough PUBLIC ".") diff --git a/examples/Parameters/CMakeLists.txt b/examples/Parameters/CMakeLists.txt new file mode 100644 index 00000000..181c81c1 --- /dev/null +++ b/examples/Parameters/CMakeLists.txt @@ -0,0 +1,13 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_parameters + TARGETS jack ladspa dssi lv2 vst + UI_TYPE opengl + FILES_DSP + ExamplePluginParameters.cpp + FILES_UI + ExampleUIParameters.cpp) + +target_include_directories( + d_parameters PUBLIC ".") diff --git a/examples/States/CMakeLists.txt b/examples/States/CMakeLists.txt new file mode 100644 index 00000000..20384526 --- /dev/null +++ b/examples/States/CMakeLists.txt @@ -0,0 +1,13 @@ +# CMake file for DISTRHO Plugins # +# ------------------------------ # + +dpf_add_plugin(d_states + TARGETS jack lv2 vst + UI_TYPE opengl + FILES_DSP + ExamplePluginStates.cpp + FILES_UI + ExampleUIStates.cpp) + +target_include_directories( + d_states PUBLIC ".") From dd102f78c13d1164257e99ed91903d3e04840614 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 04:53:04 +0200 Subject: [PATCH 11/26] Add workflow for cmake --- .github/workflows/build.yml | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..25a2ce75 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: build + +on: + push: + branches: + - '*' + tags: + - '*' + pull_request: + branches: + - '*' + +env: + BUILD_TYPE: Release + +jobs: + build_for_linux: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up dependencies + run: | + sudo apt-get update && \ + sudo apt-get install \ + cmake \ + ninja-build \ + libjack-jackd2-dev \ + liblo-dev \ + libgl-dev \ + libcairo2-dev \ + libx11-dev + - name: Create Build Environment + shell: bash + working-directory: ${{runner.workspace}} + run: cmake -E make_directory build + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + cmake "$GITHUB_WORKSPACE" -G Ninja \ + -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ + -DDPF_EXAMPLES=ON + - name: Build all + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config "$BUILD_TYPE" -j 2 From a02804483534bfd83a619b57a38bb327c91fedd6 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 18:15:17 +0200 Subject: [PATCH 12/26] cmake: do not strictly require liblo and jack --- cmake/DPF-plugin.cmake | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 3a93dec2..2ca933e4 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -122,6 +122,14 @@ endfunction() # Add build rules for a JACK program. # function(dpf__build_jack NAME DGL_LIBRARY) + find_package(PkgConfig) + pkg_check_modules(JACK "jack") + if(NOT JACK_FOUND) + dpf__warn_once_only(missing_jack + "JACK is not found, skipping the `jack` plugin targets") + return() + endif() + dpf__add_executable("${NAME}-jack") dpf__add_plugin_main("${NAME}-jack" "jack") dpf__add_ui_main("${NAME}-jack" "jack" "${DGL_LIBRARY}") @@ -130,9 +138,6 @@ function(dpf__build_jack NAME DGL_LIBRARY) RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/$<0:>" OUTPUT_NAME "${NAME}") - find_package(PkgConfig) - pkg_check_modules(JACK "jack" REQUIRED) - target_include_directories("${NAME}-jack" PRIVATE ${JACK_INCLUDE_DIRS}) target_link_libraries("${NAME}-jack" PRIVATE ${JACK_LIBRARIES}) link_directories(${JACK_LIBRARY_DIRS}) @@ -159,7 +164,14 @@ endfunction() # Add build rules for a DSSI plugin. # function(dpf__build_dssi NAME DGL_LIBRARY) - # -- build for DSSI + find_package(PkgConfig) + pkg_check_modules(LIBLO "liblo") + if(NOT LIBLO_FOUND) + dpf__warn_once_only(missing_liblo + "liblo is not found, skipping the `dssi` plugin targets") + return() + endif() + dpf__add_module("${NAME}-dssi") dpf__add_plugin_main("${NAME}-dssi" "dssi") target_link_libraries("${NAME}-dssi" PRIVATE "${NAME}-dsp") @@ -176,9 +188,6 @@ function(dpf__build_dssi NAME DGL_LIBRARY) RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}-dssi/$<0:>" OUTPUT_NAME "${NAME}_ui") - find_package(PkgConfig) - pkg_check_modules(LIBLO "liblo" REQUIRED) - target_include_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_INCLUDE_DIRS}) target_link_libraries("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARIES}) link_directories(${LIBLO_LIBRARY_DIRS}) @@ -469,3 +478,16 @@ function(dpf__ensure_sources_non_empty VAR) endif() set("${VAR}" "${_file}" PARENT_SCOPE) endfunction() + +# dpf__warn_once +# ------------------------------------------------------------------------------ +# +# Prints a warning message once only. +# +function(dpf__warn_once_only TOKEN MESSAGE) + get_property(_warned GLOBAL PROPERTY "dpf__have_warned_${TOKEN}") + if(NOT _warned) + set_property(GLOBAL PROPERTY "dpf__have_warned_${TOKEN}" TRUE) + message(WARNING "${MESSAGE}") + endif() +endfunction() From 0533e2e64b98fecbbea1e7808729cb068ea980f5 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 19:05:41 +0200 Subject: [PATCH 13/26] Compatibility with cmake 3.7 --- cmake/DPF-plugin.cmake | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 2ca933e4..c277b339 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -130,7 +130,9 @@ function(dpf__build_jack NAME DGL_LIBRARY) return() endif() - dpf__add_executable("${NAME}-jack") + dpf__create_dummy_source_list(_no_srcs) + + dpf__add_executable("${NAME}-jack" ${_no_srcs}) dpf__add_plugin_main("${NAME}-jack" "jack") dpf__add_ui_main("${NAME}-jack" "jack" "${DGL_LIBRARY}") target_link_libraries("${NAME}-jack" PRIVATE "${NAME}-dsp" "${NAME}-ui") @@ -149,7 +151,9 @@ endfunction() # Add build rules for a DSSI plugin. # function(dpf__build_ladspa NAME) - dpf__add_module("${NAME}-ladspa") + dpf__create_dummy_source_list(_no_srcs) + + dpf__add_module("${NAME}-ladspa" ${_no_srcs}) dpf__add_plugin_main("${NAME}-ladspa" "ladspa") target_link_libraries("${NAME}-ladspa" PRIVATE "${NAME}-dsp") set_target_properties("${NAME}-ladspa" PROPERTIES @@ -172,7 +176,9 @@ function(dpf__build_dssi NAME DGL_LIBRARY) return() endif() - dpf__add_module("${NAME}-dssi") + dpf__create_dummy_source_list(_no_srcs) + + dpf__add_module("${NAME}-dssi" ${_no_srcs}) dpf__add_plugin_main("${NAME}-dssi" "dssi") target_link_libraries("${NAME}-dssi" PRIVATE "${NAME}-dsp") set_target_properties("${NAME}-dssi" PROPERTIES @@ -181,7 +187,7 @@ function(dpf__build_dssi NAME DGL_LIBRARY) PREFIX "") if(DGL_LIBRARY) - dpf__add_executable("${NAME}-dssi-ui") + dpf__add_executable("${NAME}-dssi-ui" ${_no_srcs}) dpf__add_ui_main("${NAME}-dssi-ui" "dssi" "${DGL_LIBRARY}") target_link_libraries("${NAME}-dssi-ui" PRIVATE "${NAME}-ui") set_target_properties("${NAME}-dssi-ui" PROPERTIES @@ -200,7 +206,9 @@ endfunction() # Add build rules for a LV2 plugin. # function(dpf__build_lv2 NAME DGL_LIBRARY MONOLITHIC) - dpf__add_module("${NAME}-lv2") + dpf__create_dummy_source_list(_no_srcs) + + dpf__add_module("${NAME}-lv2" ${_no_srcs}) dpf__add_plugin_main("${NAME}-lv2" "lv2") target_link_libraries("${NAME}-lv2" PRIVATE "${NAME}-dsp") set_target_properties("${NAME}-lv2" PROPERTIES @@ -215,7 +223,7 @@ function(dpf__build_lv2 NAME DGL_LIBRARY MONOLITHIC) set_target_properties("${NAME}-lv2" PROPERTIES OUTPUT_NAME "${NAME}") else() - dpf__add_module("${NAME}-lv2-ui") + dpf__add_module("${NAME}-lv2-ui" ${_no_srcs}) dpf__add_ui_main("${NAME}-lv2-ui" "lv2" "${DGL_LIBRARY}") target_link_libraries("${NAME}-lv2-ui" PRIVATE "${NAME}-ui") set_target_properties("${NAME}-lv2-ui" PROPERTIES @@ -241,7 +249,9 @@ endfunction() # Add build rules for a VST plugin. # function(dpf__build_vst NAME DGL_LIBRARY) - dpf__add_module("${NAME}-vst") + dpf__create_dummy_source_list(_no_srcs) + + dpf__add_module("${NAME}-vst" ${_no_srcs}) dpf__add_plugin_main("${NAME}-vst" "vst") dpf__add_ui_main("${NAME}-vst" "vst" "${DGL_LIBRARY}") target_link_libraries("${NAME}-vst" PRIVATE "${NAME}-dsp" "${NAME}-ui") @@ -479,6 +489,20 @@ function(dpf__ensure_sources_non_empty VAR) set("${VAR}" "${_file}" PARENT_SCOPE) endfunction() +# dpf__create_dummy_source_list +# ------------------------------------------------------------------------------ +# +# Create a dummy source list which is equivalent to compiling nothing. +# This is only for compatibility with older CMake versions, which refuse to add +# targets without any sources. +# +macro(dpf__create_dummy_source_list VAR) + set("${VAR}") + if(CMAKE_VERSION VERSION_LESS "3.11") + dpf__ensure_sources_non_empty("${VAR}") + endif() +endmacro() + # dpf__warn_once # ------------------------------------------------------------------------------ # From d2b4827096f3578e4be02ec6b68b715aa0007646 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 19:06:42 +0200 Subject: [PATCH 14/26] Change the dummy source file to C --- cmake/DPF-plugin.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index c277b339..4d1cd0a8 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -482,7 +482,7 @@ function(dpf__ensure_sources_non_empty VAR) if(NOT "" STREQUAL "${${VAR}}") return() endif() - set(_file "${CMAKE_CURRENT_BINARY_DIR}/_dpf_empty.cpp") + set(_file "${CMAKE_CURRENT_BINARY_DIR}/_dpf_empty.c") if(NOT EXISTS "${_file}") file(WRITE "${_file}" "") endif() From 6fc21959b7031b1241657a54a4343a5e1be5a498 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 20:39:10 +0200 Subject: [PATCH 15/26] cmake: do not build d_cairoui as ladspa --- examples/CairoUI/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/CairoUI/CMakeLists.txt b/examples/CairoUI/CMakeLists.txt index 1c98394c..9bd07f26 100644 --- a/examples/CairoUI/CMakeLists.txt +++ b/examples/CairoUI/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_cairoui - TARGETS jack ladspa dssi lv2 vst + TARGETS jack dssi lv2 vst UI_TYPE cairo FILES_DSP CairoExamplePlugin.cpp From a4d8eb903c1c2595ea88d556e7af9c686272c20b Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 20:51:17 +0200 Subject: [PATCH 16/26] cmake: make UI_TYPE default to opengl --- cmake/DPF-plugin.cmake | 28 +++++++++++++++++----------- examples/FileHandling/CMakeLists.txt | 1 - examples/Info/CMakeLists.txt | 1 - examples/Meters/CMakeLists.txt | 1 - examples/Parameters/CMakeLists.txt | 1 - examples/States/CMakeLists.txt | 1 - 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 4d1cd0a8..7425f26e 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -35,7 +35,7 @@ include(CMakeParseArguments) # `jack`, `ladspa`, `dssi`, `lv2`, `vst` # # `UI_TYPE` -# the user interface type, if any: `cairo`, `opengl` +# the user interface type: `opengl` (default), `cairo` # # `MONOLITHIC` # build LV2 as a single binary for UI and DSP @@ -45,6 +45,7 @@ include(CMakeParseArguments) # # `FILES_UI` ... # list of sources which are part of the UI +# empty indicates the plugin does not have UI # # `FILES_COMMON` ... # list of sources which are part of both DSP and UI @@ -55,16 +56,21 @@ function(dpf_add_plugin NAME) set(multiValueArgs TARGETS FILES_DSP FILES_UI) cmake_parse_arguments(_dpf_plugin "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT _dpf_plugin_UI_TYPE) - set(_dgl_library) - elseif(_dpf_plugin_UI_TYPE STREQUAL "cairo") - dpf__add_dgl_cairo() - set(_dgl_library dgl-cairo) - elseif(_dpf_plugin_UI_TYPE STREQUAL "opengl") - dpf__add_dgl_opengl() - set(_dgl_library dgl-opengl) - else() - message(FATAL_ERROR "Unrecognized UI type for plugin: ${UI_TYPE}") + if("${_dpf_plugin_UI_TYPE}" STREQUAL "") + set(_dpf_plugin_UI_TYPE "opengl") + endif() + + set(_dgl_library) + if(_dpf_plugin_FILES_UI) + if(_dpf_plugin_UI_TYPE STREQUAL "cairo") + dpf__add_dgl_cairo() + set(_dgl_library dgl-cairo) + elseif(_dpf_plugin_UI_TYPE STREQUAL "opengl") + dpf__add_dgl_opengl() + set(_dgl_library dgl-opengl) + else() + message(FATAL_ERROR "Unrecognized UI type for plugin: ${_dpf_plugin_UI_TYPE}") + endif() endif() ### diff --git a/examples/FileHandling/CMakeLists.txt b/examples/FileHandling/CMakeLists.txt index a6b1e594..56e1be22 100644 --- a/examples/FileHandling/CMakeLists.txt +++ b/examples/FileHandling/CMakeLists.txt @@ -3,7 +3,6 @@ dpf_add_plugin(d_files TARGETS jack lv2 vst - UI_TYPE opengl FILES_DSP FileHandlingPlugin.cpp FILES_UI diff --git a/examples/Info/CMakeLists.txt b/examples/Info/CMakeLists.txt index e92a0221..1650bbe5 100644 --- a/examples/Info/CMakeLists.txt +++ b/examples/Info/CMakeLists.txt @@ -3,7 +3,6 @@ dpf_add_plugin(d_info TARGETS jack lv2 vst - UI_TYPE opengl FILES_DSP InfoExamplePlugin.cpp FILES_UI diff --git a/examples/Meters/CMakeLists.txt b/examples/Meters/CMakeLists.txt index cc2062e9..f76ee769 100644 --- a/examples/Meters/CMakeLists.txt +++ b/examples/Meters/CMakeLists.txt @@ -3,7 +3,6 @@ dpf_add_plugin(d_meters TARGETS jack dssi lv2 vst - UI_TYPE opengl FILES_DSP ExamplePluginMeters.cpp FILES_UI diff --git a/examples/Parameters/CMakeLists.txt b/examples/Parameters/CMakeLists.txt index 181c81c1..7a528bc0 100644 --- a/examples/Parameters/CMakeLists.txt +++ b/examples/Parameters/CMakeLists.txt @@ -3,7 +3,6 @@ dpf_add_plugin(d_parameters TARGETS jack ladspa dssi lv2 vst - UI_TYPE opengl FILES_DSP ExamplePluginParameters.cpp FILES_UI diff --git a/examples/States/CMakeLists.txt b/examples/States/CMakeLists.txt index 20384526..4fd22895 100644 --- a/examples/States/CMakeLists.txt +++ b/examples/States/CMakeLists.txt @@ -3,7 +3,6 @@ dpf_add_plugin(d_states TARGETS jack lv2 vst - UI_TYPE opengl FILES_DSP ExamplePluginStates.cpp FILES_UI From cb7f353ffc7e5ec26726ab582939f79f54982152 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 20:52:32 +0200 Subject: [PATCH 17/26] Do not build d_latency as DSSI --- examples/Latency/CMakeLists.txt | 2 +- examples/Latency/Makefile | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/Latency/CMakeLists.txt b/examples/Latency/CMakeLists.txt index aa6183ef..235b052d 100644 --- a/examples/Latency/CMakeLists.txt +++ b/examples/Latency/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_latency - TARGETS ladspa dssi lv2 vst + TARGETS ladspa lv2 vst FILES_DSP LatencyExamplePlugin.cpp) diff --git a/examples/Latency/Makefile b/examples/Latency/Makefile index c0520530..2cac959a 100644 --- a/examples/Latency/Makefile +++ b/examples/Latency/Makefile @@ -25,7 +25,6 @@ include ../../Makefile.plugins.mk ifneq ($(MACOS_OR_WINDOWS),true) TARGETS += ladspa -TARGETS += dssi endif TARGETS += lv2_dsp From 2d50c880397639d8d939812dc1d4f14804f14c22 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 21:01:47 +0200 Subject: [PATCH 18/26] cmake: build libs+examples when configured from the DPF dir --- CMakeLists.txt | 15 ++++++++++++++- cmake/DPF-plugin.cmake | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9d11d39..3dd2d8db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,15 @@ cmake_minimum_required(VERSION 3.7) project(DPF) -option(DPF_EXAMPLES "Build the examples" OFF) +# check if we are building from this project, or are imported by another +if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + set(DPF_BUILD_FROM_HERE TRUE) +else() + set(DPF_BUILD_FROM_HERE FALSE) +endif() + +option(DPF_LIBRARIES "Build the libraries" "${DPF_BUILD_FROM_HERE}") +option(DPF_EXAMPLES "Build the examples" "${DPF_BUILD_FROM_HERE}") set(DPF_ROOT_DIR "${PROJECT_SOURCE_DIR}" CACHE INTERNAL "Root directory of the DISTRHO Plugin Framework.") @@ -10,6 +18,11 @@ set(DPF_ROOT_DIR "${PROJECT_SOURCE_DIR}" CACHE INTERNAL list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") include(DPF-plugin) +if(DPF_LIBRARIES) + dpf__add_dgl_cairo() + dpf__add_dgl_opengl() +endif() + if(DPF_EXAMPLES) add_subdirectory("examples/CairoUI") #add_subdirectory("examples/ExternalUI") diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 7425f26e..aa276bdf 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -280,7 +280,7 @@ function(dpf__add_dgl_cairo) find_package(PkgConfig) pkg_check_modules(CAIRO "cairo" REQUIRED) - dpf__add_static_library(dgl-cairo EXCLUDE_FROM_ALL + dpf__add_static_library(dgl-cairo STATIC "${DPF_ROOT_DIR}/dgl/src/Application.cpp" "${DPF_ROOT_DIR}/dgl/src/Color.cpp" "${DPF_ROOT_DIR}/dgl/src/Geometry.cpp" @@ -326,7 +326,7 @@ function(dpf__add_dgl_opengl) find_package(OpenGL REQUIRED) - dpf__add_static_library(dgl-opengl EXCLUDE_FROM_ALL + dpf__add_static_library(dgl-opengl STATIC "${DPF_ROOT_DIR}/dgl/src/Application.cpp" "${DPF_ROOT_DIR}/dgl/src/Color.cpp" "${DPF_ROOT_DIR}/dgl/src/Geometry.cpp" From c23ef7dad95b1a0bbc17c1b4d152a1bc9f9badd3 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 21:26:23 +0200 Subject: [PATCH 19/26] cmake: some changes of minor importance --- cmake/DPF-plugin.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index aa276bdf..1dd74ee4 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -110,6 +110,8 @@ function(dpf_add_plugin NAME) dpf__build_lv2("${NAME}" "${_dgl_library}" "${_dpf_plugin_MONOLITHIC}") elseif(_target STREQUAL "vst") dpf__build_vst("${NAME}" "${_dgl_library}") + else() + message(FATAL_ERROR "Unrecognized target type for plugin: ${_target}") endif() endforeach() endfunction() @@ -416,7 +418,7 @@ endfunction() # dpf__add_static_library # ------------------------------------------------------------------------------ # -# Adds a module target, and set some default properties on the target. +# Adds a static library target, and set some default properties on the target. # function(dpf__add_static_library NAME) add_library("${NAME}" STATIC ${ARGN}) From 4c0729269800ca3311d4e624f468c48ae8697499 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 22:27:16 +0200 Subject: [PATCH 20/26] cmake: add copyright notices on files --- CMakeLists.txt | 5 +++++ cmake/DPF-plugin.cmake | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dd2d8db..d4a7de15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,8 @@ +# DISTRHO Plugin Framework (DPF) +# Copyright (C) 2021 Jean Pierre Cimalando +# +# SPDX-License-Identifier: ISC + cmake_minimum_required(VERSION 3.7) project(DPF) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 1dd74ee4..70575c68 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -1,3 +1,8 @@ +# DISTRHO Plugin Framework (DPF) +# Copyright (C) 2021 Jean Pierre Cimalando +# +# SPDX-License-Identifier: ISC + include(CMakeParseArguments) # ------------------------------------------------------------------------------ From 34e19396e1a4a5a1bb37757c9665a55b8389ffe7 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 22:37:48 +0200 Subject: [PATCH 21/26] cmake: add usage documentation --- cmake/DPF-plugin.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 70575c68..8bac5f68 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -3,6 +3,33 @@ # # SPDX-License-Identifier: ISC +# ------------------------------------------------------------------------------ +# CMake support module for the DISTRHO Plugin Framework +# +# The purpose of this module is to help building music plugins easily, when the +# project uses CMake as its build system. +# +# In order to use the helpers provided by this module, a plugin author should +# add DPF as a subproject, making the function `dpf_add_plugin` available. +# The usage of this function is documented below in greater detail. +# +# Example project `CMakeLists.txt`: +# +# ``` +# cmake_minimum_required(VERSION 3.7) +# project(MyPlugin) +# +# add_subdirectory(DPF) +# +# dpf_add_plugin(MyPlugin +# TARGETS lv2 vst +# UI_TYPE opengl +# FILES_DSP +# src/MyPlugin.cpp +# FILES_UI +# src/MyUI.cpp) +# ``` + include(CMakeParseArguments) # ------------------------------------------------------------------------------ From 90c22db67a4ae19314ca7f651dc14f1c010db980 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 23:11:19 +0200 Subject: [PATCH 22/26] cmake: more documentation --- cmake/DPF-plugin.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 8bac5f68..828221f0 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -28,7 +28,14 @@ # src/MyPlugin.cpp # FILES_UI # src/MyUI.cpp) +# +# target_include_directories(MyPlugin +# PUBLIC src) # ``` +# +# Important: note that properties, such as include directories, definitions, +# and linked libraries *must* be marked with `PUBLIC` so they take effect and +# propagate into all the plugin targets. include(CMakeParseArguments) From 03d6bb148b44333bf39cbd6967c0629b8cb260f3 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 21 May 2021 23:27:29 +0200 Subject: [PATCH 23/26] cmake: rename target vst to vst2 --- cmake/DPF-plugin.cmake | 33 +++++++++++++++++----------- examples/CairoUI/CMakeLists.txt | 2 +- examples/FileHandling/CMakeLists.txt | 2 +- examples/Info/CMakeLists.txt | 2 +- examples/Latency/CMakeLists.txt | 2 +- examples/Meters/CMakeLists.txt | 2 +- examples/MidiThrough/CMakeLists.txt | 2 +- examples/Parameters/CMakeLists.txt | 2 +- examples/States/CMakeLists.txt | 2 +- 9 files changed, 28 insertions(+), 21 deletions(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 828221f0..c6b124e4 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -22,7 +22,7 @@ # add_subdirectory(DPF) # # dpf_add_plugin(MyPlugin -# TARGETS lv2 vst +# TARGETS lv2 vst2 # UI_TYPE opengl # FILES_DSP # src/MyPlugin.cpp @@ -71,7 +71,7 @@ include(CMakeParseArguments) # # `TARGETS` ... # a list of one of more of the following target types: -# `jack`, `ladspa`, `dssi`, `lv2`, `vst` +# `jack`, `ladspa`, `dssi`, `lv2`, `vst2` # # `UI_TYPE` # the user interface type: `opengl` (default), `cairo` @@ -147,8 +147,8 @@ function(dpf_add_plugin NAME) dpf__build_dssi("${NAME}" "${_dgl_library}") elseif(_target STREQUAL "lv2") dpf__build_lv2("${NAME}" "${_dgl_library}" "${_dpf_plugin_MONOLITHIC}") - elseif(_target STREQUAL "vst") - dpf__build_vst("${NAME}" "${_dgl_library}") + elseif(_target STREQUAL "vst2") + dpf__build_vst2("${NAME}" "${_dgl_library}") else() message(FATAL_ERROR "Unrecognized target type for plugin: ${_target}") endif() @@ -290,21 +290,21 @@ function(dpf__build_lv2 NAME DGL_LIBRARY MONOLITHIC) WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}.lv2") endfunction() -# dpf__build_vst +# dpf__build_vst2 # ------------------------------------------------------------------------------ # -# Add build rules for a VST plugin. +# Add build rules for a VST2 plugin. # -function(dpf__build_vst NAME DGL_LIBRARY) +function(dpf__build_vst2 NAME DGL_LIBRARY) dpf__create_dummy_source_list(_no_srcs) - dpf__add_module("${NAME}-vst" ${_no_srcs}) - dpf__add_plugin_main("${NAME}-vst" "vst") - dpf__add_ui_main("${NAME}-vst" "vst" "${DGL_LIBRARY}") - target_link_libraries("${NAME}-vst" PRIVATE "${NAME}-dsp" "${NAME}-ui") - set_target_properties("${NAME}-vst" PROPERTIES + dpf__add_module("${NAME}-vst2" ${_no_srcs}) + dpf__add_plugin_main("${NAME}-vst2" "vst2") + dpf__add_ui_main("${NAME}-vst2" "vst2" "${DGL_LIBRARY}") + target_link_libraries("${NAME}-vst2" PRIVATE "${NAME}-dsp" "${NAME}-ui") + set_target_properties("${NAME}-vst2" PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/$<0:>" - OUTPUT_NAME "${NAME}-vst" + OUTPUT_NAME "${NAME}-vst2" PREFIX "") endfunction() @@ -500,6 +500,13 @@ endfunction() # function(dpf__add_plugin_target_definition NAME TARGET) string(TOUPPER "${TARGET}" _upperTarget) + + # resolve the alias into the proper name + # the name "vst2" is new, "vst" is legacy + if(_upperTarget STREQUAL "VST2") + set(_upperTarget "VST") + endif() + target_compile_definitions("${NAME}" PRIVATE "DISTRHO_PLUGIN_TARGET_${_upperTarget}") endfunction() diff --git a/examples/CairoUI/CMakeLists.txt b/examples/CairoUI/CMakeLists.txt index 9bd07f26..580c9896 100644 --- a/examples/CairoUI/CMakeLists.txt +++ b/examples/CairoUI/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_cairoui - TARGETS jack dssi lv2 vst + TARGETS jack dssi lv2 vst2 UI_TYPE cairo FILES_DSP CairoExamplePlugin.cpp diff --git a/examples/FileHandling/CMakeLists.txt b/examples/FileHandling/CMakeLists.txt index 56e1be22..6007a260 100644 --- a/examples/FileHandling/CMakeLists.txt +++ b/examples/FileHandling/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_files - TARGETS jack lv2 vst + TARGETS jack lv2 vst2 FILES_DSP FileHandlingPlugin.cpp FILES_UI diff --git a/examples/Info/CMakeLists.txt b/examples/Info/CMakeLists.txt index 1650bbe5..9efc9620 100644 --- a/examples/Info/CMakeLists.txt +++ b/examples/Info/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_info - TARGETS jack lv2 vst + TARGETS jack lv2 vst2 FILES_DSP InfoExamplePlugin.cpp FILES_UI diff --git a/examples/Latency/CMakeLists.txt b/examples/Latency/CMakeLists.txt index 235b052d..fd0ddcb8 100644 --- a/examples/Latency/CMakeLists.txt +++ b/examples/Latency/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_latency - TARGETS ladspa lv2 vst + TARGETS ladspa lv2 vst2 FILES_DSP LatencyExamplePlugin.cpp) diff --git a/examples/Meters/CMakeLists.txt b/examples/Meters/CMakeLists.txt index f76ee769..0d7807a4 100644 --- a/examples/Meters/CMakeLists.txt +++ b/examples/Meters/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_meters - TARGETS jack dssi lv2 vst + TARGETS jack dssi lv2 vst2 FILES_DSP ExamplePluginMeters.cpp FILES_UI diff --git a/examples/MidiThrough/CMakeLists.txt b/examples/MidiThrough/CMakeLists.txt index 1f77d56e..38facaa5 100644 --- a/examples/MidiThrough/CMakeLists.txt +++ b/examples/MidiThrough/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_midiThrough - TARGETS jack lv2 vst + TARGETS jack lv2 vst2 FILES_DSP MidiThroughExamplePlugin.cpp) diff --git a/examples/Parameters/CMakeLists.txt b/examples/Parameters/CMakeLists.txt index 7a528bc0..4d1e77e9 100644 --- a/examples/Parameters/CMakeLists.txt +++ b/examples/Parameters/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_parameters - TARGETS jack ladspa dssi lv2 vst + TARGETS jack ladspa dssi lv2 vst2 FILES_DSP ExamplePluginParameters.cpp FILES_UI diff --git a/examples/States/CMakeLists.txt b/examples/States/CMakeLists.txt index 4fd22895..fdbb2f25 100644 --- a/examples/States/CMakeLists.txt +++ b/examples/States/CMakeLists.txt @@ -2,7 +2,7 @@ # ------------------------------ # dpf_add_plugin(d_states - TARGETS jack lv2 vst + TARGETS jack lv2 vst2 FILES_DSP ExamplePluginStates.cpp FILES_UI From b3dba5700df94cda126a9b7e19896ee8c8557295 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 21 May 2021 23:00:15 +0100 Subject: [PATCH 24/26] cmake: fix linking against libs in custom prefix --- cmake/DPF-plugin.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index c6b124e4..a2456ace 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -188,6 +188,7 @@ function(dpf__build_jack NAME DGL_LIBRARY) OUTPUT_NAME "${NAME}") target_include_directories("${NAME}-jack" PRIVATE ${JACK_INCLUDE_DIRS}) + target_link_directories("${NAME}-jack" PRIVATE ${JACK_LIBRARY_DIRS}) target_link_libraries("${NAME}-jack" PRIVATE ${JACK_LIBRARIES}) link_directories(${JACK_LIBRARY_DIRS}) endfunction() @@ -242,6 +243,7 @@ function(dpf__build_dssi NAME DGL_LIBRARY) OUTPUT_NAME "${NAME}_ui") target_include_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_INCLUDE_DIRS}) + target_link_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARY_DIRS}) target_link_libraries("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARIES}) link_directories(${LIBLO_LIBRARY_DIRS}) endif() @@ -347,6 +349,7 @@ function(dpf__add_dgl_cairo) target_compile_definitions(dgl-cairo-definitions INTERFACE "DGL_CAIRO" "HAVE_CAIRO") target_include_directories(dgl-cairo PUBLIC ${CAIRO_INCLUDE_DIRS}) + target_link_directories(dgl-cairo PRIVATE ${CAIRO_LIBRARY_DIRS}) target_link_libraries(dgl-cairo PRIVATE dgl-cairo-definitions ${CAIRO_LIBRARIES}) link_directories(${CAIRO_LIBRARY_DIRS}) endfunction() From 6cd2b4062d6c6c98debf2a710b36a7a691866689 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 22 May 2021 00:43:47 +0200 Subject: [PATCH 25/26] Revert "cmake: fix linking against libs in custom prefix" This reverts commit b3dba5700df94cda126a9b7e19896ee8c8557295. --- cmake/DPF-plugin.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index a2456ace..c6b124e4 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -188,7 +188,6 @@ function(dpf__build_jack NAME DGL_LIBRARY) OUTPUT_NAME "${NAME}") target_include_directories("${NAME}-jack" PRIVATE ${JACK_INCLUDE_DIRS}) - target_link_directories("${NAME}-jack" PRIVATE ${JACK_LIBRARY_DIRS}) target_link_libraries("${NAME}-jack" PRIVATE ${JACK_LIBRARIES}) link_directories(${JACK_LIBRARY_DIRS}) endfunction() @@ -243,7 +242,6 @@ function(dpf__build_dssi NAME DGL_LIBRARY) OUTPUT_NAME "${NAME}_ui") target_include_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_INCLUDE_DIRS}) - target_link_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARY_DIRS}) target_link_libraries("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARIES}) link_directories(${LIBLO_LIBRARY_DIRS}) endif() @@ -349,7 +347,6 @@ function(dpf__add_dgl_cairo) target_compile_definitions(dgl-cairo-definitions INTERFACE "DGL_CAIRO" "HAVE_CAIRO") target_include_directories(dgl-cairo PUBLIC ${CAIRO_INCLUDE_DIRS}) - target_link_directories(dgl-cairo PRIVATE ${CAIRO_LIBRARY_DIRS}) target_link_libraries(dgl-cairo PRIVATE dgl-cairo-definitions ${CAIRO_LIBRARIES}) link_directories(${CAIRO_LIBRARY_DIRS}) endfunction() From e248d6cb8a01794e4565aa0486a957073c0562b3 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 22 May 2021 00:44:49 +0200 Subject: [PATCH 26/26] Fix attempt of cmake link directories --- cmake/DPF-plugin.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index c6b124e4..dc3813ca 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -177,6 +177,8 @@ function(dpf__build_jack NAME DGL_LIBRARY) return() endif() + link_directories(${JACK_LIBRARY_DIRS}) + dpf__create_dummy_source_list(_no_srcs) dpf__add_executable("${NAME}-jack" ${_no_srcs}) @@ -189,7 +191,6 @@ function(dpf__build_jack NAME DGL_LIBRARY) target_include_directories("${NAME}-jack" PRIVATE ${JACK_INCLUDE_DIRS}) target_link_libraries("${NAME}-jack" PRIVATE ${JACK_LIBRARIES}) - link_directories(${JACK_LIBRARY_DIRS}) endfunction() # dpf__build_ladspa @@ -223,6 +224,8 @@ function(dpf__build_dssi NAME DGL_LIBRARY) return() endif() + link_directories(${LIBLO_LIBRARY_DIRS}) + dpf__create_dummy_source_list(_no_srcs) dpf__add_module("${NAME}-dssi" ${_no_srcs}) @@ -243,7 +246,6 @@ function(dpf__build_dssi NAME DGL_LIBRARY) target_include_directories("${NAME}-dssi-ui" PRIVATE ${LIBLO_INCLUDE_DIRS}) target_link_libraries("${NAME}-dssi-ui" PRIVATE ${LIBLO_LIBRARIES}) - link_directories(${LIBLO_LIBRARY_DIRS}) endif() endfunction() @@ -321,6 +323,8 @@ function(dpf__add_dgl_cairo) find_package(PkgConfig) pkg_check_modules(CAIRO "cairo" REQUIRED) + link_directories(${CAIRO_LIBRARY_DIRS}) + dpf__add_static_library(dgl-cairo STATIC "${DPF_ROOT_DIR}/dgl/src/Application.cpp" "${DPF_ROOT_DIR}/dgl/src/Color.cpp" @@ -348,7 +352,6 @@ function(dpf__add_dgl_cairo) target_include_directories(dgl-cairo PUBLIC ${CAIRO_INCLUDE_DIRS}) target_link_libraries(dgl-cairo PRIVATE dgl-cairo-definitions ${CAIRO_LIBRARIES}) - link_directories(${CAIRO_LIBRARY_DIRS}) endfunction() # dpf__add_dgl_opengl