Skip to content

Commit bae211a

Browse files
committed
cmake: use PIE option specific to game building
1 parent d7cc979 commit bae211a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ endif()
515515
include(DaemonNacl)
516516
if (NACL)
517517
add_library(srclibs-nacl-module EXCLUDE_FROM_ALL ${NACLLIST_MODULE})
518-
set_target_properties(srclibs-nacl-module PROPERTIES POSITION_INDEPENDENT_CODE 1 FOLDER "libs")
518+
set_target_properties(srclibs-nacl-module PROPERTIES POSITION_INDEPENDENT_CODE ${GAME_PIE} FOLDER "libs")
519519
set(LIBS_BASE ${LIBS_BASE} srclibs-nacl-module)
520520
else()
521521
add_library(srclibs-nacl-native EXCLUDE_FROM_ALL ${NACLLIST_NATIVE})
@@ -643,7 +643,7 @@ if (BUILD_CLIENT OR BUILD_TTY_CLIENT OR BUILD_SERVER OR BUILD_DUMMY_APP OR NACL)
643643
find_package(ZLIB REQUIRED)
644644
else()
645645
add_library(srclibs-zlib EXCLUDE_FROM_ALL ${ZLIBLIST})
646-
set_target_properties(srclibs-zlib PROPERTIES POSITION_INDEPENDENT_CODE 1 FOLDER "libs")
646+
set_target_properties(srclibs-zlib PROPERTIES POSITION_INDEPENDENT_CODE ${GAME_PIE} FOLDER "libs")
647647
set(ZLIB_INCLUDE_DIRS ${LIB_DIR}/zlib)
648648
set(ZLIB_LIBRARIES srclibs-zlib)
649649
endif()

cmake/DaemonPlatform.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,17 @@ else()
4040
message( FATAL_ERROR "Platform not supported" )
4141
endif()
4242

43+
if (USE_NACL_SAIGO)
44+
# Saigo clang reports weird errors when building some cgame and sgame arm nexe with PIE.
45+
# Saigo clang crashes when building amd64 cgame with PIE, sgame builds properly though.
46+
if (NACL_TARGET STREQUAL "armhf" OR NACL_TARGET STREQUAL "amd64")
47+
set(GAME_PIE 0)
48+
else()
49+
set(GAME_PIE 1)
50+
endif()
51+
else()
52+
set(GAME_PIE 1)
53+
endif()
54+
55+
4356
include(DaemonArchitecture)

0 commit comments

Comments
 (0)