CMake: Remove all references to wx

This commit is contained in:
Stenzek 2022-12-24 14:54:18 +10:00 committed by refractionpcsx2
parent 7cb22815e6
commit 9a3e7eecd9
14 changed files with 110 additions and 2480 deletions

View File

@ -58,27 +58,7 @@ endif()
#-------------------------------------------------------------------------------
# Install some files to ease package creation
if(PACKAGE_MODE)
# set categories depending on system/distribution in pcsx2.desktop
if(openSUSE)
set(PCSX2_MENU_CATEGORIES "System;Emulator;")
else()
set(PCSX2_MENU_CATEGORIES "Game;Emulator;")
endif()
configure_file("${CMAKE_SOURCE_DIR}/linux_various/PCSX2.desktop.in" "${CMAKE_BINARY_DIR}/linux_various/PCSX2.desktop" @ONLY)
INSTALL(FILES "${CMAKE_BINARY_DIR}/linux_various/PCSX2.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2.xpm" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps")
INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2_FAQ.pdf" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
# INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/Configuration_Guide.pdf" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
if(NOT DISABLE_PCSX2_WRAPPER)
INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
elseif(NOT WIN32)
if(NOT DISABLE_PCSX2_WRAPPER)
# special case to avoid having linux files in windows
INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_SOURCE_DIR}/bin")
endif()
if(NOT WIN32 AND NOT DISABLE_PCSX2_WRAPPER)
# special case to avoid having linux files in windows
INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_SOURCE_DIR}/bin")
endif()

View File

@ -51,12 +51,9 @@ option(USE_VULKAN "Enable Vulkan GS renderer" ON)
#-------------------------------------------------------------------------------
# Path and lib option
#-------------------------------------------------------------------------------
option(PACKAGE_MODE "Use this option to ease packaging of PCSX2 (developer/distribution option)")
option(DISABLE_PCSX2_WRAPPER "Disable including the PCSX2-linux.sh file")
option(DISABLE_SETCAP "Do not set files capabilities")
option(XDG_STD "Use XDG standard path instead of the standard PCSX2 path")
option(CUBEB_API "Build Cubeb support on SPU2" ON)
option(GTK2_API "Use GTK2 api (legacy)")
option(QT_BUILD "Build Qt frontend instead of wx" ON)
if(UNIX AND NOT APPLE)
@ -64,15 +61,6 @@ if(UNIX AND NOT APPLE)
option(WAYLAND_API "Enable Wayland support" OFF)
endif()
if(PACKAGE_MODE)
file(RELATIVE_PATH relative_datadir ${CMAKE_INSTALL_FULL_BINDIR} ${CMAKE_INSTALL_FULL_DATADIR}/PCSX2)
file(RELATIVE_PATH relative_docdir ${CMAKE_INSTALL_FULL_BINDIR} ${CMAKE_INSTALL_FULL_DOCDIR})
# Compile all source codes with those defines
list(APPEND PCSX2_DEFS
PCSX2_APP_DATADIR="${relative_datadir}"
PCSX2_APP_DOCDIR="${relative_docdir}")
endif()
if(APPLE)
option(OSX_USE_DEFAULT_SEARCH_PATH "Don't prioritize system library paths" OFF)
option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF)

View File

