Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/cgreen-runner_nm_parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
thoni56 committed Dec 28, 2021
2 parents 12d3699 + 9314651 commit 873c5c9
Show file tree
Hide file tree
Showing 20 changed files with 334 additions and 230 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enable_testing()
set(APPLICATION_NAME ${PROJECT_NAME})
set(APPLICATION_VERSION_MAJOR "1")
set(APPLICATION_VERSION_MINOR "4")
set(APPLICATION_VERSION_PATCH "0")
set(APPLICATION_VERSION_PATCH "1")

set(APPLICATION_VERSION ${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}${APPLICATION_VERSION_STATUS})
add_definitions(-DVERSION="${APPLICATION_VERSION}")
Expand Down
82 changes: 0 additions & 82 deletions INSTALL

This file was deleted.

96 changes: 96 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Building and Installing Cgreen

Here are your alternatives for installing `Cgreen`.

## Install using your distro package manager

Cgreen is available for [some Linux distros]
(https://repology.org/project/cgreen/versions). If you are on one of
those you can do

$ sudo apt install cgreen1

or equivalent. Not all distros have an up-to-date version.


## Install pre-built binary

There are occassionally pre-built binaries available from [the GitHub
repo](https://github.com/cgreen-devs/cgreen/releases). You can
download and install these using an appropriate package manager.


## Build from source

### Get source and build

Clone the [`Cgreen` repo](https://github.com/cgreen-devs/cgreen)

$ git clone https://github.com/cgreen-devs/cgreen

or get the source from the same place.

Then build it

$ cd cgreen
$ make

The Makefile is mainly for convenience as `Cgreen` is actually built
using `CMake`. So you can tweak the build using normal `CMake`
settings.

Optional: If you have `ninja` installed the underlying `CMake` builder
will use that, which is faster.

You can run some tests using

$ make unit
$ make test

### Build options

You also have some extra options available

- build with static libraries
- build HTML or PDF documentation

To enable any of these use the `CMake` graphical user interface (CMakeSetup
on Windows or ccmake on UNIX) to turn these options on or off.

Note on CYGWIN: Cygwin is not a WIN32 platform, but it is a
DLL-platform where libraries normally goes in the bin directory. Running
the self-tests handles this automatically but if you want to use the binaries
in the 'build'-tree you can either:

1) install before running the tests and also set your PATH to include
"/usr/local/lib"

2) setting the PATH to include the build directory where the libraries are
there is a sh-compatible command script to do that for you. From the top
of the Cgreen source directory do:

. cygwin-setup.sh

### Use directly

You can use `Cgreen` from the source tree without actually
installing. Just set your compilation includes to include
`<path_to_cgreen>/include` and link with the built library by pointing
the linker to `<path_to_cgreen>/build/src/` and use `-lcgreen`. E.g.

$ cc ... -I/home/me/cgreen/include ...
$ cc ... -L/home/me/cgreen/build/src -lcgreen ...

### Install

You can also install `Cgreen` with

$ make install

which will install `Cgreen` in what `CMake` considers standard
locations for your environment. Assuming that is `/usr/local` you
should now be able to compile and link using

$ cc ... -I/usr/local/include ...
$ cc ... -L/usr/local/lib -lcgreen ...

24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ all: build-it

.PHONY:debug
debug: build
cd build; cmake -DCMAKE_BUILD_TYPE:string=Debug ..; make
cd build; cmake -DCMAKE_BUILD_TYPE:string=Debug ..; $(BUILDER)

32bit: build
-rm -rf build; mkdir build; cd build; cmake -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" ..; make
-rm -rf build; mkdir build; cd build; cmake -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" $(GENERATOR) ..; $(BUILDER)

.PHONY:test
test: build/Makefile
cd build; make check
test: build-it
cd build; $(BUILDER) check

.PHONY:clean
clean: build/Makefile
cd build; make clean
cd build; $(BUILDER) clean

.PHONY:package
package: build/Makefile
cd build; make package
cd build; $(BUILDER) package

.PHONY:install
install: build
ifeq ($(OS),Msys)
# Thanks to https://stackoverflow.com/a/46027426/204658
cd build; make install DESTDIR=/
cd build; $(BUILDER) install DESTDIR=/
else
cd build; make install
cd build; $(BUILDER) install
endif

# This is kind of a hack to get a quicker and clearer feedback when
Expand Down Expand Up @@ -120,10 +120,10 @@ unit: build-it

.PHONY: doc
doc: build
cd build; cmake -DCGREEN_WITH_HTML_DOCS:bool=TRUE ..; make; cmake -DCGREEN_WITH_HTML_DOCS:bool=False ..; echo open $(PWD)/build/doc/cgreen-guide-en.html
cd build; cmake -DCGREEN_WITH_HTML_DOCS:bool=TRUE ..; $(BUILDER); cmake -DCGREEN_WITH_HTML_DOCS:bool=False ..; echo open $(PWD)/build/doc/cgreen-guide-en.html

pdf: build
cd build; cmake -DCGREEN_WITH_PDF_DOCS:bool=TRUE ..; make; cmake -DCGREEN_WITH_PDF_DOCS:bool=False ..; echo open $(PWD)/build/doc/cgreen-guide-en.pdf
cd build; cmake -DCGREEN_WITH_PDF_DOCS:bool=TRUE ..; $(BUILDER); cmake -DCGREEN_WITH_PDF_DOCS:bool=False ..; echo open $(PWD)/build/doc/cgreen-guide-en.pdf

chunked: doc
asciidoctor-chunker build/doc/cgreen-guide-en.html -o docs
Expand All @@ -138,6 +138,10 @@ build:
mkdir -p build

build/Makefile: | build
ifeq ($(OS),Darwin)
cd build; cmake -DCMAKE_OSX_ARCHITECTURES="arm64e;x86_64" ..
else
cd build; cmake ..
endif

.SILENT:
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/cgreen-devs/cgreen.svg?branch=master)](https://travis-ci.com/cgreen-devs/cgreen)
[![Build Status](https://app.travis-ci.com/cgreen-devs/cgreen.svg?branch=master)](https://app.travis-ci.com/github/cgreen-devs/cgreen)
[![Coverage Status](https://coveralls.io/repos/cgreen-devs/cgreen/badge.svg?branch=master&service=github)](https://coveralls.io/github/cgreen-devs/cgreen?branch=master)

![](https://github.com/cgreen-devs/cgreen/blob/master/doc/logo.png?s=300)
Expand Down
6 changes: 4 additions & 2 deletions cmake/Modules/DefineCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ if (UNIX)
endif (CGREEN_INTERNAL_WITH_GCOV)

add_definitions(-D_REENTRANT) # for gmtime_r()
add_definitions(-D_XOPEN_SOURCE) # for popen() and pclose()
add_definitions(-D_XOPEN_SOURCE_EXTENDED) # for strdup(), which isn't part of C99
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES ".*OpenBSD.*")
add_definitions(-D_XOPEN_SOURCE) # for popen() and pclose()
add_definitions(-D_XOPEN_SOURCE_EXTENDED) # for strdup(), which isn't part of C99
endif()
add_definitions(-D__STDC_FORMAT_MACROS) # for PRI*PTR format macros, required by C99

if (NOT CYGWIN)
Expand Down
3 changes: 3 additions & 0 deletions contrib/cgreen-mocker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pycparser
packaging

0 comments on commit 873c5c9

Please sign in to comment.