@@ -40,15 +40,15 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
4040
4141 #Base flags
4242 self .cflags = ['-D' + project .upper () + '_COMPILE=1' ,
43- '-funit-at-a-time' , '-fstrict-aliasing' ,
44- '-fno-math-errno' ,'-ffinite-math-only' , '-funsafe-math-optimizations' ,
43+ '-funit-at-a-time' , '-fstrict-aliasing' , '-fvisibility=hidden' , '-fno-stack-protector' ,
44+ '-fomit-frame-pointer' , '- fno-math-errno' ,'-ffinite-math-only' , '-funsafe-math-optimizations' ,
4545 '-fno-trapping-math' , '-ffast-math' ]
4646 self .cwarnflags = ['-W' , '-Werror' , '-pedantic' , '-Wall' , '-Weverything' ,
47- '-Wno-padded' , '-Wno-documentation-unknown-command' ]
47+ '-Wno-padded' , '-Wno-documentation-unknown-command' , '-Wno-static-in-inline' ]
4848 self .cmoreflags = []
4949 self .mflags = []
5050 self .arflags = []
51- self .linkflags = []
51+ self .linkflags = ['-fomit-frame-pointer' ]
5252 self .oslibs = []
5353 self .frameworks = []
5454
@@ -65,7 +65,6 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
6565 if self .target .is_linux () or self .target .is_bsd () or self .target .is_raspberrypi ():
6666 self .cflags += ['-D_GNU_SOURCE=1' ]
6767 self .linkflags += ['-pthread' ]
68- self .oslibs += ['m' ]
6968 if self .target .is_linux () or self .target .is_raspberrypi ():
7069 self .oslibs += ['dl' ]
7170 if self .target .is_bsd ():
@@ -85,7 +84,7 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
8584 self .cflags += ['-w' ]
8685 self .cxxflags = list (self .cflags )
8786
88- self .cflags += ['-std=c11 ' ]
87+ self .cflags += ['-std=gnu11 ' ]
8988 if self .target .is_macos () or self .target .is_ios ():
9089 self .cxxflags += ['-std=c++14' , '-stdlib=libc++' ]
9190 else :
@@ -311,7 +310,7 @@ def make_carchflags(self, arch, targettype):
311310 flags = []
312311 if targettype == 'sharedlib' :
313312 flags += ['-DBUILD_DYNAMIC_LINK=1' ]
314- if self .target .is_linux ():
313+ if self .target .is_linux () or self . target . is_bsd () :
315314 flags += ['-fPIC' ]
316315 flags += self .make_targetarchflags (arch , targettype )
317316 return flags
@@ -321,11 +320,11 @@ def make_cconfigflags(self, config, targettype):
321320 if config == 'debug' :
322321 flags += ['-DBUILD_DEBUG=1' , '-g' ]
323322 elif config == 'release' :
324- flags += ['-DBUILD_RELEASE=1' , '-O3' , '-g' , '-funroll-loops' ]
323+ flags += ['-DBUILD_RELEASE=1' , '-DNDEBUG' , '- O3' , '-g' , '-funroll-loops' ]
325324 elif config == 'profile' :
326- flags += ['-DBUILD_PROFILE=1' , '-O3' , '-g' , '-funroll-loops' ]
325+ flags += ['-DBUILD_PROFILE=1' , '-DNDEBUG' , '- O3' , '-g' , '-funroll-loops' ]
327326 elif config == 'deploy' :
328- flags += ['-DBUILD_DEPLOY=1' , '-O3' , '-g' , '-funroll-loops' ]
327+ flags += ['-DBUILD_DEPLOY=1' , '-DNDEBUG' , '- O3' , '-g' , '-funroll-loops' ]
329328 return flags
330329
331330 def make_ararchflags (self , arch , targettype ):
@@ -363,7 +362,9 @@ def make_linkconfigflags(self, config, targettype, variables):
363362 flags += ['-dynamiclib' ]
364363 else :
365364 if targettype == 'sharedlib' :
366- flags += ['-shared' ]
365+ flags += ['-shared' , '-fPIC' ]
366+ if config == 'release' :
367+ flags += ['-DNDEBUG' , '-O3' ]
367368 return flags
368369
369370 def make_linkarchlibs (self , arch , targettype ):
0 commit comments