Commit f6aad0f5 authored by Max Lyon's avatar Max Lyon

Merge branch 'CI' into 'master'

CI

See merge request !6
parents 349b1872 86a11d36
Pipeline #11536 passed with stage
in 7 minutes and 5 seconds
stages:
- build
gcc-c++11:
stage: build
script: "CI/ci-linux.sh gcc C++11"
tags:
- Linux
clang-c++11:
stage: build
script: "CI/ci-linux.sh clang C++11"
tags:
- Linux
gcc-c++14:
stage: build
script: "CI/ci-linux.sh gcc C++14"
tags:
- Linux
clang-c++14:
stage: build
script: "CI/ci-linux.sh clang C++14"
tags:
- Linux
macos-c++11:
stage: build
script: "CI/ci-mac.sh C++11"
tags:
- Apple
macos-c++14:
stage: build
script: "CI/ci-mac.sh C++14"
tags:
- Apple
#!/bin/bash
COMPILER=$1
LANGUAGE=$2
# Exit script on any error
set -e
OPTIONS=""
MAKE_OPTIONS=""
BUILDPATH=""
if [ "$COMPILER" == "gcc" ]; then
echo "Building with GCC";
BUILDPATH="gcc"
# without icecc: no options required
OPTIONS="-DCMAKE_CXX_COMPILER=/usr/lib/icecc/bin/g++ -DCMAKE_C_COMPILER=/usr/lib/icecc/bin/gcc"
MAKE_OPTIONS="-j16"
export ICECC_CXX=/usr/bin/g++ ; export ICECC_CC=/usr/bin/gcc
elif [ "$COMPILER" == "clang" ]; then
OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
echo "Building with CLANG";
BUILDPATH="clang"
fi
if [ "$LANGUAGE" == "C++98" ]; then
echo "Building with C++98";
BUILDPATH="$BUILDPATH-cpp98"
elif [ "$LANGUAGE" == "C++11" ]; then
echo "Building with C++11";
OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' "
BUILDPATH="$BUILDPATH-cpp11"
elif [ "$LANGUAGE" == "C++14" ]; then
echo "Building with C++14";
OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++14' "
BUILDPATH="$BUILDPATH-cpp14"
fi
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
WARNING='\033[0;93m'
#clone OpenVolumeMesh
if [ ! -d OpenVolueMesh ]; then
git clone https://graphics.rwth-aachen.de:9000/OpenVolumeMesh/OpenVolumeMesh
else
cd OpenVolumeMesh
git pull
cd ..
fi
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Basic configuration details:"
echo "======================================================================"
echo -e "${NC}"
echo "Compiler: $COMPILER"
echo "Options: $OPTIONS"
echo "Language: $LANGUAGE"
echo "Make Options: $OPTIONS"
echo "BuildPath: $BUILDPATH"
echo "Path: $PATH"
echo "Language: $LANGUAGE"
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Building Release version"
echo "======================================================================"
echo -e "${NC}"
if [ ! -d build-release-$BUILDPATH ]; then
mkdir build-release-$BUILDPATH
fi
cd build-release-$BUILDPATH
cmake -DCMAKE_BUILD_TYPE=Release -DHEXEX_BUILD_UNIT_TESTS=TRUE $OPTIONS ../
#build it
make $MAKE_OPTIONS
#build the unit tests
make $MAKE_OPTIONS unittests
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version"
echo "======================================================================"
echo -e "${NC}"
cd Build
#execute tests
./unittests --gtest_color=yes --gtest_output=xml
cd ..
cd ..
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Building Debug version"
echo "======================================================================"
echo -e "${NC}"
if [ ! -d build-debug-$BUILDPATH ]; then
mkdir build-debug-$BUILDPATH
fi
cd build-debug-$BUILDPATH
cmake -DCMAKE_BUILD_TYPE=Debug -DHEXEX_BUILD_UNIT_TESTS=TRUE $OPTIONS ../
#build it
make $MAKE_OPTIONS
#build the unit tests
make $MAKE_OPTIONS unittests
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version"
echo "======================================================================"
echo -e "${NC}"
cd Build
#execute tests
./unittests --gtest_color=yes --gtest_output=xml
cd ..
cd ..
#!/bin/bash
#Exit on any error
set -e
LANGUAGE=$1
PATH=$PATH:/opt/local/bin
export PATH
OPTIONS=""
if [ "$LANGUAGE" == "C++98" ]; then
echo "Building with C++98";
BUILDPATH="cpp98"
elif [ "$LANGUAGE" == "C++11" ]; then
echo "Building with C++11";
OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' "
BUILDPATH="cpp11"
elif [ "$LANGUAGE" == "C++14" ]; then
echo "Building with C++14";
OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++14' "
BUILDPATH="cpp14"
fi
#=====================================
# Color Settings:
#=====================================
NC='\033[0m'
OUTPUT='\033[0;32m'
WARNING='\033[0;93m'
#clone OpenVolumeMesh
if [ ! -d OpenVolueMesh ]; then
git clone https://graphics.rwth-aachen.de:9000/OpenVolumeMesh/OpenVolumeMesh
else
cd OpenVolumeMesh
git pull
cd ..
fi
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Basic configuration details:"
echo "======================================================================"
echo -e "${NC}"
echo "Options: $OPTIONS"
echo "BuildPath: $BUILDPATH"
echo "Path: $PATH"
echo "Language: $LANGUAGE"
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Building Release version with vectorchecks enabled"
echo "======================================================================"
echo -e "${NC}"
if [ ! -d build-release-$BUILDPATH ]; then
mkdir build-release-$BUILDPATH
fi
cd build-release-$BUILDPATH
cmake -DCMAKE_BUILD_TYPE=Release -DHEXEX_BUILD_UNIT_TESTS=TRUE $OPTIONS ../
#build it
make
#build the unit tests
make unittests
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Release version"
echo "======================================================================"
echo -e "${NC}"
cd Build
#execute tests
./unittests --gtest_color=yes --gtest_output=xml
cd ..
cd ..
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Building Debug version"
echo "======================================================================"
echo -e "${NC}"
if [ ! -d build-debug-$BUILDPATH-Vector-Checks ]; then
mkdir build-debug-$BUILDPATH-Vector-Checks
fi
cd build-debug-$BUILDPATH-Vector-Checks
cmake -DCMAKE_BUILD_TYPE=Debug -DHEXEX_BUILD_UNIT_TESTS=TRUE $OPTIONS ../
#build it
make
#build the unit tests
make unittests
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
echo "Running unittests Debug version"
echo "======================================================================"
echo -e "${NC}"
cd Build
#execute tests
./unittests --gtest_color=yes --gtest_output=xml
cd ..
cd ..
......@@ -28,8 +28,6 @@ endif()
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
find_package (OpenVolumeMesh REQUIRED)
add_definitions(-DINCLUDE_TEMPLATES)
set (SOURCES "")
......@@ -40,6 +38,14 @@ set (LIBRARY_DIRS "")
file(GLOB SRCS "${CMAKE_CURRENT_LIST_DIR}/src/*.cc" "${CMAKE_CURRENT_LIST_DIR}/src/*.c")
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/OpenVolumeMesh")
add_subdirectory(OpenVolumeMesh)
message("Building with OpenVolumeMesh")
else()
message("Not Building with OpenVolumeMesh")
endif()
find_package (OpenVolumeMesh REQUIRED)
list (APPEND SOURCES ${SRCS})
list (APPEND INCLUDE_DIRS ${OPENVOLUMEMESH_INCLUDE_DIR})
......@@ -128,16 +134,17 @@ if("${PROJECT_NAME}" MATCHES "HexEx")
add_subdirectory(demo/minimum_example)
endif()
#set(BUILD_UNIT_TESTS false CACHE BOOL "Whether to build the unit tests.")
#if (BUILD_UNIT_TESTS)
# enable_testing()
# set(GTEST_DIR CACHE PATH "Source path of googletest.")
# if (NOT GTEST_DIR)
# message(FATAL_ERROR "GTEST_DIR unset")
# endif()
# add_subdirectory(${GTEST_DIR} gtest)
# add_subdirectory(tests)
#if ( NOT DEFINED HEXEX_BUILD_UNIT_TESTS)
# set( HEXEX_BUILD_UNIT_TESTS false CACHE BOOL "Enable or disable unit test builds in HexEx." )
#endif()
#add_subdirectory (unittests)
set(HEXEX_BUILD_UNIT_TESTS false CACHE BOOL "Whether to build the unit tests.")
if (HEXEX_BUILD_UNIT_TESTS)
enable_testing()
find_package(GoogleTest REQUIRED)
add_subdirectory(tests)
endif()
#find_package(Doxygen)
......
if (EXISTS ${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.cmake)
include (${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.cmake)
endif ()
# prevent build in source directory
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message (SEND_ERROR "Building in the source directory is not supported.")
message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} <path to the sources>\".")
endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# allow only Debug and Release builds
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "")
mark_as_advanced (CMAKE_CONFIGURATION_TYPES)
# set Debus as default build target
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug, Release."
FORCE)
endif ()
# create our output directroy
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build)
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build)
endif ()
# read version from file
macro (acg_get_version)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGN}/VERSION")
file (READ "${CMAKE_CURRENT_SOURCE_DIR}/${ARGN}/VERSION" _file)
else ()
file (READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" _file)
endif ()
string (
REGEX REPLACE
"^.*ID=([^\n]*).*$" "\\1"
_id ${_file}
)
string (
REGEX REPLACE
"^.*VERSION=([^\n]*).*$" "\\1"
_version ${_file}
)
string (
REGEX REPLACE
"^.*MAJOR=([^\n]*).*$" "\\1"
_major ${_file}
)
string (
REGEX REPLACE
"^.*MINOR=([^\n]*).*$" "\\1"
_minor ${_file}
)
string (
REGEX REPLACE
"^.*PATCH=([^\n]*).*$" "\\1"
_patch ${_file}
)
set (${_id}_VERSION ${_version})
set (${_id}_VERSION_MAJOR ${_major})
set (${_id}_VERSION_MINOR ${_minor})
set (${_id}_VERSION_PATCH ${_patch})
endmacro ()
# set directory structures for the different platforms
if (CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
set (ACG_PROJECT_DATADIR ".")
set (ACG_PROJECT_LIBDIR "lib")
set (ACG_PROJECT_BINDIR ".")
set (ACG_PROJECT_PLUGINDIR "Plugins")
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR})
endif ()
elseif (APPLE)
set (ACG_PROJECT_DATADIR "share/${CMAKE_PROJECT_NAME}")
set (ACG_PROJECT_LIBDIR "lib${LIB_SUFFIX}")
set (CMAKE_LIBRARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}")
set (ACG_PROJECT_PLUGINDIR "${ACG_PROJECT_LIBDIR}/plugins")
set (ACG_PROJECT_BINDIR "bin")
else ()
set (ACG_PROJECT_DATADIR "share/${CMAKE_PROJECT_NAME}")
set (ACG_PROJECT_LIBDIR "lib${LIB_SUFFIX}")
set (ACG_PROJECT_PLUGINDIR "${ACG_PROJECT_LIBDIR}/plugins")
set (ACG_PROJECT_BINDIR "bin")
endif ()
if( NOT APPLE )
# check 64 bit
if( CMAKE_SIZEOF_VOID_P MATCHES 4 )
set( HAVE_64_BIT 0 )
else( CMAKE_SIZEOF_VOID_P MATCHES 4 )
set( HAVE_64_BIT 1 )
endif( CMAKE_SIZEOF_VOID_P MATCHES 4 )
endif ( NOT APPLE )
# allow a project to modify the directories
if (COMMAND acg_modify_project_dirs)
acg_modify_project_dirs ()
endif ()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR})
endif ()
# sets default build properties
macro (acg_set_target_props target)
if (WIN32)
set_target_properties (
${target} PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH 0
)
elseif (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE)
if (NOT (CMAKE_MAJOR_VERSION LESS 3) )
# save rpath
set_target_properties (
${target} PROPERTIES
INSTALL_RPATH "@executable_path/../${ACG_PROJECT_LIBDIR}"
MACOSX_RPATH 1
#BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH 0
)
else()
# save rpath via install name dir
set_target_properties (
${target} PROPERTIES
INSTALL_NAME_DIR "@executable_path/../${ACG_PROJECT_LIBDIR}"
#BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH 0
)
endif(NOT (CMAKE_MAJOR_VERSION LESS 3) )
elseif (NOT APPLE)
set_target_properties (
${target} PROPERTIES
INSTALL_RPATH "$ORIGIN/../${ACG_PROJECT_LIBDIR}"
BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH 0
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_BINDIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}"
)
endif ()
endmacro ()
include (AddFileDependencies)
include (ACGCompiler)
# define INCLUDE_TEMPLATES for everything we build
add_definitions (-DINCLUDE_TEMPLATES)
# unsets the given variable
macro (acg_unset var)
set (${var} "" CACHE INTERNAL "")
endmacro ()
# sets the given variable
macro (acg_set var value)
set (${var} ${value} CACHE INTERNAL "")
endmacro ()
# test for OpenMP
macro (acg_openmp)
if (NOT OPENMP_NOTFOUND)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
add_definitions(-DUSE_OPENMP)
else ()
set (OPENMP_NOTFOUND 1)
endif()
endif ()
endmacro ()
# test for FTGL
macro (acg_ftgl)
find_package (Freetype)
if (FREETYPE_FOUND)
find_package (FTGL)
if (FTGL_FOUND)
add_definitions (-DUSE_FTGL)
include_directories (${FTGL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIR_freetype2})
set (FTGL_LIBS ${FREETYPE_LIBRARIES} ${FTGL_LIBRARIES})
endif ()
endif ()
endmacro ()
# append all files with extension "ext" in the "dirs" directories to "ret"
# excludes all files starting with a '.' (dot)
macro (acg_append_files ret ext)
foreach (_dir ${ARGN})
file (GLOB _files "${_dir}/${ext}")
foreach (_file ${_files})
get_filename_component (_filename ${_file} NAME)
if (_filename MATCHES "^[.]")
list (REMOVE_ITEM _files ${_file})
endif ()
endforeach ()
list (APPEND ${ret} ${_files})
endforeach ()
endmacro ()
# append all files with extension "ext" in the "dirs" directories and its subdirectories to "ret"
# excludes all files starting with a '.' (dot)
macro (acg_append_files_recursive ret ext)
foreach (_dir ${ARGN})
file (GLOB_RECURSE _files "${_dir}/${ext}")
foreach (_file ${_files})
get_filename_component (_filename ${_file} NAME)
if (_filename MATCHES "^[.]")
list (REMOVE_ITEM _files ${_file})
endif ()
endforeach ()
list (APPEND ${ret} ${_files})
endforeach ()
endmacro ()
# get all files in directory, but ignore svn
macro (acg_get_files_in_dir ret dir)
file (GLOB_RECURSE __files RELATIVE "${dir}" "${dir}/*")
foreach (_file ${__files})
if ( (NOT _file MATCHES ".*svn.*") AND (NOT _file MATCHES ".DS_Store") )
list (APPEND ${ret} "${_file}")
endif ()
endforeach ()
endmacro ()
# copy the whole directory without svn files
function (acg_copy_after_build target src dst)
acg_unset (_files)
acg_get_files_in_dir (_files ${src})
foreach (_file ${_files})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${src}/${_file}" "${dst}/${_file}"
)
endforeach ()
endfunction ()
# install the whole directory without svn files
function (acg_install_dir src dst)
acg_unset (_files)
acg_get_files_in_dir (_files ${src})
foreach (_file ${_files})
get_filename_component (_file_PATH ${_file} PATH)
install(FILES "${src}/${_file}"
DESTINATION "${dst}/${_file_PATH}"
)
endforeach ()
endfunction ()
# extended version of add_executable that also copies output to out Build directory
function (acg_add_executable _target)
add_executable (${_target} ${ARGN})
# set common target properties defined in common.cmake
acg_set_target_props (${_target})
if