shadPS4/externals/CMakeLists.txt

235 lines
6.4 KiB
CMake
Raw Normal View History

# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
2024-06-27 10:46:55 +00:00
set(BUILD_SHARED_LIBS OFF)
set(BUILD_TESTING OFF)
2024-10-09 06:28:09 +00:00
set_directory_properties(PROPERTIES
EXCLUDE_FROM_ALL ON
SYSTEM ON
)
2024-06-27 10:46:55 +00:00
# Set CMP0069 policy to "NEW" in order to ensure consistent behavior when building external targets with LTO enabled
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
if (MSVC)
# Silence "deprecation" warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
endif()
# Boost
2024-06-27 10:46:55 +00:00
if (NOT TARGET Boost::headers)
2024-07-11 10:07:01 +00:00
set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/ext-boost" CACHE STRING "")
2024-06-27 10:46:55 +00:00
set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "")
add_subdirectory(ext-boost)
2024-06-27 10:46:55 +00:00
endif()
# fmtlib
2024-06-27 10:46:55 +00:00
if (NOT TARGET fmt::fmt)
add_subdirectory(fmt)
endif()
file formats and qt (#88) * added psf file format * clang format fix * crypto functions for pkg decryption * pkg decryption * initial add of qt gui , not yet usable * renamed ini for qt gui settings into shadps4qt.ini * file detection and loader support * option to build QT qui * clang format fix * fixed reuse * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.h Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * uppercase fix * clang format fix * small fixes * let's try windows qt build ci * some more fixes for ci * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update .github/workflows/windows-qt.yml Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/psf.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * loader namespace * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * constexpr magic * linux qt ci by qurious * fix for linux qt * Make script executable * ci fix? --------- Co-authored-by: raziel1000 <ckraziel@gmail.com> Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> Co-authored-by: GPUCode <geoster3d@gmail.com>
2024-02-29 22:00:35 +00:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC)
# If it is clang and MSVC we will add a static lib
# CryptoPP
2024-06-27 10:46:55 +00:00
add_subdirectory(cryptoppwin)
file formats and qt (#88) * added psf file format * clang format fix * crypto functions for pkg decryption * pkg decryption * initial add of qt gui , not yet usable * renamed ini for qt gui settings into shadps4qt.ini * file detection and loader support * option to build QT qui * clang format fix * fixed reuse * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.h Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * uppercase fix * clang format fix * small fixes * let's try windows qt build ci * some more fixes for ci * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update .github/workflows/windows-qt.yml Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/psf.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * loader namespace * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * constexpr magic * linux qt ci by qurious * fix for linux qt * Make script executable * ci fix? --------- Co-authored-by: raziel1000 <ckraziel@gmail.com> Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> Co-authored-by: GPUCode <geoster3d@gmail.com>
2024-02-29 22:00:35 +00:00
target_include_directories(cryptoppwin INTERFACE cryptoppwin/include)
else()
# CryptoPP
2024-06-27 10:46:55 +00:00
if (NOT TARGET cryptopp::cryptopp)
set(CRYPTOPP_INSTALL OFF)
set(CRYPTOPP_BUILD_TESTING OFF)
2024-12-07 17:41:41 +00:00
set(CRYPTOPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp)
2024-06-27 10:46:55 +00:00
add_subdirectory(cryptopp-cmake)
file(COPY cryptopp DESTINATION cryptopp FILES_MATCHING PATTERN "*.h")
2024-12-01 09:16:01 +00:00
# remove externals/cryptopp from include directories because it contains a conflicting zlib.h file
set_target_properties(cryptopp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/cryptopp")
2024-06-27 10:46:55 +00:00
endif()
file formats and qt (#88) * added psf file format * clang format fix * crypto functions for pkg decryption * pkg decryption * initial add of qt gui , not yet usable * renamed ini for qt gui settings into shadps4qt.ini * file detection and loader support * option to build QT qui * clang format fix * fixed reuse * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.h Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * uppercase fix * clang format fix * small fixes * let's try windows qt build ci * some more fixes for ci * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update .github/workflows/windows-qt.yml Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/psf.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * loader namespace * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * constexpr magic * linux qt ci by qurious * fix for linux qt * Make script executable * ci fix? --------- Co-authored-by: raziel1000 <ckraziel@gmail.com> Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> Co-authored-by: GPUCode <geoster3d@gmail.com>
2024-02-29 22:00:35 +00:00
endif()
if (NOT TARGET FFmpeg::ffmpeg)
2024-07-26 15:34:36 +00:00
add_subdirectory(ffmpeg-core)
add_library(FFmpeg::ffmpeg ALIAS ffmpeg)
2024-07-26 15:34:36 +00:00
endif()
# LibAtrac9
file(GLOB LIBATRAC9_SOURCES LibAtrac9/C/src/*.c)
add_library(LibAtrac9 STATIC ${LIBATRAC9_SOURCES})
target_include_directories(LibAtrac9 INTERFACE LibAtrac9/C/src)
2024-11-30 20:39:51 +00:00
# zlib
if (NOT TARGET ZLIB::ZLIB)
2024-06-27 10:46:55 +00:00
set(ZLIB_ENABLE_TESTS OFF)
set(WITH_GTEST OFF)
set(WITH_NEW_STRATEGIES ON)
set(WITH_NATIVE_INSTRUCTIONS ON)
set(ZLIB_COMPAT ON CACHE BOOL "" FORCE)
2024-11-30 20:39:51 +00:00
include(FetchContent)
FetchContent_Declare(
ZLIB
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib-ng"
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(ZLIB)
add_library(ZLIB::ZLIB ALIAS zlib)
2024-12-01 09:16:01 +00:00
# libpng expects this variable to exist after its find_package(ZLIB)
2024-12-02 03:04:44 +00:00
set(ZLIB_INCLUDE_DIRS "${FETCHCONTENT_BASE_DIR}/zlib-build")
2024-06-27 10:46:55 +00:00
endif()
# SDL3
2024-06-27 10:46:55 +00:00
if (NOT TARGET SDL3::SDL3)
set(SDL_PIPEWIRE OFF)
2024-06-27 10:46:55 +00:00
add_subdirectory(sdl3)
endif()
# vulkan-headers
2024-06-27 10:46:55 +00:00
if (NOT TARGET Vulkan::Headers)
set(VULKAN_HEADERS_ENABLE_MODULE OFF)
add_subdirectory(vulkan-headers)
endif()
# VMA
2024-06-27 10:46:55 +00:00
if (NOT TARGET GPUOpen::VulkanMemoryAllocator)
add_subdirectory(vma)
endif()
# RenderDoc
if (NOT TARGET RenderDoc::API)
add_library(renderdoc INTERFACE)
2024-10-09 06:28:09 +00:00
target_include_directories(renderdoc INTERFACE ./renderdoc)
add_library(RenderDoc::API ALIAS renderdoc)
endif()
# glslang
2024-06-27 10:46:55 +00:00
if (NOT TARGET glslang::glslang)
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "")
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "")
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "")
set(ENABLE_CTEST OFF CACHE BOOL "")
set(ENABLE_HLSL OFF CACHE BOOL "")
set(BUILD_EXTERNAL OFF CACHE BOOL "")
set(ENABLE_OPT OFF CACHE BOOL "")
add_subdirectory(glslang)
file(COPY glslang/SPIRV DESTINATION glslang/glslang FILES_MATCHING PATTERN "*.h")
target_include_directories(SPIRV INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/glslang")
endif()
# Robin-map
2024-06-27 10:46:55 +00:00
if (NOT TARGET tsl::robin_map)
add_subdirectory(robin-map)
endif()
# Xbyak
2024-06-27 10:46:55 +00:00
if (NOT TARGET xbyak::xbyak)
add_subdirectory(xbyak)
endif()
2024-05-09 20:45:09 +00:00
# MagicEnum
2024-06-27 10:46:55 +00:00
if (NOT TARGET magic_enum::magic_enum)
add_subdirectory(magic_enum)
endif()
# Toml11
2024-06-27 10:46:55 +00:00
if (NOT TARGET toml11::toml11)
add_subdirectory(toml11)
endif()
# xxHash
2024-06-27 10:46:55 +00:00
if (NOT TARGET xxHash::xxhash)
add_library(xxhash xxhash/xxhash.h xxhash/xxhash.c)
target_include_directories(xxhash PUBLIC xxhash)
add_library(xxHash::xxhash ALIAS xxhash)
endif()
# Zydis
2024-06-27 10:46:55 +00:00
if (NOT TARGET Zydis::Zydis)
option(ZYDIS_BUILD_TOOLS "" OFF)
option(ZYDIS_BUILD_EXAMPLES "" OFF)
add_subdirectory(zydis)
endif()
2024-05-09 20:45:09 +00:00
# Winpthreads
if (WIN32)
2024-06-27 10:46:55 +00:00
add_subdirectory(winpthreads)
2024-05-09 20:45:09 +00:00
target_include_directories(winpthreads INTERFACE winpthreads/include)
endif()
# sirit
2024-06-27 10:46:55 +00:00
add_subdirectory(sirit)
2024-05-22 11:18:05 +00:00
if (WIN32)
target_compile_options(sirit PUBLIC "-Wno-error=unused-command-line-argument")
endif()
2024-06-10 15:20:49 +00:00
# half
2024-10-18 04:52:57 +00:00
if (NOT TARGET half::half)
add_library(half INTERFACE)
target_include_directories(half INTERFACE half/include)
add_library(half::half ALIAS half)
endif()
# libpng
2024-11-30 20:39:51 +00:00
if (NOT TARGET PNG::PNG)
set(PNG_SHARED OFF CACHE BOOL "" FORCE)
set(PNG_STATIC ON CACHE BOOL "" FORCE)
set(PNG_TESTS OFF CACHE BOOL "" FORCE)
set(PNG_TOOLS OFF CACHE BOOL "" FORCE)
set(SKIP_INSTALL_ALL OFF CACHE BOOL "" FORCE)
add_subdirectory(libpng)
add_library(PNG::PNG ALIAS png_static)
endif()
if (APPLE)
# date
if (NOT TARGET date::date-tz)
option(BUILD_TZ_LIB "" ON)
option(USE_SYSTEM_TZ_DB "" ON)
add_subdirectory(date)
endif()
2024-07-09 09:18:34 +00:00
endif()
# Dear ImGui
add_library(Dear_ImGui
dear_imgui/imgui.cpp
dear_imgui/imgui_demo.cpp
dear_imgui/imgui_draw.cpp
dear_imgui/imgui_internal.h
dear_imgui/imgui_tables.cpp
dear_imgui/imgui_widgets.cpp
)
target_include_directories(Dear_ImGui INTERFACE dear_imgui/)
2024-06-10 15:20:49 +00:00
# Tracy
option(TRACY_ENABLE "" ON)
option(TRACY_NO_CRASH_HANDLER "" ON) # Otherwise texture cache exceptions will be treaten as a crash
option(TRACY_ON_DEMAND "" ON)
option(TRACY_NO_FRAME_IMAGE "" ON)
option(TRACY_FIBERS "" ON) # For AmdGpu frontend profiling
2024-07-20 09:30:55 +00:00
option(TRACY_NO_SYSTEM_TRACING "" ON)
option(TRACY_NO_CALLSTACK "" ON)
option(TRACY_NO_CODE_TRANSFER "" ON)
option(TRACY_NO_SAMPLING "" ON)
option(TRACY_ONLY_LOCALHOST "" ON)
option(TRACY_NO_CONTEXT_SWITCH "" ON)
2024-06-27 10:46:55 +00:00
add_subdirectory(tracy)
# pugixml
if (NOT TARGET pugixml::pugixml)
add_subdirectory(pugixml)
endif()
# Discord RPC
if (ENABLE_DISCORD_RPC)
set(BUILD_EXAMPLES OFF)
2024-12-07 17:41:41 +00:00
add_subdirectory(discord-rpc)
target_include_directories(discord-rpc INTERFACE discord-rpc/include)
endif()
# GCN Headers
2024-10-09 06:28:09 +00:00
add_subdirectory(gcn)
2024-12-05 21:10:27 +00:00
# stb
if (NOT TARGET stb::headers)
add_library(stb INTERFACE)
target_include_directories(stb INTERFACE stb)
add_library(stb::headers ALIAS stb)
endif()