@ -1,920 +0,0 @@
#.rst:
# FindGTK3
# --------
#
# FindGTK3.cmake
#
# This module can find the GTK3 widget libraries and several of its
# other optional components like gtkmm, glade, and glademm.
#
# NOTE: If you intend to use version checking, CMake 2.6.2 or later is
#
# ::
#
# required.
#
#
#
# Specify one or more of the following components as you call this find
# module. See example below.
#
# ::
#
# gtk
# gtkmm
# glade
# glademm
#
#
#
# The following variables will be defined for your use
#
# ::
#
# GTK3_FOUND - Were all of your specified components found?
# GTK3_INCLUDE_DIRS - All include directories
# GTK3_LIBRARIES - All libraries
# GTK3_DEFINITIONS - Additional compiler flags
#
#
#
# ::
#
# GTK3_VERSION - The version of GTK3 found (x.y.z)
# GTK3_MAJOR_VERSION - The major version of GTK3
# GTK3_MINOR_VERSION - The minor version of GTK3
# GTK3_PATCH_VERSION - The patch version of GTK3
#
#
#
# Optional variables you can define prior to calling this module:
#
# ::
#
# GTK3_DEBUG - Enables verbose debugging of the module
# GTK3_ADDITIONAL_SUFFIXES - Allows defining additional directories to
# search for include files
#
#
#
# ================= Example Usage:
#
# ::
#
# Call find_package() once, here are some examples to pick from:
#
#
#
# ::
#
# Require GTK 3.6 or later
# find_package(GTK3 3.6 REQUIRED gtk)
#
#
#
# ::
#
# Require GTK 3.10 or later and Glade
# find_package(GTK3 3.10 REQUIRED gtk glade)
#
#
#
# ::
#
# Search for GTK/GTKMM 3.8 or later
# find_package(GTK3 3.8 COMPONENTS gtk gtkmm)
#
#
#
# ::
#
# if(GTK3_FOUND)
# include_directories(${GTK3_INCLUDE_DIRS})
# add_executable(mygui mygui.cc)
# target_link_libraries(mygui ${GTK3_LIBRARIES})
# endif()
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2008-2012 Philip Lowman <philip@yhbt.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Version gtk3-0.1 (12/27/2014)
# * Initial port of FindGTK2 (CMake 3.1.0) to FindGTK3.
# sed -i 's/GTK2/GTK3/g
# s/gtk2/gtk3/g
# s,${CMAKE_CURRENT_LIST_DIR}/,,g
# s,.cmake),),g
# s/gtk-x11/gtk/g
# s/gdk-x11/gdk/g
# s/gdkmm-2.4/gdkmm-3.0/g
# s/gtk-2.0/gtk-3.0/g
# s/gtkmm-2.4/gtkmm-3.0/g
# s/2.4;Path/3.0;Path/g
# s,GDKCONFIG gdkconfig.h,GDKCONFIG gdk/gdkconfig.h,g
# s,set(_versions 2,set(_versions 3.0 3 2,g
# s/_gtk_/_gtk3_/g' FindGTK2.cmake
# * Detect cairo-gobject library.
# * Update the dependencies of gdk, gtk, pangomm, gdkmm, gtkmm, glade, and
# glademm based on their .pc files. This ammounts to dropping pangoft2
# and gthread from the dependencies (they are still detected) while adding
# cairo-gobject. All of the optional dependencies are required in GTK3.
# Version 1.6 (CMake 3.0)
# * Create targets for each library
# * Do not link libfreetype
# Version 1.5 (CMake 2.8.12)
# * 14236: Detect gthread library
# Detect pangocairo on windows
# Detect pangocairo with gtk module instead of with gtkmm
# * 14259: Use vc100 libraries with MSVC11
# * 14260: Export a GTK2_DEFINITIONS variable to set /vd2 when appropriate
# (i.e. MSVC)
# * Use the optimized/debug syntax for _LIBRARY and _LIBRARIES variables when
# appropriate. A new set of _RELEASE variables was also added.
# * Remove GTK2_SKIP_MARK_AS_ADVANCED option, as now the variables are
# marked as advanced by SelectLibraryConfigurations
# * Detect gmodule, pangoft2 and pangoxft libraries
# Version 1.4 (10/4/2012) (CMake 2.8.10)
# * 12596: Missing paths for FindGTK2 on NetBSD
# * 12049: Fixed detection of GTK include files in the lib folder on
# multiarch systems.
# Version 1.3 (11/9/2010) (CMake 2.8.4)
# * 11429: Add support for detecting GTK2 built with Visual Studio 10.
# Thanks to Vincent Levesque for the patch.
# Version 1.2 (8/30/2010) (CMake 2.8.3)
# * Merge patch for detecting gdk-pixbuf library (split off
# from core GTK in 2.21). Thanks to Vincent Untz for the patch
# and Ricardo Cruz for the heads up.
# Version 1.1 (8/19/2010) (CMake 2.8.3)
# * Add support for detecting GTK2 under macports (thanks to Gary Kramlich)
# Version 1.0 (8/12/2010) (CMake 2.8.3)
# * Add support for detecting new pangommconfig.h header file
# (Thanks to Sune Vuorela & the Debian Project for the patch)
# * Add support for detecting fontconfig.h header
# * Call find_package(Freetype) since it's required
# * Add support for allowing users to add additional library directories
# via the GTK2_ADDITIONAL_SUFFIXES variable (kind of a future-kludge in
# case the GTK developers change versions on any of the directories in the
# future).
# Version 0.8 (1/4/2010)
# * Get module working under MacOSX fink by adding /sw/include, /sw/lib
# to PATHS and the gobject library
# Version 0.7 (3/22/09)
# * Checked into CMake CVS
# * Added versioning support
# * Module now defaults to searching for GTK if COMPONENTS not specified.
# * Added HKCU prior to HKLM registry key and GTKMM specific environment
# variable as per mailing list discussion.
# * Added lib64 to include search path and a few other search paths where GTK
# may be installed on Unix systems.
# * Switched to lowercase CMake commands
# * Prefaced internal variables with _GTK2 to prevent collision
# * Changed internal macros to functions
# * Enhanced documentation
# Version 0.6 (1/8/08)
# Added GTK2_SKIP_MARK_AS_ADVANCED option
# Version 0.5 (12/19/08)
# Second release to cmake mailing list
#=============================================================
# _GTK3_GET_VERSION
# Internal function to parse the version number in gtkversion.h
# _OUT_major = Major version number
# _OUT_minor = Minor version number
# _OUT_micro = Micro version number
# _gtkversion_hdr = Header file to parse
#=============================================================
include(SelectLibraryConfigurations)
include(CMakeParseArguments)
function(_GTK3_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+")
if(_contents)
string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}")
string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}")
string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}")
if(NOT ${_OUT_major} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for GTK3_MAJOR_VERSION!")
endif()
if(NOT ${_OUT_minor} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for GTK3_MINOR_VERSION!")
endif()
if(NOT ${_OUT_micro} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for GTK3_MICRO_VERSION!")
endif()
set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE)
set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE)
set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE)
else()
message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist")
endif()
endfunction()
#=============================================================
# _GTK3_FIND_INCLUDE_DIR
# Internal function to find the GTK include directories
# _var = variable to set (_INCLUDE_DIR is appended)
# _hdr = header file to look for
#=============================================================
function(_GTK3_FIND_INCLUDE_DIR _var _hdr)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"_GTK3_FIND_INCLUDE_DIR( ${_var} ${_hdr} )")
endif()
set(_gtk3_packages
# If these ever change, things will break.
${GTK3_ADDITIONAL_SUFFIXES}
glibmm-2.4
glib-2.0
atk-1.0
atkmm-1.6
cairo
cairomm-1.0
gdk-pixbuf-2.0
gdkmm-3.0
giomm-2.4
gtk-3.0
gtkmm-3.0
libglade-2.0
libglademm-2.4
pango-1.0
pangomm-1.4
sigc++-2.0
)
#
# NOTE: The following suffixes cause searching for header files in both of
# these directories:
# /usr/include/<pkg>
# /usr/lib/<pkg>/include
#
set(_suffixes)
foreach(_d ${_gtk3_packages})
list(APPEND _suffixes ${_d})
list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-3.0/include
endforeach()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"include suffixes = ${_suffixes}")
endif()
if(CMAKE_LIBRARY_ARCHITECTURE)
set(_gtk3_arch_dir /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE})
if(GTK3_DEBUG)
message(STATUS "Adding ${_gtk3_arch_dir} to search path for multiarch support")
endif()
endif()
find_path(GTK3_${_var}_INCLUDE_DIR ${_hdr}
PATHS
${_gtk3_arch_dir}
/usr/local/lib64
/usr/local/lib
/usr/lib64
/usr/lib
/usr/X11R6/include
/usr/X11R6/lib
/opt/gnome/include
/opt/gnome/lib
/opt/openwin/include
/usr/openwin/lib
/sw/include
/sw/lib
/opt/local/include
/opt/local/lib
/usr/pkg/lib
/usr/pkg/include/glib
$ENV{GTKMM_BASEPATH}/include
$ENV{GTKMM_BASEPATH}/lib
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/include
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib
PATH_SUFFIXES
${_suffixes}
)
mark_as_advanced(GTK3_${_var}_INCLUDE_DIR)
if(GTK3_${_var}_INCLUDE_DIR)
set(GTK3_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS} ${GTK3_${_var}_INCLUDE_DIR} PARENT_SCOPE)
endif()
endfunction()
#=============================================================
# _GTK3_FIND_LIBRARY
# Internal function to find libraries packaged with GTK3
# _var = library variable to create (_LIBRARY is appended)
#=============================================================
function(_GTK3_FIND_LIBRARY _var _lib _expand_vc _append_version)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"_GTK3_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )")
endif()
# Not GTK versions per se but the versions encoded into Windows
# import libraries (GtkMM 2.14.1 has a gtkmm-vc80-2_4.lib for example)
# Also the MSVC libraries use _ for . (this is handled below)
set(_versions 3.0 3 2.20 2.18 2.16 2.14 2.12
2.10 2.8 2.6 2.4 2.2 2.0
1.20 1.18 1.16 1.14 1.12
1.10 1.8 1.6 1.4 1.2 1.0)
set(_library)
set(_library_d)
set(_library ${_lib})
if(_expand_vc AND MSVC)
# Add vc80/vc90/vc100 midfixes
if(MSVC80)
set(_library ${_library}-vc80)
elseif(MSVC90)
set(_library ${_library}-vc90)
elseif(MSVC10)
set(_library ${_library}-vc100)
elseif(MSVC11)
# Up to gtkmm-win 2.22.0-2 there are no vc110 libraries but vc100 can be used
set(_library ${_library}-vc100)
endif()
set(_library_d ${_library}-d)
endif()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"After midfix addition = ${_library} and ${_library_d}")
endif()
set(_lib_list)
set(_libd_list)
if(_append_version)
foreach(_ver ${_versions})
list(APPEND _lib_list "${_library}-${_ver}")
list(APPEND _libd_list "${_library_d}-${_ver}")
endforeach()
else()
set(_lib_list ${_library})
set(_libd_list ${_library_d})
endif()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"library list = ${_lib_list} and library debug list = ${_libd_list}")
endif()
# For some silly reason the MSVC libraries use _ instead of .
# in the version fields
if(_expand_vc AND MSVC)
set(_no_dots_lib_list)
set(_no_dots_libd_list)
foreach(_l ${_lib_list})
string(REPLACE "." "_" _no_dots_library ${_l})
list(APPEND _no_dots_lib_list ${_no_dots_library})
endforeach()
# And for debug
set(_no_dots_libsd_list)
foreach(_l ${_libd_list})
string(REPLACE "." "_" _no_dots_libraryd ${_l})
list(APPEND _no_dots_libd_list ${_no_dots_libraryd})
endforeach()
# Copy list back to original names
set(_lib_list ${_no_dots_lib_list})
set(_libd_list ${_no_dots_libd_list})
endif()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"While searching for GTK3_${_var}_LIBRARY, our proposed library list is ${_lib_list}")
endif()
find_library(GTK3_${_var}_LIBRARY_RELEASE
NAMES ${_lib_list}
PATHS
/opt/gnome/lib
/usr/openwin/lib
/sw/lib
$ENV{GTKMM_BASEPATH}/lib
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib
)
if(_expand_vc AND MSVC)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"While searching for GTK3_${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}")
endif()
find_library(GTK3_${_var}_LIBRARY_DEBUG
NAMES ${_libd_list}
PATHS
$ENV{GTKMM_BASEPATH}/lib
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib
)
endif()
select_library_configurations(GTK3_${_var})
set(GTK3_${_var}_LIBRARY ${GTK3_${_var}_LIBRARY} PARENT_SCOPE)
set(GTK3_${_var}_FOUND ${GTK3_${_var}_FOUND} PARENT_SCOPE)
if(GTK3_${_var}_FOUND)
set(GTK3_LIBRARIES ${GTK3_LIBRARIES} ${GTK3_${_var}_LIBRARY})
set(GTK3_LIBRARIES ${GTK3_LIBRARIES} PARENT_SCOPE)
endif()
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"GTK3_${_var}_LIBRARY_RELEASE = \"${GTK3_${_var}_LIBRARY_RELEASE}\"")
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"GTK3_${_var}_LIBRARY_DEBUG = \"${GTK3_${_var}_LIBRARY_DEBUG}\"")
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"GTK3_${_var}_LIBRARY = \"${GTK3_${_var}_LIBRARY}\"")
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"GTK3_${_var}_FOUND = \"${GTK3_${_var}_FOUND}\"")
endif()
endfunction()
function(_GTK3_ADD_TARGET_DEPENDS_INTERNAL _var _property)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"_GTK3_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )")
endif()
string(TOLOWER "${_var}" _basename)
if (TARGET GTK3::${_basename})
foreach(_depend ${ARGN})
set(_valid_depends)
if (TARGET GTK3::${_depend})
list(APPEND _valid_depends GTK3::${_depend})
endif()
if (_valid_depends)
set_property(TARGET GTK3::${_basename} APPEND PROPERTY ${_property} "${_valid_depends}")
endif()
set(_valid_depends)
endforeach()
endif()
endfunction()
function(_GTK3_ADD_TARGET_DEPENDS _var)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"_GTK3_ADD_TARGET_DEPENDS( ${_var} )")
endif()
string(TOLOWER "${_var}" _basename)
if(TARGET GTK3::${_basename})
get_target_property(_configs GTK3::${_basename} IMPORTED_CONFIGURATIONS)
_GTK3_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN})
foreach(_config ${_configs})
_GTK3_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN})
endforeach()
endif()
endfunction()
function(_GTK3_ADD_TARGET_INCLUDE_DIRS _var)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"_GTK3_ADD_TARGET_INCLUDE_DIRS( ${_var} )")
endif()
string(TOLOWER "${_var}" _basename)
if(TARGET GTK3::${_basename})
foreach(_include ${ARGN})
set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}")
endforeach()
endif()
endfunction()
#=============================================================
# _GTK3_ADD_TARGET
# Internal function to create targets for GTK3
# _var = target to create
#=============================================================
function(_GTK3_ADD_TARGET _var)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"_GTK3_ADD_TARGET( ${_var} )")
endif()
string(TOLOWER "${_var}" _basename)
cmake_parse_arguments(_${_var} "" "" "GTK3_DEPENDS;GTK3_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN})
if(GTK3_${_var}_FOUND AND NOT TARGET GTK3::${_basename})
# Do not create the target if dependencies are missing
foreach(_dep ${_${_var}_GTK3_DEPENDS})
if(NOT TARGET GTK3::${_dep})
message("Not creating GTK3::${_basename}, missing GTK3::${_dep}")
return()
endif()
endforeach()
add_library(GTK3::${_basename} UNKNOWN IMPORTED)
if(GTK3_${_var}_LIBRARY_RELEASE)
set_property(TARGET GTK3::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_property(TARGET GTK3::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK3_${_var}_LIBRARY_RELEASE}" )
endif()
if(GTK3_${_var}_LIBRARY_DEBUG)
set_property(TARGET GTK3::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_property(TARGET GTK3::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK3_${_var}_LIBRARY_DEBUG}" )
endif()
if(GTK3_${_var}_INCLUDE_DIR)
set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK3_${_var}_INCLUDE_DIR}")
endif()
if(GTK3_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK3_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK3_${_var}_INCLUDE_DIR}")
set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK3_${_var}CONFIG_INCLUDE_DIR}")
endif()
if(GTK3_DEFINITIONS)
set_property(TARGET GTK3::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK3_DEFINITIONS}")
endif()
if(_${_var}_GTK3_DEPENDS)
_GTK3_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK3_DEPENDS} ${_${_var}_GTK3_OPTIONAL_DEPENDS})
endif()
if(_${_var}_OPTIONAL_INCLUDES)
foreach(_D ${_${_var}_OPTIONAL_INCLUDES})
if(_D)
_GTK3_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D})
endif()
endforeach()
endif()
if(GTK3_USE_IMPORTED_TARGETS)
set(GTK3_${_var}_LIBRARY GTK3::${_basename} PARENT_SCOPE)
endif()
endif()
endfunction()
#=============================================================
#
# main()
#
set(GTK3_FOUND)
set(GTK3_INCLUDE_DIRS)
set(GTK3_LIBRARIES)
set(GTK3_DEFINITIONS)
if(NOT GTK3_FIND_COMPONENTS)
# Assume they only want GTK
set(GTK3_FIND_COMPONENTS gtk)
endif()
#
# If specified, enforce version number
#
if(GTK3_FIND_VERSION)
set(GTK3_FAILED_VERSION_CHECK true)
if(GTK3_DEBUG)
message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] "
"Searching for version ${GTK3_FIND_VERSION}")
endif()
_GTK3_FIND_INCLUDE_DIR(GTK gtk/gtk.h)
if(GTK3_GTK_INCLUDE_DIR)
_GTK3_GET_VERSION(GTK3_MAJOR_VERSION
GTK3_MINOR_VERSION
GTK3_PATCH_VERSION
${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
set(GTK3_VERSION
${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION})
if(GTK3_FIND_VERSION_EXACT)
if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION)
set(GTK3_FAILED_VERSION_CHECK false)
endif()
else()
if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION OR
GTK3_VERSION VERSION_GREATER GTK3_FIND_VERSION)
set(GTK3_FAILED_VERSION_CHECK false)
endif()
endif()
else()
# If we can't find the GTK include dir, we can't do version checking
if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY)
message(FATAL_ERROR "Could not find GTK3 include directory")
endif()
return()
endif()
if(GTK3_FAILED_VERSION_CHECK)
if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY)
if(GTK3_FIND_VERSION_EXACT)
message(FATAL_ERROR "GTK3 version check failed. Version ${GTK3_VERSION} was found, version ${GTK3_FIND_VERSION} is needed exactly.")
else()
message(FATAL_ERROR "GTK3 version check failed. Version ${GTK3_VERSION} was found, at least version ${GTK3_FIND_VERSION} is required")
endif()
endif()
# If the version check fails, exit out of the module here
return()
endif()
endif()
#
# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be
# passed to the compiler in order to use gtkmm
#
if(MSVC)
foreach(_GTK3_component ${GTK3_FIND_COMPONENTS})
if(_GTK3_component STREQUAL "gtkmm")
set(GTK3_DEFINITIONS "/vd2")
elseif(_GTK3_component STREQUAL "glademm")
set(GTK3_DEFINITIONS "/vd2")
endif()
endforeach()
endif()
#
# Find all components
#
find_package(Freetype QUIET)
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
list(APPEND GTK3_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2})
endif()
foreach(_GTK3_component ${GTK3_FIND_COMPONENTS})
if(_GTK3_component STREQUAL "gtk")
# Left for compatibility with previous versions.
_GTK3_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h)
_GTK3_FIND_INCLUDE_DIR(X11 X11/Xlib.h)
_GTK3_FIND_INCLUDE_DIR(GLIB glib.h)
_GTK3_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h)
_GTK3_FIND_LIBRARY (GLIB glib false true)
_GTK3_ADD_TARGET (GLIB)
_GTK3_FIND_INCLUDE_DIR(GOBJECT glib-object.h)
_GTK3_FIND_LIBRARY (GOBJECT gobject false true)
_GTK3_ADD_TARGET (GOBJECT GTK3_DEPENDS glib)
_GTK3_FIND_INCLUDE_DIR(ATK atk/atk.h)
_GTK3_FIND_LIBRARY (ATK atk false true)
_GTK3_ADD_TARGET (ATK GTK3_DEPENDS gobject glib)
_GTK3_FIND_LIBRARY (GIO gio false true)
_GTK3_ADD_TARGET (GIO GTK3_DEPENDS gobject glib)
_GTK3_FIND_LIBRARY (GTHREAD gthread false true)
_GTK3_ADD_TARGET (GTHREAD GTK3_DEPENDS glib)
_GTK3_FIND_LIBRARY (GMODULE gmodule false true)
_GTK3_ADD_TARGET (GMODULE GTK3_DEPENDS glib)
_GTK3_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h)
_GTK3_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true)
_GTK3_ADD_TARGET (GDK_PIXBUF GTK3_DEPENDS gobject glib)
_GTK3_FIND_INCLUDE_DIR(CAIRO cairo.h)
_GTK3_FIND_LIBRARY (CAIRO cairo false false)
_GTK3_ADD_TARGET (CAIRO)
_GTK3_FIND_INCLUDE_DIR(CAIRO_GOBJECT cairo-gobject.h)
_GTK3_FIND_LIBRARY (CAIRO_GOBJECT cairo-gobject false false)
_GTK3_ADD_TARGET (CAIRO_GOBJECT GTK3_DEPENDS cairo gobject glib)
_GTK3_FIND_INCLUDE_DIR(PANGO pango/pango.h)
_GTK3_FIND_LIBRARY (PANGO pango false true)
_GTK3_ADD_TARGET (PANGO GTK3_DEPENDS gobject glib)
_GTK3_FIND_LIBRARY (PANGOCAIRO pangocairo false true)
_GTK3_ADD_TARGET (PANGOCAIRO GTK3_DEPENDS pango cairo gobject glib)
_GTK3_FIND_LIBRARY (PANGOFT2 pangoft2 false true)
_GTK3_ADD_TARGET (PANGOFT2 GTK3_DEPENDS pango gobject glib
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
_GTK3_FIND_LIBRARY (PANGOXFT pangoxft false true)
_GTK3_ADD_TARGET (PANGOXFT GTK3_DEPENDS pangoft2 pango gobject glib
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
_GTK3_FIND_INCLUDE_DIR(GDK gdk/gdk.h)
_GTK3_FIND_INCLUDE_DIR(GDKCONFIG gdk/gdkconfig.h)
if(UNIX)
if(APPLE)
_GTK3_FIND_LIBRARY (GDK gdk-quartz false true)
endif()
if(NOT GTK3_GDK_FOUND)
_GTK3_FIND_LIBRARY (GDK gdk false true)
endif()
else()
_GTK3_FIND_LIBRARY (GDK gdk-win32 false true)
endif()
_GTK3_ADD_TARGET (GDK GTK3_DEPENDS pangocairo pango cairo_gobject cairo gdk_pixbuf gobject glib)
_GTK3_FIND_INCLUDE_DIR(GTK gtk/gtk.h)
if(UNIX)
if(APPLE)
_GTK3_FIND_LIBRARY (GTK gtk-quartz false true)
endif()
if(NOT GTK3_GTK_FOUND)
_GTK3_FIND_LIBRARY (GTK gtk false true)
endif()
else()
_GTK3_FIND_LIBRARY (GTK gtk-win32 false true)
endif()
_GTK3_ADD_TARGET (GTK GTK3_DEPENDS gdk atk pangocairo pango cairo_gobject cairo gdk_pixbuf gio gobject glib)
elseif(_GTK3_component STREQUAL "gtkmm")
_GTK3_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h)
_GTK3_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h)
_GTK3_FIND_LIBRARY (SIGC++ sigc true true)
_GTK3_ADD_TARGET (SIGC++)
_GTK3_FIND_INCLUDE_DIR(GLIBMM glibmm.h)
_GTK3_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h)
_GTK3_FIND_LIBRARY (GLIBMM glibmm true true)
_GTK3_ADD_TARGET (GLIBMM GTK3_DEPENDS gobject sigc++ glib)
_GTK3_FIND_INCLUDE_DIR(GIOMM giomm.h)
_GTK3_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h)
_GTK3_FIND_LIBRARY (GIOMM giomm true true)
_GTK3_ADD_TARGET (GIOMM GTK3_DEPENDS gio glibmm gobject sigc++ glib)
_GTK3_FIND_INCLUDE_DIR(ATKMM atkmm.h)
_GTK3_FIND_LIBRARY (ATKMM atkmm true true)
_GTK3_ADD_TARGET (ATKMM GTK3_DEPENDS atk glibmm gobject sigc++ glib)
_GTK3_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h)
_GTK3_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h)
_GTK3_FIND_LIBRARY (CAIROMM cairomm true true)
_GTK3_ADD_TARGET (CAIROMM GTK3_DEPENDS cairo sigc++
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
_GTK3_FIND_INCLUDE_DIR(PANGOMM pangomm.h)
_GTK3_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h)
_GTK3_FIND_LIBRARY (PANGOMM pangomm true true)
_GTK3_ADD_TARGET (PANGOMM GTK3_DEPENDS glibmm cairomm sigc++ pangocairo pango cairo gobject glib
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
_GTK3_FIND_INCLUDE_DIR(GDKMM gdkmm.h)
_GTK3_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h)
_GTK3_FIND_LIBRARY (GDKMM gdkmm true true)
_GTK3_ADD_TARGET (GDKMM GTK3_DEPENDS pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
_GTK3_FIND_INCLUDE_DIR(GTKMM gtkmm.h)
_GTK3_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h)
_GTK3_FIND_LIBRARY (GTKMM gtkmm true true)
_GTK3_ADD_TARGET (GTKMM GTK3_DEPENDS atkmm gdkmm pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
elseif(_GTK3_component STREQUAL "glade")
_GTK3_FIND_INCLUDE_DIR(GLADE glade/glade.h)
_GTK3_FIND_LIBRARY (GLADE glade false true)
_GTK3_ADD_TARGET (GLADE GTK3_DEPENDS gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
elseif(_GTK3_component STREQUAL "glademm")
_GTK3_FIND_INCLUDE_DIR(GLADEMM libglademm.h)
_GTK3_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h)
_GTK3_FIND_LIBRARY (GLADEMM glademm true true)
_GTK3_ADD_TARGET (GLADEMM GTK3_DEPENDS gtkmm glade atkmm gdkmm pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib
OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}
${GTK3_FONTCONFIG_INCLUDE_DIR}
${GTK3_X11_INCLUDE_DIR})
else()
message(FATAL_ERROR "Unknown GTK3 component ${_component}")
endif()
endforeach()
#
# Solve for the GTK3 version if we haven't already
#
if(NOT GTK3_FIND_VERSION AND GTK3_GTK_INCLUDE_DIR)
_GTK3_GET_VERSION(GTK3_MAJOR_VERSION
GTK3_MINOR_VERSION
GTK3_PATCH_VERSION
${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
set(GTK3_VERSION ${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION})
endif()
#
# Try to enforce components
#
set(_GTK3_did_we_find_everything true) # This gets set to GTK3_FOUND
include(FindPackageHandleStandardArgs)
foreach(_GTK3_component ${GTK3_FIND_COMPONENTS})
string(TOUPPER ${_GTK3_component} _COMPONENT_UPPER)
set(GTK3_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK3_FIND_QUIETLY})
if(_GTK3_component STREQUAL "gtk")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
GTK3_GTK_LIBRARY
GTK3_GTK_INCLUDE_DIR
GTK3_GDK_INCLUDE_DIR
GTK3_GDKCONFIG_INCLUDE_DIR
GTK3_GDK_LIBRARY
GTK3_GLIB_INCLUDE_DIR
GTK3_GLIBCONFIG_INCLUDE_DIR
GTK3_GLIB_LIBRARY
)
elseif(_GTK3_component STREQUAL "gtkmm")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found."
GTK3_GTKMM_LIBRARY
GTK3_GTKMM_INCLUDE_DIR
GTK3_GTKMMCONFIG_INCLUDE_DIR
GTK3_GDKMM_INCLUDE_DIR
GTK3_GDKMMCONFIG_INCLUDE_DIR
GTK3_GDKMM_LIBRARY
GTK3_GLIBMM_INCLUDE_DIR
GTK3_GLIBMMCONFIG_INCLUDE_DIR
GTK3_GLIBMM_LIBRARY
FREETYPE_INCLUDE_DIR_ft2build
FREETYPE_INCLUDE_DIR_freetype2
)
elseif(_GTK3_component STREQUAL "glade")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "The glade library was not found."
GTK3_GLADE_LIBRARY
GTK3_GLADE_INCLUDE_DIR
)
elseif(_GTK3_component STREQUAL "glademm")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "The glademm library was not found."
GTK3_GLADEMM_LIBRARY
GTK3_GLADEMM_INCLUDE_DIR
GTK3_GLADEMMCONFIG_INCLUDE_DIR
)
endif()
if(NOT GTK3_${_COMPONENT_UPPER}_FOUND)
set(_GTK3_did_we_find_everything false)
endif()
endforeach()
if(_GTK3_did_we_find_everything AND NOT GTK3_VERSION_CHECK_FAILED)
set(GTK3_FOUND true)
else()
# Unset our variables.
set(GTK3_FOUND false)
set(GTK3_VERSION)
set(GTK3_VERSION_MAJOR)
set(GTK3_VERSION_MINOR)
set(GTK3_VERSION_PATCH)
set(GTK3_INCLUDE_DIRS)
set(GTK3_LIBRARIES)
set(GTK3_DEFINITIONS)
endif()
if(GTK3_INCLUDE_DIRS)
list(REMOVE_DUPLICATES GTK3_INCLUDE_DIRS)
endif()

