cmake: Windows dependency builds

This commit is contained in:
TellowKrinkle 2021-08-04 00:43:25 -05:00 committed by refractionpcsx2
parent 205c8a05c3
commit e1bb96cc94
17 changed files with 1856 additions and 181 deletions

55
3rdparty/baseclasses/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,55 @@
add_library(baseclasses
amextra.cpp
amfilter.cpp
amvideo.cpp
combase.cpp
ctlutil.cpp
ddmm.cpp
mtype.cpp
outputq.cpp
pstream.cpp
pullpin.cpp
refclock.cpp
renbase.cpp
schedule.cpp
seekpt.cpp
source.cpp
strmctl.cpp
sysclock.cpp
transfrm.cpp
transip.cpp
vtrans.cpp
wxdebug.cpp
wxlist.cpp
wxutil.cpp
amextra.h
amfilter.h
cache.h
combase.h
ctlutil.h
ddmm.h
fourcc.h
measure.h
msgthrd.h
mtype.h
outputq.h
pstream.h
pullpin.h
refclock.h
reftime.h
renbase.h
schedule.h
seekpt.h
source.h
streams.h
strmctl.h
sysclock.h
transfrm.h
transip.h
vtrans.h
wxdebug.h
wxlist.h
wxutil.h
)
target_include_directories(baseclasses PUBLIC .)
target_precompile_headers(baseclasses PRIVATE streams.h)

50
3rdparty/freetype/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,50 @@
add_library(freetype
src/autofit/autofit.c
src/bdf/bdf.c
src/cff/cff.c
src/base/ftbase.c
src/base/ftbitmap.c
src/cache/ftcache.c
src/base/ftfstype.c
src/base/ftgasp.c
src/base/ftglyph.c
src/gzip/ftgzip.c
src/base/ftinit.c
src/lzw/ftlzw.c
src/base/ftstroke.c
src/base/ftsystem.c
src/smooth/smooth.c
src/base/ftbbox.c
src/base/ftfntfmt.c
src/base/ftmm.c
src/base/ftpfr.c
src/base/ftsynth.c
src/base/fttype1.c
src/base/ftwinfnt.c
src/base/ftlcdfil.c
src/base/ftgxval.c
src/base/ftotval.c
src/base/ftpatent.c
src/pcf/pcf.c
src/pfr/pfr.c
src/psaux/psaux.c
src/pshinter/pshinter.c
src/psnames/psmodule.c
src/raster/raster.c
src/sfnt/sfnt.c
src/truetype/truetype.c
src/type1/type1.c
src/cid/type1cid.c
src/type42/type42.c
src/winfonts/winfnt.c
include/ft2build.h
include/freetype/config/ftconfig.h
include/freetype/config/ftheader.h
include/freetype/config/ftmodule.h
include/freetype/config/ftoption.h
include/freetype/config/ftstdlib.h
)
target_compile_definitions(freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE FT2_BUILD_LIBRARY)
target_include_directories(freetype PUBLIC include)
target_link_libraries(freetype PRIVATE ZLIB::ZLIB)
add_library(Freetype::Freetype ALIAS freetype)

60
3rdparty/libjpeg/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,60 @@
add_library(jpeg
jaricom.c
jcapimin.c
jcapistd.c
jcarith.c
jccoefct.c
jccolor.c
jcdctmgr.c
jchuff.c
jcinit.c
jcmainct.c
jcmarker.c
jcmaster.c
jcomapi.c
jcparam.c
jcprepct.c
jcsample.c
jctrans.c
jdapimin.c
jdapistd.c
jdarith.c
jdatadst.c
jdatasrc.c
jdcoefct.c
jdcolor.c
jddctmgr.c
jdhuff.c
jdinput.c
jdmainct.c
jdmarker.c
jdmaster.c
jdmerge.c
jdpostct.c
jdsample.c
jdtrans.c
jerror.c
jfdctflt.c
jfdctfst.c
jfdctint.c
jidctflt.c
jidctfst.c
jidctint.c
jmemansi.c
jmemmgr.c
jquant1.c
jquant2.c
jutils.c
jconfig.h
jdct.h
jerror.h
jinclude.h
jmemsys.h
jmorecfg.h
jpegint.h
jpeglib.h
jversion.h
)
target_include_directories(jpeg PUBLIC .)
add_library(JPEG::JPEG ALIAS jpeg)

