Configure appveyor (#142)
with much appreciation to @michaeltryby 🎉
* Initial commit getting Appveyor running
* Modifying branch built
* Modifying generator
* Modifying path to test scripts
* Modifying path to test scripts
* Configuring appveyor cache to store cmake generated build files
* suppressing insecure string warnings
* Fixing typo
* Fixing problem with cmake build invocation
* Changing CMake to Linux build on Travis
* Adding compiler flags for MSVC
* Adding Appveyor build status badge
* Adding Appveyor build status badge
* Adding include directory so it is available to project files
* cleaning cache
* rebuilding cache
This commit is contained in:
committed by
Sam Hatchett
parent
d2503bc035
commit
47733feb74
@@ -26,34 +26,48 @@
|
|||||||
# cmake -G "Visual Studio 10 2010" ..
|
# cmake -G "Visual Studio 10 2010" ..
|
||||||
# msbuild /p:Configuration=Release ALL_BUILD.vcxproj
|
# msbuild /p:Configuration=Release ALL_BUILD.vcxproj
|
||||||
#
|
#
|
||||||
|
# Generic Invocation:
|
||||||
|
# cmake -E make_directory buildprod
|
||||||
|
# cd build
|
||||||
|
# cmake -G GENERATOR -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
# cmake --build . --target SOME_TARGET --config Release
|
||||||
|
#
|
||||||
# More information:
|
# More information:
|
||||||
# cmake --help
|
# cmake --help
|
||||||
#
|
#
|
||||||
# CMake is available at https://cmake.org/download/
|
# CMake is available at https://cmake.org/download/
|
||||||
#
|
#
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.8.8)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
|
||||||
|
|
||||||
project(EPANET)
|
project(EPANET)
|
||||||
|
|
||||||
IF(APPLE)
|
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
IF (APPLE)
|
||||||
SET(CMAKE_INSTALL_NAME_DIR @executable_path)
|
SET(CMAKE_INSTALL_NAME_DIR @executable_path)
|
||||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||||
ENDIF(APPLE)
|
ENDIF (APPLE)
|
||||||
|
|
||||||
|
IF (MSVC)
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "/GL")
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
ENDIF (MSVC)
|
||||||
|
|
||||||
# the library
|
|
||||||
include_directories(include)
|
|
||||||
file(GLOB EPANET_SOURCES src/*.c)
|
|
||||||
file(GLOB EPANET_HEADERS src/*.h)
|
|
||||||
file(GLOB EPANET_DATA src/*.dat)
|
|
||||||
set(EPANET_API_HEADER "include/epanet2.h")
|
set(EPANET_API_HEADER "include/epanet2.h")
|
||||||
|
|
||||||
add_library(epanet STATIC ${EPANET_SOURCES} ${EPANET_HEADERS} ${EPANET_DATA} ${EPANET_API_HEADER})
|
# create object library for reuse in other targets
|
||||||
|
include_directories(include; src)
|
||||||
|
file(GLOB EPANET_SOURCES src/*.c)
|
||||||
|
add_library(epanet_objs OBJECT ${EPANET_SOURCES})
|
||||||
|
|
||||||
|
# the shared library
|
||||||
|
add_library(epanet SHARED $<TARGET_OBJECTS:epanet_objs> ${EPANET_API_HEADER})
|
||||||
|
|
||||||
# the standalone executable
|
# the standalone executable
|
||||||
include_directories(src)
|
add_executable(runepanet run/main.c $<TARGET_OBJECTS:epanet_objs>)
|
||||||
add_executable(runepanet run/main.c)
|
if (NOT MSVC)
|
||||||
target_link_libraries (runepanet LINK_PUBLIC epanet m)
|
target_link_libraries (runepanet m)
|
||||||
|
endif (NOT MSVC)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
EPANET {#epanet-readme}
|
EPANET {#epanet-readme}
|
||||||
======
|
======
|
||||||
|
|
||||||
|
## Build Status
|
||||||
|
[](https://ci.appveyor.com/project/OpenWaterAnalytics/epanet/branch/dev)
|
||||||
[](https://travis-ci.org/OpenWaterAnalytics/EPANET)
|
[](https://travis-ci.org/OpenWaterAnalytics/EPANET)
|
||||||
|
|
||||||
The EPANET Library is a pressurized pipe network hydraulic and water quality analysis toolkit written in C.
|
The EPANET Library is a pressurized pipe network hydraulic and water quality analysis toolkit written in C.
|
||||||
|
|||||||
48
appveyor.yml
Normal file
48
appveyor.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#
|
||||||
|
# appveyor.yml - Appveyor CI configuration for OWA EPANET
|
||||||
|
#
|
||||||
|
# Date created: 01/09/2018
|
||||||
|
#
|
||||||
|
# Author: Michael E. Tryby
|
||||||
|
# US EPA - ORD/NRMRL
|
||||||
|
#
|
||||||
|
|
||||||
|
version: 2.0.{build}
|
||||||
|
|
||||||
|
image:
|
||||||
|
- Visual Studio 2013
|
||||||
|
|
||||||
|
# called before repo cloning
|
||||||
|
init:
|
||||||
|
- set EPANET_HOME=%APPVEYOR_BUILD_FOLDER%
|
||||||
|
- set BUILD_HOME=buildprod
|
||||||
|
- set TEST_HOME=tests\epanet-nrtestsuite
|
||||||
|
- set NRTEST_SCRIPT=%EPANET_HOME%\%BUILD_HOME%\packages\nrtest\scripts
|
||||||
|
- set GENERATOR="Visual Studio 10 2010"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- C:\ProgramData\chocolatey\bin -> appveyor.yml
|
||||||
|
- C:\ProgramData\chocolatey\lib -> appveyor.yml
|
||||||
|
- '%BUILD_HOME% -> CMakeLists.txt'
|
||||||
|
|
||||||
|
# called after repo clone
|
||||||
|
install:
|
||||||
|
- choco install swig
|
||||||
|
- python -m pip install --src %BUILD_HOME%\packages -r tools\requirements.txt
|
||||||
|
|
||||||
|
# called before build
|
||||||
|
before_build:
|
||||||
|
- cd %BUILD_HOME%
|
||||||
|
- cmake -G %GENERATOR% -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
|
||||||
|
# run custom build script
|
||||||
|
build_script:
|
||||||
|
- cmake --build . --target runepanet --config Release
|
||||||
|
|
||||||
|
before_test:
|
||||||
|
- cd %EPANET_HOME%
|
||||||
|
- tools\gen-config.cmd %EPANET_HOME%\%BUILD_HOME%\bin\Release > %TEST_HOME%\apps\epanet-%APPVEYOR_REPO_COMMIT%.json
|
||||||
|
|
||||||
|
# run custom test script
|
||||||
|
test_script:
|
||||||
|
- tools\run-nrtest.cmd %NRTEST_SCRIPT% %TEST_HOME% %APPVEYOR_REPO_COMMIT%
|
||||||
29
tools/gen-config.cmd
Normal file
29
tools/gen-config.cmd
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
::
|
||||||
|
:: gen-config.cmd - Generated nrtest app configuration file for test executable
|
||||||
|
::
|
||||||
|
:: Date Created: 1/8/2018
|
||||||
|
::
|
||||||
|
:: Author: Michael E. Tryby
|
||||||
|
:: US EPA - ORD/NRMRL
|
||||||
|
::
|
||||||
|
:: Arguments:
|
||||||
|
:: 1 - absolute path to test executable (valid path seperator for nrtest is "/")
|
||||||
|
::
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
:: process path to remove quotes and convert backward to forward slash
|
||||||
|
set ABS_BUILD_PATH=%~1
|
||||||
|
set ABS_BUILD_PATH=%ABS_BUILD_PATH:\=/%
|
||||||
|
|
||||||
|
:: this is the target created by the cmake build script
|
||||||
|
set TEST_CMD=runepanet.exe
|
||||||
|
|
||||||
|
echo {
|
||||||
|
echo "name" : "epanet",
|
||||||
|
echo "version" : "",
|
||||||
|
echo "description" : "",
|
||||||
|
echo "setup_script" : "",
|
||||||
|
echo "exe" : "%ABS_BUILD_PATH%/%TEST_CMD%"
|
||||||
|
echo }
|
||||||
46
tools/run-nrtest.cmd
Normal file
46
tools/run-nrtest.cmd
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
::
|
||||||
|
:: run_nrtest.cmd - Runs numerical regression test
|
||||||
|
::
|
||||||
|
:: Date Created: 1/8/2018
|
||||||
|
::
|
||||||
|
:: Author: Michael E. Tryby
|
||||||
|
:: US EPA - ORD/NRMRL
|
||||||
|
::
|
||||||
|
:: Arguments:
|
||||||
|
:: 1 - nrtest script path
|
||||||
|
:: 2 - test suite path
|
||||||
|
:: 3 - version/build identifier
|
||||||
|
::
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set NRTEST_SCRIPT_PATH=%~1
|
||||||
|
set TEST_SUITE_PATH=%~2
|
||||||
|
|
||||||
|
set NRTEST_EXECUTE_CMD=python %NRTEST_SCRIPT_PATH%\nrtest execute
|
||||||
|
set TEST_APP_PATH=apps\epanet-%3.json
|
||||||
|
set TESTS=tests\examples
|
||||||
|
set TEST_OUTPUT_PATH=benchmark\epanet-%3
|
||||||
|
|
||||||
|
set NRTEST_COMPARE_CMD=python %NRTEST_SCRIPT_PATH%\nrtest compare
|
||||||
|
set REF_OUTPUT_PATH=benchmark\epanet-2012
|
||||||
|
set RTOL_VALUE=0.1
|
||||||
|
set ATOL_VALUE=0.0
|
||||||
|
|
||||||
|
:: change current directory to test suite
|
||||||
|
cd %TEST_SUITE_PATH%
|
||||||
|
|
||||||
|
:: if present clean test benchmark results
|
||||||
|
if exist %TEST_OUTPUT_PATH% (
|
||||||
|
rmdir /s /q %TEST_OUTPUT_PATH%
|
||||||
|
)
|
||||||
|
|
||||||
|
echo INFO: Creating test benchmark
|
||||||
|
set NRTEST_COMMAND=%NRTEST_EXECUTE_CMD% %TEST_APP_PATH% %TESTS% -o %TEST_OUTPUT_PATH%
|
||||||
|
:: if there is an error exit the script with error value 1
|
||||||
|
%NRTEST_COMMAND% || exit /B 1
|
||||||
|
|
||||||
|
echo INFO: Comparing test and ref benchmark
|
||||||
|
set NRTEST_COMMAND=%NRTEST_COMPARE_CMD% %TEST_OUTPUT_PATH% %REF_OUTPUT_PATH% --rtol %RTOL_VALUE% --atol %ATOL_VALUE%
|
||||||
|
%NRTEST_COMMAND%
|
||||||
Reference in New Issue
Block a user