From 428d6da406866766e05859fb6de6285173e0b431 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 27 May 2014 00:36:53 +0100 Subject: [PATCH] OSX fixing --- data/macos/build-deps.sh | 10 +++++----- data/macos/build.sh | 5 +++++ source/modules/dgl/Makefile | 20 ++++++++++++-------- source/modules/dgl/src/Window.cpp | 2 -- source/modules/dgl/src/nanovg/stb_image.c | 16 ++++++++-------- 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/data/macos/build-deps.sh b/data/macos/build-deps.sh index 48d2efd80..875d73f1b 100755 --- a/data/macos/build-deps.sh +++ b/data/macos/build-deps.sh @@ -149,8 +149,8 @@ export CXX=clang # qt5-base download if [ ! -d qtbase-opensource-src-5.3.0 ]; then -curl -O http://download.qt-project.org/official_releases/qt/5.3/5.3.0/submodules/qtbase-opensource-src-5.3.0.tar.xz -tar -xf qtbase-opensource-src-5.3.0.tar.xz +curl -L http://download.qt-project.org/official_releases/qt/5.3/5.3.0/submodules/qtbase-opensource-src-5.3.0.tar.gz -o qtbase-opensource-src-5.3.0.tar.gz +tar -xf qtbase-opensource-src-5.3.0.tar.gz fi # ------------------------------------------------------------------------------------ @@ -227,7 +227,7 @@ export QMAKESPEC=macx-clang # qt5-base download (5.2.1 for now) if [ ! -d qtbase-opensource-src-5.2.1 ]; then -curl -O http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtbase-opensource-src-5.2.1.tar.gz +curl -L http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtbase-opensource-src-5.2.1.tar.gz -o qtbase-opensource-src-5.2.1.tar.gz tar -xf qtbase-opensource-src-5.2.1.tar.gz fi @@ -257,7 +257,7 @@ fi # qt5-mac-extras if [ ! -d qtmacextras-opensource-src-5.2.1 ]; then -curl -O http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtmacextras-opensource-src-5.2.1.tar.gz +curl -L http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtmacextras-opensource-src-5.2.1.tar.gz -o qtmacextras-opensource-src-5.2.1.tar.gz tar -xf qtmacextras-opensource-src-5.2.1.tar.gz fi @@ -274,7 +274,7 @@ fi # qt5-svg if [ ! -d qtsvg-opensource-src-5.2.1 ]; then -curl -O http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtsvg-opensource-src-5.2.1.tar.gz +curl -L http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtsvg-opensource-src-5.2.1.tar.gz -o qtsvg-opensource-src-5.2.1.tar.gz tar -xf qtsvg-opensource-src-5.2.1.tar.gz fi diff --git a/data/macos/build.sh b/data/macos/build.sh index 8f0f99fc7..3167e607f 100755 --- a/data/macos/build.sh +++ b/data/macos/build.sh @@ -16,6 +16,11 @@ export CXFREEZE=/opt/carla/bin/cxfreeze # Build python stuff export PATH=/opt/carla/bin:/opt/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin export PKG_CONFIG_PATH=/opt/carla/lib/pkgconfig:/opt/carla64/lib/pkgconfig + +# clean? +# make clean + +# Build Py UI stuff make $JOBS UI RES WIDGETS # Build theme diff --git a/source/modules/dgl/Makefile b/source/modules/dgl/Makefile index 082853976..aad87faa4 100644 --- a/source/modules/dgl/Makefile +++ b/source/modules/dgl/Makefile @@ -20,8 +20,15 @@ OBJS = \ src/ImageButton.cpp.o \ src/ImageKnob.cpp.o \ src/ImageSlider.cpp.o \ - src/Widget.cpp.o \ - src/Window.cpp.o + src/ImageSwitch.cpp.o \ + src/NanoVG.cpp.o \ + src/Widget.cpp.o + +ifeq ($(MACOS),true) +OBJS += src/Window.mm.o +else +OBJS += src/Window.cpp.o +endif OBJS_posix32 = \ src/App.cpp.posix32.o \ @@ -67,12 +74,6 @@ OBJS_win64 = \ src/Widget.cpp.win64.o \ src/Window.cpp.win64.o -ifeq ($(MACOS),true) -OBJS += src/pugl/pugl_osx_extended.m.o -OBJS_posix32 += src/pugl/pugl_osx_extended.m.posix32.o -OBJS_posix64 += src/pugl/pugl_osx_extended.m.posix64.o -endif - # -------------------------------------------------------------- all: ../dgl.a @@ -133,6 +134,9 @@ win64: ../dgl.win64.a %.m.o: %.m $(CC) $< $(BUILD_C_FLAGS) -ObjC -c -o $@ +%.mm.o: %.mm + $(CXX) $< $(BUILD_CXX_FLAGS) -ObjC++ -c -o $@ + # -------------------------------------------------------------- clean: diff --git a/source/modules/dgl/src/Window.cpp b/source/modules/dgl/src/Window.cpp index 0ee57f4f2..043cee210 100644 --- a/source/modules/dgl/src/Window.cpp +++ b/source/modules/dgl/src/Window.cpp @@ -26,9 +26,7 @@ #if defined(DISTRHO_OS_WINDOWS) # include "pugl/pugl_win.cpp" #elif defined(DISTRHO_OS_MAC) -extern "C" { # include "pugl/pugl_osx.m" -} #elif defined(DISTRHO_OS_LINUX) # include # include diff --git a/source/modules/dgl/src/nanovg/stb_image.c b/source/modules/dgl/src/nanovg/stb_image.c index 1ec363b4c..d72ee6a47 100644 --- a/source/modules/dgl/src/nanovg/stb_image.c +++ b/source/modules/dgl/src/nanovg/stb_image.c @@ -2261,13 +2261,13 @@ static void init_defaults(void) int stbi_png_partial; // a quick hack to only allow decoding some of a PNG... I should implement real streaming support instead static int parse_zlib(zbuf *a, int parse_header) { - int final, type; + int final_, type; if (parse_header) if (!parse_zlib_header(a)) return 0; a->num_bits = 0; a->code_buffer = 0; do { - final = zreceive(a,1); + final_ = zreceive(a,1); type = zreceive(a,2); if (type == 0) { if (!parse_uncompressed_block(a)) return 0; @@ -2286,7 +2286,7 @@ static int parse_zlib(zbuf *a, int parse_header) } if (stbi_png_partial && a->zout - a->zout_start > 65536) break; - } while (!final); + } while (!final_); return 1; } @@ -2519,7 +2519,7 @@ static int create_png_image_raw(png *a, uint8 *raw, uint32 raw_len, int out_n, u static int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n, int interlaced) { - uint8 *final; + uint8 *final_; int p; int save; if (!interlaced) @@ -2528,7 +2528,7 @@ static int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n, int i stbi_png_partial = 0; // de-interlacing - final = (uint8 *) malloc(a->s->img_x * a->s->img_y * out_n); + final_ = (uint8 *) malloc(a->s->img_x * a->s->img_y * out_n); for (p=0; p < 7; ++p) { int xorig[] = { 0,4,0,2,0,1,0 }; int yorig[] = { 0,0,4,0,2,0,1 }; @@ -2540,19 +2540,19 @@ static int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n, int i y = (a->s->img_y - yorig[p] + yspc[p]-1) / yspc[p]; if (x && y) { if (!create_png_image_raw(a, raw, raw_len, out_n, x, y)) { - free(final); + free(final_); return 0; } for (j=0; j < y; ++j) for (i=0; i < x; ++i) - memcpy(final + (j*yspc[p]+yorig[p])*a->s->img_x*out_n + (i*xspc[p]+xorig[p])*out_n, + memcpy(final_ + (j*yspc[p]+yorig[p])*a->s->img_x*out_n + (i*xspc[p]+xorig[p])*out_n, a->out + (j*x+i)*out_n, out_n); free(a->out); raw += (x*out_n+1)*y; raw_len -= (x*out_n+1)*y; } } - a->out = final; + a->out = final_; stbi_png_partial = save; return 1;