cmake: Use imported targets

This commit is contained in:
TellowKrinkle 2021-04-17 15:30:03 -05:00 committed by tellowkrinkle
parent e788dd352c
commit 4213b4a409
16 changed files with 143 additions and 332 deletions

View File

@ -7,7 +7,7 @@ project(Pcsx2)
#
# Setting it to a range tells it that it supports the features on the newer
# versions as well, avoiding setting policies.
cmake_minimum_required(VERSION 3.3.0...3.17)
cmake_minimum_required(VERSION 3.10...3.17)
# Variable to check that people use the good file
set(TOP_CMAKE_WAS_SOURCED TRUE)
@ -42,15 +42,11 @@ if(NOT NO_TRANSLATION)
endif()
# make common
if(common_libs)
add_subdirectory(common/src/Utilities)
add_subdirectory(common/src/x86emitter)
endif()
add_subdirectory(common/src/Utilities)
add_subdirectory(common/src/x86emitter)
# make pcsx2
if(EXISTS "${CMAKE_SOURCE_DIR}/pcsx2" AND pcsx2_core)
add_subdirectory(pcsx2)
endif()
add_subdirectory(pcsx2)
# tests
if(ACTUALLY_ENABLE_TESTS)

View File

@ -7,16 +7,12 @@ endmacro()
macro(check_lib var lib)
set(_arg_list ${ARGN})
if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND AND NOT CMAKE_CROSSCOMPILING)
if(PKG_CONFIG_FOUND AND NOT CMAKE_CROSSCOMPILING)
string(TOLOWER ${lib} lower_lib)
pkg_search_module(${var} QUIET ${lower_lib})
pkg_search_module(${var} QUIET IMPORTED_TARGET ${lower_lib})
endif()
if(${var}_FOUND)
include_directories(${${var}_INCLUDE_DIRS})
# Make sure include directories for headers found using find_path below
# are re-added when reconfiguring
include_directories(${${var}_INCLUDE})
if(TARGET PkgConfig::${var})
_internal_message("-- ${var} found pkg")
else()
find_library(${var}_LIBRARIES ${lib})
@ -27,7 +23,12 @@ macro(check_lib var lib)
endif()
if(${var}_LIBRARIES AND ${var}_INCLUDE)
include_directories(${${var}_INCLUDE})
add_library(PkgConfig::${var} UNKNOWN IMPORTED GLOBAL)
# Imitate what pkg-config would have found
set_target_properties(PkgConfig::${var} PROPERTIES
IMPORTED_LOCATION "${${var}_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${${var}_INCLUDE}"
)
_internal_message("-- ${var} found")
set(${var}_FOUND 1 CACHE INTERNAL "")
elseif(${var}_LIBRARIES)

View File

@ -11,6 +11,9 @@
# libpcap if the module has problems finding the
# proper installation path.
#
# Imported Targets:
# PCAP::PCAP The libpcap library, if found
#
# Variables defined by this module:
#
# PCAP_FOUND System has libpcap, include and library dirs found
@ -67,6 +70,13 @@ set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
check_function_exists(pcap_get_pfring_id HAVE_PF_RING)
set(CMAKE_REQUIRED_LIBRARIES)
if(PCAP_LIBRARY AND NOT TARGET PCAP::PCAP)
add_library(PCAP::PCAP UNKNOWN IMPORTED GLOBAL)
set_target_properties(PCAP::PCAP PROPERTIES
IMPORTED_LOCATION "${PCAP_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PCAP_INCLUDE_DIR}")
endif()
mark_as_advanced(
PCAP_ROOT_DIR
PCAP_INCLUDE_DIR

View File

@ -2,6 +2,7 @@
#
# PULSEAUDIO_FOUND - True if PULSEAUDIO_INCLUDE_DIR &
# PULSEAUDIO_LIBRARY are found
# PulseAudio::PulseAudio - Imported target for PulseAudio, if found
# PULSEAUDIO_LIBRARIES - Set when PULSEAUDIO_LIBRARY is found
# PULSEAUDIO_INCLUDE_DIRS - Set when PULSEAUDIO_INCLUDE_DIR is found
#
@ -35,6 +36,13 @@ find_package_handle_standard_args(PulseAudio
VERSION_VAR PULSEAUDIO_VERSION_STRING
)
if(PULSEAUDIO_LIBRARY AND NOT TARGET PulseAudio::PulseAudio)
add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED GLOBAL)
set_target_properties(PulseAudio::PulseAudio PROPERTIES
IMPORTED_LOCATION "${PULSEAUDIO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PULSEAUDIO_INCLUDE_DIR}")
endif()
if(PULSEAUDIO_FOUND)
set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY})
set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR})

