• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1PROJECT(BTL)
2
3CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2)
4
5set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${Eigen_SOURCE_DIR}/cmake)
6include(MacroOptionalAddSubdirectory)
7
8OPTION(BTL_NOVEC "Disable SSE/Altivec optimizations when possible" OFF)
9
10SET(CMAKE_INCLUDE_CURRENT_DIR ON)
11
12string(REGEX MATCH icpc IS_ICPC ${CMAKE_CXX_COMPILER})
13IF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC)
14  SET(CMAKE_CXX_FLAGS "-g0 -O3 -DNDEBUG")
15  SET(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG")
16  IF(NOT BTL_NOVEC)
17    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
18    SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -msse2")
19  ELSE(NOT BTL_NOVEC)
20    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE")
21  ENDIF(NOT BTL_NOVEC)
22ENDIF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC)
23
24IF(MSVC)
25  SET(CMAKE_CXX_FLAGS " /O2 /Ot /GL /fp:fast -DNDEBUG")
26#   SET(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG")
27  IF(NOT BTL_NOVEC)
28    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
29  ELSE(NOT BTL_NOVEC)
30    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE")
31  ENDIF(NOT BTL_NOVEC)
32ENDIF(MSVC)
33
34if(IS_ICPC)
35  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fast")
36  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fast")
37endif(IS_ICPC)
38
39include_directories(
40  ${PROJECT_SOURCE_DIR}/actions
41  ${PROJECT_SOURCE_DIR}/generic_bench
42  ${PROJECT_SOURCE_DIR}/generic_bench/utils
43  ${PROJECT_SOURCE_DIR}/libs/STL)
44
45# find_package(MKL)
46# if (MKL_FOUND)
47#   add_definitions(-DHAVE_MKL)
48#   set(DEFAULT_LIBRARIES ${MKL_LIBRARIES})
49# endif (MKL_FOUND)
50
51MACRO(BTL_ADD_BENCH targetname)
52
53  foreach(_current_var ${ARGN})
54    set(_last_var ${_current_var})
55  endforeach(_current_var)
56
57  set(_sources ${ARGN})
58  list(LENGTH _sources _argn_length)
59
60  list(REMOVE_ITEM _sources ON OFF TRUE FALSE)
61
62  list(LENGTH _sources _src_length)
63
64  if (${_argn_length} EQUAL ${_src_length})
65    set(_last_var ON)
66  endif (${_argn_length} EQUAL ${_src_length})
67
68  OPTION(BUILD_${targetname} "Build benchmark ${targetname}" ${_last_var})
69
70  IF(BUILD_${targetname})
71    ADD_EXECUTABLE(${targetname} ${_sources})
72    ADD_TEST(${targetname} "${targetname}")
73    target_link_libraries(${targetname} ${DEFAULT_LIBRARIES} rt)
74  ENDIF(BUILD_${targetname})
75
76ENDMACRO(BTL_ADD_BENCH)
77
78macro(btl_add_target_property target prop value)
79
80  if(BUILD_${target})
81    get_target_property(previous ${target} ${prop})
82    if(NOT previous)
83      set(previous "")
84    endif()
85    set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}")
86  endif()
87
88endmacro(btl_add_target_property)
89
90ENABLE_TESTING()
91
92add_subdirectory(libs/eigen3)
93add_subdirectory(libs/eigen2)
94add_subdirectory(libs/BLAS)
95add_subdirectory(libs/ublas)
96add_subdirectory(libs/gmm)
97add_subdirectory(libs/mtl4)
98add_subdirectory(libs/blitz)
99add_subdirectory(libs/tvmet)
100add_subdirectory(libs/STL)
101
102add_subdirectory(data)
103
104
105