2008-07-09 22:04:48 +08:00
|
|
|
PROJECT(BTL)
|
|
|
|
|
2009-01-05 00:19:12 +08:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2)
|
2008-07-09 22:04:48 +08:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
|
|
|
include(MacroOptionalAddSubdirectory)
|
|
|
|
|
|
|
|
OPTION(BTL_NOVEC "Disable SSE/Altivec optimizations when possible" OFF)
|
|
|
|
|
|
|
|
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
2008-08-05 07:12:48 +08:00
|
|
|
string(REGEX MATCH icpc IS_ICPC ${CMAKE_CXX_COMPILER})
|
|
|
|
IF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC)
|
2008-07-09 22:04:48 +08:00
|
|
|
SET(CMAKE_CXX_FLAGS "-g0 -O3 -DNDEBUG")
|
2008-07-10 06:35:11 +08:00
|
|
|
SET(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG")
|
2008-07-09 22:04:48 +08:00
|
|
|
IF(NOT BTL_NOVEC)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
|
2008-07-10 06:35:11 +08:00
|
|
|
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -msse2")
|
2008-07-09 22:04:48 +08:00
|
|
|
ELSE(NOT BTL_NOVEC)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE")
|
|
|
|
ENDIF(NOT BTL_NOVEC)
|
2008-08-05 07:12:48 +08:00
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC)
|
|
|
|
|
2008-12-18 17:07:36 +08:00
|
|
|
IF(MSVC)
|
|
|
|
SET(CMAKE_CXX_FLAGS " /O2 /Ot /GL /fp:fast -DNDEBUG")
|
|
|
|
# SET(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG")
|
|
|
|
IF(NOT BTL_NOVEC)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
|
|
|
|
ELSE(NOT BTL_NOVEC)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE")
|
|
|
|
ENDIF(NOT BTL_NOVEC)
|
|
|
|
ENDIF(MSVC)
|
|
|
|
|
2008-08-05 07:12:48 +08:00
|
|
|
if(IS_ICPC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fast")
|
|
|
|
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fast")
|
|
|
|
endif(IS_ICPC)
|
2008-07-09 22:04:48 +08:00
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${PROJECT_SOURCE_DIR}/actions
|
|
|
|
${PROJECT_SOURCE_DIR}/generic_bench
|
|
|
|
${PROJECT_SOURCE_DIR}/generic_bench/utils
|
|
|
|
${PROJECT_SOURCE_DIR}/libs/STL)
|
|
|
|
|
2008-07-27 19:39:47 +08:00
|
|
|
# find_package(MKL)
|
|
|
|
# if (MKL_FOUND)
|
|
|
|
# add_definitions(-DHAVE_MKL)
|
|
|
|
# set(DEFAULT_LIBRARIES ${MKL_LIBRARIES})
|
|
|
|
# endif (MKL_FOUND)
|
2008-07-09 22:04:48 +08:00
|
|
|
|
|
|
|
MACRO(BTL_ADD_BENCH targetname)
|
2008-07-11 02:28:50 +08:00
|
|
|
|
|
|
|
foreach(_current_var ${ARGN})
|
|
|
|
set(_last_var ${_current_var})
|
|
|
|
endforeach(_current_var)
|
|
|
|
|
|
|
|
set(_sources ${ARGN})
|
|
|
|
list(LENGTH _sources _argn_length)
|
|
|
|
|
|
|
|
list(REMOVE_ITEM _sources ON OFF TRUE FALSE)
|
|
|
|
|
|
|
|
list(LENGTH _sources _src_length)
|
|
|
|
|
|
|
|
if (${_argn_length} EQUAL ${_src_length})
|
|
|
|
set(_last_var ON)
|
|
|
|
endif (${_argn_length} EQUAL ${_src_length})
|
|
|
|
|
|
|
|
OPTION(BUILD_${targetname} "Build benchmark ${targetname}" ${_last_var})
|
|
|
|
|
|
|
|
IF(BUILD_${targetname})
|
|
|
|
ADD_EXECUTABLE(${targetname} ${_sources})
|
|
|
|
ADD_TEST(${targetname} "${targetname}")
|
2010-02-24 01:23:12 +08:00
|
|
|
target_link_libraries(${targetname} ${DEFAULT_LIBRARIES} rt)
|
2008-07-11 02:28:50 +08:00
|
|
|
ENDIF(BUILD_${targetname})
|
|
|
|
|
2008-07-09 22:04:48 +08:00
|
|
|
ENDMACRO(BTL_ADD_BENCH)
|
|
|
|
|
2009-03-09 22:18:29 +08:00
|
|
|
macro(btl_add_target_property target prop value)
|
|
|
|
|
|
|
|
if(BUILD_${target})
|
|
|
|
get_target_property(previous ${target} ${prop})
|
|
|
|
if(NOT previous)
|
|
|
|
set(previous "")
|
|
|
|
endif()
|
|
|
|
set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endmacro(btl_add_target_property)
|
|
|
|
|
2008-07-09 22:04:48 +08:00
|
|
|
ENABLE_TESTING()
|
|
|
|
|
2011-01-27 02:12:35 +08:00
|
|
|
add_subdirectory(libs/eigen3)
|
2011-03-23 17:35:54 +08:00
|
|
|
add_subdirectory(libs/BLAS)
|
2011-03-23 17:07:24 +08:00
|
|
|
add_subdirectory(libs/ublas)
|
2008-07-11 02:28:50 +08:00
|
|
|
add_subdirectory(libs/gmm)
|
|
|
|
add_subdirectory(libs/mtl4)
|
|
|
|
add_subdirectory(libs/blitz)
|
|
|
|
add_subdirectory(libs/tvmet)
|
|
|
|
add_subdirectory(libs/STL)
|
2008-07-09 22:04:48 +08:00
|
|
|
|
|
|
|
add_subdirectory(data)
|
|
|
|
|
2008-08-05 07:12:48 +08:00
|
|
|
|