View File

@ -1,181 +0,0 @@
# Copyright (c) 2012, Intel Corporation
# Copyright (c) 2019 Sony Interactive Entertainment Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Try to find Harfbuzz include and library directories.
#
# After successful discovery, this will set for inclusion where needed:
# HarfBuzz_INCLUDE_DIRS - containg the HarfBuzz headers
# HarfBuzz_LIBRARIES - containg the HarfBuzz library
#[=======================================================================[.rst:
FindHarfBuzz
--------------
Find HarfBuzz headers and libraries.
Imported Targets
^^^^^^^^^^^^^^^^
``HarfBuzz::HarfBuzz``
The HarfBuzz library, if found.
``HarfBuzz::ICU``
The HarfBuzz ICU library, if found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables in your project:
``HarfBuzz_FOUND``
true if (the requested version of) HarfBuzz is available.
``HarfBuzz_VERSION``
the version of HarfBuzz.
``HarfBuzz_LIBRARIES``
the libraries to link against to use HarfBuzz.
``HarfBuzz_INCLUDE_DIRS``
where to find the HarfBuzz headers.
``HarfBuzz_COMPILE_OPTIONS``
this should be passed to target_compile_options(), if the
target is not used for linking
#]=======================================================================]
find_package(PkgConfig QUIET)
pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz)
set(HarfBuzz_COMPILE_OPTIONS ${PC_HARFBUZZ_CFLAGS_OTHER})
set(HarfBuzz_VERSION ${PC_HARFBUZZ_CFLAGS_VERSION})
find_path(HarfBuzz_INCLUDE_DIR
NAMES hb.h
HINTS ${PC_HARFBUZZ_INCLUDEDIR} ${PC_HARFBUZZ_INCLUDE_DIRS}
PATH_SUFFIXES harfbuzz
)
find_library(HarfBuzz_LIBRARY
NAMES ${HarfBuzz_NAMES} harfbuzz
HINTS ${PC_HARFBUZZ_LIBDIR} ${PC_HARFBUZZ_LIBRARY_DIRS}
)
if (HarfBuzz_INCLUDE_DIR AND NOT HarfBuzz_VERSION)
if (EXISTS "${HarfBuzz_INCLUDE_DIR}/hb-version.h")
file(READ "${HarfBuzz_INCLUDE_DIR}/hb-version.h" _harfbuzz_version_content)
string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}")
set(HarfBuzz_VERSION "${CMAKE_MATCH_1}")
endif ()
endif ()
if ("${HarfBuzz_FIND_VERSION}" VERSION_GREATER "${HarfBuzz_VERSION}")
message(FATAL_ERROR "Required version (" ${HarfBuzz_FIND_VERSION} ") is higher than found version (" ${HarfBuzz_VERSION} ")")
endif ()
# Find components
if (HarfBuzz_INCLUDE_DIR AND HarfBuzz_LIBRARY)
set(_HarfBuzz_REQUIRED_LIBS_FOUND ON)
set(HarfBuzz_LIBS_FOUND "HarfBuzz (required): ${HarfBuzz_LIBRARY}")
else ()
set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF)
set(HarfBuzz_LIBS_NOT_FOUND "HarfBuzz (required)")
endif ()
if ("ICU" IN_LIST HarfBuzz_FIND_COMPONENTS)
pkg_check_modules(PC_HARFBUZZ_ICU QUIET harfbuzz-icu)
set(HarfBuzz_ICU_COMPILE_OPTIONS ${PC_HARFBUZZ_ICU_CFLAGS_OTHER})
find_library(HarfBuzz_ICU_LIBRARY
NAMES ${HarfBuzz_ICU_NAMES} harfbuzz-icu
HINTS ${PC_HARFBUZZ_ICU_LIBDIR} ${PC_HARFBUZZ_ICU_LIBRARY_DIRS}
)
if (HarfBuzz_ICU_LIBRARY)
if (HarfBuzz_FIND_REQUIRED_ICU)
list(APPEND HarfBuzz_LIBS_FOUND "ICU (required): ${HarfBuzz_ICU_LIBRARY}")
else ()
list(APPEND HarfBuzz_LIBS_FOUND "ICU (optional): ${HarfBuzz_ICU_LIBRARY}")
endif ()
else ()
if (HarfBuzz_FIND_REQUIRED_ICU)
set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF)
list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (required)")
else ()
list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (optional)")
endif ()
endif ()
endif ()
if (NOT HarfBuzz_FIND_QUIETLY)
if (HarfBuzz_LIBS_FOUND)
message(STATUS "Found the following HarfBuzz libraries:")
foreach (found ${HarfBuzz_LIBS_FOUND})
message(STATUS " ${found}")
endforeach ()
endif ()
if (HarfBuzz_LIBS_NOT_FOUND)
message(STATUS "The following HarfBuzz libraries were not found:")
foreach (found ${HarfBuzz_LIBS_NOT_FOUND})
message(STATUS " ${found}")
endforeach ()
endif ()
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HarfBuzz
FOUND_VAR HarfBuzz_FOUND
REQUIRED_VARS HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY _HarfBuzz_REQUIRED_LIBS_FOUND
VERSION_VAR HarfBuzz_VERSION
)
if (HarfBuzz_LIBRARY AND NOT TARGET HarfBuzz::HarfBuzz)
add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED GLOBAL)
set_target_properties(HarfBuzz::HarfBuzz PROPERTIES
IMPORTED_LOCATION "${HarfBuzz_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${HarfBuzz_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}"
)
endif ()
if (HarfBuzz_ICU_LIBRARY AND NOT TARGET HarfBuzz::ICU)
add_library(HarfBuzz::ICU UNKNOWN IMPORTED GLOBAL)
set_target_properties(HarfBuzz::ICU PROPERTIES
IMPORTED_LOCATION "${HarfBuzz_ICU_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${HarfBuzz_ICU_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}"
)
endif ()
mark_as_advanced(
HarfBuzz_INCLUDE_DIR
HarfBuzz_LIBRARY
HarfBuzz_ICU_LIBRARY
)
if (HarfBuzz_FOUND)
set(HarfBuzz_LIBRARIES ${HarfBuzz_LIBRARY} ${HarfBuzz_ICU_LIBRARY})
set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR})
endif ()

