From ec6aa630857bf8bd6e9818164fe775ee02c3a5e9 Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Tue, 2 Oct 2018 02:09:29 -0400 Subject: [PATCH 1/3] submodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 85bdd2a4722..07adea5768b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "vst3sdk"] path = vst3sdk - url = https://github.com/steinbergmedia/vst3sdk.git \ No newline at end of file + url = https://github.com/steinbergmedia/vst3sdk.git From d3d845828f5f3177d401200e30a3120c08b6bc05 Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Tue, 2 Oct 2018 15:25:12 -0400 Subject: [PATCH 2/3] Get compiling on OSX --- .gitmodules | 3 + build-osx.sh | 2 +- libs/filesystem/filesystem.cpp | 114 ++++++++++++++++++++++++++++++ libs/filesystem/filesystem.h | 68 ++++++++++++++++++ package-vst.sh | 0 premake5.lua | 11 ++- src/common/SurgeStorage.h | 4 +- src/common/SurgeSynthesizerIO.cpp | 2 +- src/vst2/Vst2PluginInstance.cpp | 2 +- 9 files changed, 200 insertions(+), 6 deletions(-) mode change 100644 => 100755 build-osx.sh create mode 100644 libs/filesystem/filesystem.cpp create mode 100644 libs/filesystem/filesystem.h mode change 100644 => 100755 package-vst.sh diff --git a/.gitmodules b/.gitmodules index 07adea5768b..c1ae414044e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "vst3sdk"] path = vst3sdk url = https://github.com/steinbergmedia/vst3sdk.git +[submodule "VST_SDK_2.4"] + path = VST_SDK_2.4 + url = https://github.com/R-Tur/VST_SDK_2.4 diff --git a/build-osx.sh b/build-osx.sh old mode 100644 new mode 100755 index 061b198a469..97f072f7cd9 --- a/build-osx.sh +++ b/build-osx.sh @@ -2,4 +2,4 @@ premake5 xcode4 xcodebuild build -configuration Release -project surge-vst2.xcodeproj xcodebuild build -configuration Release -project surge-vst3.xcodeproj -xcodebuild build -configuration Release -project surge-au.xcodeproj \ No newline at end of file +xcodebuild build -configuration Release -project surge-au.xcodeproj diff --git a/libs/filesystem/filesystem.cpp b/libs/filesystem/filesystem.cpp new file mode 100644 index 00000000000..f5a3eef9045 --- /dev/null +++ b/libs/filesystem/filesystem.cpp @@ -0,0 +1,114 @@ +// +// filesystem.cpp +// surge-vst2 +// +// Created by Keith Zantow on 10/2/18. +// + +#ifdef __APPLE__ +#include "TargetConditionals.h" +#ifdef TARGET_OS_MAC + +#include "filesystem.h" + +namespace std::experimental::filesystem { + path::path(): + path("") + {} + + path::path(std::string filePath): + p(filePath) + {} + + path::operator std::string() { + return p; + } + + void path::append(std::string s) { + p.append("/"); + p.append(s); + } + + const char* path::c_str() { + return p.c_str(); + } + + std::string path::generic_string() { + return p; + } + + path path::filename() { + auto idx = this->p.find_last_of("/"); + path p(this->p.substr(idx+1)); + return p; + } + + std::string path::extension() { + auto idx = this->p.find_last_of("."); + return p.substr(idx); + } + + file::file(std::string filePath): + p(filePath) + {} + + file::operator class path() { + return p; + } + + path file::path() { + return p; + } + + bool exists(path p) { + FILE *file; + if ((file = fopen(p.p.c_str(), "r"))) + { + fclose(file); + return true; + } + return false; + } + + void create_directories(path p) { + mode_t nMode = 0733; // UNIX style permissions + int nError = 0; +#if defined(_WIN32) + nError = _mkdir(p.c_str()); // can be used on Windows +#else + nError = mkdir(p.c_str(), nMode); // can be used on non-Windows +#endif + if (nError != 0) { + // handle your error here + } + } + + bool is_directory(path p) { + DIR *dp; + bool isDir = false; + if((dp = opendir(p.c_str())) != NULL && readdir(dp) != NULL) { + isDir = true; + } + closedir(dp); + return isDir; + } + + std::vector directory_iterator(path p) { + std::vector files; + DIR *dp; + struct dirent *dirp; + if((dp = opendir(p.c_str())) == NULL) { +// std::cout << "Error(" << errno << ") opening " << p.generic_string() << std::endl; + } + + while ((dirp = readdir(dp)) != NULL) { + files.push_back(file(string(dirp->d_name))); + } + closedir(dp); + + return files; + } +} + +#endif +#endif diff --git a/libs/filesystem/filesystem.h b/libs/filesystem/filesystem.h new file mode 100644 index 00000000000..b31c411de65 --- /dev/null +++ b/libs/filesystem/filesystem.h @@ -0,0 +1,68 @@ +// +// Filesystem.h +// surge-vst2 +// +// Created by Keith Zantow on 10/2/18. +// + +#ifndef Filesystem_h +#define Filesystem_h + +#ifdef __APPLE__ +#include "TargetConditionals.h" +#ifdef TARGET_OS_MAC + +#include +#include +#include +#include +#include + +namespace std::experimental::filesystem { + class path { + public: + std::string p; + + path(); + + path(std::string filePath); + + operator std::string(); + + void append(std::string s); + + const char* c_str(); + + std::string generic_string(); + + path filename(); + + std::string extension(); + }; + + class file { + public: + path p; + + file(std::string filePath); + + operator path(); + + path path(); + }; + + bool exists(path p); + + void create_directories(path p); + + bool is_directory(path p); + + std::vector directory_iterator(path p); +} + +#endif +#else +#include +#endif + +#endif /* Filesystem_h */ diff --git a/package-vst.sh b/package-vst.sh old mode 100644 new mode 100755 diff --git a/premake5.lua b/premake5.lua index 76f84f430c7..c55be5506cc 100644 --- a/premake5.lua +++ b/premake5.lua @@ -112,6 +112,7 @@ function plugincommon() "libs/xml/tinyxml.cpp", "libs/xml/tinyxmlerror.cpp", "libs/xml/tinyxmlparser.cpp", + "libs/filesystem/filesystem.cpp", "src/common/vt_dsp/*.cpp", "src/common/thread/*.cpp", "vst3sdk/pluginterfaces/base/*.cpp", @@ -132,6 +133,12 @@ function plugincommon() "-Wno-unused-variable" } + sysincludedirs { + "src/**", + "libs/**", + "vst3sdk/vstgui4", + } + files { "src/mac/**.mm", @@ -222,6 +229,7 @@ plugincommon() files { "src/vst2/**.cpp", "src/vst2/**.h", + "VST_SDK_2.4/public.sdk/source/vst2.x/**.cpp", "vst3sdk/public.sdk/source/vst2.x/**.cpp", VSTGUI .. "plugin-bindings/aeffguieditor.cpp", } @@ -232,6 +240,7 @@ excludes { includedirs { "src/vst2", + "VST_SDK_2.4", "vst3sdk" } @@ -400,4 +409,4 @@ if (os.istarget("macosx")) then postbuildcommands { "./package-au.sh" } -end \ No newline at end of file +end diff --git a/src/common/SurgeStorage.h b/src/common/SurgeStorage.h index 443ceb4958d..e2dd6bc2f55 100644 --- a/src/common/SurgeStorage.h +++ b/src/common/SurgeStorage.h @@ -17,7 +17,7 @@ using namespace std; #endif #include -#include +#include #include #include @@ -521,4 +521,4 @@ float db_to_linear(float); float lookup_waveshape(int, float); float lookup_waveshape_warp(int, float); float envelope_rate_lpf(float); -float envelope_rate_linear(float); \ No newline at end of file +float envelope_rate_linear(float); diff --git a/src/common/SurgeSynthesizerIO.cpp b/src/common/SurgeSynthesizerIO.cpp index ae701457e23..656c802b98e 100644 --- a/src/common/SurgeSynthesizerIO.cpp +++ b/src/common/SurgeSynthesizerIO.cpp @@ -5,7 +5,7 @@ #include "DspUtilities.h" #include #include -#include +#include #include #include diff --git a/src/vst2/Vst2PluginInstance.cpp b/src/vst2/Vst2PluginInstance.cpp index 80a466e22e9..37e15efbbdc 100644 --- a/src/vst2/Vst2PluginInstance.cpp +++ b/src/vst2/Vst2PluginInstance.cpp @@ -7,7 +7,7 @@ #include "SurgeGUIEditor.h" //#include "sub3_editor2.h" #include -#include +#include "public.sdk/source/vst2.x/aeffeditor.h" #if PPC // For Carbon, use CoreServices.h instead From 43e6ae583655f1bbf1fc8b9dcde2e322ea489323 Mon Sep 17 00:00:00 2001 From: Claes Johanson Date: Sun, 7 Oct 2018 21:17:16 +0200 Subject: [PATCH 3/3] Fix build on windows --- src/common/SurgeStorage.h | 4 +++- src/common/SurgeSynthesizerIO.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/SurgeStorage.h b/src/common/SurgeStorage.h index 012231aeec4..5941edd0dff 100644 --- a/src/common/SurgeStorage.h +++ b/src/common/SurgeStorage.h @@ -19,8 +19,10 @@ using namespace std; #if __linux #include -#else +#elif __APPLE__ #include +#else +#include #endif #include diff --git a/src/common/SurgeSynthesizerIO.cpp b/src/common/SurgeSynthesizerIO.cpp index de47a68594f..ad36ae7c54a 100644 --- a/src/common/SurgeSynthesizerIO.cpp +++ b/src/common/SurgeSynthesizerIO.cpp @@ -7,8 +7,10 @@ #include #ifdef __linux__ #include -#else +#elif __APPLE__ #include +#else +#include #endif #include #include