Skip to content

Commit 083712e

Browse files
committed
initial version
1 parent b78c166 commit 083712e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+14538
-18
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Makefile
2+
cmake_install.cmake
3+
cpm-package-lock.cmake
4+
CTestTestfile.cmake
5+
DartConfiguration.tcl
6+
/build/
7+
CMakeFiles/
8+
CMakeCache.txt
9+
CPM_*.cmake
10+
/Testing/
11+
CMakeDoxyfile.in
12+
CMakeDoxygenDefaults.cmake
13+
CMakeSettings.json
14+
/.vs/
15+
/out/

.gitlab-ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
before_script:
2+
- apt-get update
3+
- apt-get install --force-yes -y python lcov
4+
- apt remove --purge --auto-remove cmake
5+
- apt install -y software-properties-common lsb-release cmake
6+
7+
build:
8+
tags:
9+
- Ubuntu2004-64bit
10+
script:
11+
- cmake -DCODE_COVERAGE=ON .
12+
- make
13+
- ctest
14+
- make maxpluslibcoverage
15+
artifacts:
16+
expire_in: 14d
17+
when: always
18+
paths:
19+
- ./build/coverage/

CMakeLists.txt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
2+
project(MaxPLusLib)
3+
4+
option(CODE_COVERAGE "Compile for code coverage (default OFF)." OFF)
5+
6+
set(CPM_USE_LOCAL_PACKAGES ON)
7+
include(config/get_cpm.cmake)
8+
9+
# Only do these if this is the main project, and not if it is included through add_subdirectory
10+
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
11+
12+
if(NOT CMAKE_BUILD_TYPE)
13+
set(CMAKE_BUILD_TYPE Release)
14+
endif()
15+
16+
# Let's ensure -std=c++xx instead of -std=g++xx
17+
set(CMAKE_CXX_EXTENSIONS OFF)
18+
set(CMAKE_CXX_STANDARD 17)
19+
20+
# # Set output folders
21+
set(MAXPLUSLIB_BUILD_DIRECTORY ${CMAKE_BINARY_DIR}/build)
22+
set(MAXPLUSLIB_COVERAGE_DIRECTORY ${MAXPLUSLIB_BUILD_DIRECTORY}/coverage)
23+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${MAXPLUSLIB_BUILD_DIRECTORY}/lib)
24+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MAXPLUSLIB_BUILD_DIRECTORY}/lib)
25+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MAXPLUSLIB_BUILD_DIRECTORY}/bin)
26+
27+
# Let's nicely support folders in IDEs
28+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
29+
30+
# Testing only available if this is the main app
31+
# Note this needs to be done in the main CMakeLists
32+
# since it calls enable_testing, which must be in the
33+
# main CMakeLists.
34+
include(CTest)
35+
36+
find_package(Doxygen OPTIONAL_COMPONENTS dot)
37+
if (Doxygen_FOUND)
38+
add_subdirectory(documentation)
39+
else()
40+
message(STATUS "Doxygen not found, not building docs")
41+
endif()
42+
43+
44+
endif()
45+
46+
### CODE COVERAGE ###
47+
if(${CODE_COVERAGE})
48+
message("Compiling for code coverage analysis.")
49+
set(CMAKE_BUILD_TYPE Debug)
50+
51+
include(config/CodeCoverage.cmake)
52+
append_coverage_compiler_flags()
53+
# add_compile_options("-fprofile-arcs")
54+
# add_compile_options("-ftest-coverage")
55+
endif()
56+
57+
enable_testing()
58+
59+
add_custom_target(maxpluslibcoverage_setup
60+
${CMAKE_COMMAND} -E make_directory ${MAXPLUSLIB_COVERAGE_DIRECTORY}
61+
)
62+
63+
add_custom_target(maxpluslibcoverage1
64+
lcov --capture --directory ${CMAKE_BINARY_DIR} --output ${MAXPLUSLIB_BUILD_DIRECTORY}/coverage.info
65+
DEPENDS maxpluslibcoverage_setup
66+
)
67+
68+
add_custom_target(maxpluslibcoverage2
69+
lcov -r ${MAXPLUSLIB_BUILD_DIRECTORY}/coverage.info /usr/include/\* -o ${MAXPLUSLIB_BUILD_DIRECTORY}/coverage.info
70+
DEPENDS maxpluslibcoverage1
71+
)
72+
73+
add_custom_target(maxpluslibcoverage
74+
genhtml ${MAXPLUSLIB_BUILD_DIRECTORY}/coverage.info --output-directory ${MAXPLUSLIB_COVERAGE_DIRECTORY}/
75+
DEPENDS maxpluslibcoverage2
76+
)
77+
78+
79+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
80+
81+
add_subdirectory(src)

Dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# build with:
2+
# docker build . -t maxpluslib
3+
4+
FROM ubuntu:20.04
5+
6+
# the following lines are to avoid the interactive time zone question during install
7+
ENV TZ=Europe/Amsterdam
8+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
9+
10+
RUN apt-get update
11+
RUN apt-get install --force-yes -y libxml2-dev libxml2-utils python lcov build-essential make cmake pkg-config git doxygen graphviz
12+
13+
WORKDIR /usr/
14+
15+
# copy relevant input directories
16+
# don't copy existing cmake cache files
17+
COPY src ./src
18+
COPY include ./include
19+
COPY documentation ./documentation
20+
COPY config ./config
21+
COPY CMakeLists.txt .
22+
23+
# make release executables
24+
RUN cmake -DCMAKE_BUILD_TYPE=Release .
25+
RUN make
26+
RUN mkdir /maxpluslib
27+
RUN mkdir /maxpluslib/lib
28+
RUN mkdir /maxpluslib/include
29+
RUN cp -R ./build/lib/* /maxpluslib/lib
30+
RUN cp -R ./include/maxplus /maxpluslib/include/
31+
32+
# execute tests
33+
RUN cmake -DCODE_COVERAGE=ON .
34+
RUN make
35+
# run test and continue also if test fails
36+
RUN mkdir /maxpluslibtest
37+
RUN ctest > /maxpluslibtest/testlog.txt || :
38+
39+
#documentation
40+
RUN mkdir /maxpluslibdoc
41+
RUN make doc
42+
RUN cp -R ./documentation/html /maxpluslibdoc/
43+
44+
# get coverage information
45+
RUN make maxpluslibcoverage
46+
RUN mkdir /maxpluslibcoverage
47+
RUN cp -R ./build/coverage/* /maxpluslibcoverage/
48+
49+
VOLUME /maxpluslib
50+
VOLUME /maxpluslibtest
51+
VOLUME /maxpluslibdoc
52+
VOLUME /maxpluslibcoverage

LICENSE

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1-
MIT License
1+
Copyright 2023 Eindhoven University of Technology
22

3-
Copyright (c) 2023 Model-Based-Design-Lab
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
116

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# MaxPlusLib
2+
3+
A library of max-plus algebra related algorithms.
4+
It was originally developed to support the analysis of timed dataflow models in the [SDF3](http://www.es.ele.tue.nl/sdf3) library.
5+
6+
7+
8+
Note that there is additionally a Python library that supports a different set of max-plus algebra related algorithms:
9+
- <https://github.com/Model-Based-Design-Lab/cmlib>
10+
11+
## Getting started
12+
13+
The library can be built with cmake on a Linux platform as follows.
14+
15+
``` bash
16+
cmake .
17+
make
18+
```
19+
20+
This creates a static library that can be used with the provided include files.
21+
22+
Use the following to run the tests and coverage results.
23+
24+
``` bash
25+
cmake -DCODE_COVERAGE=ON .
26+
ctest
27+
make maxpluslibcoverage
28+
```
29+
30+
The documentation can be built with the following command.
31+
32+
``` bash
33+
make documentation
34+
```
35+
36+
### Build wih Visual Studio
37+
38+
In Visual Studio, make sure that the `C++ CMake tools for Windows` option is installed as part of the `Desktop development with C++` modules of Visual Studio.
39+
Start VS and select `Open a local folder` and select the main folder of the repository (with the top level `CMakeLists.txt` file).
40+
Select `Project->Configure Cache` and then `Build->Build All`.
41+
42+
### Build with docker
43+
44+
Create a docker image from the provided `Dockerfile`
45+
46+
``` bash
47+
docker build . -t maxpluslib
48+
```
49+
50+
Wait for the construction of the image to complete.
51+
The static library, include files, test and test coverage results and documentation reside in mounted volumes in the image.
52+
The results can be copied from the image to the host by creating a container from the image and copying the volumes to the host as needed.
53+
54+
``` bash
55+
docker cp CONTAINER:/maxpluslib/ <host path>
56+
docker cp CONTAINER:/maxpluslibtest/ <host path>
57+
docker cp CONTAINER:/maxpluslibdoc/ <host path>
58+
docker cp CONTAINER:/maxpluslibcoverage/ <host path>
59+
```
60+
61+
62+
## Authors and acknowledgment
63+
64+
This library contains contributions by the following authors.
65+
66+
- Marc Geilen (m.c.w.geilen@tue.nl)
67+
- Bram van der Sanden
68+
- Sander Stuijk
69+
- Peter Poplavko
70+
- Bart Theelen
71+
72+
## Documentation
73+
74+
To make documentation, install doxygen and graphviz and run the following command.
75+
76+
``` bash
77+
make doc
78+
```
79+
80+
Documentation is built in `documentation/hmtml`.
81+
82+
## Contact Information
83+
84+
For questions regarding the library, contact Marc Geilen (m.c.w.geilen@tue.nl)
85+
86+
87+
## License
88+
89+
This software is licensed under the MIT License
90+

0 commit comments

Comments
 (0)