force PIE usage on linux

This commit is contained in:
Random06457 2024-08-28 16:39:16 +09:00
parent e4254ebdaa
commit ccd9b5deb4
1 changed files with 13 additions and 3 deletions

View File

@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.16.3)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD_REQUIRED True)
# Forcing PIE makes sure that the base address is high enough so that it doesn't clash with the PS4 memory.
if (UNIX)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
endif()
if(APPLE) if(APPLE)
enable_language(OBJC) enable_language(OBJC)
set(CMAKE_OSX_DEPLOYMENT_TARGET 11) set(CMAKE_OSX_DEPLOYMENT_TARGET 11)
@ -629,6 +634,11 @@ endif()
create_target_directory_groups(shadps4) create_target_directory_groups(shadps4)
# Forcing PIE makes sure that the base address is high enough so that it doesn't clash with the PS4 memory.
if (UNIX)
target_link_options(shadps4 PRIVATE -pie)
endif()
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg) target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::SPIRV glslang::glslang SDL3::SDL3) target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::SPIRV glslang::glslang SDL3::SDL3)