View File

@ -1,6 +1,7 @@
# Find Intel's VTUNE tool
# VTUNE_FOUND found Vtune
# Vtune::Vtune Imported target, if found
# VTUNE_INCLUDE_DIRS include path to jitprofiling.h
# VTUNE_LIBRARIES path to vtune libs
@ -29,5 +30,12 @@ endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vtune DEFAULT_MSG VTUNE_LIBRARIES VTUNE_INCLUDE_DIRS)
if(VTUNE_LIBRARIES AND NOT TARGET Vtune::Vtune)
add_library(Vtune::Vtune UNKNOWN IMPORTED GLOBAL)
set_target_properties(Vtune::Vtune PROPERTIES
IMPORTED_LOCATION "${VTUNE_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${VTUNE_INCLUDE_DIRS}")
endif()
mark_as_advanced(VTUNE_FOUND VTUNE_INCLUDE_DIRS VTUNE_LIBRARIES)

View File

@ -1,53 +0,0 @@
#.rst:
# FindXCB
# -------
#
# Find XCB libraries
#
# Tries to find xcb libraries on unix systems.
#
# - Be sure to set the COMPONENTS to the components you want to link to
# - The XCB_LIBRARIES variable is set ONLY to your COMPONENTS list
# - To use only a specific component check the XCB_LIBRARIES_${COMPONENT} variable
#
# The following values are defined
#
# ::
#
# XCB_FOUND - True if xcb is available
# XCB_INCLUDE_DIRS - Include directories for xcb
# XCB_LIBRARIES - List of libraries for xcb
# XCB_DEFINITIONS - List of definitions for xcb
#
#=============================================================================
# Copyright (c) 2015 Jari Vetoniemi
#
# Distributed under the OSI-approved BSD License (the "License");
#
# 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.
#=============================================================================
include(FeatureSummary)
set_package_properties(XCB PROPERTIES
URL "http://xcb.freedesktop.org/"
DESCRIPTION "X protocol C-language Binding")
find_package(PkgConfig)
pkg_check_modules(PC_XCB QUIET xcb ${XCB_FIND_COMPONENTS})
find_library(XCB_LIBRARIES xcb HINTS ${PC_XCB_LIBRARY_DIRS})
find_path(XCB_INCLUDE_DIRS xcb/xcb.h PATH_SUFFIXES xcb HINTS ${PC_XCB_INCLUDE_DIRS})
foreach(COMPONENT ${XCB_FIND_COMPONENTS})
find_library(XCB_LIBRARIES_${COMPONENT} ${COMPONENT} HINTS ${PC_XCB_LIBRARY_DIRS})
list(APPEND XCB_LIBRARIES ${XCB_LIBRARIES_${COMPONENT}})
mark_as_advanced(XCB_LIBRARIES_${COMPONENT})
endforeach(COMPONENT ${XCB_FIND_COMPONENTS})
set(XCB_DEFINITIONS ${PC_XCB_CFLAGS_OTHER})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS)
mark_as_advanced(XCB_INCLUDE_DIRS XCB_LIBRARIES XCB_DEFINITIONS)

