Skip to content

Commit

Permalink
Merge pull request #214 from pariterre/dev
Browse files Browse the repository at this point in the history
Move to AppVeyor
  • Loading branch information
pariterre authored Jul 15, 2021
2 parents 5c47224 + 2f7d5e2 commit 45f622c
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 149 deletions.
105 changes: 105 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#---------------------------------#
# environment configuration #
#---------------------------------#

# Build worker image (VM template)
image:
- Ubuntu2004
- Visual Studio 2019
- macos

# set clone depth
clone_depth: 5 # clone entire repository history if not defined

# There is no building process
build: off

# scripts that run after cloning repository
install:
- sh: if [[ $CI_LINUX == true ]]; then sudo apt install lcov -y; fi
- sh: if [[ $CI_LINUX == true ]]; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 1000 --slave /usr/bin/g++ g++ /usr/bin/g++-9; fi
- sh: if [[ $CI_LINUX == true ]]; then wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; bash miniconda.sh -b -p $HOME/miniconda; export PATH="$HOME/miniconda/bin:$PATH"; else curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -L -o miniconda.sh; bash miniconda.sh -b -p $HOME/miniconda; export PATH="$HOME/miniconda/bin:$PATH"; fi
- sh: hash -r
- sh: source activate
- cmd: SET MINICONDA_PATH="C:\\Miniconda38-x64"
- cmd: SET PATH=%MINICONDA_PATH%;%MINICONDA_PATH%"\\Scripts";%PATH%
- cmd: conda init cmd.exe
- conda config --set always_yes yes --set changeps1 no
- conda config --set auto_update_conda no
- conda update -q conda
- conda create -n ezc3d
- conda activate ezc3d

# Set environment variables
- sh: EZC3D_FOLDER=`pwd`
- sh: EZC3D_BUILD_FOLDER=$EZC3D_FOLDER/build
- sh: EZC3D_COVERAGE_BUILD_FOLDER=$EZC3D_FOLDER/build_coverage
- sh: EZC3D_COVERAGE_BUILD_FOLDER=$EZC3D_FOLDER/build_coverage
- sh: CONDA_ENV_PATH=$HOME/miniconda/envs
- sh: if [[ $CI_LINUX == true ]]; then export CC=/usr/bin/gcc; fi
- sh: if [[ $CI_LINUX == true ]]; then export CXX=/usr/bin/g++; fi
- cmd: SET EZC3D_FOLDER=%cd%
- cmd: SET EZC3D_BUILD_FOLDER=%EZC3D_FOLDER%\\build
- cmd: SET CONDA_ENV_PATH=%MINICONDA_PATH%\\envs

# Setup the conda environment
- conda install git numpy pytest swig pkgconfig cmake -c conda-forge
- sh: conda install octave -cconda-forge
- cmd: conda install ninja -cconda-forge
- conda list


test_script:
############################################################################
# Test the build
############################################################################
- sh: cd $EZC3D_FOLDER
- cmd: cd %EZC3D_FOLDER%

# LINUX and MAC
- sh: mkdir -p $EZC3D_BUILD_FOLDER
- sh: cd $EZC3D_BUILD_FOLDER
- sh: cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH/ezc3d/ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DBUILD_DOC=OFF -DBUILD_EXAMPLE=ON -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_OCTAVE=ON -DOctave_ezc3d_INSTALL_DIR=$HOME -DBINDER_PYTHON3=ON ..
- sh: make install

# WINDOWS
- cmd: mkdir %EZC3D_BUILD_FOLDER%
- cmd: cd %EZC3D_BUILD_FOLDER%
- cmd: cmake -GNinja -DCMAKE_INSTALL_PREFIX=%CONDA_ENV_PATH%\\ezc3d -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DBUILD_DOC=OFF -DBUILD_EXAMPLE=ON -DUSE_MATRIX_FAST_ACCESSOR=OFF -DBINDER_OCTAVE=OFF -DBINDER_PYTHON3=ON ..
- cmd: cmake --build . --config Release --target install

# Run the tests
- cd test
- cmd: xcopy ..\*.dll .
- cmd: xcopy ..\bin\*.dll .
- sh: ./ezc3d_test
- cmd: .\\ezc3d_test.exe
- cd ..

# Test the python binder
- pytest -v --color=yes ../test/python3

