2022-07-08 12:43:38 +00:00
|
|
|
add_library(util
|
|
|
|
audio_stream.cpp
|
|
|
|
audio_stream.h
|
|
|
|
cd_image.cpp
|
|
|
|
cd_image.h
|
|
|
|
cd_image_bin.cpp
|
|
|
|
cd_image_cue.cpp
|
|
|
|
cd_image_chd.cpp
|
|
|
|
cd_image_device.cpp
|
|
|
|
cd_image_ecm.cpp
|
|
|
|
cd_image_hasher.cpp
|
|
|
|
cd_image_hasher.h
|
|
|
|
cd_image_m3u.cpp
|
|
|
|
cd_image_memory.cpp
|
|
|
|
cd_image_mds.cpp
|
|
|
|
cd_image_pbp.cpp
|
|
|
|
cd_image_ppf.cpp
|
|
|
|
cd_subchannel_replacement.cpp
|
|
|
|
cd_subchannel_replacement.h
|
|
|
|
cd_xa.cpp
|
|
|
|
cd_xa.h
|
|
|
|
cue_parser.cpp
|
|
|
|
cue_parser.h
|
2023-08-13 03:42:02 +00:00
|
|
|
gpu_device.cpp
|
|
|
|
gpu_device.h
|
2023-12-04 05:47:18 +00:00
|
|
|
gpu_framebuffer_manager.h
|
2023-08-13 03:42:02 +00:00
|
|
|
gpu_shader_cache.cpp
|
|
|
|
gpu_shader_cache.h
|
|
|
|
gpu_texture.cpp
|
|
|
|
gpu_texture.h
|
2024-03-03 02:25:37 +00:00
|
|
|
gpu_types.h
|
2023-08-27 06:00:06 +00:00
|
|
|
host.cpp
|
|
|
|
host.h
|
2023-11-06 09:59:02 +00:00
|
|
|
http_downloader.cpp
|
|
|
|
http_downloader.h
|
2024-03-06 06:08:10 +00:00
|
|
|
image.cpp
|
|
|
|
image.h
|
2023-08-13 06:28:28 +00:00
|
|
|
imgui_fullscreen.cpp
|
|
|
|
imgui_fullscreen.h
|
|
|
|
imgui_manager.cpp
|
|
|
|
imgui_manager.h
|
2022-07-11 13:03:29 +00:00
|
|
|
ini_settings_interface.cpp
|
|
|
|
ini_settings_interface.h
|
2023-08-13 06:28:28 +00:00
|
|
|
input_manager.cpp
|
|
|
|
input_manager.h
|
|
|
|
input_source.cpp
|
|
|
|
input_source.h
|
2022-07-08 12:43:38 +00:00
|
|
|
iso_reader.cpp
|
|
|
|
iso_reader.h
|
|
|
|
jit_code_buffer.cpp
|
|
|
|
jit_code_buffer.h
|
|
|
|
page_fault_handler.cpp
|
|
|
|
page_fault_handler.h
|
2023-08-13 06:28:28 +00:00
|
|
|
platform_misc.h
|
2023-08-27 12:48:40 +00:00
|
|
|
postprocessing.cpp
|
|
|
|
postprocessing.h
|
2023-08-13 06:28:28 +00:00
|
|
|
postprocessing_shader.cpp
|
|
|
|
postprocessing_shader.h
|
2023-08-13 13:23:54 +00:00
|
|
|
postprocessing_shader_fx.cpp
|
|
|
|
postprocessing_shader_fx.h
|
2023-08-13 03:42:02 +00:00
|
|
|
postprocessing_shader_glsl.cpp
|
|
|
|
postprocessing_shader_glsl.h
|
2023-08-13 06:28:28 +00:00
|
|
|
shadergen.cpp
|
|
|
|
shadergen.h
|
2022-07-08 12:43:38 +00:00
|
|
|
shiftjis.cpp
|
|
|
|
shiftjis.h
|
|
|
|
state_wrapper.cpp
|
|
|
|
state_wrapper.h
|
|
|
|
wav_writer.cpp
|
|
|
|
wav_writer.h
|
2023-08-13 03:42:02 +00:00
|
|
|
window_info.cpp
|
|
|
|
window_info.h
|
2024-02-05 04:26:42 +00:00
|
|
|
zstd_byte_stream.cpp
|
2022-07-08 12:43:38 +00:00
|
|
|
)
|
|
|
|
|
2023-09-02 03:41:41 +00:00
|
|
|
target_precompile_headers(util PRIVATE "pch.h")
|
2022-07-08 12:43:38 +00:00
|
|
|
target_include_directories(util PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
|
|
|
target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
2023-08-13 06:28:28 +00:00
|
|
|
target_link_libraries(util PUBLIC common simpleini imgui)
|
2024-02-03 07:12:40 +00:00
|
|
|
target_link_libraries(util PRIVATE stb libchdr ZLIB::ZLIB soundtouch xxhash Zstd::Zstd reshadefx)
|
2023-08-13 06:28:28 +00:00
|
|
|
|
2023-09-17 02:28:11 +00:00
|
|
|
if(ENABLE_CUBEB)
|
2023-08-13 06:28:28 +00:00
|
|
|
target_sources(util PRIVATE
|
|
|
|
cubeb_audio_stream.cpp
|
|
|
|
)
|
2023-09-17 02:28:11 +00:00
|
|
|
target_compile_definitions(util PUBLIC "ENABLE_CUBEB=1")
|
2023-08-13 06:28:28 +00:00
|
|
|
target_link_libraries(util PRIVATE cubeb)
|
|
|
|
endif()
|
|
|
|
|
2023-09-17 02:28:11 +00:00
|
|
|
if(ENABLE_X11)
|
|
|
|
target_compile_definitions(util PRIVATE "-DENABLE_X11=1")
|
2023-09-16 04:39:13 +00:00
|
|
|
target_link_libraries(util PRIVATE X11::X11 X11::Xrandr)
|
2023-08-13 03:42:02 +00:00
|
|
|
endif()
|
|
|
|
|
2023-09-17 02:28:11 +00:00
|
|
|
if(ENABLE_WAYLAND)
|
|
|
|
target_compile_definitions(util PRIVATE "-DENABLE_WAYLAND=1")
|
2023-08-13 03:42:02 +00:00
|
|
|
endif()
|
|
|
|
|
2023-08-13 06:28:28 +00:00
|
|
|
if(ENABLE_OPENGL)
|
|
|
|
target_sources(util PRIVATE
|
2024-02-25 09:22:25 +00:00
|
|
|
opengl_context.cpp
|
|
|
|
opengl_context.h
|
2023-08-13 03:42:02 +00:00
|
|
|
opengl_device.cpp
|
|
|
|
opengl_device.h
|
|
|
|
opengl_loader.h
|
|
|
|
opengl_pipeline.cpp
|
|
|
|
opengl_pipeline.h
|
|
|
|
opengl_stream_buffer.cpp
|
|
|
|
opengl_stream_buffer.h
|
|
|
|
opengl_texture.cpp
|
|
|
|
opengl_texture.h
|
2023-08-13 06:28:28 +00:00
|
|
|
)
|
2023-09-17 02:28:11 +00:00
|
|
|
target_compile_definitions(util PUBLIC "ENABLE_OPENGL=1")
|
2023-08-13 06:28:28 +00:00
|
|
|
target_link_libraries(util PRIVATE glad)
|
2023-08-13 03:42:02 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_sources(util PRIVATE
|
2024-02-25 09:22:25 +00:00
|
|
|
opengl_context_wgl.cpp
|
|
|
|
opengl_context_wgl.h
|
2023-08-13 03:42:02 +00:00
|
|
|
)
|
2023-09-02 03:41:41 +00:00
|
|
|
target_link_libraries(util PRIVATE "opengl32.lib")
|
2023-08-13 03:42:02 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LINUX OR FREEBSD OR ANDROID)
|
|
|
|
target_sources(util PRIVATE
|
2024-02-25 09:22:25 +00:00
|
|
|
opengl_context_egl.cpp
|
|
|
|
opengl_context_egl.h
|
2023-08-13 03:42:02 +00:00
|
|
|
)
|
2023-09-17 02:28:11 +00:00
|
|
|
target_compile_definitions(util PRIVATE "-DENABLE_EGL=1")
|
2023-08-13 03:42:02 +00:00
|
|
|
|
2023-09-17 02:28:11 +00:00
|
|
|
if(ENABLE_X11)
|
2023-08-13 03:42:02 +00:00
|
|
|
target_sources(util PRIVATE
|
2024-02-25 09:22:25 +00:00
|
|
|
opengl_context_egl_x11.cpp
|
|
|
|
opengl_context_egl_x11.h
|
2023-08-13 03:42:02 +00:00
|
|
|
)
|
|
|
|
endif()
|
2023-09-17 02:28:11 +00:00
|
|
|
if(ENABLE_WAYLAND)
|
2023-08-13 03:42:02 +00:00
|
|
|
target_sources(util PRIVATE
|
2024-02-25 09:22:25 +00:00
|
|
|
opengl_context_egl_wayland.cpp
|
|
|
|
opengl_context_egl_wayland.h
|
2023-08-13 03:42:02 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(ANDROID)
|
2023-10-31 15:32:29 +00:00
|
|
|
target_include_directories(util PRIVATE "${CMAKE_SOURCE_DIR}/android/app/src/cpp")
|
2023-08-13 03:42:02 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
target_sources(util PRIVATE
|
2024-02-25 09:22:25 +00:00
|
|
|
opengl_context_agl.mm
|
|
|
|
opengl_context_agl.h
|
2023-08-13 03:42:02 +00:00
|
|
|
)
|
2024-02-25 09:22:25 +00:00
|
|
|
set_source_files_properties(opengl_context_agl.mm PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
|
2023-08-13 03:42:02 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_VULKAN OR APPLE)
|
|
|
|
target_sources(util PRIVATE
|
|
|
|
spirv_compiler.cpp
|
|
|
|
spirv_compiler.h
|
|
|
|
)
|
|
|
|
target_link_libraries(util PRIVATE glslang)
|
|
|
|
if(APPLE)
|
|
|
|
target_link_libraries(util PRIVATE spirv-cross)
|
|
|
|
endif()
|
2023-08-13 06:28:28 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_VULKAN)
|
|
|
|
target_sources(util PRIVATE
|
2023-08-13 03:42:02 +00:00
|
|
|
vulkan_builders.cpp
|
|
|
|
vulkan_builders.h
|
|
|
|
vulkan_device.cpp
|
|
|
|
vulkan_device.h
|
|
|
|
vulkan_entry_points.h
|
|
|
|
vulkan_entry_points.inl
|
|
|
|
vulkan_loader.cpp
|
|
|
|
vulkan_loader.h
|
|
|
|
vulkan_pipeline.cpp
|
|
|
|
vulkan_pipeline.h
|
|
|
|
vulkan_stream_buffer.cpp
|
|
|
|
vulkan_stream_buffer.h
|
|
|
|
vulkan_swap_chain.cpp
|
|
|
|
vulkan_swap_chain.h
|
|
|
|
vulkan_texture.cpp
|
|
|
|
vulkan_texture.h
|
2023-08-13 06:28:28 +00:00
|
|
|
)
|
2023-09-17 02:28:11 +00:00
|
|
|
target_compile_definitions(util PUBLIC "ENABLE_VULKAN=1")
|
2023-10-16 10:00:33 +00:00
|
|
|
target_link_libraries(util PUBLIC vulkan-headers)
|
2023-08-13 06:28:28 +00:00
|
|
|
endif()
|
|
|
|
|
2023-09-17 02:28:11 +00:00
|
|
|
if(ENABLE_SDL2)
|
2023-08-13 06:28:28 +00:00
|
|
|
target_sources(util PRIVATE
|
|
|
|
sdl_input_source.cpp
|
|
|
|
sdl_input_source.h
|
|
|
|
)
|
2023-09-17 02:28:11 +00:00
|
|
|
target_compile_definitions(util PUBLIC "ENABLE_SDL2=1")
|
2023-09-02 05:34:03 +00:00
|
|
|
target_link_libraries(util PUBLIC SDL2::SDL2)
|
2023-08-13 06:28:28 +00:00
|
|
|
|
|
|
|
# Copy bundled SDL2 to output on Windows.
|
|
|
|
if(WIN32)
|
2023-09-02 05:34:03 +00:00
|
|
|
# Copy SDL2 DLL to binary directory.
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
get_property(SDL2_DLL_PATH TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION_DEBUG)
|
|
|
|
else()
|
|
|
|
get_property(SDL2_DLL_PATH TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION_RELEASE)
|
|
|
|
endif()
|
2023-08-13 06:28:28 +00:00
|
|
|
add_custom_command(TARGET util POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SDL2.dll")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_sources(util PRIVATE
|
2023-09-02 03:41:41 +00:00
|
|
|
d3d_common.cpp
|
|
|
|
d3d_common.h
|
|
|
|
d3d11_device.cpp
|
|
|
|
d3d11_device.h
|
|
|
|
d3d11_pipeline.cpp
|
|
|
|
d3d11_pipeline.h
|
|
|
|
d3d11_stream_buffer.cpp
|
|
|
|
d3d11_stream_buffer.h
|
|
|
|
d3d11_texture.cpp
|
|
|
|
d3d11_texture.h
|
|
|
|
d3d12_builders.cpp
|
|
|
|
d3d12_builders.h
|
|
|
|
d3d12_descriptor_heap_manager.cpp
|
|
|
|
d3d12_descriptor_heap_manager.h
|
|
|
|
d3d12_device.cpp
|
|
|
|
d3d12_device.h
|
|
|
|
d3d12_pipeline.cpp
|
|
|
|
d3d12_pipeline.h
|
|
|
|
d3d12_stream_buffer.cpp
|
|
|
|
d3d12_stream_buffer.h
|
|
|
|
d3d12_texture.cpp
|
|
|
|
d3d12_texture.h
|
2023-08-13 06:28:28 +00:00
|
|
|
dinput_source.cpp
|
|
|
|
dinput_source.h
|
2023-11-06 09:59:02 +00:00
|
|
|
http_downloader_winhttp.cpp
|
|
|
|
http_downloader_winhttp.h
|
2023-08-13 06:28:28 +00:00
|
|
|
platform_misc_win32.cpp
|
|
|
|
win32_raw_input_source.cpp
|
|
|
|
win32_raw_input_source.h
|
|
|
|
xaudio2_audio_stream.cpp
|
|
|
|
xinput_source.cpp
|
|
|
|
xinput_source.h
|
|
|
|
)
|
2023-09-02 03:41:41 +00:00
|
|
|
target_link_libraries(util PRIVATE d3d12ma)
|
2023-11-06 09:59:02 +00:00
|
|
|
target_link_libraries(util PRIVATE d3d11.lib d3d12.lib d3dcompiler.lib dxgi.lib winmm.lib Dwmapi.lib winhttp.lib)
|
2023-09-02 03:41:41 +00:00
|
|
|
|
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
|
|
|
target_link_libraries(util PRIVATE WinPixEventRuntime::WinPixEventRuntime)
|
|
|
|
endif()
|
2023-08-13 06:28:28 +00:00
|
|
|
elseif(APPLE)
|
2023-09-10 06:26:58 +00:00
|
|
|
include(AddMetalSources)
|
|
|
|
|
2023-09-02 03:41:41 +00:00
|
|
|
set(MAC_SOURCES
|
2023-08-13 03:42:02 +00:00
|
|
|
metal_device.h
|
|
|
|
metal_device.mm
|
2023-09-23 12:20:50 +00:00
|
|
|
metal_layer.h
|
2023-08-13 03:42:02 +00:00
|
|
|
metal_stream_buffer.h
|
|
|
|
metal_stream_buffer.mm
|
2023-08-13 06:28:28 +00:00
|
|
|
platform_misc_mac.mm
|
|
|
|
)
|
2023-09-10 06:26:58 +00:00
|
|
|
set(METAL_SOURCES
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/metal_shaders.metal"
|
|
|
|
)
|
|
|
|
set_property(GLOBAL PROPERTY UTIL_METAL_SOURCES ${METAL_SOURCES})
|
2023-09-02 03:41:41 +00:00
|
|
|
target_sources(util PRIVATE ${MAC_SOURCES})
|
2023-08-13 03:42:02 +00:00
|
|
|
find_library(IOK_LIBRARY IOKit REQUIRED)
|
|
|
|
find_library(METAL_LIBRARY Metal)
|
|
|
|
find_library(QUARTZCORE_LIBRARY QuartzCore)
|
|
|
|
target_link_libraries(util PRIVATE ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY} ${IOK_LIBRARY})
|
2023-09-02 03:41:41 +00:00
|
|
|
set_source_files_properties(${MAC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
|
2023-08-13 06:28:28 +00:00
|
|
|
elseif(NOT ANDROID)
|
|
|
|
target_sources(util PRIVATE
|
|
|
|
platform_misc_unix.cpp
|
|
|
|
)
|
2023-09-16 04:39:13 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(DBUS REQUIRED dbus-1)
|
|
|
|
target_include_directories(util PRIVATE ${DBUS_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(util PRIVATE ${DBUS_LINK_LIBRARIES})
|
2024-02-29 14:50:31 +00:00
|
|
|
|
|
|
|
if(LINUX)
|
|
|
|
target_link_libraries(util PRIVATE UDEV::UDEV)
|
|
|
|
endif()
|
2023-08-13 06:28:28 +00:00
|
|
|
endif()
|
2023-09-10 04:14:27 +00:00
|
|
|
|
2023-11-06 09:59:02 +00:00
|
|
|
if(NOT WIN32 AND NOT ANDROID)
|
2023-11-18 04:58:42 +00:00
|
|
|
target_sources(util PRIVATE
|
2023-11-06 09:59:02 +00:00
|
|
|
http_downloader_curl.cpp
|
|
|
|
http_downloader_curl.h
|
|
|
|
)
|
2023-11-18 04:58:42 +00:00
|
|
|
target_link_libraries(util PRIVATE
|
2023-11-06 09:59:02 +00:00
|
|
|
CURL::libcurl
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2023-09-10 04:14:27 +00:00
|
|
|
function(add_util_resources target)
|
|
|
|
if(APPLE)
|
2023-09-10 06:26:58 +00:00
|
|
|
get_property(UTIL_METAL_SOURCES GLOBAL PROPERTY UTIL_METAL_SOURCES)
|
|
|
|
add_metal_sources(${target} ${UTIL_METAL_SOURCES})
|
|
|
|
|
2023-09-10 04:14:27 +00:00
|
|
|
# Copy MoltenVK into the bundle
|
|
|
|
unset(MOLTENVK_PATH CACHE)
|
|
|
|
find_file(MOLTENVK_PATH NAMES
|
|
|
|
libMoltenVK.dylib
|
|
|
|
lib/libMoltenVK.dylib
|
|
|
|
)
|
|
|
|
if (MOLTENVK_PATH)
|
|
|
|
target_sources(${target} PRIVATE "${MOLTENVK_PATH}")
|
|
|
|
set_source_files_properties("${MOLTENVK_PATH}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
|
|
|
message(STATUS "Using MoltenVK from ${MOLTENVK_PATH}")
|
|
|
|
else()
|
|
|
|
message(WARNING "MoltenVK not found in path, it will depend on the target system having it.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endfunction()
|