Skip to content

Commit

Permalink
Come up with use_gcc.
Browse files Browse the repository at this point in the history
Add new method. Fix wrong version condition for -fpie.
  • Loading branch information
marxin committed Feb 23, 2019
1 parent 4f697f7 commit 0d2a105
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ if selected_platform in platform_list:
disable_nonessential_warnings = ['-Wno-sign-compare']
shadow_local_warning = []

if 'gcc' in os.path.basename(env["CC"]):
if methods.use_gcc(env):
version = methods.get_compiler_version(env)
if version != None and version[0] >= '7':
shadow_local_warning = ['-Wshadow-local']
Expand Down
3 changes: 3 additions & 0 deletions methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,3 +667,6 @@ def get_compiler_version(env):
return match.group().split('.')
else:
return None

def use_gcc(env):
return 'gcc' in os.path.basename(env["CC"])
11 changes: 6 additions & 5 deletions platform/x11/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import platform
import sys
from compat import decode_utf8
from methods import get_compiler_version
from methods import get_compiler_version, use_gcc

def is_active():
return True
Expand Down Expand Up @@ -162,10 +162,11 @@ def configure(env):
env.Append(LINKFLAGS=['-pipe'])

# Check for gcc version >= 6 before adding -no-pie
version = get_compiler_version(env)
if version != None and version[0] > '6':
env.Append(CCFLAGS=['-fpie'])
env.Append(LINKFLAGS=['-no-pie'])
if use_gcc(env):
version = get_compiler_version(env)
if version != None and version[0] >= '6':
env.Append(CCFLAGS=['-fpie'])
env.Append(LINKFLAGS=['-no-pie'])

## Dependencies

Expand Down

0 comments on commit 0d2a105

Please sign in to comment.