View File

@ -1,10 +0,0 @@
# This file should be run with cmake -DPCSX2_BUNDLE_PATH=path -P Pcsx2PostprocessBundle.cmake
get_filename_component(PCSX2_BUNDLE_PATH "${PCSX2_BUNDLE_PATH}" ABSOLUTE)
# Fixup plugins too
file(GLOB_RECURSE plugins "${PCSX2_BUNDLE_PATH}/Contents/MacOS/*.dylib")
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle("${PCSX2_BUNDLE_PATH}" "${plugins}" "")

View File

@ -9,18 +9,13 @@ if (WIN32)
add_subdirectory(3rdparty/zlib EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/libpng EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/libjpeg EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/pthreads4w EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/soundtouch EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/wil EXCLUDE_FROM_ALL)
if (NOT PCSX2_CORE)
add_subdirectory(3rdparty/wxwidgets3.0 EXCLUDE_FROM_ALL)
endif()
add_subdirectory(3rdparty/xz EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/D3D12MemAlloc EXCLUDE_FROM_ALL)
set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/3rdparty/ffmpeg/include")
else()
find_package(PCAP REQUIRED)
find_package(Gettext) # translation tool
find_package(LibLZMA REQUIRED)
make_imported_target_if_missing(LibLZMA::LibLZMA LIBLZMA)
@ -46,82 +41,6 @@ else()
set(FFMPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/3rdparty/ffmpeg/include")
endif()
if(NOT PCSX2_CORE)
# Does not require the module (allow to compile non-wx plugins)
# Force the unicode build (the variable is only supported on cmake 2.8.3 and above)
# Warning do not put any double-quote for the argument...
# set(wxWidgets_CONFIG_OPTIONS --unicode=yes --debug=yes) # In case someone want to debug inside wx
#
# Fedora uses an extra non-standard option ... Arch must be the first option.
# They do uname -m if missing so only fix for cross compilations.
# http://pkgs.fedoraproject.org/cgit/wxGTK.git/plain/wx-config
if(Fedora AND CMAKE_CROSSCOMPILING)
set(wxWidgets_CONFIG_OPTIONS --arch ${PCSX2_TARGET_ARCHITECTURES} --unicode=yes)
else()
set(wxWidgets_CONFIG_OPTIONS --unicode=yes)
endif()
# I'm removing the version check, because it excludes newer versions and requires specifically 3.0.
#list(APPEND wxWidgets_CONFIG_OPTIONS --version=3.0)
# The wx version must be specified so a mix of gtk2 and gtk3 isn't used
# as that can cause compile errors.
if(GTK2_API AND NOT APPLE)
list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk2)
elseif(NOT APPLE)
list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk3)
endif()
# wx2.8 => /usr/bin/wx-config-2.8
# lib32-wx2.8 => /usr/bin/wx-config32-2.8
# wx3.0 => /usr/bin/wx-config-3.0
# I'm going to take a wild guess and predict this:
# lib32-wx3.0 => /usr/bin/wx-config32-3.0
# FindwxWidgets only searches for wx-config.
if(CMAKE_CROSSCOMPILING)
# May need to fix the filenames for lib32-wx3.0.
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
if (Fedora AND EXISTS "/usr/bin/wx-config-3.0")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0")
endif()
if (EXISTS "/usr/bin/wx-config32")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32")
endif()
if (EXISTS "/usr/bin/wx-config32-3.0")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32-3.0")
endif()
endif()
else()
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
if(EXISTS "/usr/local/bin/wxgtk3u-3.1-config")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.1-config")
endif()
if(EXISTS "/usr/local/bin/wxgtk3u-3.0-config")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.0-config")
endif()
endif()
if(EXISTS "/usr/bin/wx-config-3.2")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.2")
endif()
if(EXISTS "/usr/bin/wx-config-3.1")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.1")
endif()
if(EXISTS "/usr/bin/wx-config-3.0")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0")
endif()
if(EXISTS "/usr/bin/wx-config")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config")
endif()
if(NOT GTK2_API AND EXISTS "/usr/bin/wx-config-gtk3")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-gtk3")
endif()
endif()
find_package(wxWidgets REQUIRED base core adv)
include(${wxWidgets_USE_FILE})
make_imported_target_if_missing(wxWidgets::all wxWidgets)
endif()
find_package(ZLIB REQUIRED)
## Use pcsx2 package to find module
@ -164,20 +83,6 @@ else()
find_package(X11 REQUIRED)
make_imported_target_if_missing(X11::X11 X11)
if (GTK2_API)
find_package(GTK2 REQUIRED gtk)
alias_library(GTK::gtk GTK2::gtk)
else()
if(CMAKE_CROSSCOMPILING)
find_package(GTK3 REQUIRED gtk)
alias_library(GTK::gtk GTK3::gtk)
else()
check_lib(GTK3 gtk+-3.0 gtk/gtk.h)
alias_library(GTK::gtk PkgConfig::GTK3)
endif()
## Use pcsx2 package to find module
find_package(HarfBuzz)
endif()
if(WAYLAND_API)
find_package(Wayland REQUIRED)
endif()

View File

@ -1,99 +0,0 @@
# Macro to compile po file
# It based on FindGettext.cmake files.
# The macro was adapted for PCSX2 need. Several pot file, language based on directory instead of file
# Copyright (c) 2007-2009 Kitware, Inc., Insight Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * The names of Kitware, Inc., the Insight Consortium, or the names of
# any consortium members, or of any contributors, may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FUNCTION(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile)
SET(_moFiles)
GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
FOREACH (_currentPoFile ${ARGN})
GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} DIRECTORY)
GET_FILENAME_COMPONENT(_lang ${_abs_PATH} NAME_WE)
SET(_moFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}/${_potBasename}.mo)
IF (APPLE)
# On MacOS, we have have to preprocess the po files to remove mnemonics:
# On Windows, menu items have "mnemonics", the items with a letter underlined that you can use with alt to select menu items. MacOS doesn't do this.
# Some languages don't use easily-typable characters, so it's common to add a dedicated character for the mnemonic (e.g. in Japanese on Windows, the File menu would be "ファイル(&F)").
# On MacOS, these extra letters in parentheses are useless and should be avoided.
SET(_mnemonicless "${CMAKE_CURRENT_BINARY_DIR}/${_lang}/${_potBasename}.nomnemonic.po")
SET(_compileCommand
COMMAND sed -e "\"s/[(]&[A-Za-z][)]//g\"" "${_absFile}" > "${_mnemonicless}"
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_moFile} ${_mnemonicless}
BYPRODUCTS ${_mnemonicless}
)
ELSE (APPLE)
SET(_compileCommand
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_moFile} ${_absFile}
)
ENDIF (APPLE)
IF (_currentPoFile MATCHES "\\.git")
continue()
ENDIF (_currentPoFile MATCHES "\\.git")
IF (CMAKE_BUILD_PO)
ADD_CUSTOM_COMMAND(OUTPUT ${_moFile}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${_lang}
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
${_compileCommand}
DEPENDS ${_absPotFile} ${_absFile}
)
ELSE (CMAKE_BUILD_PO)
ADD_CUSTOM_COMMAND(OUTPUT ${_moFile}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${_lang}
${_compileCommand}
DEPENDS ${_absFile}
)
ENDIF (CMAKE_BUILD_PO)
IF(APPLE)
target_sources(PCSX2 PRIVATE ${_moFile})
set_source_files_properties(${_moFile} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/locale/${_lang})
source_group(Resources/locale/${__lang} FILES ${_moFile})
ELSEIF(PACKAGE_MODE)
INSTALL(FILES ${_moFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/PCSX2/resources/locale/${_lang})
ELSE()
INSTALL(FILES ${_moFile} DESTINATION ${CMAKE_SOURCE_DIR}/bin/resources/locale/${_lang})
ENDIF()
LIST(APPEND _moFiles ${_moFile})
ENDFOREACH (_currentPoFile)
IF(NOT LINUX_PACKAGE AND NOT APPLE)
ADD_CUSTOM_TARGET(translations_${_potBasename} ALL DEPENDS ${_moFiles})
ENDIF(NOT LINUX_PACKAGE AND NOT APPLE)
ENDFUNCTION(GETTEXT_CREATE_TRANSLATIONS_PCSX2)

View File

@ -1,55 +0,0 @@
# Tell cmake we are cross compiling and targeting linux
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i686)
# It could be i?86-*linux-gnu, x86_64-*linux-gnu, x86_64-*linux-gnux32, etc.
# Leave it generic to only support amd64 or x32 to i386 with any compiler.
if ("$ENV{CC}" STREQUAL "")
set(CMAKE_C_COMPILER cc -m32)
elseif(NOT "$ENV{CC}" MATCHES "-m32")
set(CMAKE_C_COMPILER $ENV{CC} -m32)
endif()
if ("$ENV{CXX}" STREQUAL "")
set(CMAKE_CXX_COMPILER c++ -m32)
elseif(NOT "$ENV{CXX}" MATCHES "-m32")
set(CMAKE_CXX_COMPILER $ENV{CXX} -m32)
endif()
# cmake 2.8.5 correctly sets CMAKE_LIBRARY_ARCHITECTURE for Debian multiarch.
# Be really strict about what gets used.
if(EXISTS /usr/lib/i386-linux-gnu)
set(CMAKE_SYSTEM_IGNORE_PATH
/lib /lib64 /lib32
/usr/lib /usr/lib64 /usr/lib32
/usr/local/lib /usr/local/lib64 /usr/local/lib32)
list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib/i386-linux-gnu)
list(APPEND CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu)
list(APPEND CMAKE_LIBRARY_PATH /lib/i386-linux-gnu)
elseif(EXISTS /usr/lib32)
set(CMAKE_SYSTEM_IGNORE_PATH
/lib /lib64
/usr/lib /usr/lib64
/usr/local/lib /usr/local/lib64)
set(CMAKE_LIBRARY_ARCHITECTURE "../lib32")
list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib32)
list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
list(APPEND CMAKE_LIBRARY_PATH /lib32)
else()
set(CMAKE_SYSTEM_IGNORE_PATH
/lib64
/usr/lib64
/usr/local/lib64)
set(CMAKE_LIBRARY_ARCHITECTURE ".")
list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib)
list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
list(APPEND CMAKE_LIBRARY_PATH /lib)
endif()
list(REMOVE_DUPLICATES CMAKE_LIBRARY_PATH)
# If given a CMAKE_FIND_ROOT_PATH then
# FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run)
# FIND_{LIBRARY,INCLUDE,PACKAGE} only uses the files in CMAKE_FIND_ROOT_PATH.
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

View File

@ -1,57 +0,0 @@
# This file is used to be invoked at build time. It generates the needed
# resource XML file.
# Input variables that need to provided when invoking this script:
# GXML_OUTPUT The output file path where to save the XML file.
# GXML_COMPRESS_ALL Sets all COMPRESS flags in all resources in resource
# list.
# GXML_NO_COMPRESS_ALL Removes all COMPRESS flags in all resources in
# resource list.
# GXML_STRIPBLANKS_ALL Sets all STRIPBLANKS flags in all resources in
# resource list.
# GXML_NO_STRIPBLANKS_ALL Removes all STRIPBLANKS flags in all resources in
# resource list.
# GXML_TOPIXDATA_ALL Sets all TOPIXDATA flags i nall resources in resource
# list.
# GXML_NO_TOPIXDATA_ALL Removes all TOPIXDATA flags in all resources in
# resource list.
# GXML_PREFIX Overrides the resource prefix that is prepended to
# each relative name in registered resources.
# GXML_RESOURCES The list of resource files. Whether absolute or
# relative path is equal.
# Include the GENERATE_GXML() function.
include(${CMAKE_CURRENT_LIST_DIR}/GenerateGXML.cmake)
# Set flags to actual invocation flags.
if(GXML_COMPRESS_ALL)
set(GXML_COMPRESS_ALL COMPRESS_ALL)
endif()
if(GXML_NO_COMPRESS_ALL)
set(GXML_NO_COMPRESS_ALL NO_COMPRESS_ALL)
endif()
if(GXML_STRIPBLANKS_ALL)
set(GXML_STRIPBLANKS_ALL STRIPBLANKS_ALL)
endif()
if(GXML_NO_STRIPBLANKS_ALL)
set(GXML_NO_STRIPBLANKS_ALL NO_STRIPBLANKS_ALL)
endif()
if(GXML_TOPIXDATA_ALL)
set(GXML_TOPIXDATA_ALL TOPIXDATA_ALL)
endif()
if(GXML_NO_TOPIXDATA_ALL)
set(GXML_NO_TOPIXDATA_ALL NO_TOPIXDATA_ALL)
endif()
# Replace " " with ";" to import the list over the command line. Otherwise
# CMake would interprete the passed resources as a whole string.
string(REPLACE " " ";" GXML_RESOURCES ${GXML_RESOURCES})
# Invoke the gresource XML generation function.
generate_gxml(${GXML_OUTPUT}
${GXML_COMPRESS_ALL} ${GXML_NO_COMPRESS_ALL}
${GXML_STRIPBLANKS_ALL} ${GXML_NO_STRIPBLANKS_ALL}
${GXML_TOPIXDATA_ALL} ${GXML_NO_TOPIXDATA_ALL}
PREFIX ${GXML_PREFIX}
RESOURCES ${GXML_RESOURCES})

