You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.8 KiB

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