21
3rdparty/libpng/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,21 @@
add_library(png
png.c
pngerror.c
pngget.c
pngmem.c
pngpread.c
pngread.c
pngrio.c
pngrtran.c
pngrutil.c
pngset.c
pngtrans.c
pngwio.c
pngwrite.c
pngwtran.c
pngwutil.c
)
target_link_libraries(png PRIVATE ZLIB::ZLIB)
target_include_directories(png PUBLIC .)
add_library(PNG::PNG ALIAS png)

14
3rdparty/libsamplerate/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,14 @@
add_library(samplerate
samplerate.c
src_linear.c
src_sinc.c
src_zoh.c
common.h
config.h
fastest_coeffs.h
high_qual_coeffs.h
mid_qual_coeffs.h
samplerate.h
)
target_include_directories(samplerate PUBLIC .)
add_library(PkgConfig::SAMPLERATE ALIAS samplerate)

36
3rdparty/portaudio/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,36 @@
add_library(portaudio
src/common/pa_allocation.c
src/common/pa_converters.c
src/common/pa_cpuload.c
src/common/pa_debugprint.c
src/common/pa_dither.c
src/common/pa_front.c
src/common/pa_process.c
src/common/pa_ringbuffer.c
src/common/pa_stream.c
src/common/pa_trace.c
src/hostapi/dsound/pa_win_ds.c
src/hostapi/dsound/pa_win_ds_dynlink.c
src/hostapi/wdmks/pa_win_wdmks.c
src/hostapi/wmme/pa_win_wmme.c
src/hostapi/wasapi/pa_win_wasapi.c
src/os/win/pa_win_coinitialize.c
src/os/win/pa_win_hostapis.c
src/os/win/pa_win_util.c
src/os/win/pa_win_waveformat.c
src/os/win/pa_win_wdmks_utils.c
src/os/win/pa_x86_plain_converters.c
include/pa_asio.h
include/pa_jack.h
include/pa_linux_alsa.h
include/pa_mac_core.h
include/pa_win_ds.h
include/pa_win_wasapi.h
include/pa_win_waveformat.h
include/pa_win_wdmks.h
include/pa_win_wmme.h
include/portaudio.h
src/os/win/pa_win_coinitialize.h
)
target_include_directories(portaudio PUBLIC include PRIVATE src/common src/os/win)
add_library(PkgConfig::PORTAUDIO ALIAS portaudio)

11
3rdparty/pthreads4w/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,11 @@
add_library(pthreads4w
pthread.c
config.h
context.h
include/pthread.h
include/sched.h
include/semaphore.h
need_errno.h
)
target_compile_definitions(pthreads4w PUBLIC PTW32_STATIC_LIB __CLEANUP_SEH PRIVATE HAVE_PTW32_CONFIG_H PTW32_BUILD_INLINED)
target_include_directories(pthreads4w PUBLIC include)

34
3rdparty/soundtouch/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,34 @@
add_library(soundtouch
source/SoundStretch/WavFile.cpp
source/SoundTouch/AAFilter.cpp
source/SoundTouch/BPMDetect.cpp
source/SoundTouch/cpu_detect_x86.cpp
source/SoundTouch/FIFOSampleBuffer.cpp
source/SoundTouch/FIRFilter.cpp
source/SoundTouch/InterpolateCubic.cpp
source/SoundTouch/InterpolateLinear.cpp
source/SoundTouch/InterpolateShannon.cpp
source/SoundTouch/mmx_optimized.cpp
source/SoundTouch/PeakFinder.cpp
source/SoundTouch/RateTransposer.cpp
source/SoundTouch/SoundTouch.cpp
source/SoundTouch/sse_optimized.cpp
source/SoundTouch/TDStretch.cpp
soundtouch/BPMDetect.h
soundtouch/FIFOSampleBuffer.h
soundtouch/FIFOSamplePipe.h
soundtouch/SoundTouch.h
soundtouch/STTypes.h
source/SoundStretch/WavFile.h
source/SoundTouch/AAFilter.h
source/SoundTouch/cpu_detect.h
source/SoundTouch/FIRFilter.h
source/SoundTouch/InterpolateCubic.h
source/SoundTouch/InterpolateLinear.h
source/SoundTouch/InterpolateShannon.h
source/SoundTouch/PeakFinder.h
source/SoundTouch/RateTransposer.h
source/SoundTouch/TDStretch.h
)
target_include_directories(soundtouch PUBLIC soundtouch)
add_library(PkgConfig::SOUNDTOUCH ALIAS soundtouch)

