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 ${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) 19ENDIF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) 20 21IF(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) 27ENDIF(MSVC) 28 29if(IS_ICPC) 30 set(CMAKE_CXX_FLAGS "-fast ${CMAKE_CXX_FLAGS}") 31 set(CMAKE_Fortran_FLAGS "-fast ${CMAKE_Fortran_FLAGS}") 32endif(IS_ICPC) 33 34include_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 46find_library(EIGEN_BTL_RT_LIBRARY rt) 47# if we cannot find it easily, then we don't need it! 48if(NOT EIGEN_BTL_RT_LIBRARY) 49 set(EIGEN_BTL_RT_LIBRARY "") 50endif() 51 52MACRO(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 77ENDMACRO(BTL_ADD_BENCH) 78 79macro(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 89endmacro(btl_add_target_property) 90 91ENABLE_TESTING() 92 93add_subdirectory(libs/eigen3) 94add_subdirectory(libs/eigen2) 95add_subdirectory(libs/tensors) 96add_subdirectory(libs/BLAS) 97add_subdirectory(libs/ublas) 98add_subdirectory(libs/gmm) 99add_subdirectory(libs/mtl4) 100add_subdirectory(libs/blitz) 101add_subdirectory(libs/tvmet) 102add_subdirectory(libs/STL) 103add_subdirectory(libs/blaze) 104 105add_subdirectory(data) 106 107 108