View File

@ -1,25 +0,0 @@
# - Try to find libsamplerate
# Once done this will define
#
# LIBSAMPLERATE_FOUND - system has libsamplerate
# LIBSAMPLERATE_INCLUDE_DIRS - the libsamplerate include directory
# LIBSAMPLERATE_LIBRARIES - The libsamplerate libraries
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules (LIBSAMPLERATE samplerate)
list(APPEND LIBSAMPLERATE_INCLUDE_DIRS ${LIBSAMPLERATE_INCLUDEDIR})
endif()
if(NOT LIBSAMPLERATE_FOUND)
find_path( LIBSAMPLERATE_INCLUDE_DIRS "samplerate.h"
PATH_SUFFIXES "samplerate" )
find_library( LIBSAMPLERATE_LIBRARIES samplerate)
endif()
# handle the QUIETLY and REQUIRED arguments and set SAMPLERATE_FOUND to TRUE if
# all listed variables are TRUE
include( "FindPackageHandleStandardArgs" )
find_package_handle_standard_args(libsamplerate DEFAULT_MSG LIBSAMPLERATE_INCLUDE_DIRS LIBSAMPLERATE_LIBRARIES)
mark_as_advanced(LIBSAMPLERATE_INCLUDE_DIRS LIBSAMPLERATE_LIBRARIES)

View File

@ -95,6 +95,24 @@ function(check_no_parenthesis_in_path)
endif()
endfunction()
# Makes an imported target if it doesn't exist. Useful for when find scripts from older versions of cmake don't make the targets you need
function(make_imported_target_if_missing target lib)
if(${lib}_FOUND AND NOT TARGET ${target})
add_library(_${lib} INTERFACE)
target_link_libraries(_${lib} INTERFACE "${${lib}_LIBRARIES}")
target_include_directories(_${lib} INTERFACE "${${lib}_INCLUDE_DIRS}")
add_library(${target} ALIAS _${lib})
endif()
endfunction()
# like add_library(new ALIAS old) but avoids add_library cannot create ALIAS target "new" because target "old" is imported but not globally visible. on older cmake
function(alias_library new old)
string(REPLACE "::" "" library_no_namespace ${old})
add_library(_alias_${library_no_namespace} INTERFACE)
target_link_libraries(_alias_${library_no_namespace} INTERFACE ${old})
add_library(${new} ALIAS _alias_${library_no_namespace})
endfunction()
#NOTE: this macro is used to get rid of whitespace and newlines.
macro(append_flags target flags)
if(flags STREQUAL "")

View File

