Feature unittest (#157)

* Adding support for unit testing using boost unit test and ctest

* Adding libboost-test to Travis config.

* Adding libboost-test to Travis config.

* Modifying per element comparison

* Modifying per element comparison

* Fixing typo

* Fixing typo

* Adding custom comparison for strings

* Updating Travis to run unit tests

* Updating Travis to run unit tests

* Fixing typo

* Preparing unit testing to run on Appveyor

* Preparing unit testing to run on Appveyor

* Preparing unit testing to run on Appveyor

* Preparing unit testing to run on Appveyor and Travis

* Preparing unit testing to run on Appveyor and Travis

* Preparing unit testing to run on Appveyor and Travis

* Preparing unit testing to run on Appveyor

* Preparing unit testing to run on Appveyor

* Fixing unit testing path issue in CMake

* Fixing unit testing path issue in CMake

* Fixing bugs in cmake and appveyor scripts

* Rolling back generate_export_header in cmake
This commit is contained in:
Michael Tryby
2018-03-21 14:10:10 -04:00
committed by Sam Hatchett
parent 63b4438765
commit bbe40c5ba4
11 changed files with 520 additions and 30 deletions

View File

@@ -41,11 +41,19 @@
cmake_minimum_required (VERSION 2.8.8)
project(EPANET)
add_subdirectory(tools/epanet-output)
add_subdirectory(tests)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
# Sets for output directory for executables and libraries.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# Sets the position independent code property for all targets
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
IF (APPLE)
SET(CMAKE_INSTALL_NAME_DIR @executable_path)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
@@ -56,20 +64,35 @@ IF (MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
ENDIF (MSVC)
# create object library for reuse in other targets
include_directories(include src)
#include_directories(include src)
# configure file groups
file(GLOB EPANET_SOURCES src/*.c)
set(EPANET_API_HEADER include/epanet2.h)
#set(EPANET_API_HEADER include/epanet2.h)
set(EPANET_CLI_SOURCES run/main.c)
file(GLOB EPANET_LIB_ALL src/*)
source_group("Library" FILES ${EPANET_LIB_ALL})
source_group("CLI" REGULAR_EXPRESSION "run/.*")
# the shared library
add_library(epanet SHARED ${EPANET_SOURCES} ${EPANET_API_HEADER})
add_library(epanet SHARED ${EPANET_SOURCES}) #${EPANET_API_HEADER})
target_include_directories(epanet PUBLIC ${PROJECT_SOURCE_DIR}/include)
# create export lib so we can link against dll using Visual Studio
#include(GenerateExportHeader)
#GENERATE_EXPORT_HEADER(epanet
# BASE_NAME epanet
# EXPORT_MACRO_NAME DLLEXPORT
# EXPORT_FILE_NAME epanet_export.h
# STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC)
#
#file(COPY ${CMAKE_CURRENT_BINARY_DIR}/epanet_export.h
# DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include)
# the standalone executable
add_executable(runepanet ${EPANET_CLI_SOURCES})