# file : build2/buildfile # license : MIT; see accompanying LICENSE file # NOTE: imports should go into root.build. # libs = $libbutl include ../libbuild2/ libs += ../libbuild2/lib{build2} for m: bash bin c cc cxx in version { include ../libbuild2/$m/ libs += ../libbuild2/$m/lib{build2-$m} } exe{b}: {hxx ixx txx cxx}{** -b-options} {hxx ixx cxx}{b-options} $libs # Target metadata, see also --build2-metadata in b.cxx. # exe{b}: { export.metadata = 1 b b.name = [string] b b.version = $version b.checksum = $version b.static = ($bin.link_member(exe) == liba) } # Build options. # # Pass our compiler target to be used as build2 host. # obj{b}: cxx.poptions += -DBUILD2_HOST_TRIPLET=\"$cxx.target\" # Pass the copyright notice extracted from the LICENSE file. # copyright = $process.run_regex( \ cat $src_root/LICENSE, \ 'Copyright \(c\) (.+) \(see the AUTHORS file\)\.', \ '\1') obj{b}: cxx.poptions += -DBUILD2_COPYRIGHT=\"$copyright\" switch $cxx.target.class { case 'linux' { # Make sure backtrace includes function names. # if ($cc.stdlib == 'glibc') cxx.loptions += -rdynamic # Make sure we use RPATH and not RUNPATH since the latter messes up # dlopen(). # cxx.loptions += -Wl,--disable-new-dtags } case 'windows' { # Adjust stack size (affects all threads). # # 8M 4M stack_size = ($cxx.target.cpu == "x86_64" ? 8388608 : 4194304) cxx.loptions += ($cxx.target.system == 'win32-msvc' \ ? "/STACK:$stack_size" \ : "-Wl,--stack,$stack_size") } } # Generated options parser. # if $cli.configured { cli.cxx{b-options}: cli{b} cli.options += --std c++11 -I $src_root --include-with-brackets \ --include-prefix build2 --guard-prefix BUILD2 \ --cxx-prologue "#include " \ --cli-namespace build2::cl --generate-file-scanner --keep-separator \ --generate-parse --generate-merge --generate-specifier # Usage options. # cli.options += --suppress-undocumented --long-usage --ansi-color \ --page-usage 'build2::print_$name$_' --option-length 21 cli.cxx{*}: { # Include the generated cli files into the distribution and don't remove # them when cleaning in src (so that clean results in a state identical to # distributed). # dist = true clean = ($src_root != $out_root) # We keep the generated code in the repository so copy it back to src in # case of a forwarded configuration. # backlink = overwrite } }