1149
3rdparty/wxwidgets3.0/CMakeLists.txt vendored Normal file

File diff suppressed because it is too large Load Diff

158
3rdparty/xz/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,158 @@
add_library(xz-lzma
xz/src/common/tuklib_cpucores.c
xz/src/common/tuklib_physmem.c
xz/src/liblzma/check/check.c
xz/src/liblzma/check/crc32_fast.c
xz/src/liblzma/check/crc32_table.c
xz/src/liblzma/check/crc64_fast.c
xz/src/liblzma/check/crc64_table.c
xz/src/liblzma/check/sha256.c
xz/src/liblzma/common/alone_decoder.c
xz/src/liblzma/common/alone_encoder.c
xz/src/liblzma/common/auto_decoder.c
xz/src/liblzma/common/block_buffer_decoder.c
xz/src/liblzma/common/block_buffer_encoder.c
xz/src/liblzma/common/block_decoder.c
xz/src/liblzma/common/block_encoder.c
xz/src/liblzma/common/block_header_decoder.c
xz/src/liblzma/common/block_header_encoder.c
xz/src/liblzma/common/block_util.c
xz/src/liblzma/common/common.c
xz/src/liblzma/common/easy_buffer_encoder.c
xz/src/liblzma/common/easy_decoder_memusage.c
xz/src/liblzma/common/easy_encoder.c
xz/src/liblzma/common/easy_encoder_memusage.c
xz/src/liblzma/common/easy_preset.c
xz/src/liblzma/common/filter_buffer_decoder.c
xz/src/liblzma/common/filter_buffer_encoder.c
xz/src/liblzma/common/filter_common.c
xz/src/liblzma/common/filter_decoder.c
xz/src/liblzma/common/filter_encoder.c
xz/src/liblzma/common/filter_flags_decoder.c
xz/src/liblzma/common/filter_flags_encoder.c
xz/src/liblzma/common/hardware_cputhreads.c
xz/src/liblzma/common/hardware_physmem.c
xz/src/liblzma/common/index.c
xz/src/liblzma/common/index_decoder.c
xz/src/liblzma/common/index_encoder.c
xz/src/liblzma/common/index_hash.c
xz/src/liblzma/common/outqueue.c
xz/src/liblzma/common/stream_buffer_decoder.c
xz/src/liblzma/common/stream_buffer_encoder.c
xz/src/liblzma/common/stream_decoder.c
xz/src/liblzma/common/stream_encoder.c
xz/src/liblzma/common/stream_encoder_mt.c
xz/src/liblzma/common/stream_flags_common.c
xz/src/liblzma/common/stream_flags_decoder.c
xz/src/liblzma/common/stream_flags_encoder.c
xz/src/liblzma/common/vli_decoder.c
xz/src/liblzma/common/vli_encoder.c
xz/src/liblzma/common/vli_size.c
xz/src/liblzma/delta/delta_common.c
xz/src/liblzma/delta/delta_decoder.c
xz/src/liblzma/delta/delta_encoder.c
xz/src/liblzma/lzma/fastpos_table.c
xz/src/liblzma/lzma/lzma2_decoder.c
xz/src/liblzma/lzma/lzma2_encoder.c
xz/src/liblzma/lzma/lzma_decoder.c
xz/src/liblzma/lzma/lzma_encoder.c
xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c
xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c
xz/src/liblzma/lzma/lzma_encoder_presets.c
xz/src/liblzma/lz/lz_decoder.c
xz/src/liblzma/lz/lz_encoder.c
xz/src/liblzma/lz/lz_encoder_mf.c
xz/src/liblzma/rangecoder/price_table.c
xz/src/liblzma/simple/arm.c
xz/src/liblzma/simple/armthumb.c
xz/src/liblzma/simple/ia64.c
xz/src/liblzma/simple/powerpc.c
xz/src/liblzma/simple/simple_coder.c
xz/src/liblzma/simple/simple_decoder.c
xz/src/liblzma/simple/simple_encoder.c
xz/src/liblzma/simple/sparc.c
xz/src/liblzma/simple/x86.c
xz/src/common/mythread.h
xz/src/common/sysdefs.h
xz/src/common/tuklib_common.h
xz/src/common/tuklib_config.h
xz/src/common/tuklib_cpucores.h
xz/src/common/tuklib_integer.h
xz/src/common/tuklib_physmem.h
xz/src/liblzma/api/lzma.h
xz/src/liblzma/api/lzma/base.h
xz/src/liblzma/api/lzma/bcj.h
xz/src/liblzma/api/lzma/block.h
xz/src/liblzma/api/lzma/check.h
xz/src/liblzma/api/lzma/container.h
xz/src/liblzma/api/lzma/delta.h
xz/src/liblzma/api/lzma/filter.h
xz/src/liblzma/api/lzma/hardware.h
xz/src/liblzma/api/lzma/index.h
xz/src/liblzma/api/lzma/index_hash.h
xz/src/liblzma/api/lzma/lzma12.h
xz/src/liblzma/api/lzma/stream_flags.h
xz/src/liblzma/api/lzma/version.h
xz/src/liblzma/api/lzma/vli.h
xz/src/liblzma/check/check.h
xz/src/liblzma/check/crc32_table_be.h
xz/src/liblzma/check/crc32_table_le.h
xz/src/liblzma/check/crc64_table_be.h
xz/src/liblzma/check/crc64_table_le.h
xz/src/liblzma/check/crc_macros.h
xz/src/liblzma/common/alone_decoder.h
xz/src/liblzma/common/block_buffer_encoder.h
xz/src/liblzma/common/block_decoder.h
xz/src/liblzma/common/block_encoder.h
xz/src/liblzma/common/common.h
xz/src/liblzma/common/easy_preset.h
xz/src/liblzma/common/filter_common.h
xz/src/liblzma/common/filter_decoder.h
xz/src/liblzma/common/filter_encoder.h
xz/src/liblzma/common/index.h
xz/src/liblzma/common/index_encoder.h
xz/src/liblzma/common/memcmplen.h
xz/src/liblzma/common/outqueue.h
xz/src/liblzma/common/stream_decoder.h
xz/src/liblzma/common/stream_flags_common.h
xz/src/liblzma/delta/delta_common.h
xz/src/liblzma/delta/delta_decoder.h
xz/src/liblzma/delta/delta_encoder.h
xz/src/liblzma/delta/delta_private.h
xz/src/liblzma/lzma/fastpos.h
xz/src/liblzma/lzma/lzma2_decoder.h
xz/src/liblzma/lzma/lzma2_encoder.h
xz/src/liblzma/lzma/lzma_common.h
xz/src/liblzma/lzma/lzma_decoder.h
xz/src/liblzma/lzma/lzma_encoder.h
xz/src/liblzma/lzma/lzma_encoder_private.h
xz/src/liblzma/lz/lz_decoder.h
xz/src/liblzma/lz/lz_encoder.h
xz/src/liblzma/lz/lz_encoder_hash.h
xz/src/liblzma/lz/lz_encoder_hash_table.h
xz/src/liblzma/rangecoder/price.h
xz/src/liblzma/rangecoder/range_common.h
xz/src/liblzma/rangecoder/range_decoder.h
xz/src/liblzma/rangecoder/range_encoder.h
xz/src/liblzma/simple/simple_coder.h
xz/src/liblzma/simple/simple_decoder.h
xz/src/liblzma/simple/simple_encoder.h
xz/src/liblzma/simple/simple_private.h
config.h
)
target_compile_definitions(xz-lzma PRIVATE HAVE_CONFIG_H)
target_include_directories(xz-lzma
PUBLIC
xz/src/liblzma/api
PRIVATE
.
xz/src/common
xz/src/liblzma/check
xz/src/liblzma/common
xz/src/liblzma/delta
xz/src/liblzma/lz
xz/src/liblzma/lzma
xz/src/liblzma/rangecoder
xz/src/liblzma/simple
)
add_library(LibLZMA::LibLZMA ALIAS xz-lzma)

