cmake_minimum_required(VERSION 3.10)
project(TestHadamard)

#find_package(TBB COMPONENTS tbb REQUIRED)

# Take account the two build modes
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
	message(STATUS "Build for tests COVERAGE")
	set(CTEST_COVERAGE_COMMAND "gcov")
	set(SELF_TESTS_MODE yes)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++17 -Wall -Werror -g -O0  -fprofile-arcs -ftest-coverage")
else()
	message(STATUS "Standard Build")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++17 -Wall -Werror -g -O2")
endif()

add_executable(hadamard_product main.cpp)
#target_link_libraries(hadamard_product TBB::tbb)
include(CTest)
add_test(NAME TestHadamard
	COMMAND ${CMAKE_CURRENT_BINARY_DIR}/hadamard_product
	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_test(NAME TestHadamardSize
	COMMAND ${CMAKE_CURRENT_BINARY_DIR}/hadamard_product 4096
	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

add_executable(hadamard_product_vectorized main.cpp)
set_property(TARGET hadamard_product_vectorized PROPERTY COMPILE_FLAGS "-O3 -march=native -mtune=native -ftree-vectorize -funroll-loops")

