2010-11-17 05:49:11 +00:00
|
|
|
# Check that people use the good file
|
|
|
|
if(NOT TOP_CMAKE_WAS_SOURCED)
|
2021-07-04 05:24:21 +00:00
|
|
|
message(FATAL_ERROR "
|
|
|
|
You did not 'cmake' the good CMakeLists.txt file. Use the one in the top dir.
|
|
|
|
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
|
2010-11-17 05:49:11 +00:00
|
|
|
endif(NOT TOP_CMAKE_WAS_SOURCED)
|
|
|
|
|
2021-09-02 16:36:36 +00:00
|
|
|
add_library(common)
|
2021-07-18 06:45:18 +00:00
|
|
|
|
2021-09-02 16:36:36 +00:00
|
|
|
# x86emitter sources
|
|
|
|
target_sources(common PRIVATE
|
2021-09-03 10:43:33 +00:00
|
|
|
AlignedMalloc.cpp
|
2015-11-17 17:30:20 +00:00
|
|
|
VirtualMemory.cpp
|
2021-09-02 16:36:36 +00:00
|
|
|
EventSource.inl
|
|
|
|
SafeArray.inl
|
2010-11-17 05:49:11 +00:00
|
|
|
Console.cpp
|
2022-04-23 05:24:06 +00:00
|
|
|
CrashHandler.cpp
|
2010-11-17 05:49:11 +00:00
|
|
|
EventSource.cpp
|
|
|
|
Exceptions.cpp
|
2021-09-21 10:05:20 +00:00
|
|
|
FastJmp.cpp
|
2021-09-21 09:52:13 +00:00
|
|
|
FileSystem.cpp
|
2022-08-22 13:20:15 +00:00
|
|
|
Image.cpp
|
2022-04-18 10:07:08 +00:00
|
|
|
HTTPDownloader.cpp
|
2022-08-22 13:21:39 +00:00
|
|
|
MemorySettingsInterface.cpp
|
2021-03-28 07:50:18 +00:00
|
|
|
Misc.cpp
|
2021-10-21 06:57:10 +00:00
|
|
|
MD5Digest.cpp
|
2010-11-17 05:49:11 +00:00
|
|
|
PrecompiledHeader.cpp
|
2015-12-06 11:57:54 +00:00
|
|
|
Perf.cpp
|
2021-09-14 09:09:09 +00:00
|
|
|
ProgressCallback.cpp
|
2022-09-18 01:37:49 +00:00
|
|
|
ReadbackSpinManager.cpp
|
2021-09-02 16:36:36 +00:00
|
|
|
Semaphore.cpp
|
2021-09-22 07:39:01 +00:00
|
|
|
SettingsWrapper.cpp
|
2021-09-14 09:09:09 +00:00
|
|
|
StringUtil.cpp
|
2021-09-14 09:09:09 +00:00
|
|
|
Timer.cpp
|
2022-04-18 10:07:08 +00:00
|
|
|
ThreadPool.cpp
|
2021-07-18 03:11:33 +00:00
|
|
|
WindowInfo.cpp
|
2022-10-12 07:24:20 +00:00
|
|
|
emitter/avx.cpp
|
2021-09-02 16:36:36 +00:00
|
|
|
emitter/bmi.cpp
|
|
|
|
emitter/cpudetect.cpp
|
|
|
|
emitter/fpu.cpp
|
|
|
|
emitter/groups.cpp
|
|
|
|
emitter/jmp.cpp
|
|
|
|
emitter/legacy.cpp
|
|
|
|
emitter/legacy_sse.cpp
|
|
|
|
emitter/movs.cpp
|
|
|
|
emitter/simd.cpp
|
2021-09-03 10:43:33 +00:00
|
|
|
emitter/LnxCpuDetect.cpp
|
2021-09-02 16:36:36 +00:00
|
|
|
emitter/WinCpuDetect.cpp
|
|
|
|
emitter/x86emitter.cpp
|
2021-09-03 10:43:33 +00:00
|
|
|
Darwin/DarwinThreads.cpp
|
|
|
|
Darwin/DarwinMisc.cpp
|
|
|
|
Darwin/DarwinSemaphore.cpp
|
|
|
|
Linux/LnxHostSys.cpp
|
|
|
|
Linux/LnxThreads.cpp
|
|
|
|
Linux/LnxMisc.cpp
|
2021-09-02 16:36:36 +00:00
|
|
|
Windows/WinThreads.cpp
|
|
|
|
Windows/WinHostSys.cpp
|
2021-11-06 06:53:01 +00:00
|
|
|
Windows/WinMisc.cpp
|
|
|
|
)
|
2010-11-17 05:49:11 +00:00
|
|
|
|
2021-09-02 16:36:36 +00:00
|
|
|
# x86emitter headers
|
|
|
|
target_sources(common PRIVATE
|
2021-10-16 00:42:31 +00:00
|
|
|
Align.h
|
2021-11-14 01:21:17 +00:00
|
|
|
AlignedMalloc.h
|
2021-09-02 16:36:36 +00:00
|
|
|
Assertions.h
|
|
|
|
boost_spsc_queue.hpp
|
|
|
|
Console.h
|
2022-04-23 05:24:06 +00:00
|
|
|
CrashHandler.h
|
2022-08-22 13:20:15 +00:00
|
|
|
Easing.h
|
2022-01-28 04:46:22 +00:00
|
|
|
EnumOps.h
|
2021-09-02 16:36:36 +00:00
|
|
|
EventSource.h
|
|
|
|
Exceptions.h
|
2021-09-21 10:05:20 +00:00
|
|
|
FastJmp.h
|
2021-09-21 09:52:13 +00:00
|
|
|
FileSystem.h
|
2021-09-02 16:36:36 +00:00
|
|
|
General.h
|
2021-12-20 13:48:13 +00:00
|
|
|
HashCombine.h
|
2022-08-22 13:21:39 +00:00
|
|
|
HeterogeneousContainers.h
|
2022-08-22 13:20:15 +00:00
|
|
|
Image.h
|
2022-07-24 06:45:33 +00:00
|
|
|
LRUCache.h
|
2022-04-18 10:07:08 +00:00
|
|
|
HTTPDownloader.h
|
2021-09-02 16:36:36 +00:00
|
|
|
MemcpyFast.h
|
2022-08-22 13:21:39 +00:00
|
|
|
MemorySettingsInterface.h
|
2021-09-02 16:36:36 +00:00
|
|
|
MemsetFast.inl
|
2021-10-21 06:57:10 +00:00
|
|
|
MD5Digest.h
|
2021-11-16 11:17:30 +00:00
|
|
|
MRCHelpers.h
|
2021-09-02 16:36:36 +00:00
|
|
|
Path.h
|
|
|
|
PageFaultSource.h
|
2015-11-17 17:30:20 +00:00
|
|
|
PrecompiledHeader.h
|
2021-09-14 09:09:09 +00:00
|
|
|
ProgressCallback.h
|
2022-09-18 01:37:49 +00:00
|
|
|
ReadbackSpinManager.h
|
2021-09-02 16:36:36 +00:00
|
|
|
RedtapeWindows.h
|
|
|
|
SafeArray.h
|
2021-10-15 23:57:50 +00:00
|
|
|
ScopedGuard.h
|
2021-09-22 07:39:01 +00:00
|
|
|
SettingsInterface.h
|
|
|
|
SettingsWrapper.h
|
2021-09-14 09:09:09 +00:00
|
|
|
StringUtil.h
|
2021-09-14 09:09:09 +00:00
|
|
|
Timer.h
|
2021-09-02 16:36:36 +00:00
|
|
|
Threading.h
|
2022-04-18 10:07:08 +00:00
|
|
|
ThreadPool.h
|
2021-09-02 16:36:36 +00:00
|
|
|
TraceLog.h
|
2021-07-18 03:11:33 +00:00
|
|
|
WindowInfo.h
|
2021-09-02 16:36:36 +00:00
|
|
|
emitter/cpudetect_internal.h
|
|
|
|
emitter/implement/dwshift.h
|
|
|
|
emitter/implement/group1.h
|
|
|
|
emitter/implement/group2.h
|
|
|
|
emitter/implement/group3.h
|
|
|
|
emitter/implement/helpers.h
|
|
|
|
emitter/implement/incdec.h
|
|
|
|
emitter/implement/jmpcall.h
|
|
|
|
emitter/implement/movs.h
|
|
|
|
emitter/implement/simd_arithmetic.h
|
|
|
|
emitter/implement/simd_comparisons.h
|
|
|
|
emitter/implement/simd_helpers.h
|
|
|
|
emitter/implement/simd_moremovs.h
|
|
|
|
emitter/implement/simd_shufflepack.h
|
|
|
|
emitter/implement/simd_templated_helpers.h
|
|
|
|
emitter/implement/test.h
|
|
|
|
emitter/implement/xchg.h
|
|
|
|
emitter/instructions.h
|
|
|
|
emitter/internal.h
|
|
|
|
emitter/legacy_instructions.h
|
|
|
|
emitter/legacy_internal.h
|
|
|
|
emitter/legacy_types.h
|
|
|
|
emitter/tools.h
|
|
|
|
emitter/x86emitter.h
|
|
|
|
emitter/x86types.h
|
2021-11-06 06:53:01 +00:00
|
|
|
)
|
|
|
|
|
2022-04-03 04:49:49 +00:00
|
|
|
if(USE_OPENGL)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
GL/Context.cpp
|
|
|
|
GL/Program.cpp
|
|
|
|
GL/ShaderCache.cpp
|
|
|
|
GL/StreamBuffer.cpp
|
|
|
|
)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
GL/Context.h
|
|
|
|
GL/Program.h
|
|
|
|
GL/ShaderCache.h
|
|
|
|
GL/StreamBuffer.h
|
|
|
|
)
|
|
|
|
target_link_libraries(common PUBLIC glad)
|
|
|
|
endif()
|
|
|
|
|
2021-11-06 06:53:01 +00:00
|
|
|
if(USE_VULKAN)
|
|
|
|
target_link_libraries(common PUBLIC
|
|
|
|
Vulkan-Headers glslang
|
|
|
|
)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
Vulkan/ShaderCache.cpp
|
|
|
|
Vulkan/Texture.cpp
|
|
|
|
Vulkan/Loader.cpp
|
|
|
|
Vulkan/ShaderCompiler.cpp
|
|
|
|
Vulkan/Util.cpp
|
|
|
|
Vulkan/SwapChain.cpp
|
|
|
|
Vulkan/StreamBuffer.cpp
|
|
|
|
Vulkan/Context.cpp
|
|
|
|
Vulkan/Builders.cpp
|
|
|
|
Vulkan/vk_mem_alloc.cpp
|
|
|
|
Vulkan/Context.h
|
|
|
|
Vulkan/Texture.h
|
|
|
|
Vulkan/ShaderCompiler.h
|
|
|
|
Vulkan/SwapChain.h
|
|
|
|
Vulkan/Builders.h
|
|
|
|
Vulkan/StreamBuffer.h
|
|
|
|
Vulkan/ShaderCache.h
|
|
|
|
Vulkan/EntryPoints.h
|
|
|
|
Vulkan/Loader.h
|
|
|
|
Vulkan/Util.h
|
2017-02-16 18:50:33 +00:00
|
|
|
)
|
2021-11-06 06:53:01 +00:00
|
|
|
endif()
|
2010-11-17 05:49:11 +00:00
|
|
|
|
2021-08-21 21:36:01 +00:00
|
|
|
if(USE_VTUNE)
|
2021-09-02 16:36:36 +00:00
|
|
|
target_link_libraries(common PUBLIC Vtune::Vtune)
|
2021-08-21 21:36:01 +00:00
|
|
|
endif()
|
|
|
|
|
2021-09-02 16:36:36 +00:00
|
|
|
if(WIN32)
|
2021-09-21 10:05:20 +00:00
|
|
|
enable_language(ASM_MASM)
|
|
|
|
target_sources(common PRIVATE FastJmp.asm)
|
2022-05-09 10:34:26 +00:00
|
|
|
target_link_libraries(common PUBLIC WIL::WIL D3D12MemAlloc Winmm.lib)
|
2021-07-08 13:35:21 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-04-18 14:58:13 +00:00
|
|
|
CrashHandler.cpp
|
|
|
|
CrashHandler.h
|
2021-07-08 13:35:21 +00:00
|
|
|
FastJmp.asm
|
2022-04-18 10:07:08 +00:00
|
|
|
HTTPDownloaderWinHTTP.cpp
|
|
|
|
HTTPDownloaderWinHTTP.h
|
2022-04-18 14:58:13 +00:00
|
|
|
StackWalker.cpp
|
|
|
|
StackWalker.h
|
2022-01-09 08:23:27 +00:00
|
|
|
D3D11/ShaderCache.cpp
|
|
|
|
D3D11/ShaderCache.h
|
|
|
|
D3D11/ShaderCompiler.cpp
|
|
|
|
D3D11/ShaderCompiler.h
|
2022-03-19 12:17:18 +00:00
|
|
|
D3D12/Builders.cpp
|
|
|
|
D3D12/Builders.h
|
|
|
|
D3D12/Context.cpp
|
|
|
|
D3D12/Context.h
|
|
|
|
D3D12/DescriptorHeapManager.cpp
|
|
|
|
D3D12/DescriptorHeapManager.h
|
|
|
|
D3D12/ShaderCache.cpp
|
|
|
|
D3D12/ShaderCache.h
|
|
|
|
D3D12/StreamBuffer.cpp
|
|
|
|
D3D12/StreamBuffer.h
|
|
|
|
D3D12/Texture.cpp
|
|
|
|
D3D12/Texture.h
|
|
|
|
D3D12/Util.cpp
|
|
|
|
D3D12/Util.h
|
2021-07-08 13:35:21 +00:00
|
|
|
)
|
2022-04-03 04:49:49 +00:00
|
|
|
endif()
|
|
|
|
|
2022-05-25 21:43:11 +00:00
|
|
|
if(APPLE)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
CocoaTools.mm
|
|
|
|
CocoaTools.h
|
|
|
|
)
|
|
|
|
target_compile_options(common PRIVATE -fobjc-arc)
|
|
|
|
target_link_options(common PRIVATE -fobjc-link-runtime)
|
|
|
|
endif()
|
|
|
|
|
2022-04-03 04:49:49 +00:00
|
|
|
if(USE_OPENGL)
|
|
|
|
if(WIN32)
|
2021-07-08 13:35:21 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-04-03 04:49:49 +00:00
|
|
|
GL/ContextWGL.cpp
|
|
|
|
GL/ContextWGL.h
|
2021-07-08 13:35:21 +00:00
|
|
|
)
|
2022-04-03 04:49:49 +00:00
|
|
|
target_link_libraries(common PUBLIC opengl32.lib)
|
|
|
|
elseif(APPLE)
|
2021-07-08 13:35:21 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-04-03 04:49:49 +00:00
|
|
|
GL/ContextAGL.mm
|
|
|
|
GL/ContextAGL.h
|
2021-07-08 13:35:21 +00:00
|
|
|
)
|
2022-04-03 04:49:49 +00:00
|
|
|
else()
|
|
|
|
if(X11_API OR WAYLAND_API)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
GL/ContextEGL.cpp
|
|
|
|
GL/ContextEGL.h
|
|
|
|
)
|
|
|
|
target_link_libraries(common PRIVATE PkgConfig::EGL)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(X11_API)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
GL/ContextEGLX11.cpp
|
|
|
|
GL/ContextEGLX11.h
|
|
|
|
)
|
|
|
|
if(TARGET PkgConfig::XRANDR)
|
|
|
|
target_link_libraries(common PRIVATE PkgConfig::XRANDR)
|
|
|
|
target_compile_definitions(common PRIVATE "HAS_XRANDR=1")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WAYLAND_API)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
GL/ContextEGLWayland.cpp
|
|
|
|
GL/ContextEGLWayland.h
|
|
|
|
)
|
2021-07-08 13:35:21 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2022-04-03 04:49:49 +00:00
|
|
|
endif()
|
2021-07-08 13:35:21 +00:00
|
|
|
|
2022-04-03 04:49:49 +00:00
|
|
|
if(USE_VULKAN)
|
|
|
|
if(APPLE)
|
|
|
|
# Needed for Metal surface creation.
|
|
|
|
target_compile_options(common PRIVATE -fobjc-arc)
|
|
|
|
target_link_options(common PRIVATE -fobjc-link-runtime)
|
|
|
|
elseif(NOT WIN32)
|
|
|
|
if(X11_API)
|
|
|
|
target_compile_definitions(common PUBLIC "VULKAN_USE_X11=1")
|
|
|
|
endif()
|
|
|
|
if(WAYLAND_API)
|
|
|
|
target_compile_definitions(common PUBLIC "VULKAN_USE_WAYLAND=1")
|
|
|
|
endif()
|
2021-07-08 13:35:21 +00:00
|
|
|
endif()
|
2021-09-02 16:36:36 +00:00
|
|
|
endif()
|
|
|
|
|
2021-10-24 20:11:38 +00:00
|
|
|
if (USE_GCC AND CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
|
|
|
# GCC LTO doesn't work with asm statements
|
|
|
|
set_source_files_properties(FastJmp.cpp PROPERTIES COMPILE_FLAGS -fno-lto)
|
|
|
|
endif()
|
|
|
|
|
2022-04-18 10:07:08 +00:00
|
|
|
if(NOT WIN32 AND (QT_BUILD OR NOGUI_BUILD))
|
|
|
|
# libcurl-based HTTPDownloader
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
HTTPDownloaderCurl.cpp
|
|
|
|
HTTPDownloaderCurl.h
|
|
|
|
)
|
|
|
|
target_link_libraries(common PRIVATE CURL::libcurl)
|
|
|
|
endif()
|
|
|
|
|
2022-05-18 13:27:23 +00:00
|
|
|
target_link_libraries(common PRIVATE
|
|
|
|
${LIBC_LIBRARIES}
|
2022-08-22 13:20:15 +00:00
|
|
|
PNG::PNG
|
|
|
|
jpgd
|
2022-05-18 13:27:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(common PUBLIC
|
|
|
|
fmt::fmt
|
2022-09-25 06:23:14 +00:00
|
|
|
fast_float
|
2022-05-18 13:27:23 +00:00
|
|
|
)
|
|
|
|
|
2022-05-25 21:43:11 +00:00
|
|
|
fixup_file_properties(common)
|
2021-09-02 16:36:36 +00:00
|
|
|
target_compile_features(common PUBLIC cxx_std_17)
|
|
|
|
target_include_directories(common PUBLIC ../3rdparty/include ../)
|
|
|
|
target_compile_definitions(common PUBLIC "${PCSX2_DEFS}")
|
|
|
|
target_compile_options(common PRIVATE "${PCSX2_WARNINGS}")
|
|
|
|
|
2021-07-18 06:45:18 +00:00
|
|
|
if(COMMAND target_precompile_headers)
|
2021-09-02 16:36:36 +00:00
|
|
|
target_precompile_headers(common PRIVATE PrecompiledHeader.h)
|
2021-07-18 06:45:18 +00:00
|
|
|
endif()
|