cc_project_template_gn

A gn, ninja, and googletest-based C++ project template
git clone https://git.bracken.jp/cc_project_template_gn.git
Log | Files | Refs | Submodules | README | LICENSE

BUILD.gn (848B)


      1 # Default language standards.
      2 config("compiler_std") {
      3   cflags_c = [
      4     "-std=c11",
      5   ]
      6   cflags_cc = [
      7     "-std=c++17",
      8   ]
      9   cflags_objcc = [
     10     "-std=c++17",
     11   ]
     12 }
     13 
     14 # Default compiler warnings.
     15 config("compiler_warnings") {
     16   cflags = [
     17     "-Wall",
     18     "-Wextra",
     19     "-Werror",
     20   ]
     21   cflags_cc = []
     22   cflags_objcc = []
     23 }
     24 
     25 # Debug mode build.
     26 config("debug") {
     27   defines = [ "_DEBUG" ]
     28 }
     29 
     30 # Release mode build.
     31 config("release") {
     32   defines = [ "NDEBUG" ]
     33 }
     34 
     35 # Disable optimisations.
     36 config("no_optimize") {
     37   cflags = [ "-O0" ]
     38 }
     39 
     40 # Enable optimisations.
     41 config("optimize") {
     42   cflags = [ "-O2" ]
     43 }
     44 
     45 # Regular build with symbols.
     46 config("symbols") {
     47   cflags = [ "-g2" ]
     48 }
     49 
     50 # Minimal symbols, typically just enough for backtraces.
     51 config("min_symbols") {
     52   cflags = [ "-g1" ]
     53 }
     54 
     55 # No symbols.
     56 config("no_symbols") {
     57   cflags = [ "-g0" ]
     58 }