Merge pull request #1 from Mixaill/pie

cmake: add proper check for PIE support at link time
This commit is contained in:
Random 2024-09-01 06:22:41 +02:00 committed by GitHub
commit 4541a74605
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,11 +6,6 @@ cmake_minimum_required(VERSION 3.16.3)
set(CMAKE_CXX_STANDARD 23)
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 AND NOT APPLE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
endif()
if(APPLE)
enable_language(OBJC)
set(CMAKE_OSX_DEPLOYMENT_TARGET 11)
@ -22,6 +17,18 @@ endif()
project(shadPS4)
# Forcing PIE makes sure that the base address is high enough so that it doesn't clash with the PS4 memory.
if(UNIX AND NOT APPLE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
# check PIE support at link time
include(CheckPIESupported)
check_pie_supported(OUTPUT_VARIABLE pie_check LANGUAGES C CXX)
if(NOT CMAKE_C_LINK_PIE_SUPPORTED OR NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
message(WARNING "PIE is not supported at link time: ${pie_check}")
endif()
endif()
option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF)
# This function should be passed a list of all files in a target. It will automatically generate file groups