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. Recognized version control system sub-options:
404
405 branch=name
406 Use the specified name for the initial branch in the newly cre‐
407 ated repository.
408
409 none
410 Don't initialize a version control system inside the project.
411
412 The created project, package, or source subdirectory can be further
413 customized using the pre and post-creation hooks specified with the
414 --pre-hook and --post-hook options, respectively. The pre hooks are ex‐
415 ecuted before any new files are created and the post hook – after all
416 the files have been created. The hook commands are executed in the
417 project, package, or source directory as their current working direc‐
418 tory. For example:
419
420 $ bdep new --post-hook "echo .idea/ >>.gitignore" hello
421
422 The pre hooks are primarily useful for moving/renaming existing files
423 that would otherwise clash with files created by the new command. For
424 example:
425
426 $ bdep new --pre-hook "mv .gitignore .gitignore.bak" \
427 --post-hook "cat .gitignore.bak >>.gitignore" \
428 --post-hook "rm .gitignore.bak" ...
429
430 See the --pre-hook and --post-hook options documentation below for de‐
431 tails.
432
434 --no-init
435 Don't initialize an empty build configuration set.
436
437 --package
438 Create a new package inside an already existing project rather
439 than a new project.
440
441 --source
442 Create a new source subdirectory inside an already existing
443 project or package rather than a new project.
444
445 --output-dir|-o dir
446 Create the project, package, or source subdirectory in the spec‐
447 ified directory.
448
449 --directory|-d dir
450 Assume the project/package is in the specified directory rather
451 than in the current working directory. Only used with --package
452 or --source.
453
454 --type|-t type[,opt...]
455 Specify project type and options. Valid values for type are exe
456 (executable project, default), lib (library project), bare (bare
457 project without any source code), and empty (empty project ready
458 to be filled with packages). Valid values for opt are type-spe‐
459 cific.
460
461 --lang|-l lang[,opt...]
462 Specify project language and options. Valid values for lang are
463 c and c++ (default). Valid values for opt are language-specific.
464
465 --vcs|-s vcs[,opt...]
466 Specify project version control system and options. Valid values
467 for vcs are git (default) and none. Valid values for opt are
468 system-specific.
469
470 --pre-hook command
471
472
473 --post-hook command
474 Run the specified command before/after creating the project,
475 package, or source directory.
476
477 The command value is interpreted as a whitespace-separated, po‐
478 tentially quoted command line consisting of a program or a por‐
479 table builtin (testscript#builtins) optionally followed by argu‐
480 ments and redirects. Specifically, a single level of quotes
481 (either single or double) is removed and whitespaces are not
482 treated as separators inside such quoted fragments. Currently
483 only the stdout redirect to a file is supported. For example:
484
485 $ bdep new --post-hook "echo '.idea/ # IDE' >>.gitignore" hello
486
487 The command line elements (program, arguments, etc) may option‐
488 ally contain substitutions – variable names enclosed with the @
489 substitution symbol – which are replaced with the corresponding
490 variable values to produce the actual command. The following
491 variable names are recognized with the double substitution sym‐
492 bol (@@) serving as an escape sequence.
493
494 @mode@ - one of 'project', 'package', or 'source'
495 @name@ - project, package, or source subdirectory name
496 @base@ - name base (name without extension)
497 @stem@ - name stem (name base without 'lib' prefix)
498 @root@ - project/package root directory
499 @pfx@ - combined prefix relative to project/package root
500 @inc@ - split header prefix relative to project/package root
501 @src@ - split source prefix relative to project/package root
502 @sub@ - source subdirectory relative to header/source prefix
503 @type@ - type (--type|-t value: 'exe', 'lib', etc)
504 @lang@ - language (--lang|-l value: 'c', 'c++', etc)
505 @vcs@ - version control system (--vcs|-s value: 'git', etc)
506
507 Note that the @inc@ and @src@ variables are only set if the
508 header/source prefix is split with the combined @pfx@ variable
509 set otherwise.
510
511 For example:
512
513 $ bdep new --post-hook "echo bin/ >>@name@/.gitignore" hello
514
515 These substitution variables are also made available to the hook
516 program as the BDEP_NEW_* environment variables (BDEP_NEW_MODE,
517 BDEP_NEW_NAME, etc).
518
519 --no-amalgamation
520 Create a project with disabled amalgamation support. This option
521 is normally only used for testing.
522
523 --no-checks
524 Suppress nested project/package checks. This option is normally
525 only used for testing.
526
527 --config-add|-A dir
528 Add an existing build configuration dir.
529
530 --config-create|-C dir
531 Create a new build configuration in dir.
532
533 --type|--config-type typ
534 The type of the configuration being created. By default, config‐
535 uration of type target is created. See bpkg-cfg-create(1) for
536 background on configuration types.
537
538 --default
539 Make the added or created configuration the default.
540
541 --no-default
542 Don't make the first added or created configuration the default.
543
544 --forward
545 Make the added or created configuration forwarded.
546
547 --no-forward
548 Don't make the added or created configuration forwarded.
549
550 --auto-sync
551 Make the added or created configuration automatically synchro‐
552 nized.
553
554 --no-auto-sync
555 Don't make the added or created configuration automatically syn‐
556 chronized.
557
558 --existing|-e
559 Initialize a bpkg configuration based on an existing build sys‐
560 tem configuration.
561
562 --wipe Wipe the configuration directory clean before creating the new
563 configuration.
564
565 --config-name|-n name
566 Specify the build configuration as a name.
567
568 --config-id num
569 Specify the build configuration as an id.
570
572 The common options are summarized below with a more detailed descrip‐
573 tion available in bdep-common-options(1).
574
575 -v Print essential underlying commands being executed.
576
577 -V Print all underlying commands being executed.
578
579 --quiet|-q
580 Run quietly, only printing error messages.
581
582 --verbose level
583 Set the diagnostics verbosity to level between 0 and 6.
584
585 --stdout-format format
586 Representation format to use for printing to stdout.
587
588 --jobs|-j num
589 Number of jobs to perform in parallel.
590
591 --progress
592 Display progress indicators for long-lasting operations, such as
593 network transfers, building, etc.
594
595 --no-progress
596 Suppress progress indicators for long-lasting operations, such
597 as network transfers, building, etc.
598
599 --diag-color
600 Use color in diagnostics.
601
602 --no-diag-color
603 Don't use color in diagnostics.
604
605 --bpkg path
606 The package manager program to be used for build configuration
607 management.
608
609 --bpkg-option opt
610 Additional option to be passed to the package manager program.
611
612 --build path
613 The build program to be used to build packages.
614
615 --build-option opt
616 Additional option to be passed to the build program.
617
618 --curl path
619 The curl program to be used for network operations.
620
621 --curl-option opt
622 Additional option to be passed to the curl program.
623
624 --pager path
625 The pager program to be used to show long text.
626
627 --pager-option opt
628 Additional option to be passed to the pager program.
629
630 --options-file file
631 Read additional options from file.
632
633 --default-options dir
634 The directory to load additional default options files from.
635
636 --no-default-options
637 Don't load default options files.
638
640 C and C++ projects employ a bewildering variety of source code layouts
641 most of which fit into two broad classes: combined, where all the
642 source code for a single executable or library resides in the same di‐
643 rectory and split, where headers (typically public headers of a li‐
644 brary) and other source files reside in separate directories (most com‐
645 monly called include/ and src/).
646
647 To support the creation of such varying layouts the new command divides
648 paths leading to source code inside a package/project into a number of
649 customizable components:
650
651 libhello/{include,src}/hello/
652 ^ ^ ^
653 | | |
654 project/ source source
655 package prefix subdirectory
656 root
657
658 Note that while the same physical layout can be achieved with various
659 combinations of source prefix and subdirectory, there will be differ‐
660 ences in semantics since the headers in the project are included with
661 the source subdirectory (if any) as a prefix. See Canonical Project
662 Structure (intro#proj-struct) for rationale and details.
663
664 As we have already seen, the source subdirectory can be customized with
665 the subdir project type sub-option. For example:
666
667 # libhello/hello/
668
669 $ bdep new -l c++ -t lib,subdir=hello libhello
670
671 $ tree libhello/
672 libhello/
673 `-- hello/
674 |-- hello.hxx
675 `-- hello.cxx
676
677 Note: pass -l c++,cpp if you prefer the .hpp/.cpp source file naming
678 scheme.
679
680 The source prefix can be combined, in which case it can be customized
681 with the single prefix project type sub-option. For example:
682
683 # hello/src/hello/
684
685 $ bdep new -l c++ -t exe,prefix=src hello
686
687 $ tree hello/
688 hello/
689 `-- src/
690 `-- hello/
691 `-- hello.cxx
692
693 The prefix can also be split, in which case the prefix-include and pre‐
694 fix-source sub-options can be used to customize the respective directo‐
695 ries independently. If either is omitted, then the corresponding prefix
696 is left empty. For example:
697
698 # libhello/{include,.}/libhello/
699
700 $ bdep new -l c++ -t lib,prefix-include=include libhello
701
702 $ tree libhello/
703 libhello/
704 |-- include/
705 | `-- libhello/
706 | `-- hello.hxx
707 `-- libhello/
708 `-- hello.cxx
709
710 The split sub-option is a convenient shortcut for the most common case
711 where the header prefix is include/ and source prefix is src/. For ex‐
712 ample:
713
714 # libhello/{include,src}/libhello/
715
716 $ bdep new -l c++ -t lib,split libhello
717
718 $ tree libhello/
719 libhello/
720 |-- include/
721 | `-- libhello/
722 | `-- hello.hxx
723 `-- src/
724 `-- libhello/
725 `-- hello.cxx
726
727 The source subdirectory can be omitted by specifying the no-subdir
728 project type sub-option. For example:
729
730 # hello/src/
731
732 $ bdep new -l c++ -t exe,prefix=src,no-subdir hello
733
734 $ tree hello/
735 hello/
736 `-- src/
737 `-- hello.cxx
738
739 The same but for the split layout (we also have to disable the gener‐
740 ated version header that is not supported in this layout):
741
742 # libhello/{include,src}/
743
744 $ bdep new -l c++ -t lib,split,no-subdir,no-version libhello
745
746 $ tree libhello/
747 libhello/
748 |-- include/
749 | `-- hello.hxx
750 `-- src/
751 `-- hello.cxx
752
753 To achieve the layout where all the source code resides in the project
754 root, we omit both the source prefix and subdirectory (we also have to
755 disable a couple of other features that are not supported in this lay‐
756 out):
757
758 # hello/
759
760 $ bdep new -l c++ -t lib,no-subdir,no-version,no-tests libhello
761
762 $ tree libhello/
763 libhello/
764 |-- hello.cxx
765 `-- hello.hxx
766
767 We can also omit the source subdirectory but only in the source prefix
768 of the split layout by specifying the no-subdir-source sub-option. For
769 example:
770
771 # libhello/{include/hello,src}/
772
773 $ bdep new -l c++ -t lib,split,subdir=hello,no-subdir-source libhello
774
775 $ tree libhello/
776 libhello/
777 |-- include/
778 | `-- hello/
779 | `-- hello.hxx
780 `-- src/
781 `-- hello.cxx
782
783 To achieve the split layout where the include/ directory is inside
784 src/:
785
786 # libhello/src/{include,.}/hello/
787
788 $ bdep new \
789 -l c++ \
790 -t lib,prefix-include=src/include,prefix-source=src,subdir=hello \
791 libhello
792
793 $ tree libhello/
794 libhello/
795 `-- src/
796 |-- include/
797 | `-- hello/
798 | `-- hello.hxx
799 `-- hello/
800 `-- hello.cxx
801
802 A similar layout but without the source subdirectory in src/:
803
804 # libhello/src/{include/hello,.}/
805
806 $ bdep new \
807 -l c++ \
808 -t lib,prefix-include=src/include,prefix-source=src,\
809 subdir=hello,no-subdir-source \
810 libhello
811
812 $ tree libhello/
813 libhello/
814 `-- src/
815 |-- include/
816 | `-- hello/
817 | `-- hello.hxx
818 `-- hello.cxx
819
820 The layout used by the Boost libraries:
821
822 # libhello/{include/hello,libs/hello/src}/
823
824 $ bdep new \
825 -l c++ \
826 -t lib,prefix-include=include,prefix-source=libs/hello/src,\
827 subdir=hello,no-subdir-source \
828 libhello
829
830 $ tree libhello/
831 libhello/
832 |-- include/
833 | `-- hello/
834 | `-- hello.hxx
835 `-- libs/
836 `-- hello/
837 `-- src/
838 `-- hello.cxx
839
840 A layout where multiple components each have their own include/src
841 split:
842
843 # hello/libhello1/{include/hello1,src}/
844 # hello/libhello2/{include/hello2,src}/
845
846 $ bdep new -l c++ -t bare hello
847
848 $ bdep new -d hello --source \
849 -l c++ \
850 -t lib,\
851 prefix-include=libhello1/include,prefix-source=libhello1/src,\
852 subdir=hello1,no-subdir-source \
853 libhello1
854
855 $ bdep new -d hello --source \
856 -l c++ \
857 -t lib,\
858 prefix-include=libhello2/include,prefix-source=libhello2/src,\
859 subdir=hello2,no-subdir-source \
860 libhello2
861
862 $ tree hello/
863 hello/
864 |-- libhello1/
865 | |-- include/
866 | | `-- hello1/
867 | | `-- hello1.hxx
868 | `-- src/
869 | `-- hello1.cxx
870 `-- libhello2/
871 |-- include/
872 | `-- hello2/
873 | `-- hello2.hxx
874 `-- src/
875 `-- hello2.cxx
876
877 A layout where libraries and executables have different prefixes:
878
879 # hello/libs/libhello/{include/hello,src}/
880 # hello/src/hello/
881
882 $ bdep new -l c++ -t bare hello
883
884 $ bdep new -d hello --source \
885 -l c++ \
886 -t lib,\
887 prefix-include=libs/libhello/include,prefix-source=libs/libhello/src,\
888 subdir=hello,no-subdir-source \
889 libhello
890
891 $ bdep new -d hello --source -l c++ -t exe,prefix=src hello
892
893 $ tree hello/
894 hello/
895 |-- libs/
896 | `-- libhello/
897 | |-- include/
898 | | `-- hello/
899 | | `-- hello.hxx
900 | `-- src/
901 | `-- hello.cxx
902 `-- src/
903 `-- hello/
904 `-- hello.cxx
905
907 See bdep-default-options-files(1) for an overview of the default op‐
908 tions files. For the new command the search start directory is the
909 project directory in the package and source modes and the parent direc‐
910 tory of the new project in all other modes. The following options files
911 are searched for in each directory and, if found, loaded in the order
912 listed:
913
914 bdep.options
915 bdep-{config config-add}.options # if --config-add|-A
916 bdep-{config config-add config-create}.options # if --config-create|-C
917 bdep-new.options
918 bdep-new-{project|package|source}.options # (mode-dependent)
919
920 The following new command options cannot be specified in the default
921 options files:
922
923 --output-dir|-o
924 --directory|-d
925 --package
926 --source
927 --no-checks
928 --config-add|-A
929 --config-create|-C
930 --wipe
931
932 While the presence of the --pre-hook or --post-hook options in remote
933 default options files will trigger a prompt.
934
936 The BDEP_AUTHOR_EMAIL environment variable can be used to specify the
937 package email address. If not set, the new command will first try to
938 obtain the email from the version control system (if used) and then
939 from the EMAIL environment variable. If all these methods fail, a dummy
940 you@example.org email is used.
941
943 Send bug reports to the users@build2.org mailing list.
944
946 Copyright (c) 2014-2023 the build2 authors.
947
948 Permission is granted to copy, distribute and/or modify this document
949 under the terms of the MIT License.
950
951
952
953bdep 0.16.0 June 2023 bdep-new(1)