Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Qt/Wx: Turn Qt into the default interface #6331

Merged
merged 1 commit into from
Apr 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ option(USE_EGL "Enables EGL OpenGL Interface" OFF)
option(TRY_X11 "Enables X11 Support" ON)
option(USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF)
option(USE_UPNP "Enables UPnP port mapping support" ON)
option(ENABLE_WX "Enable wxWidgets (Default)" ON)
option(ENABLE_QT2 "Enable Qt2 (use the other experimental Qt interface)" ON)
option(ENABLE_QT2 "Enable Qt (Default)" ON)
option(ENABLE_WX "Enable wxWidgets (Legacy)" ON)
option(ENABLE_LTO "Enables Link Time Optimization" OFF)
option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF)
option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
Expand Down
35 changes: 17 additions & 18 deletions Source/Core/DolphinQt2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ message(STATUS "Found Qt version ${Qt5Core_VERSION}")

set(CMAKE_AUTOMOC ON)

add_executable(dolphin-emu-qt2
add_executable(dolphin-emu
AboutDialog.cpp
CheatsManager.cpp
FIFOPlayerWindow.cpp
Expand Down Expand Up @@ -113,28 +113,28 @@ add_executable(dolphin-emu-qt2
Updater.cpp
)

target_compile_definitions(dolphin-emu-qt2
target_compile_definitions(dolphin-emu
PRIVATE
-DQT_USE_QSTRINGBUILDER
-DQT_NO_CAST_FROM_ASCII
-DQT_NO_CAST_TO_ASCII
)

target_include_directories(dolphin-emu-qt2
target_include_directories(dolphin-emu
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
)

target_link_libraries(dolphin-emu-qt2
target_link_libraries(dolphin-emu
PRIVATE
core
Qt5::Widgets
uicommon
)

if(WIN32)
target_sources(dolphin-emu-qt2 PRIVATE DolphinQt2.manifest)
target_sources(dolphin-emu PRIVATE DolphinQt2.manifest)
endif()

# Handle localization
Expand All @@ -143,7 +143,7 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot")
file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)

target_sources(dolphin-emu-qt2 PRIVATE ${pot_file} ${LINGUAS})
target_sources(dolphin-emu PRIVATE ${pot_file} ${LINGUAS})
source_group("Localization" FILES ${LINGUAS})
source_group("Localization\\\\Generated" FILES ${pot_file})

Expand All @@ -152,7 +152,7 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
set(mo ${mo_dir}/dolphin-emu.mo)

target_sources(dolphin-emu-qt2 PRIVATE ${mo})
target_sources(dolphin-emu PRIVATE ${mo})
source_group("Localization\\\\Generated" FILES ${mo})

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
Expand All @@ -171,39 +171,38 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
endif()

if(APPLE)
# Note: This is copied from DolphinQt, based on the DolphinWX version.

include(BundleUtilities)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dolphin-emu-qt2.app)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Dolphin.app)

# Ask for an application bundle.
set_target_properties(dolphin-emu-qt2 PROPERTIES
set_target_properties(dolphin-emu PROPERTIES
MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
OUTPUT_NAME Dolphin
)

# Copy qt.conf into the bundle
target_sources(dolphin-emu-qt2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf")
target_sources(dolphin-emu PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf")
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/qt.conf" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

# Copy icon into the bundle
target_sources(dolphin-emu-qt2 PRIVATE "${CMAKE_SOURCE_DIR}/Data/Dolphin.icns")
target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/Dolphin.icns")
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/Dolphin.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

# Copy Qt plugins into the bundle
get_target_property(qtcocoa_location Qt5::QCocoaIntegrationPlugin LOCATION)
target_sources(dolphin-emu-qt2 PRIVATE "${qtcocoa_location}")
target_sources(dolphin-emu PRIVATE "${qtcocoa_location}")
set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms)

get_target_property(qtmacstyle_location Qt5::QMacStylePlugin LOCATION)
target_sources(dolphin-emu-qt2 PRIVATE "${qtmacstyle_location}")
target_sources(dolphin-emu PRIVATE "${qtmacstyle_location}")
set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles)

# Copy resources into the bundle
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys")
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
foreach(res ${resources})
target_sources(dolphin-emu-qt2 PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
get_filename_component(resdir "${res}" DIRECTORY)
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/${res}" PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
Expand All @@ -212,7 +211,7 @@ if(APPLE)

# Update library references to make the bundle portable
include(DolphinPostprocessBundle)
dolphin_postprocess_bundle(dolphin-emu-qt2)
dolphin_postprocess_bundle(dolphin-emu)
else()
install(TARGETS dolphin-emu-qt2 RUNTIME DESTINATION ${bindir})
install(TARGETS dolphin-emu RUNTIME DESTINATION ${bindir})
endif()
3 changes: 0 additions & 3 deletions Source/Core/DolphinQt2/DolphinQt2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{FA3FA62B-6F58-4B86-9453-4D149940A066}</ProjectGuid>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<!--
Enable this once wxwidgets is completely removed
<ProjectName>Dolphin</ProjectName>
-->
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt2/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</dict>
</array>
<key>CFBundleExecutable</key>
<string>dolphin-emu-qt2</string>
<string>Dolphin</string>
<key>CFBundleIconFile</key>
<string>Dolphin.icns</string>
<key>CFBundleIdentifier</key>
Expand Down
43 changes: 24 additions & 19 deletions Source/Core/DolphinWX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if(NOT wxWidgets_FOUND)
return()
endif()

add_executable(dolphin-emu
add_executable(dolphin-emu-wx
AboutDolphin.cpp
ControllerConfigDiag.cpp
Cheats/ActionReplayCodesPanel.cpp
Expand Down Expand Up @@ -83,7 +83,7 @@ add_executable(dolphin-emu
WxUtils.cpp
)

target_link_libraries(dolphin-emu
target_link_libraries(dolphin-emu-wx
PRIVATE
bdisasm
core
Expand All @@ -95,22 +95,24 @@ PRIVATE
if(APPLE)
# Add resource files to application bundle.
set(RESOURCES "${CMAKE_SOURCE_DIR}/Data/Dolphin.icns")
target_sources(dolphin-emu PRIVATE ${RESOURCES})
target_sources(dolphin-emu-wx PRIVATE ${RESOURCES})
set_source_files_properties(${RESOURCES} PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
endif()

if(WIN32)
target_sources(dolphin-emu PRIVATE
target_sources(dolphin-emu-wx PRIVATE
DolphinWX.manifest
DolphinWX.rc
)
endif()

target_link_libraries(dolphin-emu-wx PRIVATE ${LIBS})

if(USE_X11)
find_package(GTK2 REQUIRED)
target_link_libraries(dolphin-emu PRIVATE ${GTK2_LIBRARIES})
target_include_directories(dolphin-emu PRIVATE ${GTK2_INCLUDE_DIRS})
target_link_libraries(dolphin-emu-wx PRIVATE ${GTK2_LIBRARIES})
target_include_directories(dolphin-emu-wx PRIVATE ${GTK2_INCLUDE_DIRS})
endif()

# Handle localization
Expand All @@ -119,16 +121,16 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot")
file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)

target_sources(dolphin-emu PRIVATE ${pot_file} ${LINGUAS})
target_sources(dolphin-emu-wx PRIVATE ${pot_file} ${LINGUAS})
source_group("Localization" FILES ${LINGUAS})
source_group("Localization\\\\Generated" FILES ${pot_file})

foreach(po ${LINGUAS})
get_filename_component(lang ${po} NAME_WE)
set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
set(mo ${mo_dir}/dolphin-emu.mo)
set(mo ${mo_dir}/dolphin-emu-wx.mo)

target_sources(dolphin-emu PRIVATE ${mo})
target_sources(dolphin-emu-wx PRIVATE ${mo})
source_group("Localization\\\\Generated" FILES ${mo})

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
Expand All @@ -147,18 +149,21 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
endif()

if(APPLE)
include(BundleUtilities)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DolphinWx.app)

# Ask for an application bundle.
set_target_properties(dolphin-emu PROPERTIES
set_target_properties(dolphin-emu-wx PROPERTIES
MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
OUTPUT_NAME Dolphin
OUTPUT_NAME DolphinWx
)

# Copy resources in the bundle
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys")
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
foreach(res ${resources})
target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
target_sources(dolphin-emu-wx PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
get_filename_component(resdir "${res}" DIRECTORY)
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/${res}" PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
Expand All @@ -167,19 +172,19 @@ if(APPLE)

# Update library references to make the bundle portable
include(DolphinPostprocessBundle)
dolphin_postprocess_bundle(dolphin-emu)
dolphin_postprocess_bundle(dolphin-emu-wx)

# Install bundle into systemwide /Applications directory.
install(TARGETS dolphin-emu DESTINATION /Applications)
install(TARGETS dolphin-emu-wx DESTINATION /Applications)
elseif(WIN32)
set_target_properties(dolphin-emu PROPERTIES
set_target_properties(dolphin-emu-wx PROPERTIES
WIN32_EXECUTABLE ON
)
add_custom_command(TARGET dolphin-emu
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $<TARGET_FILE_DIR:dolphin-emu>/Sys
add_custom_command(TARGET dolphin-emu-wx
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $<TARGET_FILE_DIR:dolphin-emu-wx>/Sys
)
else()
install(TARGETS dolphin-emu RUNTIME DESTINATION ${bindir})
install(TARGETS dolphin-emu-wx RUNTIME DESTINATION ${bindir})
endif()

set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} dolphin-emu)
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} dolphin-emu-wx)
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/DolphinWX.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{47411FDB-1BF2-48D0-AB4E-C7C41160F898}</ProjectGuid>
<ProjectName>Dolphin</ProjectName>
<ProjectName>DolphinWx</ProjectName>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</dict>
</array>
<key>CFBundleExecutable</key>
<string>Dolphin</string>
<string>DolphinWx</string>
<key>CFBundleIconFile</key>
<string>Dolphin.icns</string>
<key>CFBundleIdentifier</key>
Expand Down