31
3rdparty/zlib/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,31 @@
add_library(pcsx2-zlib
adler32.c
compress.c
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
crc32.h
deflate.h
inffast.h
inffixed.h
inflate.h
inftrees.h
trees.h
zconf.h
zlib.h
zutil.h
)
target_include_directories(pcsx2-zlib PUBLIC .)
add_library(ZLIB::ZLIB ALIAS pcsx2-zlib)

View File

@ -77,6 +77,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(USE_GCC TRUE)
message(STATUS "Building with GNU GCC")
elseif(MSVC)
message(STATUS "Building with MSVC")
else()
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
@ -99,6 +101,8 @@ set(CMAKE_LINKER_FLAGS_DEVEL "${CMAKE_LINKER_FLAGS_RELWITHDEBINFO}"
CACHE STRING "Flags used for linking binaries during development builds" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_DEVEL "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}"
CACHE STRING "Flags used for linking shared libraries during development builds" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_DEVEL "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}"
CACHE STRING "Flags used for linking executables during development builds" FORCE)
if(CMAKE_CONFIGURATION_TYPES)
list(INSERT CMAKE_CONFIGURATION_TYPES 0 Devel)
endif()
@ -152,6 +156,9 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
if(NOT DEFINED ARCH_FLAG)
if (MSVC)
set(ARCH_FLAG /arch:SSE2)
else()
if (DISABLE_ADVANCE_SIMD)
if (USE_ICC)
set(ARCH_FLAG "-msse2 -msse4.1")
@ -165,6 +172,7 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
set(ARCH_FLAG "-mfxsr -march=native")
endif()
endif()
endif()
list(APPEND PCSX2_DEFS _ARCH_32=1 _M_X86=1 _M_X86_32=1)
set(_ARCH_32 1)
@ -174,7 +182,7 @@ elseif(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64")
# x86_64 requires -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT DEFINED ARCH_FLAG)
if(NOT DEFINED ARCH_FLAG AND NOT MSVC)
if (DISABLE_ADVANCE_SIMD)
if (USE_ICC)
set(ARCH_FLAG "-msse2 -msse4.1")
@ -235,7 +243,13 @@ option(USE_PGO_OPTIMIZE "Enable PGO optimization (use profile)")
# Note1: Builtin strcmp/memcmp was proved to be slower on Mesa than stdlib version.
# Note2: float operation SSE is impacted by the PCSX2 SSE configuration. In particular, flush to zero denormal.
add_compile_options(-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse -fno-operator-names)
if(NOT MSVC)
add_compile_options(-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse -fno-operator-names)
endif()
if(WIN32)
list(APPEND PCSX2_DEFS TIXML_USE_STL _SCL_SECURE_NO_WARNINGS _UNICODE UNICODE)
endif()
if(USE_VTUNE)
list(APPEND PCSX2_DEFS ENABLE_VTUNE)
@ -252,9 +266,13 @@ endif()
# -Wno-stringop-truncation: Who comes up with these compiler warnings, anyways?
# -Wno-stringop-overflow: Probably the same people as this one...
set(DEFAULT_WARNINGS -Wall -Wextra -Wno-attributes -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -Wno-deprecated-declarations -Wno-format -Wno-format-security -Wno-overloaded-virtual)
if (NOT USE_ICC)
if (MSVC)
set(DEFAULT_WARNINGS)
else()
set(DEFAULT_WARNINGS -Wall -Wextra -Wno-attributes -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -Wno-deprecated-declarations -Wno-format -Wno-format-security -Wno-overloaded-virtual)
if (NOT USE_ICC)
list(APPEND DEFAULT_WARNINGS -Wno-unused-value)
endif()
endif()
if (USE_CLANG)
@ -269,7 +287,7 @@ endif()
# -Wstrict-aliasing=n: to fix one day aliasing issue. n=1/2/3
if (USE_ICC)
set(AGGRESSIVE_WARNING -Wstrict-aliasing)
else()
elseif(NOT MSVC)
set(AGGRESSIVE_WARNING -Wstrict-aliasing -Wstrict-overflow=1)
endif()

View File

@ -68,7 +68,7 @@ function(get_git_version_info)
endfunction()
function(write_svnrev_h)
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${PCSX2_WC_TIME}ll \n#define SVN_MODS 0\n#define GIT_REV \"${PCSX2_GIT_REV}\"")
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${PCSX2_WC_TIME}ll \n#define SVN_MODS 0\n#define GIT_REV \"${PCSX2_GIT_REV}\"\n")
endfunction()
function(check_compiler_version version_warn version_err)

View File

@ -1,61 +1,75 @@
#-------------------------------------------------------------------------------
# Search all libraries on the system
#-------------------------------------------------------------------------------
## Use cmake package to find module
if (Linux)
find_package(ALSA REQUIRED)
make_imported_target_if_missing(ALSA::ALSA ALSA)
endif()
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 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 REQUIRED)
find_package(PNG REQUIRED)
find_package(Vtune)
# 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)
if (WIN32)
# We bundle everything on Windows
add_subdirectory(3rdparty/zlib EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/libpng EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/libjpeg EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/libsamplerate EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/baseclasses EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/freetype EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/portaudio EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/pthreads4w EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/soundtouch EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/wxwidgets3.0 EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/xz EXCLUDE_FROM_ALL)
else()
## Use cmake package to find module
if (Linux)
find_package(ALSA REQUIRED)
make_imported_target_if_missing(ALSA::ALSA ALSA)
endif()
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
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 REQUIRED)
find_package(PNG REQUIRED)
find_package(Vtune)
# 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()
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)
# 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)
# 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)
elseif(NOT APPLE)
list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk3)
endif()
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)
# 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")
@ -68,7 +82,7 @@ if(CMAKE_CROSSCOMPILING)
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32-3.0")
endif()
endif()
else()
else()
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.0-config")
endif()
@ -87,24 +101,24 @@ else()
if(NOT GTK2_API AND EXISTS "/usr/bin/wx-config-gtk3")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-gtk3")
endif()
endif()
endif()
find_package(wxWidgets REQUIRED base core adv)
include(${wxWidgets_USE_FILE})
make_imported_target_if_missing(wxWidgets::all wxWidgets)
find_package(wxWidgets REQUIRED base core adv)
include(${wxWidgets_USE_FILE})
make_imported_target_if_missing(wxWidgets::all wxWidgets)
find_package(ZLIB REQUIRED)
find_package(ZLIB REQUIRED)
## Use pcsx2 package to find module
include(FindLibc)
## Use pcsx2 package to find module
include(FindLibc)
## Use pcsx2 package to find module
include(FindPulseAudio)
## Use pcsx2 package to find module
include(FindPulseAudio)
## Use CheckLib package to find module
include(CheckLib)
## Use CheckLib package to find module
include(CheckLib)
if(Linux)
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)
@ -118,27 +132,27 @@ if(Linux)
else()
check_lib(LIBUDEV libudev libudev.h)
endif()
endif()
if(PORTAUDIO_API)
endif()
if(PORTAUDIO_API)
check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h)
endif()
check_lib(SOUNDTOUCH SoundTouch SoundTouch.h PATH_SUFFIXES soundtouch)
check_lib(SAMPLERATE samplerate samplerate.h)
endif()
check_lib(SOUNDTOUCH SoundTouch SoundTouch.h PATH_SUFFIXES soundtouch)
check_lib(SAMPLERATE samplerate samplerate.h)
if(SDL2_API)
if(SDL2_API)
check_lib(SDL2 SDL2 SDL.h PATH_SUFFIXES SDL2)
alias_library(SDL::SDL PkgConfig::SDL2)
else()
else()
# Tell cmake that we use SDL as a library and not as an application
set(SDL_BUILDING_LIBRARY TRUE)
find_package(SDL REQUIRED)
endif()
endif()
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE)
find_package(X11 REQUIRED)
make_imported_target_if_missing(X11::X11 X11)
endif()
if(UNIX)
endif()
if(UNIX)
# Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags
if (GTK2_API)
find_package(GTK2 REQUIRED gtk)
@ -152,12 +166,14 @@ if(UNIX)
alias_library(GTK::gtk PkgConfig::GTK3)
endif()
endif()
endif()
endif()
#----------------------------------------
# Use system include
#----------------------------------------
find_package(HarfBuzz)
#----------------------------------------
# Use system include
#----------------------------------------
find_package(HarfBuzz)
endif(WIN32)
set(ACTUALLY_ENABLE_TESTS ${ENABLE_TESTS})
if(ENABLE_TESTS)
@ -216,8 +232,10 @@ if(NOT USE_SYSTEM_YAML)
if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/yaml-cpp/yaml-cpp/CMakeLists.txt")
message(STATUS "Using bundled yaml-cpp")
add_subdirectory(3rdparty/yaml-cpp/yaml-cpp EXCLUDE_FROM_ALL)
if (NOT MSVC)
# Remove once https://github.com/jbeder/yaml-cpp/pull/815 is merged
target_compile_options(yaml-cpp PRIVATE -Wno-shadow)
endif()
else()
message(FATAL_ERROR "No bundled yaml-cpp was found")
endif()

