BUILD.gn (1111B)
1 # Default language standards. 2 config("compiler_std") { 3 cflags_c = [ "-std=c11" ] 4 cflags_cc = [ "-std=c++17" ] 5 cflags_objcc = [ "-std=c++17" ] 6 } 7 8 # Default compiler warnings. 9 config("compiler_warnings") { 10 cflags = [ 11 "-Wall", 12 "-Wextra", 13 "-Werror", 14 ] 15 cflags_cc = [] 16 cflags_objcc = [] 17 } 18 19 config("strict_prototypes") { 20 cflags = [ 21 "-Wmissing-prototypes", 22 "-Wstrict-prototypes", 23 ] 24 } 25 26 # Debug mode build. 27 config("debug") { 28 defines = [ "_DEBUG" ] 29 } 30 31 # Release mode build. 32 config("release") { 33 defines = [ "NDEBUG" ] 34 } 35 36 # Disable optimisations. 37 config("no_optimize") { 38 cflags = [ "-O0" ] 39 } 40 41 # Optimise for time performance. 42 config("optimize") { 43 cflags = [ "-O2" ] 44 } 45 46 # Optimise for size. 47 config("optimize_size") { 48 cflags = [ "-Os" ] 49 } 50 51 # Enable link-time-optimisation. 52 config("lto") { 53 cflags = [ "-flto" ] 54 ldflags = [ "-flto" ] 55 } 56 57 # Regular build with symbols. 58 config("symbols") { 59 cflags = [ "-g2" ] 60 } 61 62 # Minimal symbols, typically just enough for backtraces. 63 config("min_symbols") { 64 cflags = [ "-g1" ] 65 } 66 67 # No symbols. 68 config("no_symbols") { 69 cflags = [ "-g0" ] 70 }