Skip to content

Commit e5f36db

Browse files
committed
cmake: use PIE option specific to game building
1 parent 8553be9 commit e5f36db

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ endif()
546546
include(DaemonNacl)
547547
if (NACL)
548548
add_library(srclibs-nacl-module EXCLUDE_FROM_ALL ${NACLLIST_MODULE})
549-
set_target_properties(srclibs-nacl-module PROPERTIES POSITION_INDEPENDENT_CODE 1 FOLDER "libs")
549+
set_target_properties(srclibs-nacl-module PROPERTIES POSITION_INDEPENDENT_CODE ${GAME_PIE} FOLDER "libs")
550550
set(LIBS_BASE ${LIBS_BASE} srclibs-nacl-module)
551551
else()
552552
add_library(srclibs-nacl-native EXCLUDE_FROM_ALL ${NACLLIST_NATIVE})
@@ -620,7 +620,7 @@ if (BUILD_CLIENT OR BUILD_TTY_CLIENT OR BUILD_SERVER OR BUILD_DUMMY_APP OR NACL)
620620
find_package(ZLIB REQUIRED)
621621
else()
622622
add_library(srclibs-zlib EXCLUDE_FROM_ALL ${ZLIBLIST})
623-
set_target_properties(srclibs-zlib PROPERTIES POSITION_INDEPENDENT_CODE 1 FOLDER "libs")
623+
set_target_properties(srclibs-zlib PROPERTIES POSITION_INDEPENDENT_CODE ${GAME_PIE} FOLDER "libs")
624624
set(ZLIB_INCLUDE_DIRS ${LIB_DIR}/zlib)
625625
set(ZLIB_LIBRARIES srclibs-zlib)
626626
endif()

cmake/DaemonGame.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ include(DaemonFlags)
3131

3232
# Function to setup all the Sgame/Cgame libraries
3333
include(CMakeParseArguments)
34+
3435
function(GAMEMODULE)
3536
# ParseArguments setup
3637
set(oneValueArgs NAME)

cmake/DaemonPlatform.cmake

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

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

cmake/toolchain-saigo.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
4141
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
4242

4343
set(NACL ON)
44+
4445
add_definitions(-DUSE_NACL_SAIGO)
4546

4647
set(CMAKE_C_FLAGS "")

0 commit comments

Comments
 (0)