@ -3,22 +3,25 @@
#-------------------------------------------------------------------------------
## Use cmake package to find module
if (Linux)
find_package(ALSA)
find_package(ALSA REQUIRED)
make_imported_target_if_missing(ALSA::ALSA ALSA)
endif()
find_package(PCAP)
find_package(LibXml2)
find_package(Freetype) # GS OSD
find_package(PCAP REQUIRED)
find_package(LibXml2 REQUIRED)
make_imported_target_if_missing(LibXml2::LibXml2 LibXml2)
find_package(Freetype REQUIRED) # GS OSD
find_package(Gettext) # translation tool
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
find_package(Git)
endif()
find_package(LibLZMA)
find_package(LibLZMA REQUIRED)
make_imported_target_if_missing(LibLZMA::LibLZMA LIBLZMA)
# Using find_package OpenGL without either setting your opengl preference to GLVND or LEGACY
# is deprecated as of cmake 3.11.
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL)
find_package(PNG)
find_package(OpenGL REQUIRED)
find_package(PNG REQUIRED)
find_package(Vtune)
# Does not require the module (allow to compile non-wx plugins)
@ -86,23 +89,25 @@ else()
endif()
endif()
find_package(wxWidgets COMPONENTS base core adv)
find_package(ZLIB)
find_package(wxWidgets REQUIRED base core adv)
include(${wxWidgets_USE_FILE})
make_imported_target_if_missing(wxWidgets::all wxWidgets)
find_package(ZLIB REQUIRED)
## Use pcsx2 package to find module
include(FindLibc)
## Use pcsx2 package to find module
include(Findlibsamplerate)
## Use pcsx2 package to find module
include(FindPulseAudio)
## Use CheckLib package to find module
include(CheckLib)
if(Linux)
check_lib(EGL EGL EGL/egl.h)
check_lib(X11_XCB X11-xcb X11/Xlib-xcb.h)
check_lib(XCB xcb xcb/xcb.h)
check_lib(AIO aio libaio.h)
# There are two udev pkg config files - udev.pc (wrong), libudev.pc (correct)
# When cross compiling, pkg-config will be skipped so we have to look for
@ -117,106 +122,41 @@ endif()
if(PORTAUDIO_API)
check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h)
endif()
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h)
check_lib(SOUNDTOUCH SoundTouch SoundTouch.h PATH_SUFFIXES soundtouch)
check_lib(SAMPLERATE samplerate samplerate.h)
if(SDL2_API)
check_lib(SDL2 SDL2 SDL.h PATH_SUFFIXES SDL2)
alias_library(SDL::SDL PkgConfig::SDL2)
else()
# Tell cmake that we use SDL as a library and not as an application
set(SDL_BUILDING_LIBRARY TRUE)
find_package(SDL)
find_package(SDL REQUIRED)
endif()
if(UNIX)
find_package(X11)
find_package(X11 REQUIRED)
make_imported_target_if_missing(X11::X11 X11)
# Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags
if (GTK2_API)
find_package(GTK2 REQUIRED gtk)
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()
endif()
find_package(XCB)
endif()
#----------------------------------------
# Use system include
#----------------------------------------
if(UNIX)
if(GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
# A lazy solution
set(GTK2_LIBRARIES ${GTK3_LIBRARIES})
elseif(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
endif()
if(X11_FOUND)
include_directories(${X11_INCLUDE_DIR})
endif()
endif()
if(ALSA_FOUND)
include_directories(${ALSA_INCLUDE_DIRS})
endif()
if(CG_FOUND)
include_directories(${CG_INCLUDE_DIRS})
endif()
if(JPEG_FOUND)
include_directories(${JPEG_INCLUDE_DIR})
endif()
if(GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIR})
endif()
if(OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
if(SDL_FOUND AND NOT SDL2_API)
include_directories(${SDL_INCLUDE_DIR})
endif()
if(USE_VTUNE AND VTUNE_FOUND)
include_directories(${VTUNE_INCLUDE_DIRS})
endif()
if(wxWidgets_FOUND)
include(${wxWidgets_USE_FILE})
endif()
if(PCAP_FOUND)
include_directories(${PCAP_INCLUDE_DIR})
endif()
if(LIBSAMPLERATE_FOUND)
include_directories(${LIBSAMPLERATE_INCLUDE_DIR})
endif()
if(PULSEAUDIO_FOUND)
include_directories(${PULSEAUDIO_INCLUDE_DIR})
endif()
if(LIBXML2_FOUND)
include_directories(${LIBXML2_INCLUDE_DIRS})
endif()
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
endif()
find_package(HarfBuzz)
if(HarfBuzz_FOUND)
include_directories(${HarfBuzz_INCLUDE_DIRS})
endif()
set(ACTUALLY_ENABLE_TESTS ${ENABLE_TESTS})
if(ENABLE_TESTS)
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/gtest/CMakeLists.txt")
@ -225,17 +165,6 @@ if(ENABLE_TESTS)
endif()
endif()
#----------------------------------------
# Use project-wide include directories
#----------------------------------------
include_directories(
${CMAKE_SOURCE_DIR}/common/include
${CMAKE_SOURCE_DIR}/common/include/Utilities
${CMAKE_SOURCE_DIR}/common/include/x86emitter
# File generated by Cmake
${CMAKE_BINARY_DIR}/common/include
)
#----------------------------------------
# Check correctness of the parameter
# Note: wxWidgets_INCLUDE_DIRS must be defined
@ -291,71 +220,3 @@ if(NOT USE_SYSTEM_YAML)
endif()
add_subdirectory(3rdparty/libchdr/libchdr EXCLUDE_FROM_ALL)
#-------------------------------------------------------------------------------
# Dependency message print
#-------------------------------------------------------------------------------
set(msg_dep_common_libs "check these libraries -> wxWidgets (>=3.0), aio")
set(msg_dep_pcsx2 "check these libraries -> wxWidgets (>=3.0), gtk2, zlib (>=1.2.4), pcsx2 common libs")
macro(print_dep str dep)
if (PACKAGE_MODE)
message(FATAL_ERROR "${str}:${dep}")
else()
message(STATUS "${str}:${dep}")
endif()
endmacro(print_dep)
#-------------------------------------------------------------------------------
# Pcsx2 core & common libs
#-------------------------------------------------------------------------------
# Check for additional dependencies.
# If all dependencies are available, including OS, build it
#-------------------------------------------------------------------------------
if (GTK2_FOUND OR GTK3_FOUND)
set(GTKn_FOUND TRUE)
elseif(APPLE) # Not we have but that we don't change all if(gtkn) entries
set(GTKn_FOUND TRUE)
else()
set(GTKn_FOUND FALSE)
endif()
if(SDL_FOUND OR SDL2_FOUND)
set(SDLn_FOUND TRUE)
else()
set(SDLn_FOUND FALSE)
endif()
if(wxWidgets_FOUND)
set(common_libs TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/common/src")
set(common_libs FALSE)
else()
set(common_libs FALSE)
print_dep("Skip build of common libraries: missing dependencies" "${msg_dep_common_libs}")
endif()
# Common dependancy
if(wxWidgets_FOUND AND ZLIB_FOUND AND common_libs AND NOT (Linux AND NOT AIO_FOUND))
if(OPENGL_FOUND AND X11_FOUND AND GTKn_FOUND AND ZLIB_FOUND AND PNG_FOUND AND FREETYPE_FOUND AND LIBLZMA_FOUND AND ((EGL_FOUND AND X11_XCB_FOUND) OR APPLE))
set(pcsx2_core TRUE)
else()
print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}")
set(pcsx2_core FALSE)
endif()
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/pcsx2")
set(pcsx2_core FALSE)
else()
set(pcsx2_core FALSE)
print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}")
endif()
# Linux, BSD, use gtk2, but not OSX
if(UNIX AND pcsx2_core AND NOT GTKn_FOUND AND NOT APPLE)
set(pcsx2_core FALSE)
print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}")
endif()

