C++ tools focused on Diameter Protocol.
This image is already available at github container registry
and docker hub
for every repository tag
, and also for master as latest
:
$ docker pull ghcr.io/testillano/diametertools:<tag>
You could also build it using the script ./build.sh
located at project root:
$ ./build.sh --project-image
This image is built with ./Dockerfile
.
To run compilation over this image, just run with docker
. The entrypoint
(check it at ./deps/build.sh
) will fall back from cmake
(looking for CMakeLists.txt
file at project root, i.e. mounted on working directory /code
to generate makefiles) to make
, in order to build your source code. There are two available environment variables used by the builder script of this image: BUILD_TYPE
(for cmake
) and MAKE_PROCS
(for make
):
$ envs="-e MAKE_PROCS=$(grep processor /proc/cpuinfo -c) -e BUILD_TYPE=Release"
$ docker run --rm -it -u $(id -u):$(id -g) ${envs} -v ${PWD}:/code -w /code \
ghcr.io/testillano/diametertools:<tag>
This image is already available at github container registry
and docker hub
for every repository tag
, and also for master as latest
:
$ docker pull ghcr.io/testillano/diametertools_builder:<tag>
You could also build it using the script ./build.sh
located at project root:
$ ./build.sh --builder-image
This image is built with ./Dockerfile.build
.
Builder image is used to build the project library. To run compilation over this image, again, just run with docker
:
$ envs="-e MAKE_PROCS=$(grep processor /proc/cpuinfo -c) -e BUILD_TYPE=Release"
$ docker run --rm -it -u $(id -u):$(id -g) ${envs} -v ${PWD}:/code -w /code \
ghcr.io/testillano/diametertools_builder:<tag>
You could generate documentation passing extra arguments to the entry point behind:
$ docker run --rm -it -u $(id -u):$(id -g) ${envs} -v ${PWD}:/code -w /code \
ghcr.io/testillano/diametertools_builder::<tag>-build "" doc
You could also build the library using the script ./build.sh
located at project root:
$ ./build.sh --project
This is a cmake-based building library, so you may install cmake:
$ sudo apt-get install cmake
And then generate the makefiles from project root directory:
$ cmake .
You could specify type of build, 'Debug' or 'Release', for example:
$ cmake -DCMAKE_BUILD_TYPE=Debug .
$ cmake -DCMAKE_BUILD_TYPE=Release .
You could also change the compilers used:
$ cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_C_COMPILER=/usr/bin/gcc
or
$ cmake -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang
$ make
$ make clean
$ make doc
$ cd docs/doxygen
$ tree -L 1
.
├── Doxyfile
├── html
├── latex
└── man
$ sudo make install
Optionally you could specify another prefix for installation:
$ cmake -DMY_OWN_INSTALL_PREFIX=$HOME/mylibs/ert_diametertools
$ make install
$ cat install_manifest.txt | sudo xargs rm
To embed the library directly into an existing CMake project, place the entire source tree in a subdirectory and call add_subdirectory()
in your CMakeLists.txt
file:
add_subdirectory(ert_diametertools)
...
add_library(foo ...)
...
target_link_libraries(foo PRIVATE ert_diametertools::ert_diametertools)
Since CMake v3.11, FetchContent can be used to automatically download the repository as a dependency at configure type.
Example:
include(FetchContent)
FetchContent_Declare(ert_diametertools
GIT_REPOSITORY https://github.com/testillano/diametertools.git
GIT_TAG vx.y.z)
FetchContent_GetProperties(ert_diametertools)
if(NOT ert_json_POPULATED)
FetchContent_Populate(ert_diametertools)
add_subdirectory(${ert_diametertools_SOURCE_DIR} ${ert_diametertools_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
target_link_libraries(foo PRIVATE ert_diametertools::ert_diametertools)
Please, execute astyle
formatting (using frankwolf image) before any pull request:
$ sources=$(find . -name "*.hpp" -o -name "*.cpp")
$ docker run -i --rm -v $PWD:/data frankwolf/astyle ${sources}