View File

@ -1,230 +0,0 @@
include(CMakeParseArguments)
# Path to this file.
set(GCR_CMAKE_MACRO_DIR ${CMAKE_CURRENT_LIST_DIR})
# Compiles a gresource resource file from given resource files. Automatically
# creates the XML controlling file.
# The type of resource to generate (header, c-file or bundle) is automatically
# determined from TARGET file ending, if no TYPE is explicitly specified.
# The output file is stored in the provided variable "output".
# "xml_out" contains the variable where to output the XML path. Can be used to
# create custom targets or doing postprocessing.
# If you want to use preprocessing, you need to manually check the existence
# of the tools you use. This function doesn't check this for you, it just
# generates the XML file. glib-compile-resources will then throw a
# warning/error.
function(COMPILE_GRESOURCES output xml_out)
# Available options:
# COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all
# registered resources.
# STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all
# registered resources.
# TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all
# registered resources.
set(CG_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL
STRIPBLANKS_ALL NO_STRIPBLANKS_ALL
TOPIXDATA_ALL NO_TOPIXDATA_ALL)
# Available one value options:
# TYPE Type of resource to create. Valid options are:
# EMBED_C: A C-file that can be compiled with your project.
# EMBED_H: A header that can be included into your project.
# BUNDLE: Generates a resource bundle file that can be loaded
# at runtime.
# AUTO: Determine from target file ending. Need to specify
# target argument.
# PREFIX Overrides the resource prefix that is prepended to each
# relative file name in registered resources.
# C_PREFIX Specifies the prefix used for the C identifiers in the code generated
# when EMBED_C or EMBED_H are specified for TYPE.
# SOURCE_DIR Overrides the resources base directory to search for resources.
# Normally this is set to the source directory with that CMake
# was invoked (CMAKE_CURRENT_SOURCE_DIR).
# TARGET Overrides the name of the output file/-s. Normally the output
# names from the glib-compile-resources tool are taken.
set(CG_ONEVALUEARGS TYPE PREFIX C_PREFIX SOURCE_DIR TARGET)
# Available multi-value options:
# RESOURCES The list of resource files. Whether absolute or relative path is
# equal, absolute paths are stripped down to relative ones. If the
# absolute path is not inside the given base directory SOURCE_DIR
# or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden),
# this function aborts.
# OPTIONS Extra command line options passed to glib-compile-resources.
set(CG_MULTIVALUEARGS RESOURCES OPTIONS)
# Parse the arguments.
cmake_parse_arguments(CG_ARG
"${CG_OPTIONS}"
"${CG_ONEVALUEARGS}"
"${CG_MULTIVALUEARGS}"
"${ARGN}")
# Variable to store the double-quote (") string. Since escaping
# double-quotes in strings is not possible we need a helper variable that
# does this job for us.
set(Q \")
# Check invocation validity with the <prefix>_UNPARSED_ARGUMENTS variable.
# If other not recognized parameters were passed, throw error.
if (CG_ARG_UNPARSED_ARGUMENTS)
set(CG_WARNMSG "Invocation of COMPILE_GRESOURCES with unrecognized")
set(CG_WARNMSG "${CG_WARNMSG} parameters. Parameters are:")
set(CG_WARNMSG "${CG_WARNMSG} ${CG_ARG_UNPARSED_ARGUMENTS}.")
message(WARNING ${CG_WARNMSG})
endif()
# Check invocation validity depending on generation mode (EMBED_C, EMBED_H
# or BUNDLE).
if ("${CG_ARG_TYPE}" STREQUAL "EMBED_C")
# EMBED_C mode, output compilable C-file.
list(APPEND CG_GENERATE_COMMAND_LINE --generate-source)
if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "")
list(APPEND CG_GENERATE_COMMAND_LINE --c-name "${CG_ARG_C_PREFIX}")
endif()
set(CG_TARGET_FILE_ENDING "cpp")
elseif ("${CG_ARG_TYPE}" STREQUAL "EMBED_H")
# EMBED_H mode, output includable header file.
list(APPEND CG_GENERATE_COMMAND_LINE --generate-header)
if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "")
list(APPEND CG_GENERATE_COMMAND_LINE --c-name "${CG_ARG_C_PREFIX}")
endif()
set(CG_TARGET_FILE_ENDING "h")
elseif ("${CG_ARG_TYPE}" STREQUAL "BUNDLE")
# BUNDLE mode, output resource bundle. Don't do anything since
# glib-compile-resources outputs a bundle when not specifying
# something else.
set(CG_TARGET_FILE_ENDING "gresource")
if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "")
message(WARNING "Superfluously provided C_PREFIX=${CG_ARG_C_PREFIX} for BUNDLE.")
endif()
else()
# Everything else is AUTO mode, determine from target file ending.
if (CG_ARG_TARGET)
list(APPEND CG_GENERATE_COMMAND_LINE --generate)
else()
set(CG_ERRMSG "AUTO mode given, but no target specified. Can't")
set(CG_ERRMSG "${CG_ERRMSG} determine output type. In function")
set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
endif()
# Check flag validity.
if (CG_ARG_COMPRESS_ALL AND CG_ARG_NO_COMPRESS_ALL)
set(CG_ERRMSG "COMPRESS_ALL and NO_COMPRESS_ALL simultaneously set. In")
set(CG_ERRMSG "${CG_ERRMSG} function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
if (CG_ARG_STRIPBLANKS_ALL AND CG_ARG_NO_STRIPBLANKS_ALL)
set(CG_ERRMSG "STRIPBLANKS_ALL and NO_STRIPBLANKS_ALL simultaneously")
set(CG_ERRMSG "${CG_ERRMSG} set. In function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
if (CG_ARG_TOPIXDATA_ALL AND CG_ARG_NO_TOPIXDATA_ALL)
set(CG_ERRMSG "TOPIXDATA_ALL and NO_TOPIXDATA_ALL simultaneously set.")
set(CG_ERRMSG "${CG_ERRMSG} In function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
# Check if there are any resources.
if (NOT CG_ARG_RESOURCES)
set(CG_ERRMSG "No resource files to process. In function")
set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.")
message(FATAL_ERROR ${CG_ERRMSG})
endif()
# Extract all dependencies for targets from resource list.
foreach(res ${CG_ARG_RESOURCES})
if (NOT(("${res}" STREQUAL "COMPRESS") OR
("${res}" STREQUAL "STRIPBLANKS") OR
("${res}" STREQUAL "TOPIXDATA")))
list(APPEND CG_RESOURCES_DEPENDENCIES "${res}")
endif()
endforeach()
# Construct .gresource.xml path.
set(CG_XML_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/.gresource.xml")
# Generate gresources XML target.
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_OUTPUT=${CG_XML_FILE_PATH}")
if(CG_ARG_COMPRESS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_COMPRESS_ALL=True")
endif()
if(CG_ARG_NO_COMPRESS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_COMPRESS_ALL=True")
endif()
if(CG_ARG_STRPIBLANKS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_STRIPBLANKS_ALL=True")
endif()
if(CG_ARG_NO_STRIPBLANKS_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_STRIPBLANKS_ALL=True")
endif()
if(CG_ARG_TOPIXDATA_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_TOPIXDATA_ALL=True")
endif()
if(CG_ARG_NO_TOPIXDATA_ALL)
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_TOPIXDATA_ALL=True")
endif()
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_PREFIX=${Q}${CG_ARG_PREFIX}${Q}")
list(APPEND CG_CMAKE_SCRIPT_ARGS "-D")
list(APPEND CG_CMAKE_SCRIPT_ARGS
"GXML_RESOURCES=${Q}${CG_ARG_RESOURCES}${Q}")
list(APPEND CG_CMAKE_SCRIPT_ARGS "-P")
list(APPEND CG_CMAKE_SCRIPT_ARGS
"${GCR_CMAKE_MACRO_DIR}/BuildTargetScript.cmake")
get_filename_component(CG_XML_FILE_PATH_ONLY_NAME
"${CG_XML_FILE_PATH}" NAME)
set(CG_XML_CUSTOM_COMMAND_COMMENT
"Creating gresources XML file (${CG_XML_FILE_PATH_ONLY_NAME})")
add_custom_command(
OUTPUT ${CG_XML_FILE_PATH}
COMMAND ${CMAKE_COMMAND}
ARGS ${CG_CMAKE_SCRIPT_ARGS}
DEPENDS ${CG_RESOURCES_DEPENDENCIES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT ${CG_XML_CUSTOM_COMMAND_COMMENT})
# Create target manually if not set (to make sure glib-compile-resources
# doesn't change behaviour with it's naming standards).
if (NOT CG_ARG_TARGET)
set(CG_ARG_TARGET "${CMAKE_CURRENT_BINARY_DIR}/resources")
set(CG_ARG_TARGET "${CG_ARG_TARGET}.${CG_TARGET_FILE_ENDING}")
endif()
# Create source directory automatically if not set.
if (NOT CG_ARG_SOURCE_DIR)
set(CG_ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
# Add compilation target for resources.
add_custom_command(
OUTPUT ${CG_ARG_TARGET}
COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE}
ARGS
${OPTIONS}
--target ${CG_ARG_TARGET}
--sourcedir ${CG_ARG_SOURCE_DIR}
${CG_GENERATE_COMMAND_LINE}
${CG_XML_FILE_PATH}
VERBATIM
MAIN_DEPENDENCY ${CG_XML_FILE_PATH}
DEPENDS ${CG_RESOURCES_DEPENDENCIES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BUILD_DIR})
# Set output and XML_OUT to parent scope.
set(${xml_out} ${CG_XML_FILE_PATH} PARENT_SCOPE)
set(${output} ${CG_ARG_TARGET} PARENT_SCOPE)
endfunction()

View File

@ -1,124 +0,0 @@
include(CMakeParseArguments)
# Generates the resource XML controlling file from resource list (and saves it
# to xml_path). It's not recommended to use this function directly, since it
# doesn't handle invalid arguments. It is used by the function
# COMPILE_GRESOURCES() to create a custom command, so that this function is
# invoked at build-time in script mode from CMake.
function(GENERATE_GXML xml_path)
# Available options:
# COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all
# registered resources.
# STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all
# registered resources.
# TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all
# registered resources.
set(GXML_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL
STRIPBLANKS_ALL NO_STRIPBLANKS_ALL
TOPIXDATA_ALL NO_TOPIXDATA_ALL)
# Available one value options:
# PREFIX Overrides the resource prefix that is prepended to each
# relative file name in registered resources.
set(GXML_ONEVALUEARGS PREFIX)
# Available multi-value options:
# RESOURCES The list of resource files. Whether absolute or relative path is
# equal, absolute paths are stripped down to relative ones. If the
# absolute path is not inside the given base directory SOURCE_DIR
# or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden),
# this function aborts.
set(GXML_MULTIVALUEARGS RESOURCES)
# Parse the arguments.
cmake_parse_arguments(GXML_ARG
"${GXML_OPTIONS}"
"${GXML_ONEVALUEARGS}"
"${GXML_MULTIVALUEARGS}"
"${ARGN}")
# Variable to store the double-quote (") string. Since escaping
# double-quotes in strings is not possible we need a helper variable that
# does this job for us.
set(Q \")
# Process resources and generate XML file.
# Begin with the XML header and header nodes.
set(GXML_XML_FILE "<?xml version=${Q}1.0${Q} encoding=${Q}UTF-8${Q}?>")
set(GXML_XML_FILE "${GXML_XML_FILE}<gresources><gresource prefix=${Q}")
# Set the prefix for the resources. Depending on the user-override we choose
# the standard prefix "/" or the override.
if (GXML_ARG_PREFIX)
set(GXML_XML_FILE "${GXML_XML_FILE}${GXML_ARG_PREFIX}")
else()
set(GXML_XML_FILE "${GXML_XML_FILE}/")
endif()
set(GXML_XML_FILE "${GXML_XML_FILE}${Q}>")
# Process each resource.
foreach(res ${GXML_ARG_RESOURCES})
if ("${res}" STREQUAL "COMPRESS")
set(GXML_COMPRESSION_FLAG ON)
elseif ("${res}" STREQUAL "STRIPBLANKS")
set(GXML_STRIPBLANKS_FLAG ON)
elseif ("${res}" STREQUAL "TOPIXDATA")
set(GXML_TOPIXDATA_FLAG ON)
else()
# The file name.
set(GXML_RESOURCE_PATH "${res}")
# Append to real resource file dependency list.
list(APPEND GXML_RESOURCES_DEPENDENCIES ${GXML_RESOURCE_PATH})
# Assemble <file> node.
set(GXML_RES_LINE "<file")
if ((GXML_ARG_COMPRESS_ALL OR GXML_COMPRESSION_FLAG) AND NOT
GXML_ARG_NO_COMPRESS_ALL)
set(GXML_RES_LINE "${GXML_RES_LINE} compressed=${Q}true${Q}")
endif()
# Check preprocess flag validity.
if ((GXML_ARG_STRIPBLANKS_ALL OR GXML_STRIPBLANKS_FLAG) AND
(GXML_ARG_TOPIXDATA_ALL OR GXML_TOPIXDATA_FLAG))
set(GXML_ERRMSG "Resource preprocessing option conflict. Tried")
set(GXML_ERRMSG "${GXML_ERRMSG} to specify both, STRIPBLANKS")
set(GXML_ERRMSG "${GXML_ERRMSG} and TOPIXDATA. In resource")
set(GXML_ERRMSG "${GXML_ERRMSG} ${GXML_RESOURCE_PATH} in")
set(GXML_ERRMSG "${GXML_ERRMSG} function COMPILE_GRESOURCES.")
message(FATAL_ERROR ${GXML_ERRMSG})
endif()
if ((GXML_ARG_STRIPBLANKS_ALL OR GXML_STRIPBLANKS_FLAG) AND NOT
GXML_ARG_NO_STRIPBLANKS_ALL)
set(GXML_RES_LINE "${GXML_RES_LINE} preprocess=")
set(GXML_RES_LINE "${GXML_RES_LINE}${Q}xml-stripblanks${Q}")
elseif((GXML_ARG_TOPIXDATA_ALL OR GXML_TOPIXDATA_FLAG) AND NOT
GXML_ARG_NO_TOPIXDATA_ALL)
set(GXML_RES_LINE "${GXML_RES_LINE} preprocess=")
set(GXML_RES_LINE "${GXML_RES_LINE}${Q}to-pixdata${Q}")
endif()
set(GXML_RES_LINE "${GXML_RES_LINE}>${GXML_RESOURCE_PATH}</file>")
# Append to file string.
set(GXML_XML_FILE "${GXML_XML_FILE}${GXML_RES_LINE}")
# Unset variables.
unset(GXML_COMPRESSION_FLAG)
unset(GXML_STRIPBLANKS_FLAG)
unset(GXML_TOPIXDATA_FLAG)
endif()
endforeach()
# Append closing nodes.
set(GXML_XML_FILE "${GXML_XML_FILE}</gresource></gresources>")
# Use "file" function to generate XML controlling file.
get_filename_component(xml_path_only_name "${xml_path}" NAME)
file(WRITE ${xml_path} ${GXML_XML_FILE})
endfunction()

View File

@ -1,11 +0,0 @@
# Path to this file.
set(GCR_CMAKE_MACRO_DIR ${CMAKE_CURRENT_LIST_DIR})
# Finds the glib-compile-resources executable.
find_program(GLIB_COMPILE_RESOURCES_EXECUTABLE glib-compile-resources)
mark_as_advanced(GLIB_COMPILE_RESOURCES_EXECUTABLE)
# Include the cmake files containing the functions.
include(${GCR_CMAKE_MACRO_DIR}/CompileGResources.cmake)
include(${GCR_CMAKE_MACRO_DIR}/GenerateGXML.cmake)

View File

@ -1,61 +0,0 @@
#!/bin/sh
# PCSX2 - PS2 Emulator for PCs
# Copyright (C) 2002-2011 PCSX2 Dev Team
#
# PCSX2 is free software: you can redistribute it and/or modify it under the terms
# of the GNU Lesser General Public License as published by the Free Software Found-
# ation, either version 3 of the License, or (at your option) any later version.
#
# PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with PCSX2.
# If not, see <http://www.gnu.org/licenses/>.
# This script is a small wrapper to the PCSX2 exectuable. The purpose is to
# 1/ launch PCSX2 from the same repository every times.
# Rationale: There is no guarantee on the directory when PCSX2 is launched from a shortcut.
# This behavior trigger the first time wizards everytime...
# 2/ Change LD_LIBRARY_PATH to uses 3rdparty library
# Rationale: It is nearly impossible to have the same library version on all systems. So the
# easiest solution it to ship library used during the build.
# 3/ Set __GL_THREADED_OPTIMIZATIONS variable for Nvidia Drivers (major speed boost)
set -e
current_script=$0
me=PCSX2-linux.sh
# We are already in the good directory. Allow to use "bash PCSX2-linux.sh"
if [ $current_script = $me ]
then
if [ -e "./$me" ]
then
current_script="./$me"
else
current_script=`which $me`
fi
fi
# Avoid to screw up the shell context
DIR=`dirname $current_script`
MY_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
if [ ! -x "$DIR/pcsx2" ]
then
echo "Error PCSX2 not found in $DIR"
echo "Maybe the script was directly 'called'"
echo "Use either /absolute_path/$me or ./relative_path/$me"
return 1 # warning exit will kill current terminal
fi
# Allow to ship .so library with the build to avoid version issue
MY_LD_LIBRARY_PATH=${MY_LD_LIBRARY_PATH:+$MY_LD_LIBRARY_PATH:}$DIR/3rdPartyLibs
# openSUSE don't follow FHS !!!!
MY_LD_LIBRARY_PATH=${MY_LD_LIBRARY_PATH:+$MY_LD_LIBRARY_PATH:}/usr/lib/wx-2.8-stl
# And finally launch me
GDK_BACKEND=x11 LD_LIBRARY_PATH="$MY_LD_LIBRARY_PATH" MESA_NO_ERROR=1 $DIR/pcsx2 "$@"

View File

@ -1,35 +1,21 @@
include(macros/GlibCompileResourcesSupport)
# All flags, libraries, etc, that are shared between PCSX2 compilation files
add_library(PCSX2_FLAGS INTERFACE)
if (NOT PCSX2_CORE)
add_executable(PCSX2)
if(DISABLE_ADVANCE_SIMD OR LTO_PCSX2_CORE)
# Fixes issues with some compiler + linker combinations
add_library(PCSX2 OBJECT)
else()
if(DISABLE_ADVANCE_SIMD OR LTO_PCSX2_CORE)
# Fixes issues with some compiler + linker combinations
add_library(PCSX2 OBJECT)
else()
add_library(PCSX2)
endif()
target_compile_definitions(PCSX2_FLAGS INTERFACE
"PCSX2_CORE"
)
add_library(PCSX2)
endif()
target_compile_definitions(PCSX2_FLAGS INTERFACE
"PCSX2_CORE"
)
target_link_libraries(PCSX2 PRIVATE PCSX2_FLAGS)
target_compile_features(PCSX2_FLAGS INTERFACE cxx_std_17)
target_compile_definitions(PCSX2_FLAGS INTERFACE "${PCSX2_DEFS}")
target_compile_options(PCSX2_FLAGS INTERFACE "${PCSX2_WARNINGS}")
if (NOT PCSX2_CORE)
if (PACKAGE_MODE)
install(TARGETS PCSX2 DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
install(TARGETS PCSX2 DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif()
endif()
if (openSUSE)
# openSUSE don't install wx in a standard library system
# path. Let's bypass the dynamic linker and hardcode the path.
@ -83,20 +69,14 @@ if(TARGET SDL2::SDL2 OR TARGET SDL2::SDL2-static)
else()
target_link_libraries(PCSX2_FLAGS INTERFACE SDL2::SDL2)
endif()
if(PCSX2_CORE)
target_sources(PCSX2 PRIVATE
Frontend/SDLInputSource.cpp
Frontend/SDLInputSource.h
)
endif()
target_sources(PCSX2 PRIVATE
Frontend/SDLInputSource.cpp
Frontend/SDLInputSource.h
)
endif()
if(WIN32)
if(PCSX2_CORE)
set(MIN_WIN32 0x0A00)
else()
set(MIN_WIN32 0x0603)
endif()
set(MIN_WIN32 0x0A00)
target_compile_definitions(PCSX2_FLAGS INTERFACE
__SSE4_1__
DIRECTINPUT_VERSION=0x0800
@ -425,22 +405,6 @@ set(pcsx2DEV9Headers
DEV9/ThreadSafeMap.h
)
if(NOT PCSX2_CORE)
list(APPEND pcsx2DEV9Sources
DEV9/ConfigUI.cpp
DEV9/DEV9Config.cpp
DEV9/ATA/HddCreateWx.cpp
)
list(APPEND pcsx2DEV9Sources
DEV9/DEV9Config.h
DEV9/ATA/HddCreateWx.h
)
endif()
# USBNull
set(pcsx2USBNullSources USB/USBNull.cpp)
set(pcsx2USBNullHeaders USB/USBNull.h)
# USB sources
set(pcsx2USBSources
USB/USB.cpp
@ -508,137 +472,18 @@ if(TARGET SDL2::SDL2 OR TARGET SDL2::SDL2-static)
endif()
if(PCSX2_CORE)
# Host PAD
set(pcsx2PADSources
PAD/Host/KeyStatus.cpp
PAD/Host/PAD.cpp
PAD/Host/StateManagement.cpp
)
set(pcsx2PADHeaders
PAD/Host/Global.h
PAD/Host/KeyStatus.h
PAD/Host/PAD.h
PAD/Host/StateManagement.h
)
elseif(WIN32)
set(pcsx2PADSources
PAD/Windows/PADConfig.cpp
PAD/Windows/DeviceEnumerator.cpp
PAD/Windows/Diagnostics.cpp
PAD/Windows/DirectInput.cpp
PAD/Windows/DualShock3.cpp
PAD/Windows/HidDevice.cpp
PAD/Windows/InputManager.cpp
PAD/Windows/KeyboardQueue.cpp
PAD/Windows/PAD.cpp
PAD/Windows/PADRawInput.cpp
PAD/Windows/Tooltips.cpp
PAD/Windows/VKey.cpp
PAD/Windows/WindowsKeyboard.cpp
PAD/Windows/WindowsMessaging.cpp
PAD/Windows/WindowsMouse.cpp
PAD/Windows/WndProcEater.cpp
PAD/Windows/XInputEnum.cpp
)
set(pcsx2PADHeaders
PAD/Gamepad.h
PAD/Windows/PADConfig.h
PAD/Windows/DeviceEnumerator.h
PAD/Windows/Diagnostics.h
PAD/Windows/DirectInput.h
PAD/Windows/DualShock3.h
PAD/Windows/Global.h
PAD/Windows/HidDevice.h
PAD/Windows/InputManager.h
PAD/Windows/KeyboardQueue.h
PAD/Windows/PADRawInput.h
PAD/Windows/resource_pad.h
PAD/Windows/Tooltips.h
PAD/Windows/usb.h
PAD/Windows/VKey.h
PAD/Windows/WindowsKeyboard.h
PAD/Windows/WindowsMessaging.h
PAD/Windows/WindowsMouse.h
PAD/Windows/WndProcEater.h
PAD/Windows/XInputEnum.h
)
else()
# PAD resources pre-compilation
set(PADImgHeader "${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/ImgHeader")
set(PADImg "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/Img")
target_include_directories(PCSX2_FLAGS INTERFACE "${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/")
file(MAKE_DIRECTORY ${PADImgHeader})
foreach(result_file IN ITEMS
analog circle cross dp_bottom dp_left dp_right dp_up dualshock2
joystick_cursor l1 r1 l2 r2 l3 r3 select square start triangle arrow_up
arrow_bottom arrow_left arrow_right)
add_custom_command(
OUTPUT "${PADImgHeader}/${result_file}.h"
DEPENDS ${BIN2CPPDEP} "${PADImg}/${result_file}.png"
COMMAND ${BIN2CPP} "${PADImg}/${result_file}.png" "${PADImgHeader}/${result_file}" )
endforeach()
# PAD/Linux sources
set(pcsx2PADSources
PAD/Linux/Device.cpp
PAD/Linux/InputManager.cpp
PAD/Linux/SDL/joystick.cpp
PAD/Linux/keyboard.cpp
PAD/Linux/KeyStatus.cpp
PAD/Linux/PAD.cpp
PAD/Linux/state_management.cpp
PAD/Linux/wx_dialog/dialog.cpp
PAD/Linux/wx_dialog/opPanel.cpp
PAD/Linux/wx_dialog/GamepadConfiguration.cpp
PAD/Linux/wx_dialog/JoystickConfiguration.cpp
PAD/Linux/Config.cpp
)
# PAD/Linux headers
set(pcsx2PADHeaders
PAD/Gamepad.h
PAD/Linux/bitwise.h
PAD/Linux/Config.h
PAD/Linux/Device.h
PAD/Linux/Global.h
PAD/Linux/InputManager.h
PAD/Linux/SDL/joystick.h
PAD/Linux/keyboard.h
PAD/Linux/KeyStatus.h
PAD/Linux/state_management.h
PAD/Linux/wx_dialog/opPanel.h
PAD/Linux/wx_dialog/GamepadConfiguration.h
PAD/Linux/wx_dialog/JoystickConfiguration.h
# images
${PADImgHeader}/analog.h
${PADImgHeader}/circle.h
${PADImgHeader}/cross.h
${PADImgHeader}/dp_bottom.h
${PADImgHeader}/dp_left.h
${PADImgHeader}/dp_right.h
${PADImgHeader}/dp_up.h
${PADImgHeader}/dualshock2.h
${PADImgHeader}/joystick_cursor.h
${PADImgHeader}/l1.h
${PADImgHeader}/r1.h
${PADImgHeader}/l2.h
${PADImgHeader}/r2.h
${PADImgHeader}/l3.h
${PADImgHeader}/r3.h
${PADImgHeader}/select.h
${PADImgHeader}/square.h
${PADImgHeader}/start.h
${PADImgHeader}/triangle.h
${PADImgHeader}/arrow_up.h
${PADImgHeader}/arrow_bottom.h
${PADImgHeader}/arrow_left.h
${PADImgHeader}/arrow_right.h
)
endif()
# Host PAD
set(pcsx2PADSources
PAD/Host/KeyStatus.cpp
PAD/Host/PAD.cpp
PAD/Host/StateManagement.cpp
)
set(pcsx2PADHeaders
PAD/Host/Global.h
PAD/Host/KeyStatus.h
PAD/Host/PAD.h
PAD/Host/StateManagement.h
)
# GS sources
set(pcsx2GSSourcesUnshared
@ -796,62 +641,19 @@ set(pcsx2GSMetalShaders
GS/Renderers/Metal/fxaa.metal
)
if(PCSX2_CORE)
list(APPEND pcsx2SPU2Headers
SPU2/Host/Config.cpp
SPU2/Host/ConfigDebug.cpp
SPU2/Host/ConfigSoundTouch.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Host/Config.h
SPU2/Host/Dialogs.h
)
if(NOT WIN32)
list(APPEND pcsx2SPU2Headers
SPU2/Host/Config.cpp
SPU2/Host/ConfigDebug.cpp
SPU2/Host/ConfigSoundTouch.cpp
SPU2/WavFile.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Host/Config.h
SPU2/Host/Dialogs.h
)
if(NOT WIN32)
list(APPEND pcsx2SPU2Headers
SPU2/WavFile.cpp
)
endif()
else()
list(APPEND pcsx2GSSources
GS/Window/GSSetting.cpp
GS/Window/GSwxDialog.cpp
)
list(APPEND pcsx2GSHeaders
GS/Window/GSSetting.h
GS/Window/GSwxDialog.h
)
if(WIN32)
list(APPEND pcsx2SPU2Sources
SPU2/Windows/CfgHelpers.cpp
SPU2/Windows/Config.cpp
SPU2/Windows/ConfigDebug.cpp
SPU2/Windows/ConfigSoundTouch.cpp
SPU2/Windows/dsp.cpp
SPU2/Windows/RealtimeDebugger.cpp
SPU2/Windows/UIHelpers.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Windows/Dialogs.h
SPU2/Windows/dsp.h
SPU2/Windows/resource.h
SPU2/Windows/WinConfig.h
)
else()
list(APPEND pcsx2SPU2Sources
SPU2/Linux/CfgHelpers.cpp
SPU2/Linux/Config.cpp
SPU2/Linux/ConfigDebug.cpp
SPU2/Linux/ConfigSoundTouch.cpp
SPU2/Linux/Dialogs.cpp
SPU2/WavFile.cpp
SPU2/wx/wxConfig.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Linux/Config.h
SPU2/Linux/Dialogs.h
SPU2/wx/wxConfig.h
)
endif()
endif()
if(WIN32)
@ -1075,229 +877,67 @@ elseif(APPLE)
)
endif()
if(PCSX2_CORE)
list(APPEND pcsx2FrontendSources
Frontend/CommonHost.cpp
Frontend/CommonHotkeys.cpp
Frontend/FullscreenUI.cpp
Frontend/GameList.cpp
Frontend/HostSettings.cpp
Frontend/ImGuiFullscreen.cpp
Frontend/InputManager.cpp
Frontend/InputSource.cpp
Frontend/LayeredSettingsInterface.cpp
Frontend/LogSink.cpp
GSDumpReplayer.cpp
INISettingsInterface.cpp
VMManager.cpp
)
list(APPEND pcsx2FrontendHeaders
Frontend/CommonHost.h
Frontend/FullscreenUI.h
Frontend/GameList.h
Frontend/ImGuiFullscreen.h
Frontend/InputManager.h
Frontend/InputSource.h
Frontend/LayeredSettingsInterface.h
Frontend/LogSink.h
GSDumpReplayer.h
HostSettings.h
INISettingsInterface.h
VMManager.h)
if(USE_ACHIEVEMENTS)
list(APPEND pcsx2FrontendSources
Frontend/CommonHost.cpp
Frontend/CommonHotkeys.cpp
Frontend/FullscreenUI.cpp
Frontend/GameList.cpp
Frontend/HostSettings.cpp
Frontend/ImGuiFullscreen.cpp
Frontend/InputManager.cpp
Frontend/InputSource.cpp
Frontend/LayeredSettingsInterface.cpp
Frontend/LogSink.cpp
GSDumpReplayer.cpp
INISettingsInterface.cpp
VMManager.cpp
Frontend/Achievements.cpp
)
list(APPEND pcsx2FrontendHeaders
Frontend/CommonHost.h
Frontend/FullscreenUI.h
Frontend/GameList.h
Frontend/ImGuiFullscreen.h
Frontend/InputManager.h
Frontend/InputSource.h
Frontend/LayeredSettingsInterface.h
Frontend/LogSink.h
GSDumpReplayer.h
HostSettings.h
INISettingsInterface.h
VMManager.h)
if(USE_ACHIEVEMENTS)
list(APPEND pcsx2FrontendSources
Frontend/Achievements.cpp
)
list(APPEND pcsx2FrontendHeaders
Frontend/Achievements.h
)
target_compile_definitions(PCSX2_FLAGS INTERFACE
ENABLE_ACHIEVEMENTS
)
target_link_libraries(PCSX2_FLAGS INTERFACE
rcheevos
)
endif()
if(USE_DISCORD_PRESENCE)
target_compile_definitions(PCSX2_FLAGS INTERFACE
ENABLE_DISCORD_PRESENCE
)
target_link_libraries(PCSX2_FLAGS INTERFACE
discord-rpc
)
endif()
if(WIN32)
list(APPEND pcsx2FrontendSources
Frontend/DInputSource.cpp
Frontend/XInputSource.cpp
)
list(APPEND pcsx2FrontendHeaders
Frontend/DInputSource.h
Frontend/XInputSource.h
)
endif()
Frontend/Achievements.h
)
target_compile_definitions(PCSX2_FLAGS INTERFACE
ENABLE_ACHIEVEMENTS
)
target_link_libraries(PCSX2_FLAGS INTERFACE
rcheevos
)
endif()
# gui sources
set(pcsx2GuiSources
gui/AppAssert.cpp
gui/AppConfig.cpp
gui/AppCoreThread.cpp
gui/AppEventSources.cpp
gui/AppHost.cpp
gui/AppUserMode.cpp
gui/AppInit.cpp
gui/AppMain.cpp
gui/AppRes.cpp
gui/CheckedStaticBox.cpp
gui/ConsoleLogger.cpp
gui/Dialogs/AboutBoxDialog.cpp
gui/Dialogs/GSDumpDialog.cpp
gui/Dialogs/AssertionDialog.cpp
gui/Dialogs/BaseConfigurationDialog.cpp
gui/Dialogs/ConfirmationDialogs.cpp
gui/Dialogs/ConvertMemoryCardDialog.cpp
gui/Dialogs/CreateMemoryCardDialog.cpp
gui/Dialogs/FirstTimeWizard.cpp
gui/Dialogs/ImportSettingsDialog.cpp
gui/Dialogs/LogOptionsDialog.cpp
gui/Dialogs/McdConfigDialog.cpp
gui/Dialogs/PickUserModeDialog.cpp
gui/Dialogs/SysConfigDialog.cpp
gui/Dialogs/PINEDialog.cpp
gui/Debugger/BreakpointWindow.cpp
gui/Debugger/CtrlDisassemblyView.cpp
gui/Debugger/CtrlRegisterList.cpp
gui/Debugger/CtrlMemView.cpp
gui/Debugger/CtrlMemSearch.cpp
gui/Debugger/DebuggerLists.cpp
gui/Debugger/DisassemblyDialog.cpp
gui/Debugger/DebugEvents.cpp
gui/DriveList.cpp
gui/ExecutorThread.cpp
gui/FastFormatString.cpp
gui/FileUtils.cpp
gui/FrameForGS.cpp
gui/GlobalCommands.cpp
gui/IniInterface.cpp
gui/i18n.cpp
gui/IsoDropTarget.cpp
gui/MainFrame.cpp
gui/MainMenuClicks.cpp
gui/MessageBoxes.cpp
gui/Mutex.cpp
gui/MSWstuff.cpp
gui/Panels/BaseApplicableConfigPanel.cpp
gui/Panels/BiosSelectorPanel.cpp
gui/Panels/CpuPanel.cpp
gui/Panels/DirPickerPanel.cpp
gui/Panels/GameFixesPanel.cpp
gui/Panels/GSWindowPanel.cpp
gui/Panels/LogOptionsPanels.cpp
gui/Panels/MemoryCardListPanel.cpp
gui/Panels/MemoryCardListView.cpp
gui/Panels/MiscPanelStuff.cpp
gui/Panels/PathsPanel.cpp
gui/Panels/SpeedhacksPanel.cpp
gui/Panels/VideoPanel.cpp
gui/PathUtils.cpp
gui/PersistentThread.cpp
gui/pxCheckBox.cpp
gui/pxRadioPanel.cpp
gui/pxStaticText.cpp
gui/pxTranslate.cpp
gui/pxWindowTextWriter.cpp
gui/RecentIsoList.cpp
gui/Saveslots.cpp
gui/StringHelpers.cpp
gui/SysCoreThread.cpp
gui/SysState.cpp
gui/SysThreadBase.cpp
gui/ThreadingDialogs.cpp
gui/UpdateUI.cpp
gui/wxAppWithHelpers.cpp
gui/wxGuiTools.cpp
gui/wxHelpers.cpp
gui/wxSettingsInterface.cpp
if(USE_DISCORD_PRESENCE)
target_compile_definitions(PCSX2_FLAGS INTERFACE
ENABLE_DISCORD_PRESENCE
)
# gui headers
set(pcsx2GuiHeaders
gui/AppAccelerators.h
gui/AppCommon.h
gui/AppConfig.h
gui/AppCoreThread.h
gui/AppEventListeners.h
gui/AppHost.h
gui/AppForwardDefs.h
gui/App.h
gui/ApplyState.h
gui/AppSaveStates.h
gui/CheckedStaticBox.h
gui/ConsoleLogger.h
gui/Debugger/BreakpointWindow.h
gui/Debugger/CtrlDisassemblyView.h
gui/Debugger/CtrlMemView.h
gui/Debugger/CtrlMemSearch.h
gui/Debugger/CtrlRegisterList.h
gui/Debugger/DebugEvents.h
gui/Debugger/DebuggerLists.h
gui/Debugger/DisassemblyDialog.h
gui/Dialogs/BaseConfigurationDialog.inl
gui/Dialogs/ConfigurationDialog.h
gui/Dialogs/LogOptionsDialog.h
gui/Dialogs/ModalPopups.h
gui/DriveList.h
gui/GSFrame.h
gui/i18n.h
gui/IniInterface.h
gui/IsoDropTarget.h
gui/MainFrame.h
gui/MSWstuff.h
gui/PathDefs.h
gui/Panels/ConfigurationPanels.h
gui/Panels/LogOptionsPanels.h
gui/Panels/MemoryCardPanels.h
gui/PersistentThread.h
gui/pxCheckBox.h
gui/pxEvents.h
gui/pxEventThread.h
gui/pxRadioPanel.h
gui/pxStaticText.h
gui/RecentIsoList.h
gui/Saveslots.h
gui/StringHelpers.h
gui/SysThreads.h
gui/ThreadingDialogs.h
gui/ThreadingDialogs.cpp
gui/wxDirName.h
gui/wxGuiTools.h
gui/wxSettingsInterface.h
target_link_libraries(PCSX2_FLAGS INTERFACE
discord-rpc
)
# Warning: the declaration of the .h are mandatory in case of resources files. It will ensure the creation
# from the bin2cpp tools at right good moment (ie .h must be created before the pcsx2 compilation)
# Gui resources headers
set(res_bin "${CMAKE_BINARY_DIR}/pcsx2/gui/Resources")
set(res_src "${CMAKE_SOURCE_DIR}/pcsx2/gui/Resources")
set(pcsx2GuiResources
${res_bin}/AppIcon16.h
${res_bin}/AppIcon32.h
${res_bin}/AppIcon64.h
${res_bin}/BackgroundLogo.h
${res_bin}/ButtonIcon_Camera.h
${res_bin}/ConfigIcon_Cpu.h
${res_bin}/ConfigIcon_Gamefixes.h
${res_bin}/ConfigIcon_MemoryCard.h
${res_bin}/ConfigIcon_Paths.h
${res_bin}/ConfigIcon_Speedhacks.h
${res_bin}/ConfigIcon_Video.h
${res_bin}/Logo.h
${res_bin}/NoIcon.h
${res_bin}/Breakpoint_Active.h
${res_bin}/Breakpoint_Inactive.h
endif()
if(WIN32)
list(APPEND pcsx2FrontendSources
Frontend/DInputSource.cpp
Frontend/XInputSource.cpp
)
list(APPEND pcsx2FrontendHeaders
Frontend/DInputSource.h
Frontend/XInputSource.h
)
endif()
# Linux sources
set(pcsx2LinuxSources
@ -1318,21 +958,6 @@ set(pcsx2FreeBSDSources
Darwin/DarwinFlatFileReader.cpp
)
if(NOT PCSX2_CORE)
list(APPEND pcsx2LinuxSources
Linux/LnxConsolePipe.cpp
Linux/LnxKeyCodes.cpp
)
list(APPEND pcsx2OSXSources
Linux/LnxConsolePipe.cpp
Darwin/DarwinKeyCodes.cpp
)
list(APPEND pcsx2FreeBSDSources
Linux/LnxConsolePipe.cpp
Linux/LnxKeyCodes.cpp
)
endif()
# Linux headers
set(pcsx2LinuxHeaders
)
@ -1405,14 +1030,6 @@ set(pcsx2WindowsSources
windows/Optimus.cpp
)
if(NOT PCSX2_CORE)
list(APPEND pcsx2WindowsSources
windows/WinConsolePipe.cpp
windows/WinKeyCodes.cpp
windows/WinPowerProfile.cpp
)
endif()
# Windows headers
set(pcsx2WindowsHeaders
windows/resource.h
@ -1538,17 +1155,6 @@ target_sources(PCSX2 PRIVATE
${pcsx2SystemHeaders}
)
# gui sources when not doing a qt build
if (NOT PCSX2_CORE)
target_sources(PCSX2 PRIVATE
${pcsx2GuiSources}
${pcsx2GuiResources}
${pcsx2GuiHeaders}
${pcsx2RecordingVirtualPadResources}
${pcsx2RecordingHeaders}
)
endif()
# platform sources
# Linux
if(Linux)
@ -1563,21 +1169,6 @@ if(Linux)
)
endif()
if(UNIX AND NOT APPLE AND NOT PCSX2_CORE)
if(X11_API)
target_link_libraries(PCSX2_FLAGS INTERFACE
PkgConfig::X11_XCB
PkgConfig::XCB
X11::X11
)
endif()
if(WAYLAND_API)
target_link_libraries(PCSX2_FLAGS INTERFACE
Wayland::Client
)
endif()
endif()
# Windows
if(Windows)
target_sources(PCSX2 PRIVATE
@ -1585,12 +1176,8 @@ if(Windows)
${pcsx2WindowsHeaders})
endif()
if(PCSX2_CORE)
target_sources(PCSX2 PRIVATE ${pcsx2USBSources} ${pcsx2USBHeaders})
target_link_libraries(PCSX2_FLAGS INTERFACE jpgd)
else()
target_sources(PCSX2 PRIVATE ${pcsx2USBNullSources} ${pcsx2USBNullHeaders})
endif()
target_sources(PCSX2 PRIVATE ${pcsx2USBSources} ${pcsx2USBHeaders})
target_link_libraries(PCSX2_FLAGS INTERFACE jpgd)
# MacOSX/BSD
if(UNIX AND NOT Linux)
@ -1622,16 +1209,10 @@ target_link_libraries(PCSX2_FLAGS INTERFACE
${LIBC_LIBRARIES}
)
if(PCSX2_CORE)
target_link_libraries(PCSX2_FLAGS INTERFACE
simpleini
demangler
)
else()
target_link_libraries(PCSX2_FLAGS INTERFACE
wxWidgets::all
)
endif()
target_link_libraries(PCSX2_FLAGS INTERFACE
demangler
simpleini
)
if(WIN32)
target_link_libraries(PCSX2_FLAGS INTERFACE
@ -1654,44 +1235,17 @@ if(WIN32)
comsuppw.lib
OneCore.lib
)
if(NOT PCSX2_CORE)
target_link_libraries(PCSX2_FLAGS INTERFACE
pthreads4w
)
endif()
elseif(APPLE)
target_link_libraries(PCSX2_FLAGS INTERFACE
PCAP::PCAP
)
else()
if (NOT PCSX2_CORE)
target_link_libraries(PCSX2_FLAGS INTERFACE
GTK::gtk
HarfBuzz::HarfBuzz
)
endif()
target_link_libraries(PCSX2_FLAGS INTERFACE
OpenGL::GL
PCAP::PCAP
)
endif()
### Generate the resources files
if(NOT PCSX2_CORE)
file(MAKE_DIRECTORY ${res_bin})
foreach(res_file IN ITEMS
AppIcon16 AppIcon32 AppIcon64 BackgroundLogo Logo NoIcon ButtonIcon_Camera
ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard
ConfigIcon_Paths ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive)
add_custom_command(
OUTPUT "${res_bin}/${res_file}.h"
DEPENDS ${BIN2CPPDEP} "${res_src}/${res_file}.png"
COMMAND ${BIN2CPP} "${res_src}/${res_file}.png" "${res_bin}/${res_file}"
)
endforeach()
endif()
# additonal include directories
target_include_directories(PCSX2_FLAGS INTERFACE
.
@ -1715,8 +1269,6 @@ function(pcsx2_resource target path basedir)
if(APPLE)
target_sources(${target} PRIVATE ${path})
set_source_files_properties(${path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/${subdir})
elseif(PACKAGE_MODE)
install(FILES ${path} DESTINATION ${CMAKE_INSTALL_DATADIR}/PCSX2/resources/${subdir})
else()
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E make_directory "$<TARGET_FILE_DIR:${target}>/resources/${subdir}"
@ -1731,24 +1283,6 @@ if (NOT APPLE)
)
endif()
if(APPLE AND NOT GETTEXT_FOUND AND NOT NO_TRANSLATION AND NOT PCSX2_CORE)
message(FATAL_ERROR "MacOS cannot use the precompiled translation files. Please install gettext or disable translations with NO_TRANSLATION")
endif()
# Translation files
# CMake is dumb and can't properly associate custom command outputs with targets if they're made in different directories
# So this has to be here (and not in a CMakeLists.txt file in locales/)
if(GETTEXT_FOUND AND NOT NO_TRANSLATION AND NOT PCSX2_CORE)
include(Translation)
file(GLOB_RECURSE PO_ICO_FILES ${CMAKE_SOURCE_DIR}/locales/*/pcsx2_Iconized.po)
file(GLOB_RECURSE PO_MAIN_FILES ${CMAKE_SOURCE_DIR}/locales/*/pcsx2_Main.po)
# Macro to compile po file and install them
GETTEXT_CREATE_TRANSLATIONS_PCSX2(${CMAKE_SOURCE_DIR}/locales/templates/pcsx2_Iconized.pot ${PO_ICO_FILES})
GETTEXT_CREATE_TRANSLATIONS_PCSX2(${CMAKE_SOURCE_DIR}/locales/templates/pcsx2_Main.pot ${PO_MAIN_FILES})
endif()
fixup_file_properties(PCSX2)
if (APPLE)
@ -1775,28 +1309,16 @@ function(setup_main_executable target)
if (NOT WIN32 AND "${path}" MATCHES "/dx11/") # Don't include unneccessary stuff
continue()
endif()
if ((GETTEXT_FOUND OR NO_TRANSLATION OR PCSX2_CORE) AND "${path}" MATCHES "/locale/") # Generate locales with gettext instead of copying them from bin
continue()
endif()
pcsx2_resource(${target} ${path} ${CMAKE_SOURCE_DIR}/bin/resources/)
endforeach()
get_property(PCSX2_SOURCE_DIR GLOBAL PROPERTY PCSX2_SOURCE_DIR)
get_property(PCSX2_METAL_SHADERS GLOBAL PROPERTY PCSX2_METAL_SHADERS)
if(QT_BUILD)
get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
endif()
get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
if(WIN32)
if(NOT PCSX2_CORE)
target_sources(${target} PRIVATE
${PCSX2_SOURCE_DIR}/GS/GS.rc
${PCSX2_SOURCE_DIR}/PAD/Windows/PAD.rc
${PCSX2_SOURCE_DIR}/SPU2/Windows/SPU2.rc
)
endif()
target_sources(${target} PRIVATE
${PCSX2_SOURCE_DIR}/PCSX2.rc
${PCSX2_SOURCE_DIR}/windows/wxResources.rc
@ -1806,11 +1328,9 @@ function(setup_main_executable target)
if(MSVC)
install(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif()
if(QT_BUILD)
find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}")
install(CODE "execute_process(COMMAND \"${WINDEPLOYQT_EXE}\" \"${CMAKE_SOURCE_DIR}/bin/pcsx2-qt.exe\" --plugindir ${CMAKE_SOURCE_DIR}/bin/QtPlugins --no-compiler-runtime --no-system-d3d-compiler)")
install(CODE "file(WRITE \"${CMAKE_SOURCE_DIR}/bin/qt.conf\" \"[Paths]\\nPlugins = ./QtPlugins\")")
endif()
find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}")
install(CODE "execute_process(COMMAND \"${WINDEPLOYQT_EXE}\" \"${CMAKE_SOURCE_DIR}/bin/pcsx2-qt.exe\" --plugindir ${CMAKE_SOURCE_DIR}/bin/QtPlugins --no-compiler-runtime --no-system-d3d-compiler)")
install(CODE "file(WRITE \"${CMAKE_SOURCE_DIR}/bin/qt.conf\" \"[Paths]\\nPlugins = ./QtPlugins\")")
endif()
if(APPLE)
@ -1870,34 +1390,19 @@ function(setup_main_executable target)
set(postprocessBundleType ALL)
endif()
if(QT_BUILD)
find_program(MACDEPLOYQT_EXE macdeployqt HINTS "${QT_BINARY_DIRECTORY}")
add_custom_target(pcsx2-postprocess-bundle ${postprocessBundleType}
COMMAND "${MACDEPLOYQT_EXE}" "$<TARGET_FILE_DIR:${target}>/../.." -no-strip
)
else()
add_custom_target(pcsx2-postprocess-bundle ${postprocessBundleType}
COMMAND ${CMAKE_COMMAND} "-DPCSX2_BUNDLE_PATH=$<TARGET_FILE_DIR:${target}>/../.."
-P ${CMAKE_SOURCE_DIR}/cmake/Pcsx2PostprocessBundle.cmake
)
endif()
find_program(MACDEPLOYQT_EXE macdeployqt HINTS "${QT_BINARY_DIRECTORY}")
add_custom_target(pcsx2-postprocess-bundle ${postprocessBundleType}
COMMAND "${MACDEPLOYQT_EXE}" "$<TARGET_FILE_DIR:${target}>/../.." -no-strip
)
add_dependencies(pcsx2-postprocess-bundle ${target})
endif()
endfunction()
if (NOT QT_BUILD)
setup_main_executable(PCSX2)
if(NOT DISABLE_SETCAP AND NOT WIN32)
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_SOURCE_DIR}/bin/pcsx2' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_SOURCE_DIR}/bin/pcsx2'; set +x\")")
endif()
if(NOT DISABLE_SETCAP AND NOT PCSX2_CORE AND NOT WIN32)
if(PACKAGE_MODE)
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_INSTALL_FULL_BINDIR}/pcsx2' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_INSTALL_FULL_BINDIR}/pcsx2'; set +x\")")
else()
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_SOURCE_DIR}/bin/pcsx2' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_SOURCE_DIR}/bin/pcsx2'; set +x\")")
endif()
endif()
source_groups_from_vcxproj_filters(pcsx2.vcxproj.filters)
source_groups_from_vcxproj_filters(pcsx2core.vcxproj.filters)
# Unix-only files aren't in the vcxproj.filters
source_group(System/Ps2/DEV9 REGULAR_EXPRESSION DEV9/*)