2019-11-03 14:39:25 +00:00
|
|
|
add_library(common
|
2020-01-10 03:31:12 +00:00
|
|
|
align.h
|
|
|
|
assert.cpp
|
|
|
|
assert.h
|
2019-11-03 14:39:25 +00:00
|
|
|
bitfield.h
|
2020-04-26 07:21:33 +00:00
|
|
|
bitutils.h
|
2022-08-10 03:05:52 +00:00
|
|
|
build_timestamp.h
|
2020-01-10 03:31:12 +00:00
|
|
|
byte_stream.cpp
|
|
|
|
byte_stream.h
|
2021-01-31 06:09:36 +00:00
|
|
|
crash_handler.cpp
|
|
|
|
crash_handler.h
|
2020-06-17 12:46:13 +00:00
|
|
|
dimensional_array.h
|
2021-03-18 15:51:39 +00:00
|
|
|
error.cpp
|
|
|
|
error.h
|
2020-01-10 03:31:12 +00:00
|
|
|
fifo_queue.h
|
|
|
|
file_system.cpp
|
|
|
|
file_system.h
|
2020-06-30 14:34:22 +00:00
|
|
|
image.cpp
|
|
|
|
image.h
|
2020-01-24 04:52:00 +00:00
|
|
|
hash_combine.h
|
2020-01-10 03:31:12 +00:00
|
|
|
heap_array.h
|
2022-07-09 04:17:57 +00:00
|
|
|
heterogeneous_containers.h
|
2022-07-08 14:14:48 +00:00
|
|
|
layered_settings_interface.cpp
|
|
|
|
layered_settings_interface.h
|
2020-01-10 03:31:12 +00:00
|
|
|
log.cpp
|
|
|
|
log.h
|
2020-08-23 04:42:53 +00:00
|
|
|
make_array.h
|
2020-01-10 03:31:12 +00:00
|
|
|
md5_digest.cpp
|
|
|
|
md5_digest.h
|
2022-07-09 04:17:57 +00:00
|
|
|
memory_settings_interface.cpp
|
|
|
|
memory_settings_interface.h
|
2020-08-06 09:33:02 +00:00
|
|
|
minizip_helpers.cpp
|
|
|
|
minizip_helpers.h
|
2022-07-08 11:57:06 +00:00
|
|
|
path.h
|
2021-04-04 03:01:05 +00:00
|
|
|
platform.h
|
2020-03-12 03:54:27 +00:00
|
|
|
progress_callback.cpp
|
|
|
|
progress_callback.h
|
2021-03-12 07:24:12 +00:00
|
|
|
rectangle.h
|
2022-07-26 08:37:16 +00:00
|
|
|
scoped_guard.h
|
2022-07-08 14:14:48 +00:00
|
|
|
settings_interface.h
|
2020-01-10 03:31:12 +00:00
|
|
|
string.cpp
|
|
|
|
string.h
|
|
|
|
string_util.cpp
|
|
|
|
string_util.h
|
2021-02-28 09:01:16 +00:00
|
|
|
thirdparty/thread_pool.cpp
|
|
|
|
thirdparty/thread_pool.h
|
2022-07-11 09:45:31 +00:00
|
|
|
threading.cpp
|
|
|
|
threading.h
|
2020-01-10 03:31:12 +00:00
|
|
|
timer.cpp
|
|
|
|
timer.h
|
2019-11-05 09:19:20 +00:00
|
|
|
types.h
|
2021-04-02 14:55:09 +00:00
|
|
|
window_info.cpp
|
|
|
|
window_info.h
|
2019-09-09 07:01:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
|
|
|
target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
2022-07-24 15:06:24 +00:00
|
|
|
target_link_libraries(common PUBLIC fmt Threads::Threads vulkan-headers)
|
2022-07-30 15:06:40 +00:00
|
|
|
target_link_libraries(common PRIVATE stb libchdr zlib minizip "${CMAKE_DL_LIBS}")
|
2019-11-03 14:39:25 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_sources(common PRIVATE
|
2021-07-10 11:37:08 +00:00
|
|
|
d3d12/context.cpp
|
|
|
|
d3d12/context.h
|
|
|
|
d3d12/descriptor_heap_manager.cpp
|
|
|
|
d3d12/descriptor_heap_manager.h
|
|
|
|
d3d12/shader_cache.cpp
|
|
|
|
d3d12/shader_cache.h
|
|
|
|
d3d12/staging_texture.cpp
|
|
|
|
d3d12/staging_texture.h
|
|
|
|
d3d12/stream_buffer.cpp
|
|
|
|
d3d12/stream_buffer.h
|
|
|
|
d3d12/texture.cpp
|
|
|
|
d3d12/texture.h
|
|
|
|
d3d12/util.cpp
|
|
|
|
d3d12/util.h
|
2020-01-24 04:52:00 +00:00
|
|
|
d3d11/shader_cache.cpp
|
|
|
|
d3d11/shader_cache.h
|
2019-11-03 14:39:25 +00:00
|
|
|
d3d11/shader_compiler.cpp
|
|
|
|
d3d11/shader_compiler.h
|
|
|
|
d3d11/staging_texture.cpp
|
|
|
|
d3d11/staging_texture.h
|
|
|
|
d3d11/stream_buffer.cpp
|
|
|
|
d3d11/stream_buffer.h
|
|
|
|
d3d11/texture.cpp
|
|
|
|
d3d11/texture.h
|
2022-03-26 12:55:01 +00:00
|
|
|
thirdparty/StackWalker.cpp
|
|
|
|
thirdparty/StackWalker.h
|
|
|
|
win32_progress_callback.cpp
|
|
|
|
win32_progress_callback.h
|
2020-01-10 03:31:12 +00:00
|
|
|
windows_headers.h
|
2019-11-03 14:39:25 +00:00
|
|
|
)
|
|
|
|
target_link_libraries(common PRIVATE d3dcompiler.lib)
|
|
|
|
endif()
|
2020-01-10 03:31:12 +00:00
|
|
|
|
|
|
|
if(ANDROID)
|
|
|
|
target_link_libraries(common PRIVATE log)
|
|
|
|
endif()
|
2020-05-07 12:48:13 +00:00
|
|
|
|
|
|
|
if(USE_X11)
|
|
|
|
target_sources(common PRIVATE
|
2022-07-30 15:06:40 +00:00
|
|
|
gl/x11_window.cpp
|
|
|
|
gl/x11_window.h
|
2020-05-07 12:48:13 +00:00
|
|
|
)
|
|
|
|
target_compile_definitions(common PRIVATE "-DUSE_X11=1")
|
2021-04-02 14:55:09 +00:00
|
|
|
target_include_directories(common PRIVATE "${X11_INCLUDE_DIR}" "${X11_Xrandr_INCLUDE_PATH}")
|
|
|
|
target_link_libraries(common PRIVATE "${X11_LIBRARIES}" "${X11_Xrandr_LIB}")
|
2020-05-07 12:48:13 +00:00
|
|
|
endif()
|
|
|
|
|
2022-07-30 15:06:40 +00:00
|
|
|
if(USE_WAYLAND)
|
|
|
|
target_compile_definitions(common PRIVATE "-DUSE_WAYLAND=1")
|
|
|
|
endif()
|
|
|
|
|
2021-01-30 16:25:05 +00:00
|
|
|
if(USE_DRMKMS)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
drm_display.cpp
|
|
|
|
drm_display.h
|
|
|
|
)
|
|
|
|
target_link_libraries(common PUBLIC Libdrm::Libdrm)
|
|
|
|
endif()
|
|
|
|
|
2022-07-30 15:06:40 +00:00
|
|
|
if(ENABLE_OPENGL)
|
2020-05-07 12:48:13 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-07-30 15:06:40 +00:00
|
|
|
gl/context.cpp
|
|
|
|
gl/context.h
|
|
|
|
gl/program.cpp
|
|
|
|
gl/program.h
|
|
|
|
gl/shader_cache.cpp
|
|
|
|
gl/shader_cache.h
|
|
|
|
gl/stream_buffer.cpp
|
|
|
|
gl/stream_buffer.h
|
|
|
|
gl/texture.cpp
|
|
|
|
gl/texture.h
|
2020-05-07 12:48:13 +00:00
|
|
|
)
|
2022-07-30 15:06:40 +00:00
|
|
|
target_compile_definitions(common PUBLIC "WITH_OPENGL=1")
|
|
|
|
target_link_libraries(common PRIVATE glad)
|
2020-05-07 12:48:13 +00:00
|
|
|
|
2022-07-30 15:06:40 +00:00
|
|
|
if(WIN32)
|
2020-05-07 12:48:13 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-07-30 15:06:40 +00:00
|
|
|
gl/context_wgl.cpp
|
|
|
|
gl/context_wgl.h
|
2020-05-07 12:48:13 +00:00
|
|
|
)
|
2022-07-30 15:06:40 +00:00
|
|
|
endif()
|
2021-01-31 15:45:30 +00:00
|
|
|
|
2022-07-30 15:06:40 +00:00
|
|
|
if(USE_EGL)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
gl/context_egl.cpp
|
|
|
|
gl/context_egl.h
|
|
|
|
)
|
|
|
|
target_compile_definitions(common PRIVATE "-DUSE_EGL=1")
|
|
|
|
|
|
|
|
if(USE_X11)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
gl/context_egl_x11.cpp
|
|
|
|
gl/context_egl_x11.h
|
|
|
|
)
|
|
|
|
|
|
|
|
# We set EGL_NO_X11 because otherwise X comes in with its macros and breaks
|
|
|
|
# a bunch of files from compiling, if we include the EGL headers. This just
|
|
|
|
# makes the data types opaque, we can still use it with X11 if needed.
|
|
|
|
target_compile_definitions(common PRIVATE "-DEGL_NO_X11=1")
|
|
|
|
endif()
|
|
|
|
if(ANDROID AND USE_EGL)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
gl/context_egl_android.cpp
|
|
|
|
gl/context_egl_android.h
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(USE_DRMKMS)
|
|
|
|
target_compile_definitions(common PRIVATE "-DUSE_GBM=1")
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
gl/context_egl_gbm.cpp
|
|
|
|
gl/context_egl_gbm.h
|
|
|
|
)
|
|
|
|
target_link_libraries(common PUBLIC GBM::GBM)
|
|
|
|
endif()
|
|
|
|
if(USE_FBDEV)
|
|
|
|
target_compile_definitions(common PRIVATE "-DUSE_FBDEV=1")
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
gl/context_egl_fbdev.cpp
|
|
|
|
gl/context_egl_fbdev.h
|
|
|
|
)
|
|
|
|
endif()
|
2020-05-07 12:48:13 +00:00
|
|
|
endif()
|
2022-07-30 15:06:40 +00:00
|
|
|
|
|
|
|
if(USE_X11)
|
2020-05-07 12:48:13 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-07-30 15:06:40 +00:00
|
|
|
gl/context_glx.cpp
|
|
|
|
gl/context_glx.h
|
2020-05-07 12:48:13 +00:00
|
|
|
)
|
2022-07-30 15:06:40 +00:00
|
|
|
target_compile_definitions(common PRIVATE "-DUSE_GLX=1")
|
2020-05-07 12:48:13 +00:00
|
|
|
endif()
|
2022-07-30 15:06:40 +00:00
|
|
|
|
|
|
|
if(USE_WAYLAND)
|
2021-01-30 16:25:05 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-07-30 15:06:40 +00:00
|
|
|
gl/context_egl_wayland.cpp
|
|
|
|
gl/context_egl_wayland.h
|
2021-01-30 16:25:05 +00:00
|
|
|
)
|
|
|
|
endif()
|
2022-07-30 15:06:40 +00:00
|
|
|
|
|
|
|
if(APPLE)
|
2021-02-13 16:51:26 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-07-30 15:06:40 +00:00
|
|
|
gl/context_agl.mm
|
|
|
|
gl/context_agl.h
|
2021-02-13 16:51:26 +00:00
|
|
|
)
|
|
|
|
endif()
|
2020-05-07 12:48:13 +00:00
|
|
|
endif()
|
|
|
|
|
2022-07-30 15:06:40 +00:00
|
|
|
if(ENABLE_VULKAN)
|
2020-05-07 12:48:13 +00:00
|
|
|
target_sources(common PRIVATE
|
2022-07-30 15:06:40 +00:00
|
|
|
vulkan/builders.cpp
|
|
|
|
vulkan/builders.h
|
|
|
|
vulkan/context.cpp
|
|
|
|
vulkan/context.h
|
|
|
|
vulkan/loader.h
|
|
|
|
vulkan/loader.cpp
|
|
|
|
vulkan/shader_cache.cpp
|
|
|
|
vulkan/shader_cache.h
|
|
|
|
vulkan/shader_compiler.cpp
|
|
|
|
vulkan/shader_compiler.h
|
|
|
|
vulkan/staging_buffer.cpp
|
|
|
|
vulkan/staging_buffer.h
|
|
|
|
vulkan/staging_texture.cpp
|
|
|
|
vulkan/staging_texture.h
|
|
|
|
vulkan/stream_buffer.cpp
|
|
|
|
vulkan/stream_buffer.h
|
|
|
|
vulkan/swap_chain.cpp
|
|
|
|
vulkan/swap_chain.h
|
|
|
|
vulkan/texture.cpp
|
|
|
|
vulkan/texture.h
|
|
|
|
vulkan/util.cpp
|
|
|
|
vulkan/util.h
|
2020-05-07 12:48:13 +00:00
|
|
|
)
|
2022-07-30 15:06:40 +00:00
|
|
|
target_compile_definitions(common PUBLIC "WITH_VULKAN=1")
|
|
|
|
target_link_libraries(common PRIVATE glslang)
|
2020-05-07 12:48:13 +00:00
|
|
|
|
2022-07-30 15:06:40 +00:00
|
|
|
if(APPLE)
|
|
|
|
# Needed for Vulkan Swap Chain.
|
|
|
|
target_link_libraries(common PRIVATE "objc")
|
|
|
|
endif()
|
2020-07-07 11:40:55 +00:00
|
|
|
endif()
|
|
|
|
|
2022-07-30 15:06:40 +00:00
|
|
|
|
2020-10-18 04:43:51 +00:00
|
|
|
|
2022-03-26 13:05:02 +00:00
|
|
|
if(ENABLE_CHEEVOS)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
http_downloader.cpp
|
|
|
|
http_downloader.h
|
|
|
|
)
|
|
|
|
if(WIN32)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
http_downloader_winhttp.cpp
|
|
|
|
http_downloader_winhttp.h
|
|
|
|
)
|
|
|
|
elseif(NOT ANDROID)
|
|
|
|
target_sources(common PRIVATE
|
|
|
|
http_downloader_curl.cpp
|
|
|
|
http_downloader_curl.h
|
|
|
|
)
|
|
|
|
target_link_libraries(common PRIVATE
|
|
|
|
CURL::libcurl
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-10-18 04:43:51 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
|
# We need -lrt for shm_unlink
|
|
|
|
target_link_libraries(common PRIVATE rt)
|
|
|
|
endif()
|