diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a908f4ed0..be92b6c222 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 2.8) option(ANDROID "Enables a build for Android" OFF) option(USE_EGL "Enables EGL OpenGL Interface" OFF) -option(USE_X11 "Enables X11 Support" ON) -option(USE_WAYLAND "Enables Wayland Support" OFF) +option(TRY_X11 "Enables X11 Support" ON) +option(TRY_WAYLAND "Enables Wayland Support" OFF) option(USE_UPNP "Enables UPnP port mapping support" ON) option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF) option(ENABLE_PCH "Use PCH to speed up compilation" ON) @@ -326,27 +326,11 @@ if(ANDROID) set(USE_X11 0) set(USE_WAYLAND 0) set(USE_UPNP 0) - set(USE_EGL True) - add_definitions(-DUSE_EGL=1) + set(USE_EGL 1) endif() include_directories(Externals/GL) -# For now Wayland and EGL are tied to each other. -# The alternative would be an shm path -if(USE_WAYLAND) - add_definitions(-DUSE_EGL) - set(USE_EGL 1) -endif() - -if(USE_EGL) - message("EGL OpenGL interface enabled") - add_definitions(-DUSE_EGL=1) -else() - # Using GLX - set(USE_X11 1) - set(USE_WAYLAND 0) -endif() add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE) ######################################## @@ -422,11 +406,14 @@ if(NOT ANDROID) message("OpenAL NOT found, disabling OpenAL sound backend") endif(OPENAL_FOUND) + set(USE_X11 0) + set(USE_WAYLAND 0) + if(UNIX AND NOT APPLE) - # Note: The convention is to check USE_X11 or USE_WAYLAND where needed. + # Note: The convention is to check TRY_X11 or TRY_WAYLAND where needed. # This is where we detect platforms and set the variables accordingly. pkg_check_modules(WAYLAND wayland-egl wayland-client wayland-cursor) - if(USE_WAYLAND AND WAYLAND_FOUND) + if(TRY_WAYLAND AND WAYLAND_FOUND) pkg_check_modules(XKBCOMMON xkbcommon) if(XKBCOMMON_FOUND) set(USE_WAYLAND 1) @@ -438,11 +425,11 @@ if(NOT ANDROID) set(USE_WAYLAND 0) message("Wayland support disabled") add_definitions(-DHAVE_WAYLAND=0) - endif(USE_WAYLAND AND WAYLAND_FOUND) + endif(TRY_WAYLAND AND WAYLAND_FOUND) # Note: We do not need to explicitly check for X11 as it is done in the cmake # FindOpenGL module on linux. - if(USE_X11 AND X11_FOUND) + if(TRY_X11 AND X11_FOUND) set(USE_X11 1) add_definitions(-DHAVE_X11=1) include_directories(${X11_INCLUDE_DIR}) @@ -452,7 +439,7 @@ if(NOT ANDROID) SET(X11_FOUND "") message("X11 support disabled") add_definitions(-DHAVE_X11=0) - endif(USE_X11 AND X11_FOUND) + endif(TRY_X11 AND X11_FOUND) if (NOT USE_WAYLAND AND NOT USE_X11) message(FATAL_ERROR "\n" @@ -461,6 +448,12 @@ if(NOT ANDROID) endif() endif() + # For now Wayland and EGL are tied to each other. + # The alternative would be an shm path + if(USE_WAYLAND) + set(USE_EGL 1) + endif() + if(USE_X11) check_lib(XRANDR Xrandr) if(XRANDR_FOUND) @@ -508,6 +501,11 @@ if(NOT ANDROID) endif() endif() +if(USE_EGL) + message("EGL OpenGL interface enabled") + add_definitions(-DUSE_EGL=1) +endif() + ######################################## # Setup include directories (and make sure they are preferred over the Externals) # diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index ed20786896..302a27df28 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -23,62 +23,56 @@ if(LIBAV_FOUND) set(LIBS ${LIBS} ${LIBAV_LIBRARIES}) endif() -if(wxWidgets_FOUND) - set(SRCS - ARCodeAddEdit.cpp - AboutDolphin.cpp - CheatsWindow.cpp - ConfigMain.cpp - Debugger/BreakpointDlg.cpp - Debugger/BreakpointView.cpp - Debugger/BreakpointWindow.cpp - Debugger/CodeView.cpp - Debugger/CodeWindow.cpp - Debugger/CodeWindowFunctions.cpp - Debugger/DSPDebugWindow.cpp - Debugger/DSPRegisterView.cpp - Debugger/DebuggerPanel.cpp - Debugger/DebuggerUIUtil.cpp - Debugger/JitWindow.cpp - Debugger/MemoryCheckDlg.cpp - Debugger/MemoryView.cpp - Debugger/MemoryWindow.cpp - Debugger/RegisterView.cpp - Debugger/RegisterWindow.cpp - FifoPlayerDlg.cpp - Frame.cpp - FrameAui.cpp - FrameTools.cpp - GameListCtrl.cpp - GeckoCodeDiag.cpp - HotkeyDlg.cpp - ISOFile.cpp - ISOProperties.cpp - InputConfigDiag.cpp - InputConfigDiagBitmaps.cpp - LogConfigWindow.cpp - LogWindow.cpp - Main.cpp - MemcardManager.cpp - MemoryCards/WiiSaveCrypted.cpp - NetWindow.cpp - PatchAddEdit.cpp - SoftwareVideoConfigDialog.cpp - TASInputDlg.cpp - VideoConfigDiag.cpp - WXInputBase.cpp - WiimoteConfigDiag.cpp - WxUtils.cpp) +set(GUI_SRCS + ARCodeAddEdit.cpp + AboutDolphin.cpp + CheatsWindow.cpp + ConfigMain.cpp + Debugger/BreakpointDlg.cpp + Debugger/BreakpointView.cpp + Debugger/BreakpointWindow.cpp + Debugger/CodeView.cpp + Debugger/CodeWindow.cpp + Debugger/CodeWindowFunctions.cpp + Debugger/DSPDebugWindow.cpp + Debugger/DSPRegisterView.cpp + Debugger/DebuggerPanel.cpp + Debugger/DebuggerUIUtil.cpp + Debugger/JitWindow.cpp + Debugger/MemoryCheckDlg.cpp + Debugger/MemoryView.cpp + Debugger/MemoryWindow.cpp + Debugger/RegisterView.cpp + Debugger/RegisterWindow.cpp + FifoPlayerDlg.cpp + Frame.cpp + FrameAui.cpp + FrameTools.cpp + GameListCtrl.cpp + GeckoCodeDiag.cpp + HotkeyDlg.cpp + ISOFile.cpp + ISOProperties.cpp + InputConfigDiag.cpp + InputConfigDiagBitmaps.cpp + LogConfigWindow.cpp + LogWindow.cpp + Main.cpp + MemcardManager.cpp + MemoryCards/WiiSaveCrypted.cpp + NetWindow.cpp + PatchAddEdit.cpp + SoftwareVideoConfigDialog.cpp + TASInputDlg.cpp + VideoConfigDiag.cpp + WXInputBase.cpp + WiimoteConfigDiag.cpp + WxUtils.cpp) - set(WXLIBS ${wxWidgets_LIBRARIES} dl) -else() - if(ANDROID) - set(SRCS Android/ButtonManager.cpp - MainAndroid.cpp) - else() - set(SRCS MainNoGUI.cpp) - endif() -endif() +set(WXLIBS ${wxWidgets_LIBRARIES} dl) + +set(ANDROID_SRCS Android/ButtonManager.cpp + MainAndroid.cpp) if(USE_EGL) set(SRCS ${SRCS} GLInterface/Platform.cpp @@ -102,6 +96,8 @@ else() endif() set(SRCS ${SRCS} GLInterface/GLInterface.cpp) +set(NOGUI_SRCS MainNoGUI.cpp) + if(WIN32) set(SRCS ${SRCS} stdafx.cpp) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") @@ -140,11 +136,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") else() set(DOLPHIN_EXE_BASE dolphin-emu) endif() -if(wxWidgets_FOUND) - set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}) -else() - set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}-nogui) -endif() + +set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}) if(USE_UPNP) set(LIBS ${LIBS} miniupnpc) @@ -159,7 +152,7 @@ endif() if(ANDROID) set(DOLPHIN_EXE main) - add_library(${DOLPHIN_EXE} SHARED ${SRCS}) + add_library(${DOLPHIN_EXE} SHARED ${SRCS} ${ANDROID_SRCS}) target_link_libraries(${DOLPHIN_EXE} log android @@ -180,8 +173,10 @@ if(ANDROID) add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD COMMAND cp ARGS -r ${CMAKE_SOURCE_DIR}/Data/Sys/Shaders ${CMAKE_SOURCE_DIR}/Source/Android/assets/ ) -else() - add_executable(${DOLPHIN_EXE} ${SRCS}) + + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) +elseif(wxWidgets_FOUND) + add_executable(${DOLPHIN_EXE} ${SRCS} ${GUI_SRCS}) target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS}) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include(BundleUtilities) @@ -268,6 +263,13 @@ else() else() install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) endif() + + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) endif() -set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) +if(USE_X11) + set(DOLPHIN_NOGUI_EXE ${DOLPHIN_EXE_BASE}-nogui) + add_executable(${DOLPHIN_NOGUI_EXE} ${SRCS} ${NOGUI_SRCS}) + target_link_libraries(${DOLPHIN_NOGUI_EXE} ${LIBS}) + set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_NOGUI_EXE}) +endif() diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index 997fc5a1c5..565827fc22 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -175,7 +175,10 @@ static wxArrayString GetListOfResolutions() ZeroMemory(&dmi, sizeof(dmi)); } #elif defined(HAVE_XRANDR) && HAVE_XRANDR - main_frame->m_XRRConfig->AddResolutions(retlist); + std::vector resos; + main_frame->m_XRRConfig->AddResolutions(resos); + for (auto res : resos) + retlist.Add(StrToWxStr(res)); #elif defined(__APPLE__) CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), nullptr); for (CFIndex i = 0; i < CFArrayGetCount(modes); i++) diff --git a/Source/Core/DolphinWX/X11Utils.cpp b/Source/Core/DolphinWX/X11Utils.cpp index 796b0da46f..b1e1ddb0ff 100644 --- a/Source/Core/DolphinWX/X11Utils.cpp +++ b/Source/Core/DolphinWX/X11Utils.cpp @@ -254,8 +254,7 @@ void XRRConfiguration::ToggleDisplayMode(bool bFullscreen) XSync(dpy, false); } -#if defined(HAVE_WX) && HAVE_WX -void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution) +void XRRConfiguration::AddResolutions(std::vector& resos) { if (!bValid || !screenResources) return; @@ -268,7 +267,6 @@ void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenRe if (output_info && output_info->crtc && output_info->connection == RR_Connected) { - std::vector resos; for (int j = 0; j < output_info->nmode; j++) for (int k = 0; k < screenResources->nmode; k++) if (output_info->modes[j] == screenResources->modes[k].id) @@ -280,7 +278,6 @@ void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenRe if (std::find(resos.begin(), resos.end(), strRes) == resos.end()) { resos.push_back(strRes); - arrayStringFor_FullscreenResolution.Add(StrToWxStr(strRes)); } } } @@ -288,7 +285,6 @@ void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenRe XRRFreeOutputInfo(output_info); } } -#endif #endif diff --git a/Source/Core/DolphinWX/X11Utils.h b/Source/Core/DolphinWX/X11Utils.h index ee5a1ee9ef..d0b5dc0292 100644 --- a/Source/Core/DolphinWX/X11Utils.h +++ b/Source/Core/DolphinWX/X11Utils.h @@ -51,9 +51,7 @@ class XRRConfiguration void Update(); void ToggleDisplayMode(bool bFullscreen); -#if defined(HAVE_WX) && HAVE_WX - void AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution); -#endif + void AddResolutions(std::vector& resos); private: Display *dpy;