# Test the octave binder (LINUX and MAC)
- sh: cd $EZC3D_FOLDER/test/matlab
- sh: cp $HOME/ezc3d_octave/* .
- sh: octave test_binder_matlab.m
- sh: octave test_binder_matlab_force_platform.m
- sh: cd $EZC3D_BUILD_FOLDER


############################################################################
# Code coverage (on Linux)
############################################################################
- sh: if [[ $CI_LINUX == true ]]; then cd $EZC3D_FOLDER; mkdir $EZC3D_COVERAGE_BUILD_FOLDER; cd $EZC3D_COVERAGE_BUILD_FOLDER; fi
- sh: if [[ $CI_LINUX == true ]]; then cmake -DCMAKE_BUILD_TYPE=Coverage -DBUILD_TESTS=ON -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DUSE_MATRIX_FAST_ACCESSOR=OFF ..; fi
- sh: if [[ $CI_LINUX == true ]]; then cp -r test/c3dTestFiles/ .; fi
- sh: if [[ $CI_LINUX == true ]]; then make ezc3d_coverage; fi
- sh: if [[ $CI_LINUX == true ]]; then cd $EZC3D_BUILD_FOLDER; fi


on_success:
# Uploading report to CodeCov
- sh: if [[ $CI_LINUX == true ]]; then cd $EZC3D_COVERAGE_BUILD_FOLDER; fi
- sh: if [[ $CI_LINUX == true ]]; then lcov --directory . --capture --output-file coverage.info; lcov --remove coverage.info '/usr/*' --output-file coverage.info; lcov --list coverage.info; bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"; fi
- sh: if [[ $CI_LINUX == true ]]; then cd $EZC3D_FOLDER; fi

131 changes: 0 additions & 131 deletions .travis.yml

This file was deleted.

18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.8)
cmake_policy(SET CMP0048 NEW)
project(ezc3d VERSION 1.4.3)
project(ezc3d VERSION 1.4.4)
set(EZC3D_NAME ${PROJECT_NAME})
set(EZC3D_ROOT_FOLDER ${PROJECT_SOURCE_DIR})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(EZC3D_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
Expand Down Expand Up @@ -108,18 +109,23 @@ install(FILES "${EZC3D_BINARY_DIR}/include/ezc3dConfig.h"
)

# Prepare share
if(WIN32 AND NOT CYGWIN)
set(CMAKE_SHARE_DIR CMake)
else()
set(CMAKE_SHARE_DIR lib/cmake/${EZC3D_NAME})
endif()
include(CMakePackageConfigHelpers)
configure_package_config_file(
share/${PROJECT_NAME}Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${${PROJECT_NAME}_LIB_FOLDER}/cmake
INSTALL_DESTINATION "${CMAKE_SHARE_DIR}"
PATH_VARS
CMAKE_INSTALL_PREFIX
)
install(EXPORT ezc3dTargets DESTINATION ${${PROJECT_NAME}_LIB_FOLDER}/cmake)
install(FILES
install(EXPORT ezc3dTargets DESTINATION "${CMAKE_SHARE_DIR}")
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION ${${PROJECT_NAME}_LIB_FOLDER}/cmake
DESTINATION "${CMAKE_SHARE_DIR}"
)

# uninstall target
Expand All @@ -139,7 +145,7 @@ add_subdirectory(binding)
# Examples
option(BUILD_EXAMPLE "Build a C++ example" ON)
if (BUILD_EXAMPLE)
add_subdirectory(examples)
add_subdirectory(examples)
endif()


Expand Down
33 changes: 21 additions & 12 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@ project(${EZC3D_NAME}_test)

# Download gtest if necessary
set(RELATIVE_PATH_TO_GTEST external/gtest)
find_path(GTEST_INCLUDE_DIR gtest.h HINTS
find_path(GTEST_INCLUDE_DIR "gtest.h" HINTS
"${CMAKE_CURRENT_SOURCE_DIR}/../${RELATIVE_PATH_TO_GTEST}/googletest/include/gtest"
)

if((NOT GTEST_INCLUDE_DIR) OR (NOT EXISTS ${GTEST_INCLUDE_DIR}))
if((NOT GTEST_INCLUDE_DIR) OR (NOT EXISTS "${GTEST_INCLUDE_DIR}"))
find_package(Git QUIET)
if (NOT GIT_FOUND)
message(FATAL_ERROR "Unable to find gtest and it could not be download since Git was not found!")
endif()

# we couldn't find the header files for gtest or they don't exist
message("Unable to find gtest, try to automatically download it")
message("Unable to find gtest, I'll try to automatically download it")

# we have a submodule setup for gtest, assume it is under external/gtest
# now we need to clone this submodule
execute_process(COMMAND "git submodule update --init -- external/gtest"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/..")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init -- ${EZC3D_ROOT_FOLDER}/${RELATIVE_PATH_TO_GTEST}
WORKING_DIRECTORY ${EZC3D_ROOT_FOLDER}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "${GIT_EXECUTABLE} submodule update --init -- ${EZC3D_ROOT_FOLDER}/external/gtest failed, please checkout submodules manually")
endif()

find_path(GTEST_INCLUDE_DIR "gtest.h" HINTS
"${CMAKE_CURRENT_SOURCE_DIR}/../${RELATIVE_PATH_TO_GTEST}/googletest/include/gtest"
)
find_path(GTEST_INCLUDE_DIR "gtest.h" HINTS
"${CMAKE_CURRENT_SOURCE_DIR}/../${RELATIVE_PATH_TO_GTEST}/googletest/include/gtest"
)
endif()

# Prevent overriding the parent project's compiler/linker
Expand Down Expand Up @@ -54,12 +63,12 @@ target_include_directories(${PROJECT_NAME} PRIVATE
)

# Standard linking to gtest stuff.
target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
"gtest_main"
)

# Extra linking for the project.
target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
"${EZC3D_NAME}"
)

Expand All @@ -71,8 +80,8 @@ if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../.travis/cmake)

include(CodeCoverage)
setup_target_for_coverage(${EZC3D_NAME}_coverage
"${PROJECT_NAME}" "coverage")
setup_target_for_coverage(${EZC3D_NAME}_coverage
"${PROJECT_NAME}" "coverage")

SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
Expand Down

0 comments on commit 45f622c

Please sign in to comment.