Compare commits

...

2 Commits

Author SHA1 Message Date
f3c40f4bd7 Add -n option, and other improvements 2024-12-31 14:34:36 +01:00
63dd34e926 Add -n option for normal project type
For consistency, I added this option, so any project type can be
explicitly specified. Of course, this option is the default, so it can
be left out to yield the existing behaviour.
2024-12-31 14:32:05 +01:00
2 changed files with 57 additions and 21 deletions

View File

@ -11,7 +11,7 @@
.Nm
.Fl v
.Nm
.Op Fl f | Fl l | Fl s
.Op Fl f | Fl l | Fl n | Fl s
.Oo
.Op Fl d
.Fl g Ar gitroot
@ -24,6 +24,13 @@ The
script creates a C++ project directory structure with some predefined
boilerplate files, ready to be built using
.Xr make 1 .
.Pp
Please note that you will need GNU Make to use the supplied Makefiles, which is
standard on Linux systems.
On BSD systems, use
.Xr gmake 1 ,
which is usually available through a package manager for the platform.
.Pp
.Nm
can create a directory for a simple project using a single source file; a
general project suitable for many source files; a general project setup as a
@ -40,37 +47,54 @@ display a version string, containing the
.Xr git 1
commit hash, after you have built the tool at least once.
.Pp
The options are as follows:
The options for
.Nm
are as follows:
.Ss General Options
.Bl -tag -width Ds
.It Fl \-version, v
Print version info and exit.
.It Fl \-gitroot Ar gitroot , Fl g Ar gitroot
.It Fl d
Save default Git URL to clone from.
Will only have any effect when also using the
.Fl g
option.
It will cause the
.Ar gitroot
argument for
.Fl g
to be saved into the
.Nm
configuration file, for later use with the
.Fl G
option.
.It Fl g Ar gitroot
Clone a
.Xr git 1
repo from the supplied git URL.
When combined with the
.Fl \-default
or
.Fl d
option, the supplied git URL will be saved into the
.Nm
configuration file.
.It Fl \-gitfav , Fl G
Use the git URL saved earlier to clone a repo from.
.It Fl \-tplroot Ar tplroot , Fl t Ar tplroot
.It Fl G
Use the Git URL saved earlier to clone a repo from.
.It Fl t Ar tplroot
Specify the root directory where the project templates can be found.
This option is useful when you want to use a modified set of files to base your
projects on.
.It Fl v
Print version info and exit.
.El
.Ss Project Type Options
.Bl -tag -width Ds
.It Fl \-filter, f
Create a filter project.
.It Fl \-library, l
.It Fl f
Create a filter tool project.
.It Fl l
Create a library project.
.It Fl \-simple, s
Create a simple project.
.It Fl n
Create a normal tool project.
This is the default.
.It Fl s
Create a simple tool project.
.El
.Pp
Without any
@ -190,8 +214,9 @@ This is where the C++ standard is defined.
Change if needed for your project.
Note the
.Dq +=
operator here, so a possibly defined $CXXFLAGS environment
variable will be honored.
operator here, so a possibly defined
.Ev CXXFLAGS
environment variable will be honored.
.It PRECOMPILE
The project can generate and use a precompiled header.
By default, the precomp.hpp file contains the C++ Standard Library headers, but
@ -246,7 +271,7 @@ Possible library dependencies should be added to the Makefile.
.Bl -tag -width Ds
.It make
Use this to compile and link your tool.
When doing this with for the first time, or after doing a
When doing this for the first time, or after doing a
.Dq make dist-clean ,
a
.Dq build
@ -291,10 +316,16 @@ that is generated using the various
invocations.
.It make uninstall
Remove the files that are installed by the
.Sq make install
.Dq make install
invocation.
Please note that no dependency checks are done, so removal could break other
tools or libraries that depend on the removed files.
.Pp
Also, if the install also created standard directories, like
.Pa /usr/local/bin ,
.Pa /usr/local/lib ,
.Pa /usr/local/include ,
etc., and they end up empty after the uninstall, they won't be removed.
.El
.Ss Tool Features, out of the box
TODO describe main.cpp and version.cpp here.

View File

@ -10,7 +10,7 @@ simple=0
usegitroot=0
usage() {
echo "usage: $progname [-f|-l|-s] [[-d] -g <gitroot>|-G] [-t <tplroot>] PROJECTNAME" >&2
echo "usage: $progname [-f|-l|-n|-s] [[-d] -g <gitroot>|-G] [-t <tplroot>] PROJECTNAME" >&2
exit 1
}
@ -30,7 +30,7 @@ check_gitroot() {
progname=${0##*/}
# option processing, using silent mode
while getopts :dfGg:lst:v opt
while getopts :dfGg:lnst:v opt
do
case $opt in
d)
@ -49,6 +49,11 @@ do
l)
library=1
;;
n)
mainfile=main.cpp
library=0
simple=0
;;
s)
simple=1
;;