* add options for static linking

* make the vsync checkbox and shit work to some extent (they don't actually function tho)
This commit is contained in:
Arisotura 2020-05-29 21:03:46 +02:00
parent a38b20484d
commit 935f121025
4 changed files with 47 additions and 6 deletions

View File

@ -10,7 +10,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
project(melonDS) project(melonDS)
if(NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif()
@ -20,6 +20,7 @@ endif()
if (CMAKE_BUILD_TYPE STREQUAL Release) if (CMAKE_BUILD_TYPE STREQUAL Release)
add_compile_options(-O3) add_compile_options(-O3)
add_link_options(-s)
endif() endif()
add_compile_options(-fno-pic) add_compile_options(-fno-pic)
@ -27,6 +28,10 @@ add_link_options(-no-pie)
option(BUILD_QT_SDL "Build Qt/SDL frontend" ON) option(BUILD_QT_SDL "Build Qt/SDL frontend" ON)
if (WIN32)
option(BUILD_STATIC "Statically link dependencies" OFF)
endif()
add_subdirectory(src) add_subdirectory(src)
if (BUILD_QT_SDL) if (BUILD_QT_SDL)

View File

@ -30,9 +30,15 @@ if (WIN32)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> -o <OBJECT>") set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> -o <OBJECT>")
endif() endif()
find_package(Qt5 COMPONENTS Core REQUIRED) if (BUILD_STATIC AND QT5_STATIC_DIR)
find_package(Qt5 COMPONENTS Gui REQUIRED) set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5)
find_package(Qt5 COMPONENTS Widgets REQUIRED) set(Qt5_DIR ${QT5_STATIC_BASE})
set(Qt5Core_DIR ${QT5_STATIC_BASE}Core)
set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui)
set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets)
endif()
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
@ -46,7 +52,13 @@ target_include_directories(melonDS PRIVATE ${SDL2_INCLUDE_DIRS})
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
target_link_libraries(melonDS core ${SDL2_LIBRARIES}) target_link_libraries(melonDS core)
if (BUILD_STATIC)
target_link_libraries(melonDS -static ${SDL2_LIBRARIES})
else()
target_link_libraries(melonDS ${SDL2_LIBRARIES})
endif()
if (UNIX) if (UNIX)
option(UNIX_PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF) option(UNIX_PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
@ -77,7 +89,13 @@ if (UNIX)
target_sources(melonDS PUBLIC melon_grc.c) target_sources(melonDS PUBLIC melon_grc.c)
elseif (WIN32) elseif (WIN32)
target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc") target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc")
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32 Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32)
if (BUILD_STATIC)
target_link_libraries(melonDS imm32 winmm version setupapi -static Qt5::Core Qt5::Gui Qt5::Widgets z zstd)
else()
target_link_libraries(melonDS Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
endif () endif ()
install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)

View File

@ -60,6 +60,9 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
ui->cbxGLResolution->addItem(QString("%1x native (%2x%3)").arg(i).arg(256*i).arg(192*i)); ui->cbxGLResolution->addItem(QString("%1x native (%2x%3)").arg(i).arg(256*i).arg(192*i));
ui->cbxGLResolution->setCurrentIndex(Config::GL_ScaleFactor-1); ui->cbxGLResolution->setCurrentIndex(Config::GL_ScaleFactor-1);
if (!Config::ScreenVSync)
ui->sbVSyncInterval->setEnabled(false);
if (Config::_3DRenderer == 0) if (Config::_3DRenderer == 0)
{ {
ui->cbGLDisplay->setEnabled(true); ui->cbGLDisplay->setEnabled(true);
@ -136,6 +139,18 @@ void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state)
emit updateVideoSettings(old_gl != new_gl); emit updateVideoSettings(old_gl != new_gl);
} }
void VideoSettingsDialog::on_cbVSync_stateChanged(int state)
{
bool vsync = (state != 0);
ui->sbVSyncInterval->setEnabled(vsync);
Config::ScreenVSync = vsync;
}
void VideoSettingsDialog::on_sbVSyncInterval_valueChanged(int val)
{
Config::ScreenVSyncInterval = val;
}
void VideoSettingsDialog::on_cbSoftwareThreaded_stateChanged(int state) void VideoSettingsDialog::on_cbSoftwareThreaded_stateChanged(int state)
{ {
Config::Threaded3D = (state != 0); Config::Threaded3D = (state != 0);

View File

@ -60,6 +60,9 @@ private slots:
void onChange3DRenderer(int renderer); void onChange3DRenderer(int renderer);
void on_cbGLDisplay_stateChanged(int state); void on_cbGLDisplay_stateChanged(int state);
void on_cbVSync_stateChanged(int state);
void on_sbVSyncInterval_valueChanged(int val);
void on_cbxGLResolution_currentIndexChanged(int idx); void on_cbxGLResolution_currentIndexChanged(int idx);
void on_cbSoftwareThreaded_stateChanged(int state); void on_cbSoftwareThreaded_stateChanged(int state);