Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WiP] Build on OSX (#3) #25

Merged
merged 4 commits into from
Oct 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "vst3sdk"]
path = vst3sdk
url = https://github.com/steinbergmedia/vst3sdk.git
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
2 changes: 1 addition & 1 deletion build-osx.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
xcodebuild build -configuration Release -project surge-au.xcodeproj
114 changes: 114 additions & 0 deletions libs/filesystem/filesystem.cpp
Original file line number Diff line number Diff line change
@@ -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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obviously not necessary...

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<file> directory_iterator(path p) {
std::vector<file> 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
68 changes: 68 additions & 0 deletions libs/filesystem/filesystem.h
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>

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<file> directory_iterator(path p);
}

#endif
#else
#include <filesystem>
#endif

#endif /* Filesystem_h */
Empty file modified package-vst.sh
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,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",
Expand All @@ -162,6 +163,12 @@ function plugincommon()
"-Wno-unused-variable"
}

sysincludedirs {
"src/**",
"libs/**",
"vst3sdk/vstgui4",
}

files
{
"src/mac/**.mm",
Expand Down Expand Up @@ -293,6 +300,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",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not actually include anything to solve VST 2 compilation, does it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kzantow how does one incorporate vstsdk2.4 and vst3sdk into the mix, they don't seem to be a part of this repo. do they require a secondary install?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git submodule init ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not perfect. unclear licensing etc. it seems that Steinb0rg has completely dropped support for VST 2, which I have no idea how the license plays out in that case. but i found some stuff to make it work, barring being taken down

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was able to find a VST2.4SDK from somewhere and am linking to it outside the repo, for now, hoping to get a Surge.vst to compile and be able to do a tracktion/pluginval run on it just to find out if it can actually work with macOSX.

VSTGUI .. "plugin-bindings/aeffguieditor.cpp",
}
Expand All @@ -303,6 +311,7 @@ excludes {

includedirs {
"src/vst2",
"VST_SDK_2.4",
"vst3sdk"
}

Expand Down
2 changes: 2 additions & 0 deletions src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ using namespace std;

#if __linux
#include <experimental/filesystem>
#elif __APPLE__
#include <filesystem.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It tries to include the filesystem from c++17 or 14 right?

#else
#include <filesystem>
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/common/SurgeSynthesizerIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <vt_dsp/vt_dsp_endian.h>
#ifdef __linux__
#include <experimental/filesystem>
#elif __APPLE__
#include <filesystem.h>
#else
#include <filesystem>
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/vst2/Vst2PluginInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "SurgeGUIEditor.h"
//#include "sub3_editor2.h"
#include <float.h>
#include <public.sdk/source/vst2.x/aeffeditor.h>
#include "public.sdk/source/vst2.x/aeffeditor.h"

#if PPC
// For Carbon, use CoreServices.h instead
Expand Down