1
2
3if((NOT EIGEN3_INCLUDE_DIR) AND Eigen_SOURCE_DIR)
4  # unless EIGEN3_INCLUDE_DIR is defined, let's use current Eigen version
5  set(EIGEN3_INCLUDE_DIR ${Eigen_SOURCE_DIR})
6  set(EIGEN3_FOUND TRUE)
7else()
8  find_package(Eigen3)
9endif()
10
11if (EIGEN3_FOUND)
12
13  include_directories(${EIGEN3_INCLUDE_DIR})
14  btl_add_bench(btl_eigen3_linear main_linear.cpp)
15  btl_add_bench(btl_eigen3_vecmat main_vecmat.cpp)
16  btl_add_bench(btl_eigen3_matmat main_matmat.cpp)
17  btl_add_bench(btl_eigen3_adv main_adv.cpp      )
18
19  btl_add_target_property(btl_eigen3_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
20  btl_add_target_property(btl_eigen3_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
21  btl_add_target_property(btl_eigen3_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
22  btl_add_target_property(btl_eigen3_adv    COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3")
23
24  option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF)
25  if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC)
26    btl_add_bench(btl_eigen3_nogccvec_linear main_linear.cpp)
27    btl_add_bench(btl_eigen3_nogccvec_vecmat main_vecmat.cpp)
28    btl_add_bench(btl_eigen3_nogccvec_matmat main_matmat.cpp)
29    btl_add_bench(btl_eigen3_nogccvec_adv    main_adv.cpp   )
30
31    btl_add_target_property(btl_eigen3_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
32    btl_add_target_property(btl_eigen3_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
33    btl_add_target_property(btl_eigen3_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
34    btl_add_target_property(btl_eigen3_nogccvec_adv    COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec")
35  endif()
36
37
38  if(NOT BTL_NOVEC)
39    btl_add_bench(btl_eigen3_novec_linear main_linear.cpp OFF)
40    btl_add_bench(btl_eigen3_novec_vecmat main_vecmat.cpp OFF)
41    btl_add_bench(btl_eigen3_novec_matmat main_matmat.cpp OFF)
42    btl_add_bench(btl_eigen3_novec_adv main_adv.cpp       OFF)
43    btl_add_target_property(btl_eigen3_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
44    btl_add_target_property(btl_eigen3_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
45    btl_add_target_property(btl_eigen3_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
46    btl_add_target_property(btl_eigen3_novec_adv    COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec")
47
48#     if(BUILD_btl_eigen3_adv)
49#       target_link_libraries(btl_eigen3_adv ${MKL_LIBRARIES})
50#     endif(BUILD_btl_eigen3_adv)
51
52  endif(NOT BTL_NOVEC)
53
54  btl_add_bench(btl_tiny_eigen3 btl_tiny_eigen3.cpp OFF)
55
56  if(NOT BTL_NOVEC)
57    btl_add_bench(btl_tiny_eigen3_novec btl_tiny_eigen3.cpp OFF)
58    btl_add_target_property(btl_tiny_eigen3_novec    COMPILE_FLAGS "-DBTL_PREFIX=eigen3_tiny")
59
60    if(BUILD_btl_tiny_eigen3_novec)
61      btl_add_target_property(btl_tiny_eigen3_novec    COMPILE_FLAGS "-DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_tiny_novec")
62    endif(BUILD_btl_tiny_eigen3_novec)
63  endif(NOT BTL_NOVEC)
64
65endif (EIGEN3_FOUND)
66