forked from surge-synthesizer/surge
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request surge-synthesizer#25 from kzantow/build-on-osx
[WiP] Build on OSX (surge-synthesizer#3)
- Loading branch information
Showing
9 changed files
with
201 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters