Successful build of QT gui using cmake instead of qmake.
This commit is contained in:
parent
26e320b163
commit
1206fcebbd
|
@ -1,5 +1,5 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(fceux)
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
if(WIN32)
|
||||
set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_WIN})
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers/win/directx ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib )
|
||||
|
@ -15,27 +19,12 @@ else(WIN32)
|
|||
# Non Windows System
|
||||
# Use the package PkgConfig to detect headers/library files
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Widgets OpenGL REQUIRED)
|
||||
|
||||
# Check for GTK+3
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
add_definitions( ${Qt5Widgets_DEFINITIONS} )
|
||||
include_directories( ${Qt5Widgets_INCLUDE_DIRS} )
|
||||
|
||||
if ( ${GTK3_FOUND} )
|
||||
add_definitions( -D_GTK ${GTK3_CFLAGS} )
|
||||
endif()
|
||||
|
||||
# Check for X11
|
||||
pkg_check_modules( X11 x11 )
|
||||
|
||||
if ( ${X11_FOUND} )
|
||||
add_definitions( ${X11_CFLAGS} )
|
||||
endif()
|
||||
|
||||
# Check for OpenGL
|
||||
pkg_check_modules( GL REQUIRED gl)
|
||||
|
||||
if ( ${GL_FOUND} )
|
||||
add_definitions( -DOPENGL ${GL_CFLAGS} )
|
||||
endif()
|
||||
add_definitions( -D__QT_DRIVER__ -Wall -Wno-write-strings -Wno-sign-compare -Wno-parentheses -Wno-unused-local-typedefs -fPIC -DQT_DEPRECATED_WARNINGS )
|
||||
|
||||
# Check for libminizip
|
||||
pkg_check_modules( MINIZIP REQUIRED minizip)
|
||||
|
@ -44,6 +33,13 @@ else(WIN32)
|
|||
add_definitions( -D_SYSTEM_MINIZIP ${MINIZIP_CFLAGS} )
|
||||
endif()
|
||||
|
||||
pkg_check_modules( GL REQUIRED gl)
|
||||
|
||||
# Check for OpenGL
|
||||
if ( ${GL_FOUND} )
|
||||
add_definitions( ${GL_CFLAGS} )
|
||||
endif()
|
||||
|
||||
pkg_check_modules( ZLIB REQUIRED zlib)
|
||||
|
||||
# Check for zlib
|
||||
|
@ -72,6 +68,9 @@ else(WIN32)
|
|||
|
||||
endif(WIN32)
|
||||
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/src )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers )
|
||||
|
||||
if(APPLE)
|
||||
add_definitions( -DPSS_STYLE=4 )
|
||||
else(APPLE)
|
||||
|
@ -323,20 +322,24 @@ set(SRC_DRIVERS_COMMON
|
|||
)
|
||||
|
||||
set(SRC_DRIVERS_SDL
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/input.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/gui.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/cheat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/debugger.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/memview.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/ramwatch.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/sdl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/sdl-joystick.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/sdl-sound.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/sdl-throttle.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/sdl-video.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/glxwin.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/sdl/unix-netplay.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/main.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleWindow.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleViewerGL.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleViewerSDL.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/GamePadConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/HotKeyConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleSoundConf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/fceuWrapper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/input.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/nes_shm.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/keyscan.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-sound.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-video.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-joystick.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/sdl-throttle.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/unix-netplay.cpp
|
||||
)
|
||||
|
||||
set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_SDL})
|
||||
|
@ -344,8 +347,8 @@ set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_SDL})
|
|||
add_executable( fceux ${SOURCES} )
|
||||
|
||||
target_link_libraries( fceux
|
||||
${GTK3_LDFLAGS}
|
||||
${X11_LDFLAGS}
|
||||
${Qt5Widgets_LIBRARIES}
|
||||
${Qt5OpenGL_LIBRARIES}
|
||||
${GL_LDFLAGS}
|
||||
${SDL2_LDFLAGS}
|
||||
${MINIZIP_LDFLAGS} ${ZLIB_LDFLAGS}
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
#include <QFileDialog>
|
||||
|
||||
#include "../../fceu.h"
|
||||
|
||||
#ifdef _S9XLUA_H
|
||||
#include "../../fceulua.h"
|
||||
#endif
|
||||
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/input.h"
|
||||
|
@ -202,6 +207,20 @@ void consoleWin_t::createMainMenu(void)
|
|||
|
||||
fileMenu->addSeparator();
|
||||
|
||||
#ifdef _S9XLUA_H
|
||||
// File -> Quick Save
|
||||
loadLuaAct = new QAction(tr("Load Lua Script"), this);
|
||||
//loadLuaAct->setShortcut( QKeySequence(tr("F5")));
|
||||
loadLuaAct->setStatusTip(tr("Load Lua Script"));
|
||||
connect(loadLuaAct, SIGNAL(triggered()), this, SLOT(loadLua(void)) );
|
||||
|
||||
fileMenu->addAction(loadLuaAct);
|
||||
|
||||
fileMenu->addSeparator();
|
||||
#else
|
||||
loadLuaAct = NULL;
|
||||
#endif
|
||||
|
||||
// File -> Quit
|
||||
quitAct = new QAction(tr("Quit"), this);
|
||||
quitAct->setShortcut( QKeySequence(tr("Ctrl+Q")));
|
||||
|
@ -582,6 +601,64 @@ void consoleWin_t::changeState9(void)
|
|||
fceuWrapperUnLock();
|
||||
}
|
||||
|
||||
void consoleWin_t::loadLua(void)
|
||||
{
|
||||
#ifdef _S9XLUA_H
|
||||
int ret;
|
||||
QString filename;
|
||||
std::string last;
|
||||
QFileDialog dialog(this, tr("Open LUA Script") );
|
||||
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
|
||||
dialog.setNameFilter(tr("LUA Scripts (*.lua)(*.LUA) ;; All files (*)"));
|
||||
|
||||
dialog.setViewMode(QFileDialog::List);
|
||||
|
||||
g_config->getOption ("SDL.LastLoadLua", &last );
|
||||
|
||||
if ( last.size() == 0 )
|
||||
{
|
||||
last.assign( "/usr/share/fceux/luaScripts" );
|
||||
}
|
||||
|
||||
dialog.setDirectory( tr(last.c_str()) );
|
||||
|
||||
// the gnome default file dialog is not playing nice with QT.
|
||||
// TODO make this a config option to use native file dialog.
|
||||
dialog.setOption(QFileDialog::DontUseNativeDialog, true);
|
||||
|
||||
dialog.show();
|
||||
ret = dialog.exec();
|
||||
|
||||
if ( ret )
|
||||
{
|
||||
QStringList fileList;
|
||||
fileList = dialog.selectedFiles();
|
||||
|
||||
if ( fileList.size() > 0 )
|
||||
{
|
||||
filename = fileList[0];
|
||||
}
|
||||
}
|
||||
|
||||
if ( filename.isNull() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
qDebug() << "selected file path : " << filename.toUtf8();
|
||||
|
||||
g_config->setOption ("SDL.LastLoadLua", filename.toStdString().c_str() );
|
||||
|
||||
fceuWrapperLock();
|
||||
if ( FCEU_LoadLuaCode( filename.toStdString().c_str() ) )
|
||||
{
|
||||
printf("Error: Could not open the selected lua script: '%s'\n", filename.toStdString().c_str() );
|
||||
}
|
||||
fceuWrapperUnLock();
|
||||
#endif
|
||||
}
|
||||
|
||||
void consoleWin_t::openGamePadConfWin(void)
|
||||
{
|
||||
if ( gamePadConfWin != NULL )
|
||||
|
|
|
@ -58,6 +58,7 @@ class consoleWin_t : public QMainWindow
|
|||
QAction *saveStateAct;
|
||||
QAction *quickLoadAct;
|
||||
QAction *quickSaveAct;
|
||||
QAction *loadLuaAct;
|
||||
QAction *quitAct;
|
||||
QAction *gamePadConfig;
|
||||
QAction *gameSoundConfig;
|
||||
|
@ -108,6 +109,7 @@ class consoleWin_t : public QMainWindow
|
|||
void changeState7(void);
|
||||
void changeState8(void);
|
||||
void changeState9(void);
|
||||
void loadLua(void);
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue