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