Merge branch 'dev.test_suite' into dev

This commit is contained in:
2016-07-04 18:33:55 +01:00
6 changed files with 77 additions and 13 deletions
+72 -12
View File
@@ -3,28 +3,88 @@ set(CMAKE_CXX_STANDARD 11)
# Set the project name
project (concatenator)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.60.0 COMPONENTS program_options log log_setup thread date_time filesystem system)
###############################################################################
### Boost Settings
find_package(Boost 1.60.0 COMPONENTS program_options log log_setup thread date_time filesystem system REQUIRED)
if (NOT FO_BOOST_STATIC_LINK)
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK -DBOOST_LOG_DYN_LINK)
endif()
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
###############################################################################
# Set build flags
set(CMAKE_CXX_FLAGS "-g -Wall ")
# Set cmake to output executable to the bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include_directories(include)
# Find all the source fies in the src directory
file(GLOB SOURCES "src/*.cpp")
# Build the executable from the source files found
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(concatenator ${SOURCES})
target_link_libraries(concatenator ${Boost_LIBRARIES})
set(CONCATENATOR_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
set(CONCATENATOR_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
set(CONCATENATOR_TEST_DIR ${PROJECT_SOURCE_DIR}/tests)
set(CONCATENATOR_SOURCE_FILES
${CONCATENATOR_SOURCE_DIR}/Concatenator.cpp
${CONCATENATOR_SOURCE_DIR}/AudioDatabase.cpp
${CONCATENATOR_SOURCE_DIR}/AudioFile.cpp
${CONCATENATOR_SOURCE_DIR}/Logger.cpp
${CONCATENATOR_SOURCE_DIR}/ArgumentParser.cpp
)
set(CONCATENATOR_HEADER_FILES
${CONCATENATOR_INCLUDE_DIR}/ArgumentParser.h
${CONCATENATOR_INCLUDE_DIR}/AudioDatabase.h
${CONCATENATOR_INCLUDE_DIR}/AudioFile.h
${CONCATENATOR_INCLUDE_DIR}/Logger.h
)
set(CONCATENATOR_TEST_SOURCES
${CONCATENATOR_TEST_DIR}/Concatenator_Basic_Tests.cpp
)
include_directories(${CONCATENATOR_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS})
add_subdirectory(external)
add_executable(concatenator ${CONCATENATOR_SOURCE_FILES} ${CONCATENATOR_HEADER_FILES})
target_link_libraries(concatenator ${Boost_LIBRARIES})
# Test build options (this code adapted from: https://github.com/ComicSansMS/GhulbusBase/blob/master/CMakeLists.txt)
option(BUILD_TESTS "Determines whether to build tests." ON)
if(BUILD_TESTS)
enable_testing()
if(NOT TARGET Catch)
include(ExternalProject)
if(WIN32)
set(FETCH_EXTERNAL_CATCH
URL https://github.com/philsquared/Catch/archive/v1.2.1-develop.12.zip
URL_HASH MD5=cda228922a1c9248364c99a3ff9cd9fa)
else()
set(FETCH_EXTERNAL_CATCH
URL https://github.com/philsquared/Catch/archive/v1.2.1-develop.12.tar.gz
URL_HASH MD5=a8dfb7be899a6e7fb30bd55d53426122)
endif()
ExternalProject_Add(Catch-External
PREFIX ${CMAKE_BINARY_DIR}/external/Catch
${FETCH_EXTERNAL_CATCH}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/external/Catch/src/Catch-External/single_include/catch.hpp
${CMAKE_BINARY_DIR}/external/Catch/include/catch.hpp
)
add_library(Catch INTERFACE)
add_dependencies(Catch Catch-External)
target_include_directories(Catch INTERFACE ${CMAKE_BINARY_DIR}/external/Catch/include)
endif()
add_executable(Concatenator_Basic_Tests ${CONCATENATOR_TEST_SOURCES})
target_link_libraries(Concatenator_Basic_Tests Catch)
add_test(NAME TestBase COMMAND Concatenator_Base_Test)
endif()
View File
+2
View File
@@ -16,6 +16,7 @@ ArgumentParser::ArgumentParser() : desc("Allowed options") {
;
}
/*
int ArgumentParser::parseargs(int argc, char** argv) {
po::store(po::command_line_parser(argc, argv).options(desc).positional(positionalOptions).run(), vm);
po::notify(vm);
@@ -27,3 +28,4 @@ int ArgumentParser::parseargs(int argc, char** argv) {
}
return 0;
}
*/
+1 -1
View File
@@ -9,7 +9,7 @@ int main(int argc, char** argv) {
Logger log = Logger();
ArgumentParser argparse = ArgumentParser();
argparse.parseargs(argc, argv);
//argparse.parseargs(argc, argv);
log.error("My pretty little error!");
return 0;
}
View File
+2
View File
@@ -0,0 +1,2 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>