2015-04-22 10:17:18 +00:00
|
|
|
find_package(Boost 1.54 COMPONENTS program_options REQUIRED)
|
2015-04-12 13:25:16 +00:00
|
|
|
|
|
|
|
include_directories(
|
2015-04-23 10:54:08 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/include
|
|
|
|
${Boost_INCLUDE_DIR})
|
2015-04-12 13:25:16 +00:00
|
|
|
|
2015-04-13 08:18:58 +00:00
|
|
|
add_executable(benchmark benchmark_main.cpp)
|
|
|
|
target_link_libraries(benchmark mstch)
|
|
|
|
|
2015-04-23 10:54:08 +00:00
|
|
|
add_executable(headerize headerize.cpp)
|
|
|
|
target_link_libraries(headerize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
2015-04-12 13:25:16 +00:00
|
|
|
|
|
|
|
file(GLOB data_files RELATIVE
|
2015-04-23 10:54:08 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/test/data"
|
|
|
|
"${CMAKE_SOURCE_DIR}/test/data/*.hpp")
|
2015-04-12 13:25:16 +00:00
|
|
|
|
|
|
|
foreach(data_file ${data_files})
|
2015-04-23 10:54:08 +00:00
|
|
|
list(APPEND genargs "-C${data_file}")
|
|
|
|
string(REGEX REPLACE "\\.hpp" "" test_name "${data_file}")
|
|
|
|
list(APPEND tests "${test_name}")
|
2015-04-12 13:25:16 +00:00
|
|
|
endforeach(data_file)
|
|
|
|
|
|
|
|
file(GLOB string_files RELATIVE
|
2015-04-23 10:54:08 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/test/data"
|
|
|
|
"${CMAKE_SOURCE_DIR}/test/data/*.mustache"
|
|
|
|
"${CMAKE_SOURCE_DIR}/test/data/*.txt"
|
|
|
|
"${CMAKE_SOURCE_DIR}/test/data/*.partial")
|
2015-04-12 13:25:16 +00:00
|
|
|
|
|
|
|
foreach(string_file ${string_files})
|
2015-04-23 10:54:08 +00:00
|
|
|
list(APPEND genargs "-S${string_file}")
|
2015-04-12 13:25:16 +00:00
|
|
|
endforeach(string_file)
|
|
|
|
|
|
|
|
add_custom_command(
|
2015-04-23 10:54:08 +00:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_data.hpp
|
2015-10-01 09:49:40 +00:00
|
|
|
COMMAND headerize --output ${CMAKE_CURRENT_BINARY_DIR}/test_data.hpp --namespace mstchtest ${genargs}
|
2015-04-23 10:54:08 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test/data/)
|
2015-04-12 13:35:13 +00:00
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/test_data.hpp PROPERTIES GENERATED TRUE)
|
|
|
|
add_custom_target(test_data_hpp DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_data.hpp)
|
2015-04-12 13:25:16 +00:00
|
|
|
|
2015-05-04 12:29:15 +00:00
|
|
|
file(GLOB specs_files RELATIVE
|
2015-05-05 07:03:27 +00:00
|
|
|
"${CMAKE_SOURCE_DIR}/vendor/spec/specs"
|
|
|
|
"${CMAKE_SOURCE_DIR}/vendor/spec/specs/*.json")
|
2015-05-04 12:29:15 +00:00
|
|
|
|
|
|
|
foreach(specs_file ${specs_files})
|
|
|
|
list(APPEND specsargs "-S${specs_file}")
|
|
|
|
string(REGEX REPLACE "\\.json" "" test_name "${specs_file}")
|
2015-10-01 10:49:27 +00:00
|
|
|
string(REGEX REPLACE "~" "" test_name "${test_name}")
|
2015-05-04 12:29:15 +00:00
|
|
|
list(APPEND tests "specs_${test_name}")
|
|
|
|
endforeach(specs_file)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/specs_data.hpp
|
2015-10-01 09:49:40 +00:00
|
|
|
COMMAND headerize --output ${CMAKE_CURRENT_BINARY_DIR}/specs_data.hpp --namespace mstchtest ${specsargs}
|
2015-05-05 07:03:27 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/vendor/spec/specs/)
|
2015-05-04 12:29:15 +00:00
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/specs_data.hpp PROPERTIES GENERATED TRUE)
|
|
|
|
add_custom_target(specs_data_hpp DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/specs_data.hpp)
|
|
|
|
|
2015-04-12 13:25:16 +00:00
|
|
|
add_executable(mstch_test test_main.cpp)
|
|
|
|
target_link_libraries(mstch_test mstch)
|
2015-05-04 12:29:15 +00:00
|
|
|
add_dependencies(mstch_test test_data_hpp specs_data_hpp)
|
2015-04-12 14:13:21 +00:00
|
|
|
|
|
|
|
foreach(test ${tests})
|
2015-04-23 10:54:08 +00:00
|
|
|
add_test(NAME ${test} COMMAND mstch_test ${test})
|
2015-04-12 14:13:21 +00:00
|
|
|
endforeach(test)
|