Commit 5e3563c4 authored by Florian Goth's avatar Florian Goth
Browse files

initial checkin

parents
stages:
- build
- test
- docs
- SWIG
.src_except_template: &src_except_definition
except:
changes:
- .gitignore
- CITATION
- README.md
- doc/*
.BUILD_template: &build_definition
stage: build
<<: *src_except_definition
script:
- cmake -E make_directory build
- cd build
- cmake ..
- make
.TEST_template: &test_definition
stage: test
<<: *src_except_definition
script:
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE ..
- cmake --build . --target all --config Release
- ctest -O log.txt
- cat log.txt | grep "tests passed" | cut -d " " -f 1
template_Stretch:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:stretch-gxx
<<: *build_definition
template_Buster:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:buster-gxx
<<: *build_definition
template_Bullseye:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-gxx
<<: *build_definition
template_Buster_clang:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:buster-clang
stage: build
<<: *src_except_definition
script:
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER=clang++ ..
- make all VERBOSE=1
template_Bullseye_clang:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-clang
stage: build
<<: *src_except_definition
script:
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER=clang++ ..
- make
template_Bullseye-PGI-21-03:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-pgi-21-03
stage: build
<<: *src_except_definition
script:
- apt-get update && apt-get install -y cmake
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER="pgc++" ..
- make all VERBOSE=1
template_Bullseye-Intel-21:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-intel-oneapi-icpc
stage: build
<<: *src_except_definition
script:
- apt-get update && apt-get install -y cmake
- . /opt/intel/oneapi/setvars.sh
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER="icpc" ..
- make all VERBOSE=1
template_test_Stretch:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:stretch-gxx
<<: *test_definition
template_test_Buster:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:buster-gxx
<<: *test_definition
template_test_Bullseye_clang:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-clang
stage: test
<<: *src_except_definition
script:
- echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list
- apt-get install -y -t bullseye-backports cmake
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER=clang++ ..
- cmake --build . --target all --config Release
- ctest --version
- ctest -O log.txt --output-junit marqov-junit.xml
- cat log.txt | grep "tests passed" | cut -d " " -f 1
artifacts:
when: always
reports:
junit: ./build/marqov-junit.xml
template_Bullseye_doxygen:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-clang
stage: build
script:
- apt-get update && apt-get install -y doxygen graphviz pdf2svg plantuml
- cd doc
- cmake -E make_directory doxygen
- doxygen Doxyfile-marqov.cfg
template_Bullseye_breathe:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-clang
stage: docs
needs: ["template_Bullseye_doxygen"]
artifacts:
paths:
- doc/*
script:
- apt-get update && apt-get install -y doxygen graphviz pdf2svg python3-breathe python3-sphinx python3-sphinx-rtd-theme python3-sphinxcontrib.plantuml plantuml
- cd doc/
- doxygen Doxyfile-marqov-breathe.cfg
- make html
template_sphinx_docs:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-gfortran-blas-lapack-fftw-hdf5-scipy3
stage: docs
needs: ["template_Bullseye_doxygen"]
artifacts:
paths:
- doc/*
script:
- apt-get update && apt-get install -y doxygen graphviz pdf2svg python3-breathe python3-sphinx python3-sphinx-rtd-theme git python3-numpy python3-colorama python3-h5py python3-matplotlib python3-sphinxcontrib.plantuml plantuml
- ./scripts/compilefulldocs.sh
template_Bullseye_SWIG_python:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-gfortran-blas-lapack-fftw-hdf5-scipy3
stage: SWIG
<<: *src_except_definition
script:
- apt-get update && apt-get install -y g++ swig
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE ..
- make pyShowcase VERBOSE=1
template_Bullseye_SWIG_optionals:
image: git.physik.uni-wuerzburg.de:25812/z03/pdi/debian:bullseye-gfortran-blas-lapack-fftw-hdf5-scipy3
stage: SWIG
allow_failure: true
<<: *src_except_definition
script:
- apt-get update && apt-get install -y g++ swig lua5.4-dev default-jdk r-base-dev ocaml-4.11.1
- cmake -E make_directory build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE ..
- make pyShowcase JNIShowcase LuaShowcase RShowcase ocamlShowcase VERBOSE=1
# YAML 1.2
---
cff-version: "1.1.0"
title: cxx_template
message: "See the documentation of CFF, the citation file format for more details."
repository-code: ""
license: "MIT"
authors:
-
family-names: Doe
given-names: Joe
keywords:
- "template"
...
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(cxx_template CXX)
# Add our cmake module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# make the Release build the default and tell the user that none is specified.
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Some code to have git revision strings in our output files.
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1) # the git revision is available in GIT_SHA1
# now we need to retrieve the branch
if (NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(GIT_FOUND)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE GIT_BRANCH)
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
else()
set(GIT_BRANCH, "N/A")
endif()
# Try to us at least the native cpu instruction set if possible on the platform
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
CHECK_CXX_COMPILER_FLAG("-mtune=native" COMPILER_SUPPORTS_MTUNE_NATIVE)
if(COMPILER_SUPPORTS_MTUNE_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=native")
endif()
# Add our sub folders
add_subdirectory(lib)
add_subdirectory(fl)
add_subdirectory(bin)
add_subdirectory(testsuite)
enable_testing()
MIT License
Copyright (c) <year> <name>
<E-Mail>
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
# mytool <- Try to come up with a cool name!
(Abstract/Intro/Header)
write 2-3 sentences what your code does.
Especially try to explain in some sentences what the purpose of the code is.
## Author
Who are you?
## License
Think about which license you put your code under.
This gives future users confidence under which circumstances they may use it.
For help see here:
https://choosealicense.com/licenses/
A talk: https://av.tib.eu/media/37829
A suitable choice if you want to put your work in the public domain is the MIT License:
So write something like,
This work is licensed under the
MIT License
Please note that if you have inherited the code,
the original author or his supervisor is also a part of the decision!
## Prerequisites/environment
Give some hints about the environment that your program expects.
Is it meant for an HPC System? a Desktop? Windows/Linux?
This template utilizes cmake and utilizes doxygen and sphinx.
### tools
Note the tools that you require.
Fortran Compiler? Python interpreter? bash for scripts?
### external libraries
Note the external library dependencies:
You need Lapack? Boost?
### included libraries
you copied some source files from somewhere else into your code?
Please note here which libraries/programs/source files you copied
in which version/git commit and also note their license.
Note that this may affect the freedom you have in choosing your license!
## Configuration
this template follows standard cmake procedures:
```console
cmake -E make_directory build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target all --config Release
```
which will by default build all possible targets.
## Testing
Think about incorporating tests into your program.
Ideally you can include them into gitlab's CI pipeline: https://docs.gitlab.com/ee/ci/quick_start/
We provide some Docker images you can use for your environment here: https://git.physik.uni-wuerzburg.de/Z03/pdi
## Usage
Note on how to use your program. Is it part of a bigger pipeline with programs that are dependent on it?
## References
Note the references that you used to create the code,
but also give the publications that are related to your work on the code.
## Todo Doc #
A hint for yourself, here you can give todos for the documentation.
## Todo Code #
A hint on what's left to do in the code.
### Notes
A place for other notes.
- Did you implement as part of your project something other fancy that people might be interested in?
- ?
add_executable(testbin testbin.cpp)
set_target_properties(testbin PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES)
set_target_properties(testbin PROPERTIES COMPILE_FLAGS " ${COMPILE_FLAGS} -DGIT_SHA1=\"${GIT_SHA1}\" -DGIT_BRANCH=\"${GIT_BRANCH}\"" )
target_include_directories(testbin PUBLIC ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(testbin libmy)
\ No newline at end of file
/*
* MIT License
Copyright (c) <year> <name>
<E-Mail>
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
*/
#include <string>
#include <vector>
#include <iostream>
#include "mylib.h"
//the following macro seems to be necessary for dumping string defines...
#define XSTR(x) STR(x)
#define STR(x) #x
int main(int argc, char* argv[])
{
std::cout<<"Welcome to testbin! This code is licensed under the MIT License!"<<std::endl;
std::cout<<"This is git revision: "<<std::string(XSTR(GIT_BRANCH)) + ", SHA1: " + std::string( XSTR(GIT_SHA1) )<<std::endl;
std::cout<<func(3)<<std::endl;
std::string hw{"Hello World"};
std::cout<<tfunc(hw)<<std::endl;
return EXIT_SUCCESS;
}
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
if(NOT IS_DIRECTORY "${GIT_DIR}")
file(READ ${GIT_DIR} worktree)
string(REGEX REPLACE "gitdir: (.*)worktrees(.*)\n$" "\\1" GIT_DIR ${worktree})
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
"${GIT_EXECUTABLE}"
diff-index --quiet HEAD --
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var} "CLEAN" PARENT_SCOPE)
else()
set(${_var} "DIRTY" PARENT_SCOPE)
endif()
endfunction()
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()
This diff is collapsed.
@INCLUDE = "./Doxyfile-custom.cfg"
GENERATE_XML = YES
GENERATE_HTML = NO
# The configuration of Doxygen for mylib
@INCLUDE = "./Doxyfile-base.cfg"
PROJECT_NAME = "mylib"
PROJECT_BRIEF = A template with a sample project