Commit 1fc38ca0 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Merge branch 'development/experimental-migration' into 'master'

Merge 0.1 head

See merge request !97
parents 1b4175e3 436d6cc7
Pipeline #18253 passed with stages
in 11 minutes and 18 seconds
......@@ -25,9 +25,25 @@ BraceWrapping:
NamespaceIndentation: All
FixNamespaceComments: true
IndentWrappedFunctionNames: true
IndentWrappedFunctionNames: false # Do not indent after function def break
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakTemplateDeclarations: true
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: true
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
MaxEmptyLinesToKeep: 2
# For loop
ForEachMacros: ['mln_forall', 'mln_foreach']
ForEachMacros: ['mln_forall', 'mln_foreach', 'mln_foreach_new', 'mln_reverse_foreach']
/build*
/cmake-build-*
/doc/build
/doc/html
/doc/doxyxml
/doc/source/images/*.png
.vscode
/test_package/build
/doc/source/_build
.vs
.idea
*.pyc
compile_commands.json
\ No newline at end of file
compile_commands.json
/venv_*/
/**/.DS_Store
.nfs*
\ No newline at end of file
stages:
- build
- test
- bench
- deploy
image: carlinet/buildimage
cache:
paths:
- .cache/conan/data
variables:
FEDORA_RAWHIDE: "${CI_REGISTRY}/olena/pylene-dockers/fedora-rawhide"
FEDORA_31: "${CI_REGISTRY}/olena/pylene-dockers/fedora-31"
PACKAGE_NAME: "pylene" # Conan package name
PACKAGE_TAG: "stable" # Conan tag
PACKAGE_VERSION: "head" # Version to build
CMAKE_BUILD_PARALLEL_LEVEL: 6
CONAN_USER: "lrde"
before_script:
- conan config set storage.path="${CI_PROJECT_DIR}/.cache/conan/data"
########
# Test #
########
windows-debug:
before_script:
- conan config set storage.path="${env:CI_PROJECT_DIR}\.cache\conan\data"
- Invoke-BatchFile -Path "${env:VCVAR2019}" -Parameters "${env:ARCH}"
stage: build
script:
- mkdir build; cd build
- conan install .. -s build_type=Debug --build missing
- cmake .. -G Ninja -DCMAKE_BUILD_TYPE=debug -D CMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake"
- cmake --build . --target build-tests
- ctest -L UnitTests --schedule-random --output-on-failure
dependencies: []
artifacts:
reports:
junit: [build/tests/UT*.xml, build/bench/tests/UT*.xml]
expire_in: 1 week
tags: [ windows ]
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH == "master"
- when: manual
variables:
VCVAR2019: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat'
ARCH: x64
.job-build-linux-base: &distcheck-linux-base
stage: test
stage: build
script:
- mkdir build && cd build
- cmake .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DPYLENE_BUILD_BENCHMARKS=OFF
- cmake --build . --target check
- conan install .. -pr gcc-9 --build missing -e CXX=g++ -e CC=gcc
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DSANITIZE_ADDRESS=$ASAN -DSANITIZE_MEMORY=$MSAN -DSANITIZE_UNDEFINED=$UBSAN
- cmake --build . --target Pylene
- cmake --build . --target build-tests
- ctest -L UnitTests --schedule-random --output-on-failure
dependencies: []
artifacts:
reports:
junit: [build/tests/UT*.xml, build/bench/tests/UT*.xml]
expire_in: 1 week
# Msan not available for gcc. It requires instrumented libstdc++ and instrumented thirdparties so it is disabled for now.
# No tsan because no multithreaded code for now
# Asan, memsan and tsan are incompatible with each other within the same binary
# Asan and ubsan can work together
distcheck-linux-gcc-release:
distcheck-linux-gcc9-release:
<<: *distcheck-linux-base
image: ${FEDORA_31}
variables:
PYLENE_CONFIGURATION: "Release"
CXX: "g++"
CC: "gcc"
ASAN: "OFF"
MSAN: "OFF"
UBSAN: "OFF"
distcheck-linux-clang-release:
<<: *distcheck-linux-base
variables:
PYLENE_CONFIGURATION: "Release"
CXX: "clang++"
CC: "clang"
distcheck-linux-gcc-debug:
distcheck-linux-gcc9-debug-asan-ubsan:
<<: *distcheck-linux-base
image: ${FEDORA_31}
variables:
PYLENE_CONFIGURATION: "Debug"
CXX: "g++"
CC: "gcc"
ASAN: "ON"
MSAN: "OFF"
UBSAN: "ON"
distcheck-linux-clang-debug:
distcheck-linux-coverage:
<<: *distcheck-linux-base
image: ${FEDORA_31}
after_script:
- mkdir coverage
- gcovr --root pylene build -s --xml cobertura --html-details coverage/index.html
variables:
PYLENE_CONFIGURATION: "Debug"
CXX: "clang++"
CC: "clang"
CXX: "g++"
CC: "gcc"
CXXFLAGS: "-fprofile-arcs -ftest-coverage"
CFLAGS: "-fprofile-arcs -ftest-coverage"
artifacts:
paths:
- coverage/
reports:
cobertura: cobertura
expire_in: 1 week
coverage: '/lines: \d+\.\d+\%/'
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH == "master"
- when: manual
build-doc-images:
stage: build
#########
# Bench #
#########
.job-bench-linux-base: &distbench-linux-base
stage: bench
script:
- mkdir build && cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DPYLENE_BUILD_BENCHMARKS=OFF
- cmake --build . --target build-images
- conan install .. -pr gcc-9 --build missing -e CXX=g++ -e CC=gcc
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release
- cmake --build . --target fetch-external-data
- cmake --build . --target build-bench
- cmake --build . --target run-all-benchmarks
- ctest -L SpeedTests -V
tags: [ "pylene-benchmarks" ]
when: manual
dependencies: []
artifacts:
name: "benchmark-results"
paths:
- doc/source/images
expire_in: 2 days
- build/bench/*.json
expire_in: 1 week
distbench-linux-gcc9-release:
<<: *distbench-linux-base
image: ${FEDORA_31}
variables:
CXX: "g++"
CC: "gcc"
#################
......@@ -59,14 +154,17 @@ build-doc-images:
#################
.documentation-base: &documentation-base
stage: test
image: ${FEDORA_31}
stage: build
script:
- cd doc
- doxygen
- sphinx-build -b html source ../public
- mkdir build && cd build
- conan install -u .. -pr gcc-9 --build missing -e CXX=g++ -e CC=gcc
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release
- cmake --build . --target build-doc
- mkdir ../public && mv doc/sphinx/* ../public/
artifacts:
name: "documentation"
expire_in: 2 days
expire_in: 1 week
paths:
- public/
......@@ -74,10 +172,26 @@ build-doc-images:
documentation:
<<: *documentation-base
except:
- dev
- dev
##########
# Deploy #
##########
# Deploy
pages:
<<: *documentation-base
only:
- dev
- dev
package:
image: ${FEDORA_31}
stage: deploy
dependencies: []
script:
- mkdir build && cd build
- conan user carlinet -r lrde-public -p $CONAN_LRDE_API_KEY
- conan create .. $CONAN_USER/$PACKAGE_TAG -pr gcc-9 --build missing -e CXX=g++ -e CC=gcc
- conan upload -r lrde-public --all $PACKAGE_NAME/$PACKAGE_VERSION@$CONAN_USER/$PACKAGE_TAG
rules:
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development/cpp20"
{
"variant": null,
"activeEnvironments": [],
"codeModel": null
}
\ No newline at end of file
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${workspaceRoot}",
"${workspaceFolder}/pylene/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "/usr/local/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"configurationProvider": "vector-of-bool.cmake-tools"
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
"${workspaceRoot}"
],
"defines": [
"_DEBUG",
"UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
\ No newline at end of file
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "lldb",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.out",
"args": [],
"stopOnEntry": false,
"cwd": "${workspaceFolder}",
"linux": {
"args": [],
"terminal": "external",
"initCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
\ No newline at end of file
{
}
\ No newline at end of file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "mkdir-remote",
"type": "shell",
"command": "ssh node7 'mkdir -p /work/mroynard/lrde/pylene/build-remote'",
"group": "build"
},
{
"label": "mkdir-remote-release",
"type": "shell",
"command": "ssh node7 'mkdir -p /work/mroynard/lrde/pylene/build-remote-release'",
"group": "build"
},
{
"label": "conan-remote",
"dependsOn": "mkdir-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && source ../venv_python371/bin/activate && ../venv_python371/bin/conan install --build missing -o benchmark=True -o gtest=True -o freeimage=True ..'",
"group": "build"
},
{
"label": "conan-remote-release",
"dependsOn": "mkdir-remote-release",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote-release && source ../venv_python371/bin/activate && ../venv_python371/bin/conan install --build missing -o benchmark=True -o gtest=True -o freeimage=True ..'",
"group": "build"
},
{
"label": "configure-remote",
"dependsOn": "conan-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..'",
"group": "build"
},
{
"label": "configure-remote-release",
"dependsOn": "conan-remote-release",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote-release && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..'",
"group": "build"
},
{
"label": "build-check-remote",
"dependsOn": "configure-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && cmake --build . --target check --config Debug -- -j12 | tee check.log.txt'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "only-build-check-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && cmake --build . --target check --config Debug -- -j12 | tee check.log.txt'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "build-benchmarks-remote-release",
"dependsOn": "configure-remote-release",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote-release && cmake --build . --target benchmarks --config Release -- -j12 | tee bench.log.txt'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "only-build-benchmarks-remote-release",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote-release && cmake --build . --target benchmarks --config Release -- -j12 | tee bench.log.txt'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "run-benchmarks-remote-release",
"dependsOn": "build-benchmarks-remote-release",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote-release && cmake --build . --target benchmarks-run --config Release -- -j1'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "build-doc-remote",
"dependsOn": "configure-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && source ../venv_python371/bin/activate && cmake --build . --target doc -- -j12 | tee doc.log.txt'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "only-build-doc-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && source ../venv_python371/bin/activate && cmake --build . --target doc -- -j12 | tee doc.log.txt'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "clean-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && rm -rf CMakeCache.txt CMakeFiles'",
"group": "build",
},
{
"label": "clean-remote-release",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote-release && rm -rf CMakeCache.txt CMakeFiles'",
"group": "build",
},
{
"label": "clang-format-current",
"type": "shell",
"command": "clang-format -i ${file} ",
"group": "none"
}
]
}
\ No newline at end of file
cmake_minimum_required(VERSION 3.8.2)
project(MILENA)
project(Pylene)
# Add FindTBB directory to CMake's module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
find_package(Boost 1.42 COMPONENTS program_options REQUIRED)
if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_set_rpath()
conan_set_std()
conan_set_fpic()
conan_check_compiler()
conan_set_libcxx()
conan_set_vs_runtime()
endif()
if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake")
endif ()
find_package(Boost 1.58 COMPONENTS program_options REQUIRED)
find_package(FreeImage REQUIRED)
find_package(TBB)
find_package(Qt4)
# CONFIGURATION OPTIONS
set(MLN_USE_TBB YES CACHE BOOL "Set to NO to disable use of TBB and parallelization")
option(PYLENE_BUILD_BENCHMARKS "Require Google Benchmark library. Set to YES to enable the compilation of benchmarks." YES)
# Proper project creation
set(MLN_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
if(MSVC OR APPLE)
#dummy static project not linked anywere needed so that a vcxproj is generated with the sources in the solution
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
file(GLOB_RECURSE MLN_SOURCES "${MLN_INCLUDE_DIR}/*.hpp")
add_library(Mln_srcs EXCLUDE_FROM_ALL STATIC ${MLN_SOURCES})
set_target_properties(Mln_srcs PROPERTIES LINKER_LANGUAGE CXX)
# target_compile_features(Mln_srcs PUBLIC cxx_std_14)
target_include_directories(Mln_srcs PUBLIC ${MLN_INCLUDE_DIR})
source_group(TREE ${MLN_INCLUDE_DIR} FILES ${MLN_SOURCES})
endif()
add_library(Mln INTERFACE)
target_include_directories(Mln INTERFACE ${MLN_INCLUDE_DIR})
# CONFIGURE COMPILER LAUNCHERS
option(USE_CCACHE "Use ccache as compiler launcher" ON)
option(USE_DISTCC "Use ccache as compiler launcher" OFF)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
include_directories(${FreeImage_INCLUDE_DIRS})
link_directories(${FreeImage_LIBRARY_DIR})
link_directories(${Boost_LIBRARY_DIRS})
if (USE_CCACHE AND USE_DISTCC)
message(FATAL_ERROR "You can't use both distcc and ccache at the same time. Please choose either one.")
endif (USE_CCACHE AND USE_DISTCC)
if (TBB_FOUND AND MLN_USE_TBB)
include_directories(${TBB_INCLUDE_DIRS})
link_directories(${TBB_LIBRARY_DIRS})
link_libraries(${TBB_LIBRARIES})
else()
set(MLN_USE_TBB OFF)
add_definitions(-DMLN_NO_TBB)
endif()
# ccache
if (USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
message(STATUS "ccache found")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif (CCACHE_FOUND)
endif (USE_CCACHE)
if (UNIX AND NOT APPLE)
link_libraries(rt)
endif()
# distcc
if (USE_DISTCC)
find_program(DISTCC_FOUND distcc)
if (DISTCC_FOUND)