View File

@ -5,13 +5,6 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
endif(NOT TOP_CMAKE_WAS_SOURCED)
set(Output Utilities)
set(CommonFlags
)
set(UtilitiesFinalFlags ${CommonFlags})
# variable with all sources of this library
set(UtilitiesSources
VirtualMemory.cpp
@ -108,21 +101,13 @@ set(UtilitiesFinalSources
${UtilitiesHeaders}
)
set(UtilitiesFinalLibs
${LIBC_LIBRARIES} # Gold (new linux linker) does not get automatically dependency of dependency
${wxWidgets_LIBRARIES}
yaml-cpp chdr-static
)
add_pcsx2_lib(${Output} "${UtilitiesFinalSources}" "${UtilitiesFinalLibs}" "${UtilitiesFinalFlags}")
add_pcsx2_lib(${Output}_NO_TLS "${UtilitiesFinalSources}" "${UtilitiesFinalLibs}" "${UtilitiesFinalFlags} -DPCSX2_THREAD_LOCAL=0")
target_compile_features(${Output} PUBLIC cxx_std_17)
target_compile_features(${Output}_NO_TLS PUBLIC cxx_std_17)
target_include_directories(${Output} PUBLIC ../../../3rdparty/include)
target_include_directories(${Output}_NO_TLS PUBLIC ../../../3rdparty/include)
if(COMMAND target_precompile_headers)
target_precompile_headers(${Output} PRIVATE PrecompiledHeader.h)
target_precompile_headers(${Output}_NO_TLS PRIVATE PrecompiledHeader.h)
endif()
foreach(library Utilities Utilities_NO_TLS)
add_library(${library} "${UtilitiesFinalSources}")
target_link_libraries(${library} PRIVATE ${LIBC_LIBRARIES} PUBLIC wxWidgets::all)
target_compile_features(${library} PUBLIC cxx_std_17)
target_include_directories(${library} PUBLIC ../../../3rdparty/include ../../include ../../include/Utilities PRIVATE .)
if(COMMAND target_precompile_headers)
target_precompile_headers(${library} PRIVATE PrecompiledHeader.h)
endif()
endforeach()
target_compile_definitions(Utilities_NO_TLS PUBLIC PCSX2_THREAD_LOCAL=0)

View File

@ -5,12 +5,6 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
endif(NOT TOP_CMAKE_WAS_SOURCED)
set(Output x86emitter)
set(CommonFlags
)
set(x86emitterFinalFlags ${CommonFlags})
# variable with all sources of this library
@ -69,12 +63,13 @@ set(x86emitterFinalSources
)
set(x86emitterFinalLibs
${wxWidgets_LIBRARIES}
wxWidgets::all
)
add_pcsx2_lib(${Output} "${x86emitterFinalSources}" "${x86emitterFinalLibs}" "${x86emitterFinalFlags}")
target_compile_features(${Output} PUBLIC cxx_std_17)
add_pcsx2_lib(x86emitter "${x86emitterFinalSources}" "${x86emitterFinalLibs}" "${x86emitterFinalFlags}")
target_compile_features(x86emitter PUBLIC cxx_std_17)
target_include_directories(x86emitter PUBLIC ../../include PRIVATE ../../include/x86emitter)
if(COMMAND target_precompile_headers)
target_precompile_headers(${Output} PRIVATE PrecompiledHeader.h)
target_precompile_headers(x86emitter PRIVATE PrecompiledHeader.h)
endif()

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_ProjectFileVersion>10.0.30128.1</_ProjectFileVersion>
@ -6,10 +6,10 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\;$(SolutionDir)3rdparty\soundtouch\;$(SolutionDir)3rdparty\yaml-cpp\yaml-cpp\include\;$(SolutionDir)3rdparty\fmt\fmt\include\;$(SolutionDir)3rdparty\libchdr\libchdr\include;$(SolutionDir)3rdparty\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\;$(SolutionDir)3rdparty\soundtouch\soundtouch\;$(SolutionDir)3rdparty\yaml-cpp\yaml-cpp\include\;$(SolutionDir)3rdparty\fmt\fmt\include\;$(SolutionDir)3rdparty\libchdr\libchdr\include;$(SolutionDir)3rdparty\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)deps\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
</Project>
</Project>

