1bdep-new(1) General Commands Manual bdep-new(1)
2
3
4
6 bdep-new - create and initialize new project
7
9 bdep new [options] [--no-init] spec [name]
10 bdep new [options] --config-add|-A cfg-dir [@cfg-name] spec [name]
11 bdep new [options] --config-create|-C cfg-dir [@cfg-name] spec [name]
12 [cfg-args]
13 bdep new [options] --package [prj-spec] spec [name]
14 bdep new [options] --source [prj-spec] spec [name]
15
16 spec = [lang] [type] [vcs]
17 lang = --lang|-l (c|c++)[,lang-opt...]
18 type = --type|-t (exe|lib|bare|empty)[,type-opt...]
19 vcs = --vcs|-s (git|none)[,vcs-opt...]
20 prj-spec = --directory|-d prj-dir
21 cfg-args = [-- [bpkg-options]] [--existing|-e | (module | cfg-var)...]
22
24 The new command creates and initializes a new project (the first three
25 forms), a new package in an already existing project (the --package
26 form), or a new source subdirectory in an already existing
27 project/package (the --source form). All the forms except --source
28 first create according to spec a new build2 project/package called name
29 in the name subdirectory of the current working directory (unless over‐
30 ridden with --output-dir|-o). If name contains a directory component,
31 then the project/package is created in this directory, as if it was
32 specified with --output-dir|-o.
33
34 The first form then, unless the --no-init option is specified, initial‐
35 izes an empty project database as if by executing the bdep-init(1) com‐
36 mand with the --empty option. For example:
37
38 $ bdep new -l c++ -t exe hello
39
40 $ tree hello/
41 hello/
42 |-- hello/
43 | |-- hello.cxx
44 | `-- buildfile
45 |-- buildfile
46 `-- manifest
47
48 Similarly, the second and third forms add an existing or create a new
49 build configuration and then initialize the project in that configura‐
50 tion as if by executing the bdep-init(1) command with the --config-add
51 or --config-create option, respectively. For example:
52
53 $ bdep new -l c++ -t exe -C @gcc hello cc config.cxx=g++
54
55 The --package form adds the new package to the packages.manifest file
56 creating it if necessary. If no project directory is explicitly speci‐
57 fied with --directory|-d, then the current working directory is as‐
58 sumed. Note that nested packages are not allowed. For example:
59
60 $ bdep new -t empty hello
61 $ cd hello
62
63 $ bdep new --package -l c++ -t lib libhello
64 $ bdep new --package -l c++ -t exe hello
65
66 $ bdep init -C @gcc cc config.cxx=g++
67
68 $ cd ..
69 $ tree hello/
70 hello/
71 |-- hello/
72 | |-- hello/
73 | | |-- hello.cxx
74 | | `-- buildfile
75 | |-- buildfile
76 | `-- manifest
77 |-- libhello/
78 | |-- libhello/
79 | | |-- hello.hxx
80 | | |-- hello.cxx
81 | | `-- buildfile
82 | |-- buildfile
83 | `-- manifest
84 `-- packages.manifest
85
86 The --source form operates as-if by first creating according to spec a
87 temporary project called name and then copying its source subdirectory
88 (name/name/ by default) over to the current working directory (unless
89 overridden with --output-dir|-o). If no project/package directory is
90 explicitly specified with --directory|-d, then the current working di‐
91 rectory is assumed. For example:
92
93 $ bdep new -l c++ -t bare hello
94 $ cd hello
95
96 $ bdep new --source -l c++ -t lib libhello
97 $ bdep new --source -l c++ -t exe hello
98
99 $ bdep init -C @gcc cc config.cxx=g++
100
101 $ cd ..
102 $ tree hello/
103 hello/
104 |-- hello/
105 | |-- hello.cxx
106 | `-- buildfile
107 |-- libhello/
108 | |-- hello.hxx
109 | |-- hello.cxx
110 | `-- buildfile
111 |-- buildfile
112 `-- manifest
113
114 In all the forms, if name is omitted, then the current working direc‐
115 tory name (unless overridden with --output-dir|-o) is used as the
116 project/package/source subdirectory name. See Package Name (#package-
117 name) for details on project/package names.
118
119 The source subdirectory can be customized with the subdir project type
120 sub-option (see below for details). For example:
121
122 $ bdep new -l c++ -t lib,subdir=libhello/io libhello-io
123
124 $ tree libhello-io/
125 libhello-io/
126 `-- libhello/
127 `-- io/
128 |-- hello-io.hxx
129 `-- hello-io.cxx
130
131 By default the source subdirectory is created in the project/package
132 root directory and contains both headers (including public headers for
133 libraries) as well as sources. This can be customized in a number of
134 ways using the prefix* and split project type sub-options (see below
135 for details). For example, to move the source subdirectory inside src/:
136
137 $ bdep new -l c++ -t exe,prefix=src hello
138
139 $ tree hello/
140 hello/
141 `-- src/
142 `-- hello/
143 `-- hello.cxx
144
145 And to split the library source subdirectory into public headers and
146 other source files:
147
148 $ bdep new -l c++ -t lib,split libhello
149
150 $ tree libhello/
151 libhello/
152 |-- include/
153 | `-- libhello/
154 | `-- hello.hxx
155 `-- src/
156 `-- libhello/
157 `-- hello.cxx
158
159 See the SOURCE LAYOUT section below for details and more examples.
160
161 The output directory may already contain existing files provided they
162 don't clash with the files to be created. The new command also recog‐
163 nizes certain well-known files and tries to use the extracted informa‐
164 tion in the package manifest file. Specifically, it tries to guess the
165 license from the LICENSE file as well as extract the summary from
166 README.md. This allows for the following workflow:
167
168 # Create a project with LICENSE and README.md on one of the Git
169 # hosting services (GitHub, GitLab, etc).
170
171 $ git clone .../libhello.git
172 $ cd libhello
173
174 $ bdep new -l c++ -t lib
175
176 The project parameters such as language, type (executable, library,
177 etc), and version control system can be customized as described next.
178 Some of these parameters also support parameter-specific sub-options
179 (such as the file extensions to use in a C++ project) that can be spec‐
180 ified with a comma after the parameter value.
181
182 The project language can be specified with the --lang|-l option. Valid
183 values for this option and their semantics are described next. If un‐
184 specified, a C++ project is created by default.
185
186 c
187 A C project. Recognized language sub-options:
188
189 c++
190 A C project that can also use C++. If specified, then the hxx,
191 cxx, ixx, txx, and mxx c++ language sub-options can also be
192 specified.
193
194 c++
195 A C++ project. Recognized language sub-options:
196
197 cpp
198 Use the .cpp, .hpp, .ipp, .tpp, and .mpp source file extensions
199 (alias for extension=?pp).
200
201 extension=pattern
202 Derive source file extensions from pattern by replacing every ?
203 with one of the c (source), h (header), i (inline), t (tem‐
204 plate), or m (module interface) letters. If unspecified and no
205 individual extensions are specified with the below options, then
206 ?xx is used by default.
207
208 hxx=extension
209 Use the specified extension for header files instead of the de‐
210 fault .hxx.
211
212 cxx=extension
213 Use the specified extension for source files instead of the de‐
214 fault .cxx.
215
216 ixx=extension
217 Use the specified extension for inline files. If unspecified,
218 then assume no inline files are used by the project.
219
220 txx=extension
221 Use the specified extension for template files. If unspecified,
222 then assume no template files are used by the project.
223
224 mxx=extension
225 Use the specified extension for module interface files. If un‐
226 specified, then assume no modules are used by the project.
227
228 c
229 A C++ project that can also use C.
230
231 As an example, the following command creates a header-only C++ library
232 that uses the .h extension for header files and .cpp – for source
233 files:
234
235 $ bdep new -l c++,hxx=h,cxx=cpp -t lib,binless libhello
236
237 The project type can be specified with the --type|-t option. The empty
238 project type is language-agnostic with the semantics and valid sub-op‐
239 tions for the rest being language-dependent, as described next. If un‐
240 specified, an executable project is created by default.
241
242 exe
243 A project that builds a sample C or C++ executable. Recognized
244 executable project sub-options:
245
246 no-tests
247 Don't add support for functional/integration testing.
248
249 unit-tests
250 Add support for unit testing.
251
252 no-install
253 Don't add support for installing.
254
255 prefix=dir
256 Optional source prefix relative to project/package root.
257
258 subdir=dir
259 Alternative source subdirectory relative to source prefix.
260
261 no-subdir
262 Omit the source subdirectory.
263
264 license=name
265
266
267 no-readme
268
269
270 alt-naming
271 See common sub-options below.
272
273 lib
274 A project that builds a sample C or C++ library. Recognized li‐
275 brary project sub-options:
276
277 binless
278 Create a header-only library.
279
280 no-tests
281 Don't add support for functional/integration testing.
282
283 unit-tests
284 Add support for unit testing.
285
286 no-install
287 Don't add support for installing.
288
289 no-version
290 Don't add support for generating the version header.
291
292 prefix-include=dir
293 Optional public header prefix relative to project/package root.
294
295 prefix-source=dir
296 Optional source prefix relative to project/package root.
297
298 prefix=dir
299 Shortcut for prefix-include=dir,prefix-source=dir.
300
301 split
302 Shortcut for prefix-include=include,prefix-source=src.
303
304 subdir=dir
305 Alternative source subdirectory relative to header/source pre‐
306 fix.
307
308 no-subdir
309 Omit the source subdirectory.
310
311 no-subdir-source
312 Omit the source subdirectory relative to the source prefix but
313 still create it relative to the header prefix.
314
315 license=name
316
317
318 no-readme
319
320
321 alt-naming
322 See common sub-options below.
323
324 bare
325 A project without any source code that can be filled later (see
326 --source). Recognized bare project sub-options:
327
328 no-tests
329 Don't add support for testing.
330
331 no-install
332 Don't add support for installing.
333
334 license=name
335
336
337 no-readme
338
339
340 alt-naming
341 See common sub-options below.
342
343 empty
344 An empty project that can be filled with packages (see --pack‐
345 age). Recognized empty project sub-options:
346
347 no-readme
348 See common sub-options below.
349
350 common
351 Common project type sub-options:
352
353 license=name
354 Specify the project's license. The license name can be an SPDX
355 License Expression (https://spdx.org/licenses/), which, in its
356 simplest form, is just the license ID. Or it can be a free form
357 name in the other: license name scheme. If unspecified, then
358 other: proprietary is assumed. The following tables lists the
359 most commonly used free/open source software license IDs as well
360 as a number of pre-defined other: names. See the license (#mani‐
361 fest-package-license) package manifest value for more informa‐
362 tion.
363
364 MIT MIT License.
365
366 BSD-2-Clause BSD 2-Clause "Simplified" License
367 BSD-3-Clause BSD 3-Clause "New" or "Revised" License
368
369 GPL-3.0-only GNU General Public License v3.0 only
370 GPL-3.0-or-later GNU General Public License v3.0 or later
371
372 LGPL-3.0-only GNU Lesser General Public License v3.0 only
373 LGPL-3.0-or-later GNU Lesser General Public License v3.0 or later
374
375 AGPL-3.0-only GNU Affero General Public License v3.0 only
376 AGPL-3.0-or-later GNU Affero General Public License v3.0 or later
377
378 Apache-2.0 Apache License 2.0
379
380 MPL-2.0 Mozilla Public License 2.0
381
382 BSL-1.0 Boost Software License 1.0
383
384 Unlicense The Unlicense (public domain)
385
386 other: public domain Released into the public domain
387 other: available source Not free/open source with public source code
388 other: proprietary Not free/open source
389 other: TODO License is not yet decided
390
391 no-readme
392 Don't add README.md.
393
394 alt-naming
395 Use the alternative build file/directory naming scheme.
396
397 The project version control system can be specified with the --vcs|-s
398 option. Valid values for this option and their semantics are described
399 next. If unspecified, git is assumed by default.
400
401 git
402 Initialize a git(1) repository inside the project and generate
403 .gitignore files.
404
405 none
406 Don't initialize a version control system inside the project.
407
408 The created project, package, or source subdirectory can be further
409 customized using the pre and post-creation hooks specified with the
410 --pre-hook and --post-hook options, respectively. The pre hooks are ex‐
411 ecuted before any new files are created and the post hook – after all
412 the files have been created. The hook commands are executed in the
413 project, package, or source directory as their current working direc‐
414 tory. For example:
415
416 $ bdep new --post-hook "echo .idea/ >>.gitignore" hello
417
418 The pre hooks are primarily useful for moving/renaming existing files
419 that would otherwise clash with files created by the new command. For
420 example:
421
422 $ bdep new --pre-hook "mv .gitignore .gitignore.bak" \
423 --post-hook "cat .gitignore.bak >>.gitignore" \
424 --post-hook "rm .gitignore.bak" ...
425
426 See the --pre-hook and --post-hook options documentation below for de‐
427 tails.
428
430 --no-init
431 Don't initialize an empty build configuration set.
432
433 --package
434 Create a new package inside an already existing project rather
435 than a new project.
436
437 --source
438 Create a new source subdirectory inside an already existing
439 project or package rather than a new project.
440
441 --output-dir|-o dir
442 Create the project, package, or source subdirectory in the spec‐
443 ified directory.
444
445 --directory|-d dir
446 Assume the project/package is in the specified directory rather
447 than in the current working directory. Only used with --package
448 or --source.
449
450 --type|-t type[,opt...]
451 Specify project type and options. Valid values for type are exe
452 (executable project, default), lib (library project), bare (bare
453 project without any source code), and empty (empty project ready
454 to be filled with packages). Valid values for opt are type-spe‐
455 cific.
456
457 --lang|-l lang[,opt...]
458 Specify project language and options. Valid values for lang are
459 c and c++ (default). Valid values for opt are language-specific.
460
461 --vcs|-s vcs[,opt...]
462 Specify project version control system and options. Valid values
463 for vcs are git (default) and none. Valid values for opt are
464 system-specific.
465
466 --pre-hook command
467
468
469 --post-hook command
470 Run the specified command before/after creating the project,
471 package, or source directory.
472
473 The command value is interpreted as a whitespace-separated, po‐
474 tentially quoted command line consisting of a program or a por‐
475 table builtin (testscript#builtins) optionally followed by argu‐
476 ments and redirects. Specifically, a single level of quotes
477 (either single or double) is removed and whitespaces are not
478 treated as separators inside such quoted fragments. Currently
479 only the stdout redirect to a file is supported. For example:
480
481 $ bdep new --post-hook "echo '.idea/ # IDE' >>.gitignore" hello
482
483 The command line elements (program, arguments, etc) may option‐
484 ally contain substitutions – variable names enclosed with the @
485 substitution symbol – which are replaced with the corresponding
486 variable values to produce the actual command. The following
487 variable names are recognized with the double substitution sym‐
488 bol (@@) serving as an escape sequence.
489
490 @mode@ - one of 'project', 'package', or 'source'
491 @name@ - project, package, or source subdirectory name
492 @base@ - name base (name without extension)
493 @stem@ - name stem (name base without 'lib' prefix)
494 @root@ - project/package root directory
495 @pfx@ - combined prefix relative to project/package root
496 @inc@ - split header prefix relative to project/package root
497 @src@ - split source prefix relative to project/package root
498 @sub@ - source subdirectory relative to header/source prefix
499 @type@ - type (--type|-t value: 'exe', 'lib', etc)
500 @lang@ - language (--lang|-l value: 'c', 'c++', etc)
501 @vcs@ - version control system (--vcs|-s value: 'git', etc)
502
503 Note that the @inc@ and @src@ variables are only set if the
504 header/source prefix is split with the combined @pfx@ variable
505 set otherwise.
506
507 For example:
508
509 $ bdep new --post-hook "echo bin/ >>@name@/.gitignore" hello
510
511 These substitution variables are also made available to the hook
512 program as the BDEP_NEW_* environment variables (BDEP_NEW_MODE,
513 BDEP_NEW_NAME, etc).
514
515 --no-amalgamation
516 Create a project with disabled amalgamation support. This option
517 is normally only used for testing.
518
519 --no-checks
520 Suppress nested project/package checks. This option is normally
521 only used for testing.
522
523 --config-add|-A dir
524 Add an existing build configuration dir.
525
526 --config-create|-C dir
527 Create a new build configuration in dir.
528
529 --type|--config-type typ
530 The type of the configuration being created. By default, config‐
531 uration of type target is created. See bpkg-cfg-create(1) for
532 background on configuration types.
533
534 --default
535 Make the added or created configuration the default.
536
537 --no-default
538 Don't make the first added or created configuration the default.
539
540 --forward
541 Make the added or created configuration forwarded.
542
543 --no-forward
544 Don't make the added or created configuration forwarded.
545
546 --auto-sync
547 Make the added or created configuration automatically synchro‐
548 nized.
549
550 --no-auto-sync
551 Don't make the added or created configuration automatically syn‐
552 chronized.
553
554 --existing|-e
555 Initialize a bpkg configuration based on an existing build sys‐
556 tem configuration.
557
558 --wipe Wipe the configuration directory clean before creating the new
559 configuration.
560
561 --config-name|-n name
562 Specify the build configuration as a name.
563
564 --config-id num
565 Specify the build configuration as an id.
566
568 The common options are summarized below with a more detailed descrip‐
569 tion available in bdep-common-options(1).
570
571 -v Print essential underlying commands being executed.
572
573 -V Print all underlying commands being executed.
574
575 --quiet|-q
576 Run quietly, only printing error messages.
577
578 --verbose level
579 Set the diagnostics verbosity to level between 0 and 6.
580
581 --stdout-format format
582 Representation format to use for printing to stdout.
583
584 --jobs|-j num
585 Number of jobs to perform in parallel.
586
587 --progress
588 Display progress indicators for long-lasting operations, such as
589 network transfers, building, etc.
590
591 --no-progress
592 Suppress progress indicators for long-lasting operations, such
593 as network transfers, building, etc.
594
595 --bpkg path
596 The package manager program to be used for build configuration
597 management.
598
599 --bpkg-option opt
600 Additional option to be passed to the package manager program.
601
602 --build path
603 The build program to be used to build packages.
604
605 --build-option opt
606 Additional option to be passed to the build program.
607
608 --curl path
609 The curl program to be used for network operations.
610
611 --curl-option opt
612 Additional option to be passed to the curl program.
613
614 --pager path
615 The pager program to be used to show long text.
616
617 --pager-option opt
618 Additional option to be passed to the pager program.
619
620 --options-file file
621 Read additional options from file.
622
623 --default-options dir
624 The directory to load additional default options files from.
625
626 --no-default-options
627 Don't load default options files.
628
630 C and C++ projects employ a bewildering variety of source code layouts
631 most of which fit into two broad classes: combined, where all the
632 source code for a single executable or library resides in the same di‐
633 rectory and split, where headers (typically public headers of a li‐
634 brary) and other source files reside in separate directories (most com‐
635 monly called include/ and src/).
636
637 To support the creation of such varying layouts the new command divides
638 paths leading to source code inside a package/project into a number of
639 customizable components:
640
641 libhello/{include,src}/hello/
642 ^ ^ ^
643 | | |
644 project/ source source
645 package prefix subdirectory
646 root
647
648 Note that while the same physical layout can be achieved with various
649 combinations of source prefix and subdirectory, there will be differ‐
650 ences in semantics since the headers in the project are included with
651 the source subdirectory (if any) as a prefix. See Canonical Project
652 Structure (intro#proj-struct) for rationale and details.
653
654 As we have already seen, the source subdirectory can be customized with
655 the subdir project type sub-option. For example:
656
657 # libhello/hello/
658
659 $ bdep new -l c++ -t lib,subdir=hello libhello
660
661 $ tree libhello/
662 libhello/
663 `-- hello/
664 |-- hello.hxx
665 `-- hello.cxx
666
667 Note: pass -l c++,cpp if you prefer the .hpp/.cpp source file naming
668 scheme.
669
670 The source prefix can be combined, in which case it can be customized
671 with the single prefix project type sub-option. For example:
672
673 # hello/src/hello/
674
675 $ bdep new -l c++ -t exe,prefix=src hello
676
677 $ tree hello/
678 hello/
679 `-- src/
680 `-- hello/
681 `-- hello.cxx
682
683 The prefix can also be split, in which case the prefix-include and pre‐
684 fix-source sub-options can be used to customize the respective directo‐
685 ries independently. If either is omitted, then the corresponding prefix
686 is left empty. For example:
687
688 # libhello/{include,.}/libhello/
689
690 $ bdep new -l c++ -t lib,prefix-include=include libhello
691
692 $ tree libhello/
693 libhello/
694 |-- include/
695 | `-- libhello/
696 | `-- hello.hxx
697 `-- libhello/
698 `-- hello.cxx
699
700 The split sub-option is a convenient shortcut for the most common case
701 where the header prefix is include/ and source prefix is src/. For ex‐
702 ample:
703
704 # libhello/{include,src}/libhello/
705
706 $ bdep new -l c++ -t lib,split libhello
707
708 $ tree libhello/
709 libhello/
710 |-- include/
711 | `-- libhello/
712 | `-- hello.hxx
713 `-- src/
714 `-- libhello/
715 `-- hello.cxx
716
717 The source subdirectory can be omitted by specifying the no-subdir
718 project type sub-option. For example:
719
720 # hello/src/
721
722 $ bdep new -l c++ -t exe,prefix=src,no-subdir hello
723
724 $ tree hello/
725 hello/
726 `-- src/
727 `-- hello.cxx
728
729 The same but for the split layout (we also have to disable the gener‐
730 ated version header that is not supported in this layout):
731
732 # libhello/{include,src}/
733
734 $ bdep new -l c++ -t lib,split,no-subdir,no-version libhello
735
736 $ tree libhello/
737 libhello/
738 |-- include/
739 | `-- hello.hxx
740 `-- src/
741 `-- hello.cxx
742
743 To achieve the layout where all the source code resides in the project
744 root, we omit both the source prefix and subdirectory (we also have to
745 disable a couple of other features that are not supported in this lay‐
746 out):
747
748 # hello/
749
750 $ bdep new -l c++ -t lib,no-subdir,no-version,no-tests libhello
751
752 $ tree libhello/
753 libhello/
754 |-- hello.cxx
755 `-- hello.hxx
756
757 We can also omit the source subdirectory but only in the source prefix
758 of the split layout by specifying the no-subdir-source sub-option. For
759 example:
760
761 # libhello/{include/hello,src}/
762
763 $ bdep new -l c++ -t lib,split,subdir=hello,no-subdir-source libhello
764
765 $ tree libhello/
766 libhello/
767 |-- include/
768 | `-- hello/
769 | `-- hello.hxx
770 `-- src/
771 `-- hello.cxx
772
773 To achieve the split layout where the include/ directory is inside
774 src/:
775
776 # libhello/src/{include,.}/hello/
777
778 $ bdep new \
779 -l c++ \
780 -t lib,prefix-include=src/include,prefix-source=src,subdir=hello \
781 libhello
782
783 $ tree libhello/
784 libhello/
785 `-- src/
786 |-- include/
787 | `-- hello/
788 | `-- hello.hxx
789 `-- hello/
790 `-- hello.cxx
791
792 A similar layout but without the source subdirectory in src/:
793
794 # libhello/src/{include/hello,.}/
795
796 $ bdep new \
797 -l c++ \
798 -t lib,prefix-include=src/include,prefix-source=src,\
799 subdir=hello,no-subdir-source \
800 libhello
801
802 $ tree libhello/
803 libhello/
804 `-- src/
805 |-- include/
806 | `-- hello/
807 | `-- hello.hxx
808 `-- hello.cxx
809
810 The layout used by the Boost libraries:
811
812 # libhello/{include/hello,libs/hello/src}/
813
814 $ bdep new \
815 -l c++ \
816 -t lib,prefix-include=include,prefix-source=libs/hello/src,\
817 subdir=hello,no-subdir-source \
818 libhello
819
820 $ tree libhello/
821 libhello/
822 |-- include/
823 | `-- hello/
824 | `-- hello.hxx
825 `-- libs/
826 `-- hello/
827 `-- src/
828 `-- hello.cxx
829
830 A layout where multiple components each have their own include/src
831 split:
832
833 # hello/libhello1/{include/hello1,src}/
834 # hello/libhello2/{include/hello2,src}/
835
836 $ bdep new -l c++ -t bare hello
837
838 $ bdep new -d hello --source \
839 -l c++ \
840 -t lib,\
841 prefix-include=libhello1/include,prefix-source=libhello1/src,\
842 subdir=hello1,no-subdir-source \
843 libhello1
844
845 $ bdep new -d hello --source \
846 -l c++ \
847 -t lib,\
848 prefix-include=libhello2/include,prefix-source=libhello2/src,\
849 subdir=hello2,no-subdir-source \
850 libhello2
851
852 $ tree hello/
853 hello/
854 |-- libhello1/
855 | |-- include/
856 | | `-- hello1/
857 | | `-- hello1.hxx
858 | `-- src/
859 | `-- hello1.cxx
860 `-- libhello2/
861 |-- include/
862 | `-- hello2/
863 | `-- hello2.hxx
864 `-- src/
865 `-- hello2.cxx
866
867 A layout where libraries and executables have different prefixes:
868
869 # hello/libs/libhello/{include/hello,src}/
870 # hello/src/hello/
871
872 $ bdep new -l c++ -t bare hello
873
874 $ bdep new -d hello --source \
875 -l c++ \
876 -t lib,\
877 prefix-include=libs/libhello/include,prefix-source=libs/libhello/src,\
878 subdir=hello,no-subdir-source \
879 libhello
880
881 $ bdep new -d hello --source -l c++ -t exe,prefix=src hello
882
883 $ tree hello/
884 hello/
885 |-- libs/
886 | `-- libhello/
887 | |-- include/
888 | | `-- hello/
889 | | `-- hello.hxx
890 | `-- src/
891 | `-- hello.cxx
892 `-- src/
893 `-- hello/
894 `-- hello.cxx
895
897 See bdep-default-options-files(1) for an overview of the default op‐
898 tions files. For the new command the search start directory is the
899 project directory in the package and source modes and the parent direc‐
900 tory of the new project in all other modes. The following options files
901 are searched for in each directory and, if found, loaded in the order
902 listed:
903
904 bdep.options
905 bdep-{config config-add}.options # if --config-add|-A
906 bdep-{config config-add config-create}.options # if --config-create|-C
907 bdep-new.options
908 bdep-new-{project|package|source}.options # (mode-dependent)
909
910 The following new command options cannot be specified in the default
911 options files:
912
913 --output-dir|-o
914 --directory|-d
915 --package
916 --source
917 --no-checks
918 --config-add|-A
919 --config-create|-C
920 --wipe
921
922 While the presence of the --pre-hook or --post-hook options in remote
923 default options files will trigger a prompt.
924
926 The BDEP_AUTHOR_EMAIL environment variable can be used to specify the
927 package email address. If not set, the new command will first try to
928 obtain the email from the version control system (if used) and then
929 from the EMAIL environment variable. If all these methods fail, a dummy
930 you@example.org email is used.
931
933 Send bug reports to the users@build2.org mailing list.
934
936 Copyright (c) 2014-2022 the build2 authors.
937
938 Permission is granted to copy, distribute and/or modify this document
939 under the terms of the MIT License.
940
941
942
943bdep 0.15.0 July 2022 bdep-new(1)