View File

@ -10,7 +10,6 @@ add_library(Utilities)
# Utilities sources
target_sources(Utilities PRIVATE
VirtualMemory.cpp
AlignedMalloc.cpp
../../include/Utilities/FixedPointTypes.inl
../../include/Utilities/EventSource.inl
../../include/Utilities/SafeArray.inl
@ -20,7 +19,6 @@ target_sources(Utilities PRIVATE
Exceptions.cpp
FastFormatString.cpp
IniInterface.cpp
Linux/LnxHostSys.cpp
Mutex.cpp
PathUtils.cpp
PrecompiledHeader.cpp
@ -38,7 +36,7 @@ target_sources(Utilities PRIVATE
wxAppWithHelpers.cpp
wxGuiTools.cpp
wxHelpers.cpp
)
)
# Utilities headers
target_sources(Utilities PRIVATE
@ -76,25 +74,35 @@ target_sources(Utilities PRIVATE
ThreadingInternal.h
)
if(APPLE)
if(WIN32)
target_sources(Utilities PRIVATE
Windows/WinThreads.cpp
Windows/WinHostSys.cpp
Windows/WinMisc.cpp
Semaphore.cpp
)
if(_M_X86_32)
target_sources(Utilities PRIVATE x86/MemcpyFast.cpp)
endif()
target_link_libraries(Utilities PUBLIC pthreads4w Winmm.lib)
else()
target_sources(Utilities PRIVATE
AlignedMalloc.cpp
Linux/LnxHostSys.cpp
)
if(APPLE)
target_sources(Utilities PRIVATE
Darwin/DarwinThreads.cpp
Darwin/DarwinMisc.cpp
Darwin/DarwinSemaphore.cpp
)
elseif(Windows)
target_sources(Utilities PRIVATE
x86/MemcpyFast.cpp
Windows/WinThreads.cpp
Windows/WinHostSys.cpp
Windows/WinMisc.cpp
)
else()
else()
target_sources(Utilities PRIVATE
Linux/LnxThreads.cpp
Linux/LnxMisc.cpp
Semaphore.cpp
)
endif()
endif()
if(USE_VTUNE)

View File

@ -57,7 +57,7 @@ else()
target_sources(x86emitter PRIVATE LnxCpuDetect.cpp)
endif()
target_link_libraries(x86emitter PRIVATE wxWidgets::all)
target_link_libraries(x86emitter PRIVATE Utilities wxWidgets::all)
target_compile_features(x86emitter PUBLIC cxx_std_17)
target_include_directories(x86emitter PUBLIC ../../include PRIVATE ../../include/x86emitter)
target_compile_definitions(x86emitter PUBLIC "${PCSX2_DEFS}")

View File

@ -25,7 +25,10 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
endif()
set(CommonFlags
if(MSVC)
set(CommonFlags)
else()
set(CommonFlags
-fno-strict-aliasing
-Wstrict-aliasing # Allow to track strict aliasing issue.
-Wno-parentheses
@ -33,6 +36,7 @@ set(CommonFlags
-Wno-unknown-pragmas
-DWX_PRECOMP
)
endif()
if(GCC_VERSION VERSION_EQUAL "8.0" OR GCC_VERSION VERSION_GREATER "8.0")
# gs is pretty bad at this
@ -1248,20 +1252,28 @@ target_link_libraries(PCSX2 PRIVATE
yaml-cpp
chdr-static
wxWidgets::all
GTK::gtk
HarfBuzz::HarfBuzz
ZLIB::ZLIB
PkgConfig::SOUNDTOUCH
PCAP::PCAP
PkgConfig::SAMPLERATE
LibXml2::LibXml2
OpenGL::GL
PNG::PNG
Freetype::Freetype
LibLZMA::LibLZMA
${LIBC_LIBRARIES}
)
if(WIN32)
target_link_libraries(PCSX2 PRIVATE
)
else()
target_link_libraries(PCSX2 PRIVATE
GTK::gtk
HarfBuzz::HarfBuzz
OpenGL::GL
PCAP::PCAP
LibXml2::LibXml2
)
endif()
### Generate the resources files
file(MAKE_DIRECTORY ${res_bin})