View File

@ -1202,11 +1202,16 @@ if(Linux)
)
set(Platform_Libs
${LIBUDEV_LIBRARIES}
${X11_LIBRARIES}
${X11_XCB_LIBRARIES}
${XCB_LIBRARIES}
PkgConfig::AIO
PkgConfig::EGL
PkgConfig::LIBUDEV
PkgConfig::X11_XCB
PkgConfig::XCB
X11::X11
ALSA::ALSA
)
elseif(UNIX AND NOT APPLE)
set(Platform_Libs X11::X11)
endif()
# Windows
@ -1240,41 +1245,32 @@ set(pcsx2FinalLibs
Utilities
x86emitter
fmt::fmt
${wxWidgets_LIBRARIES}
${GTK2_LIBRARIES}
${ZLIB_LIBRARIES}
${AIO_LIBRARIES}
${GCOV_LIBRARIES}
${ALSA_LIBRARIES}
${SOUNDTOUCH_LIBRARIES}
${SDL2_LIBRARIES}
${PCAP_LIBRARY}
${LIBSAMPLERATE_LIBRARIES}
${LIBXML2_LIBRARIES}
${LIBC_LIBRARIES}
${PNG_LIBRARIES}
${FREETYPE_LIBRARIES}
${LIBLZMA_LIBRARIES}
${OPENGL_LIBRARIES}
${EGL_LIBRARIES}
yaml-cpp
chdr-static
wxWidgets::all
GTK::gtk
HarfBuzz::HarfBuzz
ZLIB::ZLIB
PkgConfig::SOUNDTOUCH
SDL::SDL
PCAP::PCAP
PkgConfig::SAMPLERATE
LibXml2::LibXml2
OpenGL::GL
PNG::PNG
Freetype::Freetype
LibLZMA::LibLZMA
${Platform_Libs}
)
if(PORTAUDIO_FOUND)
set(pcsx2FinalLibs ${pcsx2FinalLibs} ${PORTAUDIO_LIBRARIES})
set(pcsx2FinalLibs ${pcsx2FinalLibs} PkgConfig::PORTAUDIO)
endif()
if(PULSEAUDIO_FOUND)
set(pcsx2FinalLibs ${pcsx2FinalLibs} ${PULSEAUDIO_LIBRARIES})
set(pcsx2FinalLibs ${pcsx2FinalLibs} PulseAudio::PulseAudio)
endif()
# additonal include directories
include_directories(
gui
x86
${CMAKE_BINARY_DIR}/pcsx2/gui
)
### Generate the resources files
file(MAKE_DIRECTORY ${res_bin})
@ -1294,12 +1290,20 @@ foreach(res_file IN ITEMS
endforeach()
if(USE_VTUNE)
set(pcsx2FinalLibs ${pcsx2FinalLibs} ${VTUNE_LIBRARIES})
set(pcsx2FinalLibs ${pcsx2FinalLibs} Vtune::Vtune)
endif()
add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}")
target_compile_features(${Output} PRIVATE cxx_std_17)
# additonal include directories
target_include_directories(${Output} PRIVATE
gui
x86
${CMAKE_BINARY_DIR}/pcsx2/gui
${CMAKE_BINARY_DIR}/common/include/
)
if(COMMAND target_precompile_headers)
message("Using precompiled headers.")
target_precompile_headers(${Output} PRIVATE PrecompiledHeader.h)
@ -1311,6 +1315,9 @@ if (APPLE)
# Obviously not being able to make those arrays executable would be a problem
target_link_options(${Output} PRIVATE -Wl,-segprot,__DATA,rwx,rw)
# MacOS relies on X11's GL headers even though it doesn't use X11
target_include_directories(${Output} PRIVATE ${X11_INCLUDE_DIR})
set_target_properties(${Output} PROPERTIES
MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/gui/Resources/Info.plist.in"

View File

@ -17,7 +17,7 @@
#include "SPU2/Global.h"
#include "Dialogs.h"
#include "Config.h"
#include "soundtouch/SoundTouch.h"
#include "SoundTouch.h"
namespace SoundtouchCfg
{

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "Global.h"
#include "soundtouch/SoundTouch.h"
#include "SoundTouch.h"
#include <wx/datetime.h>
#include <algorithm>

View File

@ -17,7 +17,7 @@
#include "SPU2/Global.h"
#include "Dialogs.h"
#include "soundtouch/SoundTouch.h"
#include "SoundTouch.h"
static int SequenceLenMS = 30;
static int SeekWindowMS = 20;