Browse Source

Fix Windows build, use portaudio pre-builds, remove curl init/destroy

tags/v0.3.0
Andrew Belt 7 years ago
parent
commit
4ded7b1748
7 changed files with 34 additions and 36 deletions
  1. +16
    -7
      Makefile
  2. +1
    -1
      Rack.rc
  3. +9
    -9
      dep/Makefile
  4. +0
    -5
      include/util/request.hpp
  5. +2
    -5
      src/plugin.cpp
  6. +4
    -0
      src/util.cpp
  7. +2
    -9
      src/util/request.cpp

+ 16
- 7
Makefile View File

@@ -33,9 +33,10 @@ ifeq ($(ARCH), win)
LDFLAGS += -static-libgcc -static-libstdc++ -lpthread \ LDFLAGS += -static-libgcc -static-libstdc++ -lpthread \
-Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \ -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
-lgdi32 -lopengl32 -lcomdlg32 -lole32 \ -lgdi32 -lopengl32 -lcomdlg32 -lole32 \
-Ldep/lib -lglew32 -lglfw3dll -ljansson -lsamplerate -lcurl -lzip -lportaudio -lportmidi
-Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lportaudio_x64 -lportmidi \
-Wl,-Bstatic -ljansson -lsamplerate
TARGET = Rack.exe TARGET = Rack.exe
# OBJECTS = Rack.res
OBJECTS = Rack.res
endif endif




@@ -80,8 +81,6 @@ ifeq ($(ARCH), lin)
cp dep/lib/libzip.so.5 dist/Rack/ cp dep/lib/libzip.so.5 dist/Rack/
cp dep/lib/libportaudio.so.2 dist/Rack/ cp dep/lib/libportaudio.so.2 dist/Rack/
cp dep/lib/libportmidi.so dist/Rack/ cp dep/lib/libportmidi.so dist/Rack/
cp dep/lib/libsamplerate.so.0 dist/Rack/
cp dep/lib/libsamplerate.so.0 dist/Rack/
endif endif
ifeq ($(ARCH), mac) ifeq ($(ARCH), mac)
mkdir -p $(BUNDLE) mkdir -p $(BUNDLE)
@@ -118,9 +117,19 @@ ifeq ($(ARCH), mac)
cp -R Rack.app dist/Rack/ cp -R Rack.app dist/Rack/
endif endif
ifeq ($(ARCH), win) ifeq ($(ARCH), win)
# TODO Copy dlls
cp Rack/*.dll dist/Rack/
cp Rack/Rack.exe dist/Rack/
cp Rack.exe dist/Rack/
cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
cp /mingw64/bin/zlib1.dll dist/Rack/
cp /mingw64/bin/libstdc++-6.dll dist/Rack/
cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
cp dep/bin/glew32.dll dist/Rack/
cp dep/bin/glfw3.dll dist/Rack/
cp dep/bin/libcurl-4.dll dist/Rack/
cp dep/bin/libjansson-4.dll dist/Rack/
cp dep/bin/libportmidi.dll dist/Rack/
cp dep/bin/libsamplerate-0.dll dist/Rack/
cp dep/bin/libzip-5.dll dist/Rack/
cp dep/bin/portaudio_x64.dll dist/Rack/
endif endif


# Fundamental # Fundamental


+ 1
- 1
Rack.rc View File

@@ -1 +1 @@
GLFW_ICON ICON res/icon.ico
GLFW_ICON ICON icon.ico

+ 9
- 9
dep/Makefile View File

@@ -93,21 +93,21 @@ $(portmidi):
$(MAKE) -C $@ $(MAKE) -C $@
$(MAKE) -C $@ install $(MAKE) -C $@ install


$(asio):
echo "For ASIO support, download and move the ASIO SDK to $@"
exit 1

$(portaudio):
ifeq ($(ARCH),win) ifeq ($(ARCH),win)
PORTAUDIO_DEPS = $(asio)
PORTAUDIO_ASIO = --with-host_os=mingw --with-winapi=wmme,asio --with-asiodir="../$(asio)"
endif

$(portaudio): $(PORTAUDIO_DEPS)
$(WGET) https://github.com/adfernandes/precompiled-portaudio-windows/raw/master/portaudio-r1891-build.zip
$(UNZIP) portaudio-r1891-build.zip
mv portaudio-r1891-build $@
cp portaudio/lib/x64/ReleaseMinDependency/portaudio_x64.lib "$(LOCAL)/lib"
cp portaudio/lib/x64/ReleaseMinDependency/portaudio_x64.dll "$(LOCAL)/bin"
cp portaudio/include/*.h "$(LOCAL)/include"
else
$(WGET) http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz $(WGET) http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
$(UNTAR) pa_stable_v190600_20161030.tgz $(UNTAR) pa_stable_v190600_20161030.tgz
cd $@ && ./configure --prefix="$(LOCAL)" $(PORTAUDIO_ASIO) cd $@ && ./configure --prefix="$(LOCAL)" $(PORTAUDIO_ASIO)
$(MAKE) -C $@ $(MAKE) -C $@
$(MAKE) -C $@ install $(MAKE) -C $@ install
endif


clean: clean:
git clean -fdxi git clean -fdxi

+ 0
- 5
include/util/request.hpp View File

@@ -11,12 +11,7 @@ enum RequestMethod {
DELETE_METHOD, DELETE_METHOD,
}; };


/** Must be called before using this API */
void requestInit();
void requestDestroy();

