Setting up a new project on Linux

I’ve managed to compile the the SDK fine in Linux and I can load the example in Reaper just fine. Now I’d like to figure out how to set things up to compile my own plugins. What should my folder structure look like? Something like this?

My_Root_Dir
-vst3sdk
-MyPlugins
-build  
-CMakeLists.txt

Also, I’m not sure what should be in CMakeLists.txt, I’ve got the following:

cmake_minimum_required (VERSION 3.19)
project(MYPLUG)
add_subdirectory(vst3sdk)

I’ve added some defines to the top level CMakeLists.txt file and it’s making some progress.

cmake_minimum_required (VERSION 3.19)
project(MYPLUG)
add_definitions(-D_DEBUG -DDEVELOPMENT)
add_subdirectory(vst3sdk)

However, it ultimately fails with errors:

source/vst/hosting/module_linux.cpp.o
[ 80%] Linking CXX executable /VST3Inspector/VST3Inspector
Error creating directory "/VST3Inspector/Resources".
make[2]: *** [vst3sdk/public.sdk/samples/vst-hosting/inspectorapp/CMakeFiles/VST3Inspector.dir/build.make:219: /VST3Inspector/VST3Inspector] Error 1
make[1]: *** [CMakeFiles/Makefile2:660: vst3sdk/public.sdk/samples/vst-hosting/inspectorapp/CMakeFiles/VST3Inspector.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Looks like it’s trying create a directory off the root of my harddrive. The result of a missing define I suspect. Not sure where to look.

Here's the initial output of cmake:
- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [SMTG] CMAKE_SOURCE_DIR is set to: /home/rjonkman/coding/VST_3.7.5
-- [SMTG] CMAKE_CURRENT_LIST_DIR is set to: /home/rjonkman/coding/VST_3.7.5/vst3sdk
-- [SMTG] Disable all VST3 samples
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.10.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'xcb'
--   Found xcb, version 1.14
-- Checking for module 'xcb-util'
--   Found xcb-util, version 0.4.0
-- Checking for module 'xcb-cursor'
--   Found xcb-cursor, version 0.1.1
-- Checking for module 'xcb-keysyms'
--   Found xcb-keysyms, version 0.4.0
-- Checking for module 'xcb-xkb'
--   Found xcb-xkb, version 1.14
-- Checking for module 'xkbcommon'
--   Found xkbcommon, version 0.10.0
-- Checking for module 'xkbcommon-x11'
--   Found xkbcommon-x11, version 0.10.0
-- Checking for module 'glib-2.0'
--   Found glib-2.0, version 2.64.6
-- Checking for module 'cairo'
--   Found cairo, version 1.16.0
-- Checking for modules 'pangocairo;pangoft2'
--   Found pangocairo, version 1.44.7
--   Found pangoft2, version 1.44.7
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.13.1
/home/rjonkman/coding/VST_3.7.5/vst3sdk/vstgui4/vstgui/uidescription/editing
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.2.9") 
-- Checking for module 'gtkmm-3.0'
--   Found gtkmm-3.0, version 3.24.2
-- Checking for module 'sqlite3'
--   Found sqlite3, version 3.31.1
-- [SMTG] SMTG_VSTGUI_ROOT is set to: /home/rjonkman/coding/VST_3.7.5/vst3sdk
-- Performing Test SMTG_USE_STDATOMIC_H
-- Performing Test SMTG_USE_STDATOMIC_H - Failed
-- Configuring done
-- Generating done

So I gave up on trying to compile my plugin outside of the SDK and opted to just replace the contents of AGain with my own code and modify the CMakeLists.txt file accordingly.

Compiling seems to go fine, but there’s an issue during linking.

[ 68%] Linking CXX shared module ../../../../VST3/Debug/sketchpad.vst3/Contents/x86_64-linux/sketchpad.so
The shared library does not export the required 'GetPluginFactory' functionmake[2]: *** [public.sdk/samples/vst/again/CMakeFiles/sketchpad.dir/build.make:270: VST3/Debug/sketchpad.vst3/Contents/x86_64-linux/sketchpad.so] Error 1
make[2]: *** Deleting file 'VST3/Debug/sketchpad.vst3/Contents/x86_64-linux/sketchpad.so'
make[1]: *** [CMakeFiles/Makefile2:1208: public.sdk/samples/vst/again/CMakeFiles/sketchpad.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Here’s my CMakeLists.txt file for my plugin.

cmake_minimum_required(VERSION 3.15.0)

project(af-sketchpad
    VERSION 1.0
    DESCRIPTION "SketchPad Looper (VST3)"
)

if(NOT SMTG_ADD_VSTGUI)
    return()
endif()


set(sketchpad_sources
    /home/rjonkman/OneDrive/coding/Looper/source/editor.cpp
    /home/rjonkman/OneDrive/coding/Looper/source/editor.h
    /home/rjonkman/OneDrive/coding/Looper/source/processor.cpp
    /home/rjonkman/OneDrive/coding/Looper/source/processor.h
    /home/rjonkman/OneDrive/coding/Looper/source/controller.cpp
    /home/rjonkman/OneDrive/coding/Looper/source/controller.h
    /home/rjonkman/OneDrive/coding/Looper/source/SVG_PATHS.h
    /home/rjonkman/OneDrive/coding/AF/AFControls.cpp
    /home/rjonkman/OneDrive/coding/AF/AFControlCore.cpp
    /home/rjonkman/OneDrive/coding/AF/AFDrawTools.cpp
    /home/rjonkman/OneDrive/coding/AF/AFGUIBasics.cpp
    /home/rjonkman/OneDrive/coding/AF/AFPathContainer.cpp
    /home/rjonkman/OneDrive/coding/AF/AF/helpers/AF_md5.cpp
    /home/rjonkman/OneDrive/coding/AF/AF/helpers/AF_Base64.cpp
)

set(target sketchpad)

smtg_add_vst3plugin(${target} ${sketchpad_sources})
smtg_target_configure_version_file(${target})

target_include_directories(${target}
        PUBLIC
            ${SMTG_VSTGUI_ROOT}/vstgui4
            ${SMTG_VSTGUI_ROOT}/vstgui4/vstgui
            /home/rjonkman/OneDrive/coding/AF
            /home/rjonkman/OneDrive/coding/Looper/source

    )


target_compile_features(${target}
    PUBLIC
        cxx_std_17
)

target_link_libraries(${target}
    PRIVATE
        sdk
        vstgui_support
)

Success!

I had forgotten to include my entry.cpp in the CMakeLists.txt.