Home | History | Annotate | Download | only in btl
      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")
     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)
     22 ENDIF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC)
     23 
     24 IF(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)
     32 ENDIF(MSVC)
     33 
     34 if(IS_ICPC)
     35   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fast")
     36   set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fast")
     37 endif(IS_ICPC)
     38 
     39 include_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 
     51 MACRO(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 
     76 ENDMACRO(BTL_ADD_BENCH)
     77 
     78 macro(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 
     88 endmacro(btl_add_target_property)
     89 
     90 ENABLE_TESTING()
     91 
     92 add_subdirectory(libs/eigen3)
     93 add_subdirectory(libs/eigen2)
     94 add_subdirectory(libs/BLAS)
     95 add_subdirectory(libs/ublas)
     96 add_subdirectory(libs/gmm)
     97 add_subdirectory(libs/mtl4)
     98 add_subdirectory(libs/blitz)
     99 add_subdirectory(libs/tvmet)
    100 add_subdirectory(libs/STL)
    101 
    102 add_subdirectory(data)
    103 
    104 
    105