From f7892faa806878179f507a853b1af49d21a9d723 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 14:08:30 -0700 Subject: [PATCH 1/8] CMake: remove artisanal wxWidgets version check --- CMakeLists.txt | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 342119b24b..f323520589 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -789,28 +789,12 @@ if(NOT ANDROID) endif() if(NOT DISABLE_WX) - find_package(wxWidgets COMPONENTS core aui adv) + find_package(wxWidgets 3.1.0 COMPONENTS core aui adv) if(_ARCH_32) add_definitions(-DwxSIZE_T_IS_UINT) endif() - if(wxWidgets_FOUND) - EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" - ${wxWidgets_CONFIG_OPTIONS} --version - OUTPUT_VARIABLE wxWidgets_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET - ) - message(STATUS "Found wxWidgets version ${wxWidgets_VERSION}") - set(wxMIN_VERSION "3.1.0") - if(${wxWidgets_VERSION} VERSION_LESS ${wxMIN_VERSION}) - message(STATUS "At least ${wxMIN_VERSION} is required; ignoring found version") - unset(wxWidgets_FOUND) - endif() - endif() - if(UNIX AND NOT APPLE AND NOT HAIKU) # There is a bug in the FindGTK module in cmake version 2.8.2 that # does not find gdk-pixbuf-2.0. On the other hand some 2.8.3 From 8e7648f42a8e32a9fff3309a52650e8904a6de97 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Tue, 25 Apr 2017 09:37:11 -0700 Subject: [PATCH 2/8] CMake: modern-ize wxWidgets --- Externals/wxWidgets3/CMakeLists.txt | 61 ++++++++++++----------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 113c8c511a..36adfa3e44 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -818,23 +818,20 @@ set(SRCS_UNIXGTK "src/unix/uiactionx11.cpp" "src/unix/utilsx11.cpp") -include_directories(.) -include_directories(include) - -set(SRCS - ${SRCS_AUI} - ${SRCS_COMMON} - ${SRCS_GENERIC}) +add_library(wx STATIC ${SRCS_AUI} ${SRCS_COMMON} ${SRCS_GENERIC}) +target_include_directories(wx PUBLIC . include) +target_compile_definitions(wx PRIVATE "WXBUILDING") +# wxWidgets warnings are not our problem. +target_compile_options(wx PRIVATE "-w") if(APPLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98") - add_definitions(-D__WXOSX_COCOA__) - set(SRCS - ${SRCS} + target_compile_definitions(wx PRIVATE "__WXOSX_COCOA__") + target_sources(wx PRIVATE ${SRCS_GENERICOSX} ${SRCS_OSX} - ${SRCS_UNIX}) - set(LIBS + ${SRCS_UNIX} + ) + target_link_libraries(wx PRIVATE png iconv ${APPKIT_LIBRARY} @@ -847,23 +844,23 @@ if(APPLE) ${OPENGL_LIBRARY} ) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") - if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - add_definitions(-D__LINUX__=1) + target_compile_options(wx PRIVATE "$<$:-std=gnu++11>") + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + target_compile_definitions(wx PRIVATE "__LINUX__=1") else() - add_definitions(-D__BSD__=1) + target_compile_definitions(wx PRIVATE "__BSD__=1") endif() - add_definitions(-D__WXGTK__) - set(SRCS - ${SRCS} + target_compile_definitions(wx PRIVATE "__WXGTK__") + target_sources(wx PRIVATE ${SRCS_GENERICGTK} ${SRCS_GTK} ${SRCS_UNIX} - ${SRCS_UNIXGTK}) + ${SRCS_UNIXGTK} + ) if (NOT X11_xf86vmode_FOUND OR NOT X11_Xinerama_FOUND) message(FATAL_ERROR "wxGTK2 needs Xinerama and Xxf86vm") endif() - set(LIBS + target_link_libraries(wx PRIVATE png ${GTHREAD2_LIBRARIES} ${PANGOCAIRO_LIBRARIES} @@ -871,25 +868,19 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") ${Backtrace_LIBRARY} ${X11_X11_LIB} ${X11_Xxf86vm_LIB} - ${X11_Xinerama_LIB}) + ${X11_Xinerama_LIB} + ) else() - add_definitions(-D__WXMSW__) - add_definitions(-DNOPCH) remove_definitions(-DWIN32_LEAN_AND_MEAN) - set(SRCS - ${SRCS} + target_compile_definitions(wx PRIVATE "__WXMSW__" "NOPCH") + target_sources(wx PRIVATE ${SRCS_GENERICMSW} - ${SRCS_MSW}) - set(LIBS + ${SRCS_MSW} + ) + target_link_libraries(wx PRIVATE Comctl32.lib Rpcrt4.lib ${OPENGL_LIBRARIES} ) endif() -add_definitions(-DWXBUILDING) -# wxWidgets warnings are not our problem. -add_definitions(-w) - -add_library(wx STATIC ${PNG_SRCS} ${SRCS}) -target_link_libraries(wx ${LIBS}) From 6197d9622fcfc5525061c8cb8c2e1df91a0121f8 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 14:10:10 -0700 Subject: [PATCH 3/8] CMake: move GTK+ check into wxWidgets --- CMakeLists.txt | 24 ------------------------ Externals/wxWidgets3/CMakeLists.txt | 2 ++ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f323520589..b22ce6f251 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -795,30 +795,6 @@ if(NOT DISABLE_WX) add_definitions(-DwxSIZE_T_IS_UINT) endif() - if(UNIX AND NOT APPLE AND NOT HAIKU) - # There is a bug in the FindGTK module in cmake version 2.8.2 that - # does not find gdk-pixbuf-2.0. On the other hand some 2.8.3 - # users have complained that pkg-config does not find - # gdk-pixbuf-2.0. On yet another hand, cmake version 2.8.3 in - # Ubuntu Natty does not find the glib libraries correctly. - # Ugly!!! - execute_process(COMMAND lsb_release -c -s - OUTPUT_VARIABLE DIST_NAME - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} - VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty") - check_lib(GTK2 gtk+-2.0 gtk+-2.0 gtk.h REQUIRED) - else() - find_package(GTK2) - if(GTK2_FOUND) - include_directories(${GTK2_INCLUDE_DIRS}) - list(APPEND LIBS ${GTK2_LIBRARIES}) - else() - message(FATAL_ERROR "GTK is required to build the WX UI. Please install the GTK development libraries.") - endif() - endif() - endif() - if(wxWidgets_FOUND) include(${wxWidgets_USE_FILE}) message(STATUS "wxWidgets found, enabling GUI build") diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 36adfa3e44..ce30be9762 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -860,6 +860,8 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") if (NOT X11_xf86vmode_FOUND OR NOT X11_Xinerama_FOUND) message(FATAL_ERROR "wxGTK2 needs Xinerama and Xxf86vm") endif() + find_package(GTK2 REQUIRED) + target_include_directories(wx PUBLIC ${GTK2_INCLUDE_DIRS}) target_link_libraries(wx PRIVATE png ${GTHREAD2_LIBRARIES} From f4c07233877e42a208c581e40c472f81af8cbb87 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 14:14:07 -0700 Subject: [PATCH 4/8] CMake: move wxWidgets check_lib code into wxWidgets --- CMakeLists.txt | 15 --------------- Externals/wxWidgets3/CMakeLists.txt | 13 +++++++++++-- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b22ce6f251..8ab703b2c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -801,21 +801,6 @@ if(NOT DISABLE_WX) else() message(STATUS "Using static wxWidgets from Externals") - # These definitions and includes are used when building dolphin against wx, - # not when building wx itself (see wxw3 CMakeLists.txt for that) - if(APPLE) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") - # Check for required libs - check_lib(GTHREAD2 gthread-2.0 gthread-2.0 glib/gthread.h REQUIRED) - check_lib(PANGOCAIRO pangocairo pangocairo pango/pangocairo.h REQUIRED) - # On Linux "backtrace" is part of glibc. FreeBSD has a separate library. - # Required for wxUSE_STACKWALKER in Externals/wxWidgets3/wx/wxgtk.h - find_package(Backtrace REQUIRED) - elseif(WIN32) - else() - message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform") - endif() - include_directories(SYSTEM Externals/wxWidgets3 Externals/wxWidgets3/include) diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index ce30be9762..4f93792412 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -860,7 +860,14 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") if (NOT X11_xf86vmode_FOUND OR NOT X11_Xinerama_FOUND) message(FATAL_ERROR "wxGTK2 needs Xinerama and Xxf86vm") endif() + find_package(GTK2 REQUIRED) + check_lib(GTHREAD2 gthread-2.0 gthread-2.0 glib/gthread.h REQUIRED) + check_lib(PANGOCAIRO pangocairo pangocairo pango/pangocairo.h REQUIRED) + # On Linux "backtrace" is part of glibc. FreeBSD has a separate library. + # Required for wxUSE_STACKWALKER in Externals/wxWidgets3/wx/wxgtk.h + find_package(Backtrace REQUIRED) + target_include_directories(wx PUBLIC ${GTK2_INCLUDE_DIRS}) target_link_libraries(wx PRIVATE png @@ -872,7 +879,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") ${X11_Xxf86vm_LIB} ${X11_Xinerama_LIB} ) -else() +elseif(WIN32) remove_definitions(-DWIN32_LEAN_AND_MEAN) target_compile_definitions(wx PRIVATE "__WXMSW__" "NOPCH") target_sources(wx PRIVATE @@ -880,9 +887,11 @@ else() ${SRCS_MSW} ) target_link_libraries(wx PRIVATE - Comctl32.lib + Comctl32.lib Rpcrt4.lib ${OPENGL_LIBRARIES} ) +else() + message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform") endif() From 6e1940c404eeea05c9bc1f53b7ac2bc692442dce Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 14:33:15 -0700 Subject: [PATCH 5/8] CMake: don't globally include wxWidgets headers --- CMakeLists.txt | 15 +++++++++------ Externals/wxWidgets3/CMakeLists.txt | 1 + Source/Core/DolphinWX/CMakeLists.txt | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ab703b2c7..f4e2c302be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -796,17 +796,20 @@ if(NOT DISABLE_WX) endif() if(wxWidgets_FOUND) - include(${wxWidgets_USE_FILE}) message(STATUS "wxWidgets found, enabling GUI build") + if(NOT TARGET wxWidgets::wxWidgets) + add_library(wxWidgets::wxWidgets INTERFACE IMPORTED) + set_target_properties(wxWidgets::wxWidgets PROPERTIES + INTERFACE_LINK_LIBRARIES "${wxWidgets_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${wxWidgets_INCLUDE_DIRS}" + INTERFACE_COMPILE_DEFINITIONS "${wxWidgets_DEFINITIONS}" + INTERFACE_COMPILE_OPTIONS "${wxWidgets_CXX_FLAGS}" + ) + endif() else() message(STATUS "Using static wxWidgets from Externals") - - include_directories(SYSTEM - Externals/wxWidgets3 - Externals/wxWidgets3/include) add_subdirectory(Externals/wxWidgets3) set(wxWidgets_FOUND TRUE) - set(wxWidgets_LIBRARIES "wx") endif() endif() diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 4f93792412..30fe4f587d 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -895,3 +895,4 @@ else() message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform") endif() +add_library(wxWidgets::wxWidgets ALIAS wx) diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 2cad94b5b3..2cd6792a0f 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -78,7 +78,7 @@ set(GUI_SRCS WxUtils.cpp ) -set(WXLIBS ${wxWidgets_LIBRARIES}) +set(WXLIBS wxWidgets::wxWidgets) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(WXLIBS ${WXLIBS} dl) From c214c29b01a52a046837b6856742ba6c472e572a Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 14:55:29 -0700 Subject: [PATCH 6/8] CMake: DolphinWX cleanup --- Source/Core/DolphinWX/CMakeLists.txt | 157 +++++++++++++-------------- 1 file changed, 78 insertions(+), 79 deletions(-) diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 2cd6792a0f..8633cbaae9 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -1,4 +1,8 @@ -set(GUI_SRCS +if(NOT wxWidgets_FOUND) + return() +endif() + +set(SRCS AboutDolphin.cpp ControllerConfigDiag.cpp Cheats/ActionReplayCodesPanel.cpp @@ -78,21 +82,19 @@ set(GUI_SRCS WxUtils.cpp ) -set(WXLIBS wxWidgets::wxWidgets) +set(LIBS + core + uicommon + cpp-optparse + wxWidgets::wxWidgets +) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(WXLIBS ${WXLIBS} dl) + list(APPEND LIBS dl) endif() -list(APPEND LIBS core uicommon cpp-optparse) - if(APPLE) - if(wxWidgets_FOUND) - list(APPEND WXLIBS - ${APPSERV_LIBRARY} - ${COCOA_LIBRARY} - ) - endif() # Add resource files to application bundle. set(RESOURCES resources/Dolphin.icns) list(APPEND SRCS ${RESOURCES}) @@ -115,80 +117,77 @@ endif() set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}) +add_executable(${DOLPHIN_EXE} ${SRCS}) +target_link_libraries(${DOLPHIN_EXE} ${LIBS}) -if(wxWidgets_FOUND) - add_executable(${DOLPHIN_EXE} ${SRCS} ${GUI_SRCS}) - target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS}) +# Handle localization +find_package(Gettext) +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) - # Handle localization - find_package(Gettext) - 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_EXE} PRIVATE ${pot_file} ${LINGUAS}) +source_group("Localization" FILES ${LINGUAS}) +source_group("Localization\\\\Generated" FILES ${pot_file}) - target_sources(${DOLPHIN_EXE} 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) - 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) + target_sources(${DOLPHIN_EXE} PRIVATE ${mo}) + source_group("Localization\\\\Generated" FILES ${mo}) - target_sources(${DOLPHIN_EXE} PRIVATE ${mo}) - source_group("Localization\\\\Generated" FILES ${mo}) - - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set_source_files_properties(${mo} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${lang}.lproj") - else() - install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES) - endif() - - add_custom_command(OUTPUT ${mo} - COMMAND mkdir -p ${mo_dir} - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po} - DEPENDS ${po} - ) - endforeach() - endif() - - if(APPLE) - set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) - - # Ask for an application bundle. - set_target_properties(${DOLPHIN_EXE} PROPERTIES - MACOSX_BUNDLE true - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in - ) - - # 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_EXE} 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}") - source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}") - endforeach() - - # Update library references to make the bundle portable - include(DolphinPostprocessBundle) - dolphin_postprocess_bundle(${DOLPHIN_EXE}) - - # Install bundle into systemwide /Applications directory. - install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications) - elseif(WIN32) - set_target_properties(${DOLPHIN_EXE} PROPERTIES - WIN32_EXECUTABLE ON - ) - add_custom_command(TARGET ${DOLPHIN_EXE} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $/Sys - ) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_source_files_properties(${mo} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${lang}.lproj") else() - install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) + install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES) endif() - set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) + add_custom_command(OUTPUT ${mo} + COMMAND mkdir -p ${mo_dir} + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po} + DEPENDS ${po} + ) +endforeach() endif() + +if(APPLE) +set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) + +# Ask for an application bundle. +set_target_properties(${DOLPHIN_EXE} PROPERTIES + MACOSX_BUNDLE true + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in + ) + +# 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_EXE} 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}") + source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}") +endforeach() + +# Update library references to make the bundle portable +include(DolphinPostprocessBundle) +dolphin_postprocess_bundle(${DOLPHIN_EXE}) + +# Install bundle into systemwide /Applications directory. +install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications) +elseif(WIN32) +set_target_properties(${DOLPHIN_EXE} PROPERTIES + WIN32_EXECUTABLE ON +) +add_custom_command(TARGET ${DOLPHIN_EXE} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $/Sys +) +else() +install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) +endif() + +set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) From bd4ffb680cd5b35e8173f9c369a80cc5857edf36 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 14:57:11 -0700 Subject: [PATCH 7/8] CMake: don't make DolphinWX link to dl --- Source/Core/DolphinWX/CMakeLists.txt | 107 +++++++++++++-------------- 1 file changed, 51 insertions(+), 56 deletions(-) diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 8633cbaae9..9201dd7dff 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -89,11 +89,6 @@ set(LIBS wxWidgets::wxWidgets ) - -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - list(APPEND LIBS dl) -endif() - if(APPLE) # Add resource files to application bundle. set(RESOURCES resources/Dolphin.icns) @@ -123,71 +118,71 @@ target_link_libraries(${DOLPHIN_EXE} ${LIBS}) # Handle localization find_package(Gettext) 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) + set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot") + file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po) -target_sources(${DOLPHIN_EXE} PRIVATE ${pot_file} ${LINGUAS}) -source_group("Localization" FILES ${LINGUAS}) -source_group("Localization\\\\Generated" FILES ${pot_file}) + target_sources(${DOLPHIN_EXE} 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) + 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) - target_sources(${DOLPHIN_EXE} PRIVATE ${mo}) - source_group("Localization\\\\Generated" FILES ${mo}) + target_sources(${DOLPHIN_EXE} PRIVATE ${mo}) + source_group("Localization\\\\Generated" FILES ${mo}) - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set_source_files_properties(${mo} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${lang}.lproj") - else() - install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES) - endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_source_files_properties(${mo} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${lang}.lproj") + else() + install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES) + endif() - add_custom_command(OUTPUT ${mo} - COMMAND mkdir -p ${mo_dir} - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po} - DEPENDS ${po} - ) -endforeach() + add_custom_command(OUTPUT ${mo} + COMMAND mkdir -p ${mo_dir} + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po} + DEPENDS ${po} + ) + endforeach() endif() if(APPLE) -set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) + set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) -# Ask for an application bundle. -set_target_properties(${DOLPHIN_EXE} PROPERTIES - MACOSX_BUNDLE true - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in - ) + # Ask for an application bundle. + set_target_properties(${DOLPHIN_EXE} PROPERTIES + MACOSX_BUNDLE true + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in + ) -# 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_EXE} 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}") - source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}") -endforeach() + # 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_EXE} 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}") + source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}") + endforeach() -# Update library references to make the bundle portable -include(DolphinPostprocessBundle) -dolphin_postprocess_bundle(${DOLPHIN_EXE}) + # Update library references to make the bundle portable + include(DolphinPostprocessBundle) + dolphin_postprocess_bundle(${DOLPHIN_EXE}) -# Install bundle into systemwide /Applications directory. -install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications) + # Install bundle into systemwide /Applications directory. + install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications) elseif(WIN32) -set_target_properties(${DOLPHIN_EXE} PROPERTIES - WIN32_EXECUTABLE ON -) -add_custom_command(TARGET ${DOLPHIN_EXE} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $/Sys -) + set_target_properties(${DOLPHIN_EXE} PROPERTIES + WIN32_EXECUTABLE ON + ) + add_custom_command(TARGET ${DOLPHIN_EXE} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $/Sys + ) else() -install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) + install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) endif() set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) From b955805b2b0903e8f24837bb942d67624db0aad3 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 15:05:19 -0700 Subject: [PATCH 8/8] CMake: remove DolphinWX $DOLPHIN_EXE abstraction --- Source/Core/DolphinWX/CMakeLists.txt | 37 +++++++++++----------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 9201dd7dff..9082085230 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -104,16 +104,8 @@ if(WIN32) ) endif() -if(APPLE) - set(DOLPHIN_EXE_BASE Dolphin) -else() - set(DOLPHIN_EXE_BASE dolphin-emu) -endif() - -set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}) - -add_executable(${DOLPHIN_EXE} ${SRCS}) -target_link_libraries(${DOLPHIN_EXE} ${LIBS}) +add_executable(dolphin-emu ${SRCS}) +target_link_libraries(dolphin-emu ${LIBS}) # Handle localization find_package(Gettext) @@ -121,7 +113,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_EXE} PRIVATE ${pot_file} ${LINGUAS}) + target_sources(dolphin-emu PRIVATE ${pot_file} ${LINGUAS}) source_group("Localization" FILES ${LINGUAS}) source_group("Localization\\\\Generated" FILES ${pot_file}) @@ -130,7 +122,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_EXE} PRIVATE ${mo}) + target_sources(dolphin-emu PRIVATE ${mo}) source_group("Localization\\\\Generated" FILES ${mo}) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") @@ -149,19 +141,18 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE) endif() if(APPLE) - set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) - # Ask for an application bundle. - set_target_properties(${DOLPHIN_EXE} 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 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_EXE} 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}") @@ -170,19 +161,19 @@ if(APPLE) # Update library references to make the bundle portable include(DolphinPostprocessBundle) - dolphin_postprocess_bundle(${DOLPHIN_EXE}) + dolphin_postprocess_bundle(dolphin-emu) # Install bundle into systemwide /Applications directory. - install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications) + install(TARGETS dolphin-emu DESTINATION /Applications) elseif(WIN32) - set_target_properties(${DOLPHIN_EXE} PROPERTIES + set_target_properties(dolphin-emu PROPERTIES WIN32_EXECUTABLE ON ) - add_custom_command(TARGET ${DOLPHIN_EXE} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $/Sys + add_custom_command(TARGET dolphin-emu + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $/Sys ) else() - install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) + install(TARGETS dolphin-emu RUNTIME DESTINATION ${bindir}) endif() -set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) +set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} dolphin-emu)