Skip to content

Commit

Permalink
add WITHOUT_CORE flag for cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ol committed Dec 11, 2017
1 parent fd0d223 commit 19d1e8b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ FLAGS += \
SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \
ext/nanovg/src/nanovg.c

CORE_LDFLAGS = -lrtaudio -lrtmidi

ifdef WITHOUT_CORE
SOURCES := $(filter-out src/core/%,$(SOURCES))
FLAGS += -DWITHOUT_CORE
CORE_LDFLAGS =
endif

include arch.mk

Expand All @@ -14,7 +21,7 @@ ifeq ($(ARCH), lin)
LDFLAGS += -rdynamic \
-lpthread -lGL -ldl \
$(shell pkg-config --libs gtk+-2.0) \
-Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi
-Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip $(CORE_LDFLAGS)
TARGET = Rack
endif

Expand All @@ -23,7 +30,7 @@ ifeq ($(ARCH), mac)
CXXFLAGS += -DAPPLE -stdlib=libc++
LDFLAGS += -stdlib=libc++ -lpthread -ldl \
-framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \
-Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi
-Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip $(CORE_LDFLAGS)
TARGET = Rack
BUNDLE = dist/$(TARGET).app
endif
Expand All @@ -33,7 +40,7 @@ ifeq ($(ARCH), win)
LDFLAGS += -static-libgcc -static-libstdc++ -lpthread \
-Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
-lgdi32 -lopengl32 -lcomdlg32 -lole32 \
-Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lrtaudio -lrtmidi \
-Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip $(CORE_LDFLAGS) \
-Wl,-Bstatic -ljansson -lsamplerate
TARGET = Rack.exe
OBJECTS = Rack.res
Expand Down
22 changes: 17 additions & 5 deletions dep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,31 @@ endif

.NOTPARALLEL:

ifdef WITHOUT_CORE
all: $(glew) $(glfw) $(jansson) $(libsamplerate) $(libcurl) $(libzip)
@echo ""
@echo "#######################################"
@echo "# Built dependencies successfully #"
@echo "#######################################"
@echo ""
else
all: $(glew) $(glfw) $(jansson) $(libsamplerate) $(libcurl) $(libzip) $(rtmidi) $(rtaudio)
@echo ""
@echo "#######################################"
@echo "# Built all dependencies successfully #"
@echo "#######################################"
@echo ""
endif

$(glew):
$(WGET) https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0.tgz
$(UNTAR) glew-2.1.0.tgz
$(MAKE) -C glew-2.1.0 glew.lib
# On Linux, default lib path is lib64, so change it back to lib.
$(MAKE) -C glew-2.1.0 GLEW_DEST="$(LOCAL)" LIBDIR="$(LOCAL)/lib" install
ifeq ($(SYSTEM), linux-mingw64)
rm "$(LOCAL)/lib/libglew32.a" # broken file shadows the dll
endif

$(glfw):
cd glfw && $(CMAKE) . \
Expand All @@ -95,21 +107,21 @@ $(glfw):
$(jansson):
$(WGET) http://www.digip.org/jansson/releases/jansson-2.10.tar.gz
$(UNTAR) jansson-2.10.tar.gz
cd jansson-2.10 && ./configure --prefix="$(LOCAL)"
cd jansson-2.10 && ./configure $(CFGFLAGS) --prefix="$(LOCAL)"
$(MAKE) -C jansson-2.10
$(MAKE) -C jansson-2.10 install

$(libsamplerate):
$(WGET) http://www.mega-nerd.com/SRC/libsamplerate-0.1.9.tar.gz
$(UNTAR) libsamplerate-0.1.9.tar.gz
cd libsamplerate-0.1.9 && ./configure --prefix="$(LOCAL)" --disable-fftw --disable-sndfile
cd libsamplerate-0.1.9 && ./configure $(CFGFLAGS) --prefix="$(LOCAL)" --disable-fftw --disable-sndfile
$(MAKE) -C libsamplerate-0.1.9/src
$(MAKE) -C libsamplerate-0.1.9/src install

$(libcurl):
$(WGET) https://github.com/curl/curl/releases/download/curl-7_56_0/curl-7.56.0.tar.gz
$(UNTAR) curl-7.56.0.tar.gz
cd curl-7.56.0 && ./configure --prefix="$(LOCAL)" \
cd curl-7.56.0 && ./configure $(CFGFLAGS) --prefix="$(LOCAL)" \
--disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual \
--without-zlib --without-ssl --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2
$(MAKE) -C curl-7.56.0
Expand All @@ -118,14 +130,14 @@ $(libcurl):
$(libzip):
$(WGET) https://nih.at/libzip/libzip-1.2.0.tar.gz
$(UNTAR) libzip-1.2.0.tar.gz
cd libzip-1.2.0 && ./configure --prefix="$(LOCAL)"
cd libzip-1.2.0 && ./configure $(CFGFLAGS) --prefix="$(LOCAL)"
$(MAKE) -C libzip-1.2.0
$(MAKE) -C libzip-1.2.0 install

$(rtmidi):
$(WGET) http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-3.0.0.tar.gz
$(UNTAR) rtmidi-3.0.0.tar.gz
cd rtmidi-3.0.0 && ./configure --prefix="$(LOCAL)"
cd rtmidi-3.0.0 && ./configure $(CFGFLAGS) --prefix="$(LOCAL)"
$(MAKE) -C rtmidi-3.0.0
$(MAKE) -C rtmidi-3.0.0 install

Expand Down
4 changes: 2 additions & 2 deletions src/asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#endif

#if ARCH_WIN
#include <Windows.h>
#include <Shlobj.h>
#include <windows.h>
#include <shlobj.h>
#endif

#if ARCH_LIN
Expand Down
3 changes: 3 additions & 0 deletions src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,14 @@ static void refreshPurchase(json_t *pluginJ) {

void pluginInit() {
tagsInit();

#ifndef WITHOUT_CORE
// Load core
// This function is defined in core.cpp
Plugin *coreManufacturer = new Plugin();
init(coreManufacturer);
gPlugins.push_back(coreManufacturer);
#endif

// Load plugins from global directory
std::string globalPlugins = assetGlobal("plugins");
Expand Down

0 comments on commit 19d1e8b

Please sign in to comment.