/** Requests a JSON API URL over HTTP(S), using the data as the query (GET) or the body (POST, etc) */ /** Requests a JSON API URL over HTTP(S), using the data as the query (GET) or the body (POST, etc) */
json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ); json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ);
/** Returns the filename, blank if unsuccessful */ /** Returns the filename, blank if unsuccessful */
bool requestDownload(std::string url, std::string filename, float *progress); bool requestDownload(std::string url, std::string filename, float *progress);


+ 2
- 5
src/plugin.cpp View File

@@ -13,7 +13,6 @@


#if ARCH_WIN #if ARCH_WIN
#include <windows.h> #include <windows.h>
#include <shellapi.h>
#include <direct.h> #include <direct.h>
#define mkdir(_dir, _perms) _mkdir(_dir) #define mkdir(_dir, _perms) _mkdir(_dir)
#else #else
@@ -56,7 +55,8 @@ static int loadPlugin(std::string slug) {
#if ARCH_WIN #if ARCH_WIN
HINSTANCE handle = LoadLibrary(path.c_str()); HINSTANCE handle = LoadLibrary(path.c_str());
if (!handle) { if (!handle) {
fprintf(stderr, "Failed to load library %s\n", path.c_str());
int error = GetLastError();
fprintf(stderr, "Failed to load library %s: %d\n", path.c_str(), error);
return -1; return -1;
} }
#elif ARCH_LIN || ARCH_MAC #elif ARCH_LIN || ARCH_MAC
@@ -92,8 +92,6 @@ static int loadPlugin(std::string slug) {
} }


void pluginInit() { void pluginInit() {
requestInit();

// Load core // Load core
// This function is defined in core.cpp // This function is defined in core.cpp
Plugin *corePlugin = init(); Plugin *corePlugin = init();
@@ -118,7 +116,6 @@ void pluginDestroy() {
delete plugin; delete plugin;
} }
gPlugins.clear(); gPlugins.clear();
requestDestroy();
} }


//////////////////// ////////////////////


+ 4
- 0
src/util.cpp View File

@@ -3,6 +3,10 @@
#include <stdarg.h> #include <stdarg.h>
#include <random> #include <random>


#if ARCH_WIN
#include <windows.h>
#include <shellapi.h>
#endif


namespace rack { namespace rack {




+ 2
- 9
src/util/request.cpp View File

@@ -13,15 +13,6 @@ static size_t writeStringCallback(char *ptr, size_t size, size_t nmemb, void *us
} }




void requestInit() {
curl_global_init(CURL_GLOBAL_NOTHING);
}

void requestDestroy() {
curl_global_cleanup();
}


json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) { json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) {
CURL *curl = curl_easy_init(); CURL *curl = curl_easy_init();
if (!curl) if (!curl)
@@ -91,7 +82,9 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) {


// Perform request // Perform request
printf("Requesting %s\n", url.c_str()); printf("Requesting %s\n", url.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
CURLcode res = curl_easy_perform(curl); CURLcode res = curl_easy_perform(curl);
printf("%d\n", res);


// Cleanup // Cleanup
if (method != GET_METHOD) if (method != GET_METHOD)


Loading…
Cancel
Save