1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
// file : bdep/new.cli
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
include <bdep/project.cli>;
include <bdep/new-types.hxx>;
"\section=1"
"\name=bdep-new"
"\summary=create and initialize new project"
namespace bdep
{
{
"<options> <spec> <name>
<type> <type-opt>
<lang> <lang-opt>
<vcs> <vcs-opt>
<cfg-name> <cfg-dir>
<cfg-args> <option> <module> <cfg-var>",
"\h|SYNOPSIS|
\c{\b{bdep new} [<options>] [\b{--no-init}] <spec> <name>\n
\b{bdep new} [<options>] \b{--config-add|-A} <cfg-dir> [\b{@}<cfg-name>] <spec> <name>\n
\b{bdep new} [<options>] \b{--config-create|-C} <cfg-dir> [\b{@}<cfg-name>] <spec> <name>\n
\ \ \ \ \ \ \ \ \ [<cfg-args>]}
\c{<spec> \ \ \ \ = [<type>] [<lang>] [<vcs>]\n
<type> \ \ \ \ = \b{--type}|\b{-t} (\b{exe}|\b{lib}|\b{bare})[\b{,}<type-opt>...]\n
<lang> \ \ \ \ = \b{--lang}|\b{-l} (\b{c}|\b{c++})[\b{,}<lang-opt>...]\n
<vcs> \ \ \ \ \ = \b{--vcs}|\b{-s} \ (\b{git}|\b{none})[\b{,}<vcs-opt>...]\n
<cfg-args> = (<option> | <module> | <cfg-var>)...}
\h|DESCRIPTION|
The \cb{new} command creates and initializes a new \cb{build2} project.
All three forms first create according to <spec> a new \cb{build2}
project called <name> in the <name> subdirectory of the current working
directory (unless overridden with \c{\b{--output-dir}|\b{-o}}).
The first form then, unless the \cb{--no-init} option is specified,
initializes an empty project database as if by executing the
\l{bdep-init(1)} command with the \cb{--empty} option. Similarly, the
second and third forms add an existing or create new build configuration
and then initialize the project in that configuration as if by executing
the \l{bdep-init(1)} command with the \cb{--config-add} or
\cb{--config-create} option, respectively.
The project parameters such as type (executable, library, etc), language,
and version control system can be customized as described next. Some of
these parameters also support parameter-specific options (such as the
file extensions to use in a C++ project) that can be specified with a
comma after the parameter value.
The project type can be specified with the \c{\b{--type}|\b{-t}} option.
Valid values for this option and their semantics are described next. If
unspecified, an executable project is created by default.
\dl|
\li|\cb{exe}
A project that builds a sample executable. Recognized executable
project options:
\cb{no-tests} \- Don't add support for functional/integration testing.
|
\li|\cb{lib}
A project that builds a sample library. Recognized library project
options:
\cb{no-tests} \- Don't add support for functional/integration testing.
|
\li|\cb{bare}
A project without any source code. Recognized bare project options:
\cb{no-tests} \- Don't add support for functional/integration testing.
||
The project language can be specified with the \c{\b{--lang}|\b{-l}}
option. Valid values for this option and their semantics are described
next. If unspecified, a C++ project is created by default.
\dl|
\li|\cb{c}
A C project.|
\li|\cb{c++}
A C++ project. Recognized language options:
\cb{cxx} \- Use the \cb{.cxx}, \cb{.hxx}, \cb{.ixx}, \cb{.txx}, and
\cb{.mxx} source file extensions (default).
\cb{cpp} \- Use the \cb{.cpp}, \cb{.hpp}, \cb{.ipp}, \cb{.tpp}, and
\cb{.mpp} source file extensions.||
The project version control system can be specified with the
\c{\b{--vcs}|\b{-s}} option. Valid values for this option and their
semantics are described next. If unspecified, \cb{git} is assumed by
default.
\dl|
\li|\cb{git}
Initialize a \cb{git(1)} repository inside the project and generate
\cb{.gitignore} files.|
\li|\cb{none}
Don't initialize a version control system inside the project.||
"
}
//--type options
//
class cmd_new_exe_options
{
bool no-tests;
};
class cmd_new_lib_options
{
bool no-tests;
};
class cmd_new_bare_options
{
bool no-tests;
};
// --lang options
//
class cmd_new_c_options
{
};
class cmd_new_cxx_options
{
bool cpp;
bool cxx;
};
// --vcs options
//
class cmd_new_git_options
{
};
class cmd_new_none_options
{
};
class cmd_new_options: configuration_add_options, configuration_name_options
{
"\h|NEW OPTIONS|"
bool --no-init
{
"Don't initialize an empty build configuration set."
}
dir_path --config-add|-A
{
"<dir>",
"Add an existing build configuration <dir>."
}
dir_path --config-create|-C
{
"<dir>",
"Create a new build configuration in <dir>."
}
cmd_new_type --type|-t
{
"<type>[,<opt>...]",
"Specify project type and options. Valid values for <type> are \cb{exe}
(executable project, default), \cb{lib} (library project), and
\cb{bare} (bare project without any source code). Valid values for
<opt> are type-specific."
}
cmd_new_lang --lang|-l
{
"<lang>[,<opt>...]",
"Specify project language and options. Valid values for <lang> are \cb{c}
and \cb{c++} (default). Valid values for <opt> are language-specific."
}
cmd_new_vcs --vcs|-s
{
"<vcs>[,<opt>...]",
"Specify project version control system and options. Valid values for
<vcs> are \cb{git} (default) and \cb{none}. Valid values for <opt> are
system-specific."
}
dir_path --output-dir|-o
{
"<dir>",
"Create the project in the specified directory."
}
};
}
|