Skip to content

Commit

Permalink
aggiunto il supporto alle QT5.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Sep 26, 2015
1 parent 70345c2 commit 1df29f9
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 39 deletions.
94 changes: 69 additions & 25 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ AC_ARG_WITH([sdl-include], AS_HELP_STRING([--with-sdl-include=@<:@PATH@:>@], [Fo
AC_ARG_WITH([sdl-lib], AS_HELP_STRING([--with-sdl-lib=@<:@PATH@:>@], [Force path for SDL libs]), [path_sdl_lib=${with_sdl_lib}], [path_sdl_lib=no])
AC_ARG_WITH([lib7zip-precomp], AS_HELP_STRING([--with-lib7zip-precomp=@<:@PATH@:>@], [Use precompiled Lib7zip located in @<:@PATH@:>@]), [path_7zip_lib=${with_lib7zip_precomp}], [path_7zip_lib=no])

AC_ARG_ENABLE([qt5], AS_HELP_STRING([--enable-qt5], [Use QT5 instead of QT4]), [HAVE_QT5=yes], [HAVE_QT5=no])

TOP_SRCDIR="$srcdir"
AS_CASE(["${TOP_SRCDIR}"],
[[\/]*],[
Expand Down Expand Up @@ -89,6 +91,7 @@ AS_CASE(["$host_os"],

AM_CONDITIONAL(LINUX, test "x$linux" = xyes)
AM_CONDITIONAL(WINDOWS, test "x$windows" = xyes)
AM_CONDITIONAL(ENAB_QT5, test "x$enable_qt5" = xyes)
AM_CONDITIONAL(WITH_D3D9, test "x$with_d3d9" = xyes)
AM_CONDITIONAL(WITH_OPENGL, test "x$with_opengl" = xyes)
AM_CONDITIONAL(PRECOMP_QT, test "x$path_qt_inc" != xno -a "x$path_qt_inc" != x -o \
Expand Down Expand Up @@ -157,8 +160,7 @@ AM_COND_IF([PRECOMP_QT],[
AS_IF([test "x$path_qt_inc" = xno -o "x$path_qt_inc" = x],[
AC_MSG_ERROR([Needed QT include path])
])
QT4_CFLAGS="-I${path_qt_inc} -I${path_qt_inc}/QtCore -I${path_qt_inc}/QtGui"
AC_SUBST([QT4_CFLAGS])
QT_CFLAGS="-I${path_qt_inc}"
AC_MSG_RESULT(yes)
AC_MSG_CHECKING([if QT binaries path is present])
Expand All @@ -171,45 +173,87 @@ AM_COND_IF([PRECOMP_QT],[
AS_IF([test "x$path_qt_lib" = xno -o "x$path_qt_lib" = x],[
AC_MSG_ERROR([Needed QT lib path])
])
QT4_LIBS="-L${path_qt_lib} -lQtGui -lQtCore"
AC_SUBST([QT4_LIBS])
AC_MSG_RESULT(yes)
AC_CHECK_TOOLS(MOC, [moc-qt4 moc], [no], [$path_qt_bin])
AS_IF([test "x$MOC" = xno],[
AC_MSG_ERROR([Qt binaries moc not found])
AM_COND_IF([ENAB_QT5],[
AM_COND_IF([WINDOWS],[
QT_LIBS="-L${path_qt_lib} -lQt5Widgets -lqwindows -lQtGui -lQtCore -lqtharfbuzzng"
],[
QT_LIBS="-L${path_qt_lib} -lQt5Widgets -lQtGui -lQtCore"
])
AC_CHECK_TOOLS(MOC, [moc-qt5 moc], [no], [$path_qt_bin])
AC_CHECK_TOOLS(UIC, [uic-qt5 uic], [no], [$path_qt_bin])
AC_CHECK_TOOLS(RCC, [rcc-qt5 rcc], [no], [$path_qt_bin])
],[
QT_LIBS="-L${path_qt_lib} -lQtGui -lQtCore"
AC_CHECK_TOOLS(MOC, [moc-qt4 moc], [no], [$path_qt_bin])
AC_CHECK_TOOLS(UIC, [uic-qt4 uic], [no], [$path_qt_bin])
AC_CHECK_TOOLS(RCC, [rcc-qt4 rcc], [no], [$path_qt_bin])
])
AS_IF([test "x$MOC" != xno],[
MOC=$path_qt_bin/$MOC
AC_SUBST([MOC])
])
AC_CHECK_TOOLS(UIC, [uic-qt4 uic], [no], [$path_qt_bin])
AS_IF([test "x$UIC" = xno],[
AC_MSG_ERROR([Qt 4 binaries uic not found])
],[
AS_IF([test "x$UIC" != xno],[
UIC=$path_qt_bin/$UIC
AC_SUBST([UIC])
])
AC_CHECK_TOOLS(RCC, [rcc],[no], [$path_qt_bin])
AS_IF([test "x$RCC" = xno],[
AC_MSG_ERROR([Qt 4 binaries rcc not found])
],[
AS_IF([test "x$RCC" != xno],[
RCC=$path_qt_bin/$RCC
AC_SUBST([RCC])
])
my_CPPFLAGS+=" ${QT_CFLAGS}"
my_LIBS+=" ${QT_LIBS}"
],[
PKG_CHECK_MODULES(QT4, [QtCore >= 4.6.0 QtGui >= 4.6.0], [
AC_CHECK_TOOLS(MOC, [moc-qt4 moc])
AC_CHECK_TOOLS(UIC, [uic-qt4 uic])
AC_CHECK_TOOLS(RCC, [rcc])
AM_COND_IF([ENAB_QT5],[
PKG_CHECK_MODULES(QT5, [Qt5Core >= 5.0.0 Qt5Gui >= 5.0.0 Qt5Widgets >= 5.0.0], [
QT5_PREFIX="`$PKG_CONFIG --variable=host_bins Qt5Core`"
AC_CHECK_TOOLS(MOC, [moc-qt5 moc], no, [$QT5_PREFIX])
AC_CHECK_TOOLS(UIC, [uic-qt5 uic], no, [$QT5_PREFIX])
AC_CHECK_TOOLS(RCC, [rcc-qt5 rcc], no, [$QT5_PREFIX])
AS_IF([test "x$MOC" != xno],[
MOC=$QT5_PREFIX/$MOC
AC_SUBST([MOC])
])
AS_IF([test "x$UIC" != xno],[
UIC=$QT5_PREFIX/$UIC
AC_SUBST([UIC])
])
AS_IF([test "x$RCC" != xno],[
RCC=$QT5_PREFIX/$RCC
AC_SUBST([RCC])
])
],[
AC_MSG_ERROR([Qt5 library not found])
])
my_CPPFLAGS+=" ${QT5_CFLAGS}"
my_LIBS+=" ${QT5_LIBS}"
],[
AC_MSG_ERROR([Qt 4 library not found])
PKG_CHECK_MODULES(QT4, [QtCore >= 4.6.0 QtGui >= 4.6.0], [
AC_CHECK_TOOLS(MOC, [moc-qt4 moc])
AC_CHECK_TOOLS(UIC, [uic-qt4 uic])
AC_CHECK_TOOLS(RCC, [rcc-qt4 rcc])
],[
AC_MSG_ERROR([Qt4 library not found])
])
my_CPPFLAGS+=" ${QT4_CFLAGS}"
my_LIBS+=" ${QT4_LIBS}"
])
])

my_CPPFLAGS+=" ${QT4_CFLAGS}"
my_LIBS+=" ${QT4_LIBS}"
AS_IF([test "x$MOC" = xno],[
AC_MSG_ERROR([Could not find moc binaries])
])
AS_IF([test "x$UIC" = xno],[
AC_MSG_ERROR([Could not find uic binaries])
])
AS_IF([test "x$RCC" = xno],[
AC_MSG_ERROR([Could not find rcc binaries])
])

AM_COND_IF([WITH_OPENGL],[
AM_COND_IF([PRECOMP_SDL],[
Expand Down
2 changes: 1 addition & 1 deletion src/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main(int argc, char **argv) {
info.portable = FALSE;
}

gui_init(argc, argv);
gui_init(&argc, argv);

/* controllo l'esistenza della directory principale */
if (emu_make_dir(info.base_folder)) {
Expand Down
11 changes: 8 additions & 3 deletions src/core/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
#define VER1 "0"
#define VER1_INT 0

#define VER2 "97"
#define VER2_INT 97
#define VER2 "98"
#define VER2_INT 98

#if defined (RELEASE)
#define VERSION VER1 "." VER2
#else
#define VERSION VER1 "." VER2 " WIP"
#endif

#define NAME "puNES"
#define AUTHOR "FHorse"
#define COMPILED "09122015194603"
#define COMPILED "09202015030817"
#define WEBSITE "http://forums.nesdev.com/viewtopic.php?f=3&amp;t=6928"
#define DONATE "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QPPXNRL5NAHDC"

Expand Down
5 changes: 5 additions & 0 deletions src/gui/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ libgui_a_SOURCES += \
linux/jstick.c \
linux/jstick.h \
linux/os_linux.h

if ENAB_QT5
AM_CXXFLAGS = -fPIC
endif

endif

if WINDOWS
Expand Down
4 changes: 4 additions & 0 deletions src/gui/cheatObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#define CHEATOBJECT_HPP_

#include <QtCore/QMap>
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QtXml/QXmlStreamReader>
#else
#include <QtCore/QXmlStreamReader>
#endif
#include "cheat.h"

typedef QMap<QString, QString> chl_map;
Expand Down
3 changes: 2 additions & 1 deletion src/gui/dlgCheats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
#define DLGCHEATS_HPP_

#include <QtCore/QtGlobal>
#include <QtXml/QXmlStreamReader>
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QtXml/QXmlStreamReader>
#include <QtGui/QDialog>
#include <QtGui/QSpinBox>
#else
#include <QtCore/QXmlStreamReader>
#include <QtWidgets/QDialog>
#include <QtWidgets/QSpinBox>
#endif
Expand Down
6 changes: 2 additions & 4 deletions src/gui/linux/os_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
double high_resolution_ms(void);
int __nsleep(const struct timespec *req, struct timespec *rem);

void gui_init(int argc, char **argv) {
static int zero = 0;

void gui_init(int *argc, char **argv) {
//setenv("QT_NO_GLIB", "1", 1);

memset(&gui, 0, sizeof(gui));
memset(&qt, 0, sizeof(qt));

qt.app = new QApplication(zero, NULL);
qt.app = new QApplication((*argc), argv);

info.gui = TRUE;
gui.in_update = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qt.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ EXTERNC void gui_mainWindow_make_reset(BYTE type);

EXTERNC double (*gui_get_ms)(void);

EXTERNC void gui_init(int argc, char **argv);
EXTERNC void gui_init(int *argc, char **argv);
EXTERNC void gui_sleep(double ms);
#if defined (__WIN32__)
EXTERNC HWND gui_screen_id(void);
Expand Down
6 changes: 2 additions & 4 deletions src/gui/windows/os_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ double high_resolution_ms(void);
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
#endif

void gui_init(int argc, char **argv) {
static int zero = 0;

void gui_init(int *argc, char **argv) {
memset(&qt, 0, sizeof(qt));

qt.app = new QApplication(zero, NULL);
qt.app = new QApplication((*argc), argv);

info.gui = TRUE;
gui.in_update = FALSE;
Expand Down

0 comments on commit 1df29f9

Please sign in to comment.