Browse Source

doc: Show how to run CMake and CTest commands to build and test

pull/47/head
Tom G. Huang 5 years ago
parent
commit
f4cbd3bd96
  1. 359
      README.md

359
README.md

@ -1,169 +1,190 @@
[![Build Status](https://travis-ci.org/argtable/argtable3.svg?branch=master)](https://travis-ci.org/argtable/argtable3) [![Build Status](https://travis-ci.org/argtable/argtable3.svg?branch=master)](https://travis-ci.org/argtable/argtable3)
Introduction of Argtable3 Introduction of Argtable3
========================= =========================
**Argtable3** is an open source ANSI C library that parses GNU-style command-line **Argtable3** is an open source ANSI C library that parses GNU-style
options. It simplifies command-line parsing by defining a declarative-style API command-line options. It simplifies command-line parsing by defining a
that you can use to specify what your command-line syntax looks like. Argtable3 declarative-style API that you can use to specify what your command-line syntax
will automatically generate consistent error handling logic and textual looks like. Argtable3 will automatically generate consistent error handling
descriptions of the command line syntax, which are essential but tedious to logic and textual descriptions of the command line syntax, which are essential
implement for a robust CLI program. but tedious to implement for a robust CLI program.
Quick Start Quick Start
----------- -----------
> We no longer provide the amalgamation source code (`argtable3.c` and `argtable3.h`) > We no longer provide the amalgamation source code (`argtable3.c` and
> in the source code repository. You can get the amalgamation distribution either > `argtable3.h`) in the source code repository. You can get the amalgamation
> from the release page (`argtable-3.x.x-amalgamation.zip`), or generate the > distribution either from the release page (`argtable-3.x.x-amalgamation.zip`),
> distribution yourself by using the generator under the `tools` directory: > or generate the distribution yourself by using the generator under the `tools`
> > directory:
> 1. Navigate to the `tools` directory. >
> 2. Run `./build dist`, which will generate the distribution under the `<ROOT>/dist` > 1. Navigate to the `tools` directory.
> directory. > 2. Run `./build dist`, which will generate the distribution under the `<ROOT>/dist`
> directory.
Argtable3 is a single-file ANSI-C library. All you have to do is adding
`argtable3.c` to your projects, and including `argtable3.h` in your source code. Argtable3 is a single-file ANSI-C library. All you have to do is adding
`argtable3.c` to your projects, and including `argtable3.h` in your source code.
To build the library, examples, and unit tests, use CMake to generate out-of-source build:
To build the library, examples, and unit tests, use CMake to generate
* If you use GCC (Linux, MinGW, Cygwin), run: out-of-source build:
``` * If you use GCC (Linux, MinGW, Cygwin), run:
$ mkdir build
$ cd build ```
$ cmake .. $ mkdir build
$ make $ cd build
$ make test $ cmake ..
``` $ make
$ make test
To cleanup, type: ```
``` To cleanup, type:
$ make clean
``` ```
$ make clean
* If you use Microsoft Visual C++ compiler, run: ```
``` * If you use Microsoft Visual C++ compiler, run:
$ mkdir build
$ cd build ```
$ cmake -G "Visual Studio 15 2017 Win64" .. $ mkdir build
``` $ cd build
$ cmake -G "Visual Studio 15 2017 Win64" ..
Now you can use Visual Studio 2017 to open the generated solution. To cleanup, $ cmake --build . --config Debug
just remove the `build` directory. $ ctest -C Debug
```
To build a tagged version, go to the project root directory, and use the You can also use Visual Studio 2017 IDE to open the generated solution. To
`Makefile` in the project root folder to check out the specified version: cleanup, just remove the `build` directory.
```
$ make taglist To build a tagged version, go to the project root directory, and use the
Available TAGs: `Makefile` in the project root folder to check out the specified version:
v3.1.1.432a160
$ make co TAG=v3.1.1.432a160 ```
$ cd .tags/v3.1.1.432a160 $ make taglist
$ mkdir build Available TAGs:
$ cd build v3.1.1.432a160
$ cmake .. $ make co TAG=v3.1.1.432a160
$ make $ cd .tags/v3.1.1.432a160
$ make test $ mkdir build
``` $ cd build
$ cmake ..
You will find the shared library (or Windows DLL), static library, and the $ make
amalgamation distribution under the build directory. $ make test
```
Documentation and Examples You will find the shared library (or Windows DLL), static library, and the
-------------------------- amalgamation distribution under the build directory.
To learn how to use the Argtable3 API, you can see the documentation on the web
site, or examples in the `examples` folder. Documentation and Examples
--------------------------
Unit Tests To learn how to use the Argtable3 API, you can see the documentation on the web
---------- site, or examples in the `examples` folder.
Argtable3 is a BSD-licensed open source library, so you can modify the library
anyway you want. However, before committing your code to your own repository or Unit Tests
the Argtable3 official repository, please make sure your changes can pass the ----------
unit tests included in the distribution.
Argtable3 is a BSD-licensed open source library, so you can modify the library
anyway you want. However, before committing your code to your own repository or
Authors the Argtable3 official repository, please make sure your changes won't cause any
------- compiler warning and can pass the unit tests included in the distribution.
Argtable is Copyright (C) 1998-2001,2003-2011 Stewart Heitmann. To build and test each default configuration (Debug, Release, MinSizeRel,
Parts are Copyright (C) 1989-1994, 1996-1999, 2001, 2003 RelWithDebInfo), you can run CMake and CTest on all supported platforms:
Free Software Foundation, Inc.
```
Argtable was written by Stewart Heitmann <sheitmann@users.sourceforge.net> $ mkdir build
$ cd build
Argtable is now maintained by Tom G. Huang <tomghuang@gmail.com> $ cmake ..
The project homepage of argtable 3.x is http://www.argtable.org $ cmake --build . --config Debug
The project homepage of argtable 2.x is http://argtable.sourceforge.net/ $ ctest -C Debug
$ cmake --build . --config Release
Here is a list of contributors who have helped to improve argtable: $ ctest -C Release
$ cmake --build . --config MinSizeRel
- **Nina Clemson**: Editing the original argtable-1.0 documentation. $ ctest -C MinSizeRel
- **Livio Bertacco**: For bug fixes and the argtable-2.x Visual C++ Makefiles. $ cmake --build . --config RelWithDebInfo
- **Justin Dearing**: For bug fixes and Windows DLL support, plus code support for the Open Watcom compiler and help with the Mac OS X configuration. $ ctest -C RelWithDebInfo
- **Asa Packer**: Contributing bug fixes and upgrades to the Visual C++ Makefiles. ```
- **Danilo Cicerone**: For the Italian translation of "Introduction to Argtable-2x" on http://www.digitazero.org.
- **Uli Fouquet**: For configuration patches and documentation related to cross-compiling argtable from Unix to Windows, as well as providing the arg_print_glossary_gnu function.
- **Shachar Shemesh**: For Debian package integration and kick-starting the migration to automake/autoconf. Authors
- **Jasper Lievisse Adriaanse**: Maintaining the argtable package in OpenBSD ports. -------
- **Ulrich Mohr**: For bug fixes relating to Texas Instrument DSP platforms.
- **John Vickers**: For bug fixes relating to Solaris/Motorola platforms. Argtable is Copyright (C) 1998-2001,2003-2011 Stewart Heitmann.
- **Steve O'Neil**: For bug fixes relating to Solaris/Motorola platforms. Parts are Copyright (C) 1989-1994, 1996-1999, 2001, 2003
- **Lori A. Pritchett-Sheats**: Fixing a makefile bug relating to "make dist". Free Software Foundation, Inc.
- **Paolo Bormida**: For instructions on building argtable with date and regex support on Windows.
- **Michel Valin**: For bug fixes relating to the configure scripts on IBM AIX platforms and instructions on compiling the example code under AIX. Argtable was written by Stewart Heitmann <sheitmann@users.sourceforge.net>
- **Steve Christensen**: Providing prebuilt packages for SPARC/Solaris and x86/Solaris platforms on www.sunfreeware.com.
- **Jess Portnoy**: Reworking the rpm package and integrating argtable into Fedora Linux. Argtable is now maintained by Tom G. Huang <tomghuang@gmail.com>
- **Michael Brown**: Incorporating support for pkg-config into the autoconf scripts. The project homepage of argtable 3.x is http://www.argtable.org
- **Alexander Lindert**: For extensions to the parser to support hex, octal and binary integer formats as well as KB/MB/GB suffixes. The project homepage of argtable 2.x is http://argtable.sourceforge.net/
- **Rob Zaborowski**: Providing build configuration files for CMake.
- **Moczik Gabor**: For bug fixes relating to the parsing of filepaths and filename extensions. Here is a list of contributors who have helped to improve argtable:
Argtable 2.x uses `getopt` from GNU, which is LGPL licensed. In order to switch to BSD, we replaced GNU `getopt` with NetBSD `getopt`. We really appreciate this high quality library that lays the foundation of Argtable 3.x and here is its copyright notice: - **Nina Clemson**: Editing the original argtable-1.0 documentation.
- **Livio Bertacco**: For bug fixes and the argtable-2.x Visual C++ Makefiles.
``` - **Justin Dearing**: For bug fixes and Windows DLL support, plus code support for the Open Watcom compiler and help with the Mac OS X configuration.
Copyright (c) 2000 The NetBSD Foundation, Inc. - **Asa Packer**: Contributing bug fixes and upgrades to the Visual C++ Makefiles.
All rights reserved. - **Danilo Cicerone**: For the Italian translation of "Introduction to Argtable-2x" on http://www.digitazero.org.
- **Uli Fouquet**: For configuration patches and documentation related to cross-compiling argtable from Unix to Windows, as well as providing the arg_print_glossary_gnu function.
This code is derived from software contributed to The NetBSD Foundation - **Shachar Shemesh**: For Debian package integration and kick-starting the migration to automake/autoconf.
by Dieter Baron and Thomas Klausner. - **Jasper Lievisse Adriaanse**: Maintaining the argtable package in OpenBSD ports.
- **Ulrich Mohr**: For bug fixes relating to Texas Instrument DSP platforms.
Redistribution and use in source and binary forms, with or without - **John Vickers**: For bug fixes relating to Solaris/Motorola platforms.
modification, are permitted provided that the following conditions - **Steve O'Neil**: For bug fixes relating to Solaris/Motorola platforms.
are met: - **Lori A. Pritchett-Sheats**: Fixing a makefile bug relating to "make dist".
1. Redistributions of source code must retain the above copyright - **Paolo Bormida**: For instructions on building argtable with date and regex support on Windows.
notice, this list of conditions and the following disclaimer. - **Michel Valin**: For bug fixes relating to the configure scripts on IBM AIX platforms and instructions on compiling the example code under AIX.
2. Redistributions in binary form must reproduce the above copyright - **Steve Christensen**: Providing prebuilt packages for SPARC/Solaris and x86/Solaris platforms on www.sunfreeware.com.
notice, this list of conditions and the following disclaimer in the - **Jess Portnoy**: Reworking the rpm package and integrating argtable into Fedora Linux.
documentation and/or other materials provided with the distribution. - **Michael Brown**: Incorporating support for pkg-config into the autoconf scripts.
3. All advertising materials mentioning features or use of this software - **Alexander Lindert**: For extensions to the parser to support hex, octal and binary integer formats as well as KB/MB/GB suffixes.
must display the following acknowledgement: - **Rob Zaborowski**: Providing build configuration files for CMake.
This product includes software developed by the NetBSD - **Moczik Gabor**: For bug fixes relating to the parsing of filepaths and filename extensions.
Foundation, Inc. and its contributors.
4. Neither the name of The NetBSD Foundation nor the names of its Argtable 2.x uses `getopt` from GNU, which is LGPL licensed. In order to switch to BSD, we replaced GNU `getopt` with NetBSD `getopt`. We really appreciate this high quality library that lays the foundation of Argtable 3.x and here is its copyright notice:
contributors may be used to endorse or promote products derived
from this software without specific prior written permission. ```
Copyright (c) 2000 The NetBSD Foundation, Inc.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS All rights reserved.
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR This code is derived from software contributed to The NetBSD Foundation
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS by Dieter Baron and Thomas Klausner.
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF Redistribution and use in source and binary forms, with or without
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS modification, are permitted provided that the following conditions
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN are met:
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1. Redistributions of source code must retain the above copyright
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE notice, this list of conditions and the following disclaimer.
POSSIBILITY OF SUCH DAMAGE. 2. Redistributions in binary form must reproduce the above copyright
``` notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the NetBSD
Foundation, Inc. and its contributors.
4. Neither the name of The NetBSD Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
```

Loading…
Cancel
Save