Commit adf3f23a authored by Michaël Roynard's avatar Michaël Roynard
Browse files

Cleanup cmakes

Add custom target to have non-generator dependent build
Add code coverage targets
parent d13eb48b
......@@ -44,17 +44,46 @@ build-docker-automatic:
script:
- mkdir build && cd build
- conan install .. -pr $BUILD_PROFILE --build missing
- cmake .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION
- cmake --build apps --config $PYLENE_CONFIGURATION
- cmake --build tests --config $PYLENE_CONFIGURATION
- cmake --build bench/tests --config $PYLENE_CONFIGURATION
- ctest -L UnitTests -V --schedule-random --output-on-failure
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DPYLENE_CODE_COVERAGE=OFF
- cmake --build . --target build-fixtures --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-pylene --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-apps --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-cli --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-tests --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- ctest -L UnitTests --schedule-random --output-on-failure
- cmake --build . --target dist --config $PYLENE_CONFIGURATION
dependencies: []
artifacts:
reports:
junit: [build/tests/UT*.xml, build/bench/tests/UT*.xml]
expire_in: 15 days
.job-build-linux-coverage: &distcheck-linux-coverage
image: ${DOCKER_IMAGE}
stage: test
script:
- mkdir build && cd build
- conan install .. -pr $BUILD_PROFILE --build missing
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION -DPYLENE_CODE_COVERAGE=ON -DGCOV_PATH=$(which $COV)
- cmake --build . --target build-fixtures --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-pylene --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-apps --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-cli --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target build-tests --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- ctest -L UnitTests --schedule-random --output-on-failure
- cmake --build . --target run-tests_coverage-gcovr-html --config $PYLENE_CONFIGURATION
- cmake --build . --target run-tests_coverage-lcov --config $PYLENE_CONFIGURATION
- lcov --list run-tests_coverage-lcov.info
- cmake --build . --target dist --config $PYLENE_CONFIGURATION
dependencies: []
artifacts:
paths:
- build/run-tests_coverage-gcovr-html/
- build/run-tests_coverage-lcov/
reports:
junit: [build/tests/UT*.xml, build/bench/tests/UT*.xml]
expire_in: 15 days
distcheck-linux-gcc7-release:
<<: *distcheck-linux-base
variables:
......@@ -64,12 +93,13 @@ distcheck-linux-gcc7-release:
CC: "gcc-7"
distcheck-linux-gcc7-debug:
<<: *distcheck-linux-base
<<: *distcheck-linux-coverage
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "gcc7"
CXX: "g++-7"
CC: "gcc-7"
COV: "gcov-7"
distcheck-linux-gcc8-release:
<<: *distcheck-linux-base
......@@ -80,12 +110,13 @@ distcheck-linux-gcc8-release:
CC: "gcc-8"
distcheck-linux-gcc8-debug:
<<: *distcheck-linux-base
<<: *distcheck-linux-coverage
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "gcc8"
CXX: "g++-8"
CC: "gcc-8"
COV: "gcov-8"
distcheck-linux-clang6-release:
<<: *distcheck-linux-base
......@@ -96,12 +127,13 @@ distcheck-linux-clang6-release:
CC: "clang-6.0"
distcheck-linux-clang6-debug:
<<: *distcheck-linux-base
<<: *distcheck-linux-coverage
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "clang6"
CXX: "clang++-6.0"
CC: "clang-6.0"
COV: "../utils/coverage/llvm-gcov-6.0.sh"
distcheck-linux-clang7-release:
<<: *distcheck-linux-base
......@@ -112,12 +144,13 @@ distcheck-linux-clang7-release:
CC: "clang-7"
distcheck-linux-clang7-debug:
<<: *distcheck-linux-base
<<: *distcheck-linux-coverage
variables:
PYLENE_CONFIGURATION: "Debug"
BUILD_PROFILE: "clang7"
CXX: "clang++-7"
CC: "clang-7"
COV: "../utils/coverage/llvm-gcov-7.sh"
#########
......@@ -130,11 +163,10 @@ distcheck-linux-clang7-debug:
script:
- mkdir build && cd build
- conan install .. -pr $BUILD_PROFILE --build missing
- cmake .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION
- cmake --build . --target fetch-external-data
- cmake --build .
--config $PYLENE_CONFIGURATION
--target run-all-benchmarks
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$PYLENE_CONFIGURATION
- cmake --build . --target fetch-external-data --config $PYLENE_CONFIGURATION
- cmake --build . --target build-bench --config $PYLENE_CONFIGURATION -- -j $(($NBPROC / 2))
- cmake --build . --target run-all-benchmarks --config $PYLENE_CONFIGURATION
- ctest -L SpeedTests -V
tags: [ "pylene-benchmarks" ]
when: manual
......@@ -188,10 +220,8 @@ distbench-linux-clang7-release:
script:
- mkdir build && cd build
- conan install .. -pr pylene_default --build missing
- cmake .. -DCMAKE_BUILD_TYPE=Release
- cmake --build .
--config Release
--target doc
- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release
- cmake --build . --target build-doc --config Release -- -j $(($NBPROC / 2))
- mkdir ../public && mv doc/build/* ../public/
artifacts:
name: "documentation"
......
cmake_minimum_required(VERSION 3.8.2)
project(PYLENE)
project(Pylene)
# Add FindTBB directory to CMake's module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# Add CodeCoverage utility to CMake's module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules")
if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake")
endif()
endif ()
find_package(Boost 1.58 COMPONENTS program_options REQUIRED)
find_package(FreeImage REQUIRED)
......@@ -20,42 +22,41 @@ find_package(range-v3 REQUIRED)
option(USE_CCACHE "Use ccache as compiler launcher" ON)
option(USE_DISTCC "Use ccache as compiler launcher" OFF)
if(USE_CCACHE AND USE_DISTCC)
message(FATAL_ERROR "You can't use both distcc and ccache at the same time. Please choose either one.")
endif(USE_CCACHE AND USE_DISTCC)
if (USE_CCACHE AND USE_DISTCC)
message(FATAL_ERROR "You can't use both distcc and ccache at the same time. Please choose either one.")
endif (USE_CCACHE AND USE_DISTCC)
# ccache
if(USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
message(STATUS "ccache found")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
endif(USE_CCACHE)
if (USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
message(STATUS "ccache found")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif (CCACHE_FOUND)
endif (USE_CCACHE)
# distcc
if(USE_DISTCC)
find_program(DISTCC_FOUND distcc)
if(DISTCC_FOUND)
message(STATUS "distcc found")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE distcc)
# distcc doesn't offload the linker
# set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK distcc)
endif(DISTCC_FOUND)
endif(USE_DISTCC)
if (USE_DISTCC)
find_program(DISTCC_FOUND distcc)
if (DISTCC_FOUND)
message(STATUS "distcc found")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE distcc)
# distcc doesn't offload the linker
# set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK distcc)
endif (DISTCC_FOUND)
endif (USE_DISTCC)
# CONFIGURATION OPTIONS
option(PYLENE_BUILD_BENCHMARKS "Require Google Benchmark library. Set to YES to enable the compilation of benchmarks." YES)
option(PYLENE_BUILD_LIBS_ONLY "ON to build only the library (packaging)" OFF)
option(PYLENE_BUILD_TESTING "ON to build the test suite" ON)
# Compiler configurations
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
add_compile_options("-Wextra" "-Wall" "-Werror" "-Wno-deprecated-declarations")
endif()
endif ()
#### MSVC Compiler Configuration
......@@ -64,43 +65,77 @@ if (MSVC)
"/wd4456" # masque la déclaration locale précédente
"/wd5030" # l'attribut 'noinline' n'est pas reconnu
"/wd4457" # la déclaration de '?' masque le paramètre de fonction
)
)
add_compile_options("/WX" "/W4" "/wd4244" "/wd4127" "/permissive-")
add_compile_definitions(_SCL_SECURE_NO_WARNINGS)
add_compile_definitions(_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
add_compile_definitions(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
endif(MSVC)
endif (MSVC)
# default buidling type
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
endif ()
#### Configuration of the Compiler ###
# Subdirectories
add_custom_target(build-pylene)
add_subdirectory(pylene)
if (NOT PYLENE_BUILD_LIBS_ONLY)
add_custom_target(build-fixtures)
add_subdirectory(fixtures)
if (PYLENE_BUILD_BENCHMARKS)
add_subdirectory(bench EXCLUDE_FROM_ALL)
endif()
if (BUILD_TESTING)
if (PYLENE_BUILD_TESTING)
include(CTest)
add_custom_target(build-tests)
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
option(PYLENE_CODE_COVERAGE "ON to enable code coverage" OFF)
if (PYLENE_CODE_COVERAGE)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
SETUP_TARGET_FOR_COVERAGE_LCOV(
NAME run-tests_coverage-lcov
EXECUTABLE ctest -L UnitTests --schedule-random --output-on-failure -j ${PROCESSOR_COUNT}
DEPENDENCIES build-tests
)
SETUP_TARGET_FOR_COVERAGE_GCOVR_XML(
NAME run-tests_coverage-gcovr-xml
EXECUTABLE ctest -L UnitTests --schedule-random --output-on-failure -j ${PROCESSOR_COUNT}
DEPENDENCIES build-tests
)
SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML(
NAME run-tests_coverage-gcovr-html
EXECUTABLE ctest -L UnitTests --schedule-random --output-on-failure -j ${PROCESSOR_COUNT}
DEPENDENCIES build-tests
)
endif ()
endif ()
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif()
if (PYLENE_BUILD_BENCHMARKS)
add_custom_target(build-bench)
add_subdirectory(bench EXCLUDE_FROM_ALL)
endif ()
endif ()
add_custom_target(build-doc)
add_subdirectory(doc EXCLUDE_FROM_ALL)
add_custom_target(build-apps)
add_subdirectory(apps EXCLUDE_FROM_ALL)
add_custom_target(build-cli)
add_subdirectory(cli EXCLUDE_FROM_ALL)
endif()
endif ()
set(CPACK_SOURCE_GENERATOR "TBZ2")
......
......@@ -25,6 +25,7 @@ External dependancies:
* MSVC 15.8.1
[![pipeline status](https://gitlab.lrde.epita.fr/olena/pylene/badges/dev/pipeline.svg)](https://gitlab.lrde.epita.fr/olena/pylene/commits/dev)
[![coverage report](https://gitlab.lrde.epita.fr/olena/pylene/badges/dev/coverage.svg)](https://gitlab.lrde.epita.fr/olena/pylene/commits/dev)
......
......@@ -13,4 +13,8 @@ if (EIGEN3_FOUND)
add_executable(circularity-cli circularity-cli.cpp circularity.cpp attributes.cpp)
target_include_directories(circularity-cli PRIVATE ${EIGEN3_INCLUDE_DIR})
target_link_libraries(circularity-cli PUBLIC ${Boost_PROGRAM_OPTIONS_LIBRARY})
endif(EIGEN3_FOUND)
add_dependencies(build-apps circularity-cli)
endif (EIGEN3_FOUND)
add_dependencies(build-apps stat MSER-cli meaningfullness-cli)
......@@ -4,8 +4,8 @@ include_directories(clattice ${Boost_INCLUDE_DIRS})
add_executable(clattice clattice.cpp)
target_link_libraries(clattice
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${FreeImage_LIBRARIES}
)
\ No newline at end of file
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${FreeImage_LIBRARIES}
)
......@@ -2,15 +2,17 @@ link_libraries(${FreeImage_LIBRARIES})
add_library(g2-tools OBJECT satmaxtree.cpp compute_ctos.cpp routines.cpp compute_g2.cpp)
add_executable(compute_ctos-cli compute_ctos-cli.cpp $<TARGET_OBJECTS:g2-tools>)
add_executable(compute_ctos-demo compute_ctos-demo.cpp $<TARGET_OBJECTS:g2-tools>)
add_executable(compute_ctos-cli compute_ctos-cli.cpp $<TARGET_OBJECTS:g2-tools>)
add_executable(compute_ctos-demo compute_ctos-demo.cpp $<TARGET_OBJECTS:g2-tools>)
target_link_libraries(compute_ctos-cli ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(compute_ctos-demo ${Boost_PROGRAM_OPTIONS_LIBRARY})
#add_library(g2-tools-16 OBJECT routines.cpp compute_g2.cpp)
add_executable(compute_ctos_16-cli compute_ctos-cli.cpp $<TARGET_OBJECTS:g2-tools>)
set_target_properties(compute_ctos_16-cli
PROPERTIES COMPILE_DEFINITIONS MLN_INPUT_VALUE_TYPE=mln::rgb16)
PROPERTIES COMPILE_DEFINITIONS MLN_INPUT_VALUE_TYPE=mln::rgb16)
target_link_libraries(compute_ctos_16-cli ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable(satmaxtree-cli satmaxtree-cli.cpp $<TARGET_OBJECTS:g2-tools>)
add_dependencies(build-apps g2-tools compute_ctos-cli compute_ctos-demo compute_ctos_16-cli satmaxtree-cli)
......@@ -6,21 +6,22 @@ if (${QT4_FOUND})
QT4_WRAP_CPP(hierarchical_seg-gui_MOC
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/imageviewer.hpp
brush.hpp)
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/imageviewer.hpp
brush.hpp)
QT4_GENERATE_MOC(${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/imageviewer.hxx
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
add_executable(hierarchical_seg-gui hierachical_seg-gui.cpp brush.cpp
${hierarchical_seg-gui_MOC}
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
add_executable(hierarchical_seg-gui hierachical_seg-gui.cpp brush.cpp
${hierarchical_seg-gui_MOC}
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
add_executable(hierarchical_seg-cli hierachical_seg-cli.cpp)
add_executable(hierarchical_seg-cli hierachical_seg-cli.cpp)
target_link_libraries(hierarchical_seg-gui ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES})
endif(${QT4_FOUND})
add_dependencies(build-apps hierarchical_seg-gui hierarchical_seg-cli)
endif (${QT4_FOUND})
......@@ -2,4 +2,6 @@ add_executable(profiles_from_tos profiles_from_tos.cpp $<TARGET_OBJECTS:g2-tools
target_link_libraries(profiles_from_tos ${FreeImage_LIBRARIES})
add_executable(profiles_from_marginal_tos profiles_from_marginal_tos.cpp $<TARGET_OBJECTS:g2-tools>)
target_link_libraries(profiles_from_marginal_tos ${FreeImage_LIBRARIES})
\ No newline at end of file
target_link_libraries(profiles_from_marginal_tos ${FreeImage_LIBRARIES})
add_dependencies(build-apps profiles_from_tos profiles_from_marginal_tos)
......@@ -8,3 +8,4 @@ add_executable(grain_filter_color grain_filter_color.cpp)
add_executable(psnr psnr.cpp)
add_executable(compute_depth compute_depth.cpp)
add_dependencies(build-apps print_tos_stat reconstruct_from_tree ppm_grain_filter_marginal grain_filter_color psnr compute_depth)
......@@ -4,14 +4,16 @@ add_executable(mumford_shah_on_tree mumford_shah_on_tree.cpp)
add_executable(mumford_shah_on_tree_16 mumford_shah_on_tree.cpp)
add_executable(mumford_shah_on_tree_full mumford_shah_on_tree_full.cpp
${CMAKE_SOURCE_DIR}/apps/g2/satmaxtree.cpp
${CMAKE_SOURCE_DIR}/apps/g2/compute_g2.cpp)
${CMAKE_SOURCE_DIR}/apps/g2/satmaxtree.cpp
${CMAKE_SOURCE_DIR}/apps/g2/compute_g2.cpp)
add_executable(mumford_shah_on_tree_saliency mumford_shah_on_tree_saliency.cpp
${CMAKE_SOURCE_DIR}/apps/g2/satmaxtree.cpp
${CMAKE_SOURCE_DIR}/apps/g2/compute_g2.cpp)
${CMAKE_SOURCE_DIR}/apps/g2/satmaxtree.cpp
${CMAKE_SOURCE_DIR}/apps/g2/compute_g2.cpp)
set_target_properties(mumford_shah_on_tree_16 PROPERTIES COMPILE_DEFINITIONS MLN_INPUT_VALUE_TYPE=mln::rgb16)
target_link_libraries(mumford_shah_on_tree_full ${TBB_LIBRARIES})
target_link_libraries(mumford_shah_on_tree_saliency ${TBB_LIBRARIES})
\ No newline at end of file
target_link_libraries(mumford_shah_on_tree_saliency ${TBB_LIBRARIES})
add_dependencies(build-apps mumford_shah_on_tree mumford_shah_on_tree_16 mumford_shah_on_tree_full mumford_shah_on_tree_saliency)
link_libraries(${FreeImage_LIBRARIES})
if(Qt4_FOUND)
if (Qt4_FOUND)
INCLUDE(${QT_USE_FILE})
QT4_WRAP_CPP(dispsaliency_HEADERS_MOC
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/imageviewer.hpp
dispsaliency.hpp
)
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/imageviewer.hpp
dispsaliency.hpp
)
QT4_GENERATE_MOC(${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/imageviewer.hxx
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
add_executable(dispsaliency dispsaliency.cpp
${dispsaliency_HEADERS_MOC}
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp
)
${dispsaliency_HEADERS_MOC}
${CMAKE_HOME_DIRECTORY}/pylene/include/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp
)
target_link_libraries(dispsaliency ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES})
endif(Qt4_FOUND)
endif (Qt4_FOUND)
add_executable(saliency saliency.cpp
${CMAKE_HOME_DIRECTORY}/apps/attributes/MSERArgparser.cpp
${CMAKE_HOME_DIRECTORY}/apps/attributes/meaningfullnessArgparser.cpp)
${CMAKE_HOME_DIRECTORY}/apps/attributes/MSERArgparser.cpp
${CMAKE_HOME_DIRECTORY}/apps/attributes/meaningfullnessArgparser.cpp)
target_link_libraries(saliency ${Boost_PROGRAM_OPTIONS_LIBRARY})
......@@ -2,6 +2,3 @@ link_libraries(${FreeImage_LIBRARIES})
add_executable(simplify_gray simplify_gray.cpp)
add_executable(simplify_cluminance simplify_cluminance.cpp)
add_executable(simplify_color simplify_color.cpp ../tos/colorToSGrad.cpp)
......@@ -4,10 +4,10 @@ find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
if (WIN32)
link_libraries(${GTEST_BOTH_LIBRARIES})
link_libraries(${GTEST_BOTH_LIBRARIES})
else (WIN32)
link_libraries(${GTEST_BOTH_LIBRARIES} pthread)
link_libraries(${GTEST_BOTH_LIBRARIES} pthread)
endif (WIN32)
add_subdirectory(tos)
add_subdirectory(attributes)
\ No newline at end of file
add_subdirectory(attributes)
add_executable(ctos_grainfilter ctos_grainfilter.cpp $<TARGET_OBJECTS:g2-tools>)
target_link_libraries(ctos_grainfilter ${FreeImage_LIBRARIES})
add_dependencies(build-apps ctos_grainfilter)
if(Qt4_FOUND AND QWT_FOUND)
if (Qt4_FOUND AND QWT_FOUND)
INCLUDE(${QT_USE_FILE})
include_directories(${QWT_INCLUDE_DIR})
......@@ -7,39 +7,41 @@ if(Qt4_FOUND AND QWT_FOUND)
QT4_WRAP_CPP(tosgui_HEADERS_MOC
${CMAKE_HOME_DIRECTORY}/mln/qt/imageviewer.hpp
qattribute.hpp
dispatcher.hpp
plotwindow.hpp
attribute.hpp
)
${CMAKE_HOME_DIRECTORY}/mln/qt/imageviewer.hpp
qattribute.hpp
dispatcher.hpp
plotwindow.hpp
attribute.hpp
)
QT4_GENERATE_MOC(${CMAKE_HOME_DIRECTORY}/mln/qt/imageviewer.hxx
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
add_executable(tosgui tosgui.cpp qattribute.cpp dispatcher.cpp plotwindow.cpp attribute.cpp
${tosgui_HEADERS_MOC}
${CMAKE_HOME_DIRECTORY}/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp
)
${tosgui_HEADERS_MOC}
${CMAKE_HOME_DIRECTORY}/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp
)
add_executable(toscgui toscgui.cpp qattribute.cpp dispatcher.cpp
${tosgui_HEADERS_MOC}
${CMAKE_HOME_DIRECTORY}/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp
)
${tosgui_HEADERS_MOC}
${CMAKE_HOME_DIRECTORY}/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp
)
target_link_libraries(tosgui
${QWT_LIBRARY}
${QT_QTMAIN_LIBRARY}
${QT_LIBRARIES}
)
${QWT_LIBRARY}
${QT_QTMAIN_LIBRARY}
${QT_LIBRARIES}
)
target_link_libraries(toscgui
${QWT_LIBRARY}
${QT_QTMAIN_LIBRARY}
${QT_LIBRARIES}
)
${QWT_LIBRARY}
${QT_QTMAIN_LIBRARY}
${QT_LIBRARIES}
)
endif(Qt4_FOUND AND QWT_FOUND)
\ No newline at end of file
add_dependencies(build-apps tosgui toscgui)
endif (Qt4_FOUND AND QWT_FOUND)
......@@ -47,10 +47,8 @@ target_sources(BenchImpl PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/bench/neighborhood.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/neighborhood.cpp)
if (BUILD_TESTING)
include(CTest)
add_subdirectory(tests)
endif()
include(CTest)
add_subdirectory(tests)
set(src_standalone
BMErosion.cpp
......@@ -64,9 +62,6 @@ set(src_standalone
set_source_files_properties(${src_standalone} PROPERTIES COMPILE_FLAGS ${STANDALONE_COMPILE_FLAGS})
enable_testing()
add_benchmark(BMAlgorithms BMAlgorithms.cpp BMAlgorithms_main.cpp)
add_benchmark(BMNeighborhood BMNeighborhood.cpp BMNeighborhood_main.cpp)
add_benchmark(BMRotation BMRotation.cpp)
......
......@@ -22,29 +22,30 @@ function(add_benchmark Executable)
add_executable(${Benchmark_NAME} ${Benchmark_SOURCES})
target_link_libraries(${Benchmark_NAME} PRIVATE Fixtures::ImagePath BenchImpl Pylene::Pylene benchmark::benchmark ${FreeImage_LIBRARIES})
target_include_directories(${Benchmark_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(build-bench ${Benchmark_NAME})
# Retrieve reference
set(Benchmark_OUTPUT_FILE ${Benchmark_NAME}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}.json)
# Create a target to run the benchmark
add_custom_target(run-${Benchmark_NAME}
COMMAND ${Benchmark_NAME} --benchmark_out_format=json --benchmark_out=${Benchmark_OUTPUT_FILE} --benchmark_repetitions=9 #--benchmark_display_aggregates_only=true
DEPENDS ${Benchmark_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
USES_TERMINAL)
COMMAND ${Benchmark_NAME} --benchmark_out_format=json --benchmark_out=${Benchmark_OUTPUT_FILE} --benchmark_repetitions=9 #--benchmark_display_aggregates_only=true
DEPENDS ${Benchmark_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
USES_TERMINAL)
add_dependencies(run-all-benchmarks run-${Benchmark_NAME})
# Create a speed test to run the benchmark and compare to the reference
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/references/${Benchmark_OUTPUT_FILE}.md5")
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/references/${Benchmark_OUTPUT_FILE}.md5")
message(STATUS "Test ${Benchmark_NAME} found.")