specify offscreen platform when using shared lib

This commit is contained in:
Brad Parker 2016-10-11 12:54:23 -04:00
parent d931cea60a
commit dbc33d64c0
3 changed files with 161 additions and 1 deletions

154
Makefile.libretro-shared Normal file
View File

@ -0,0 +1,154 @@
STATIC_LINKING := 0
AR := ar
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
TARGET_NAME := minibrowser
ifeq ($(ARCHFLAGS),)
ifeq ($(archs),ppc)
ARCHFLAGS = -arch ppc -arch ppc64
else
ARCHFLAGS = -arch i386 -arch x86_64
endif
endif
ifeq ($(platform), osx)
ifndef ($(NOUNIVERSAL))
CXXFLAGS += $(ARCHFLAGS)
LFLAGS += $(ARCHFLAGS)
endif
endif
ifeq ($(STATIC_LINKING), 1)
EXT := a
endif
ifeq ($(platform), unix)
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC -nostdlib
SHARED := -shared -Wl,--version-script=link.T
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
DEFINES := -DIOS
CXX = cc -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
CXX += -miphoneos-version-min=8.0
CXXFLAGS += -miphoneos-version-min=8.0
else
CXX += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0
endif
else ifneq (,$(findstring qnx,$(platform)))
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_vita.a
CXX = arm-vita-eabi-g++
AR = arm-vita-eabi-ar
CXXFLAGS += -Wl,-q -O3
STATIC_LINKING = 1
else
CXX = g++
TARGET := $(TARGET_NAME)_libretro.dll
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
endif
QTDIR = /usr/include/qt
CXXFLAGS += -I. -I$(QTDIR) -I$(QTDIR)/QtWebKitWidgets -I$(QTDIR)/QtWebKit -I$(QTDIR)/QtWidgets -I$(QTDIR)/QtCore -I$(QTDIR)/QtGui
CXXFLAGS += -DQT_NO_DEBUG -DQT_WEBKITWIDGETS_LIB -DQT_WEBKIT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DSHARED
CXXFLAGS += -pipe -Wall -W -D_REENTRANT
LDFLAGS += -L. -lminibrowser -lQt5PrintSupport -lQt5WebKitWidgets -lQt5WebKit -lQt5Sql -lQt5Widgets -lQt5Gui -lQt5Network -lssl -lcrypto -lQt5Core -licui18n -licuuc -licudata -lm -ldl -lrt -lpthread -lpulse -lz -lffi -llzma -lbz2 -Wl,-rpath,.
ifeq ($(platform), win)
LDFLAGS += -lws2_32
endif
ifeq ($(DEBUG), 1)
CXXFLAGS += -O0 -g
else
CXXFLAGS += -O3
endif
OBJECTS := libretro.o
#CXXFLAGS += -pedantic $(fpic)
CXXFLAGS += $(fpic)
ifneq (,$(findstring qnx,$(platform)))
CXXFLAGS += -Wc,-std=c++11
else
CXXFLAGS += -std=c++11
endif
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
endif
all: $(TARGET)
$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
$(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
endif
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
rm -f $(OBJECTS) $(TARGET)
.PHONY: clean

View File

@ -167,7 +167,13 @@ static QApplication *browserApp;
static MiniBrowser *browserWin;
static char browser_name[] = "minibrowser";
#ifdef SHARED
static char *browser_argv[] = {browser_name, "-platform", "offscreen", NULL};
#else
static char *browser_argv[] = {browser_name, NULL};
#endif
static int browser_argc = ARRAY_SIZE(browser_argv) - 1;
static uint16_t x_coord;

View File

@ -21,7 +21,7 @@
<widget class="QWebView" name="webView">
<property name="url">
<url>
<string>http://news.google.com/</string>
<string>https://www.youtube.com/watch?v=U1i1hgyjsnY</string>
</url>
</property>
</widget>