gout

A static git page generator
git clone https://git.bracken.jp/gout.git
Log | Files | Refs | README | LICENSE

BUILDCONFIG.gn (4580B)


      1 # =============================================================================
      2 # PLATFORM SELECTION
      3 # =============================================================================
      4 #
      5 # There are two main things to set: "os" and "cpu". The "toolchain" is the name
      6 # of the GN thing that encodes combinations of these things.
      7 #
      8 # Users typically only set the variables "target_os" and "target_cpu" in "gn
      9 # args", the rest are set up by our build and internal to GN.
     10 #
     11 # There are three different types of each of these things: The "host"
     12 # represents the computer doing the compile and never changes. The "target"
     13 # represents the main thing we're trying to build. The "current" represents
     14 # which configuration is currently being defined, which can be either the
     15 # host, the target, or something completely different (like nacl). GN will
     16 # run the same build file multiple times for the different required
     17 # configuration in the same build.
     18 #
     19 # This gives the following variables:
     20 #  - host_os, host_cpu, host_toolchain
     21 #  - target_os, target_cpu, default_toolchain
     22 #  - current_os, current_cpu, current_toolchain.
     23 #
     24 # Note the default_toolchain isn't symmetrical (you would expect
     25 # target_toolchain). This is because the "default" toolchain is a GN built-in
     26 # concept, and "target" is something our build sets up that's symmetrical with
     27 # its GYP counterpart. Potentially the built-in default_toolchain variable
     28 # could be renamed in the future.
     29 #
     30 # When writing build files, to do something only for the host:
     31 #   if (current_toolchain == host_toolchain) { ...
     32 
     33 if (target_os == "") {
     34   target_os = host_os
     35 }
     36 if (target_cpu == "") {
     37   target_cpu = host_cpu
     38 }
     39 if (current_cpu == "") {
     40   current_cpu = target_cpu
     41 }
     42 if (current_os == "") {
     43   current_os = target_os
     44 }
     45 
     46 # =============================================================================
     47 # PLATFORM SELECTION
     48 # =============================================================================
     49 #
     50 # There are two main things to set: "os" and "cpu". The "toolchain" is the name
     51 # of the GN thing that encodes combinations of these things.
     52 #
     53 # Users typically only set the variables "target_os" and "target_cpu" in "gn
     54 # args", the rest are set up by our build and internal to GN.
     55 #
     56 # There are three different types of each of these things: The "host"
     57 # represents the computer doing the compile and never changes. The "target"
     58 # represents the main thing we're trying to build. The "current" represents
     59 # which configuration is currently being defined, which can be either the
     60 # host, the target, or something completely different (like nacl). GN will
     61 # run the same build file multiple times for the different required
     62 # configuration in the same build.
     63 #
     64 # This gives the following variables:
     65 #  - host_os, host_cpu, host_toolchain
     66 #  - target_os, target_cpu, default_toolchain
     67 #  - current_os, current_cpu, current_toolchain.
     68 #
     69 # Note the default_toolchain isn't symmetrical (you would expect
     70 # target_toolchain). This is because the "default" toolchain is a GN built-in
     71 # concept, and "target" is something our build sets up that's symmetrical with
     72 # its GYP counterpart. Potentially the built-in default_toolchain variable
     73 # could be renamed in the future.
     74 #
     75 # When writing build files, to do something only for the host:
     76 #   if (current_toolchain == host_toolchain) { ...
     77 
     78 declare_args() {
     79   is_debug = true
     80   system_include_dirs = []
     81   system_lib_dirs = []
     82 }
     83 
     84 # Args derived from core args.
     85 declare_args() {
     86   enable_asan = is_debug && (host_os == "mac" || host_os == "linux" || host_os == "freebsd")
     87 }
     88 
     89 # Options
     90 use_strip = !is_debug
     91 
     92 # All binary targets will get this list of configs by default.
     93 _shared_binary_target_configs = [
     94   "//build:compiler_std",
     95   "//build:compiler_warnings",
     96 ]
     97 
     98 # Optimisations and debug/release mode.
     99 if (is_debug) {
    100   _shared_binary_target_configs += [ "//build:debug" ]
    101   _shared_binary_target_configs += [ "//build:no_optimize" ]
    102   _shared_binary_target_configs += [ "//build:symbols" ]
    103 } else {
    104   _shared_binary_target_configs += [ "//build:release" ]
    105   _shared_binary_target_configs += [ "//build:optimize_size" ]
    106   _shared_binary_target_configs += [ "//build:no_symbols" ]
    107 }
    108 
    109 # Apply that default list to the binary target types.
    110 set_defaults("executable") {
    111   configs = _shared_binary_target_configs
    112 }
    113 set_defaults("static_library") {
    114   configs = _shared_binary_target_configs
    115 }
    116 set_defaults("shared_library") {
    117   configs = _shared_binary_target_configs
    118 }
    119 set_defaults("source_set") {
    120   configs = _shared_binary_target_configs
    121 }
    122 
    123 set_default_toolchain("//build/toolchain:clang")