-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
91 lines (77 loc) · 3.47 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
cmake_minimum_required(VERSION 2.8)
project(taco-bench)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ffast-math -std=c++11")
file(GLOB SOURCE_CODE ${PROJECT_SOURCE_DIR}/*.cpp)
file(GLOB HEADERS ${PROJECT_SOURCE_DIR}/*.h)
add_executable(${PROJECT_NAME} ${SOURCE_CODE} ${HEADERS})
# To find taco
if (NOT DEFINED ENV{TACO_INCLUDE_DIR} OR NOT DEFINED ENV{TACO_LIBRARY_DIR})
message(FATAL_ERROR "Set the environment variables TACO_INCLUDE_DIR and TACO_LIBRARY_DIR")
endif ()
set(TACO_INCLUDE_DIR $ENV{TACO_INCLUDE_DIR})
set(TACO_LIBRARY_DIR $ENV{TACO_LIBRARY_DIR})
find_library(taco taco ${TACO_LIBRARY_DIR})
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${taco})
# Include taco headers
include_directories(${TACO_INCLUDE_DIR})
# Eigen
if (NOT DEFINED ENV{EIGEN_DIR})
message(WARNING "Eigen not found and will not be used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN -Wno-deprecated-declarations")
include_directories($ENV{EIGEN_DIR})
endif ()
# GMM
if (NOT DEFINED ENV{GMM_INCLUDE_DIR})
message(WARNING "GMM++ not found and will not be used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGMM -DNDEBUG ")
include_directories($ENV{GMM_INCLUDE_DIR})
endif ()
# UBLAS
if (NOT DEFINED ENV{UBLAS_INCLUDE_DIR})
message(WARNING "UBLAS not found and will not be used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUBLAS -DNDEBUG ")
include_directories($ENV{UBLAS_INCLUDE_DIR})
endif ()
# OSKI
if ((NOT DEFINED ENV{OSKI_INCLUDE_DIR}) OR (NOT DEFINED ENV{OSKI_LIBRARY_DIR}))
message(WARNING "OSKI not found and will not be used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOSKI ")
include_directories($ENV{OSKI_INCLUDE_DIR})
set(OSKI_LIBRARY_DIR $ENV{OSKI_LIBRARY_DIR})
set(OSKI_INCLUDE_DIR $ENV{OSKI_INCLUDE_DIR})
set(OSKI_MOD_COMMAND "cat $ENV{OSKI_LIBRARY_DIR}/site-modules-shared.txt | sed ':a\;N\;$!ba\;s/\\n/ /g' ")
execute_process(COMMAND ${OSKI_MOD_COMMAND} OUTPUT_VARIABLE OSKI_MODULES)
target_link_libraries(${PROJECT_NAME} "-L${OSKI_LIBRARY_DIR} -loski -loskilt -loski_Tid -loski_mat_CSR_Tid -loski_mat_CSC_Tid -loski_mat_BCSR_Tid -loski_mat_MBCSR_Tid -loski_mat_GCSR_Tid -loski_mat_CB_Tid -loski_mat_VBR_Tid -loski_mat_DENSE_Tid -loski_heur_regprof_Tid -loski_heur_symmrb_Tid -loski_heur_mregblock_Tid")
# TODO try to use the module variable
# target_link_libraries(${PROJECT_NAME} "-L${OSKI_LIBRARY_DIR} ${OSKI_MODULES}")
endif ()
# POSKI
if ((NOT DEFINED ENV{POSKI_INCLUDE_DIR}) OR (NOT DEFINED ENV{POSKI_LIBRARY_DIR}))
message(WARNING "POSKI not found and will not be used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPOSKI ")
include_directories($ENV{POSKI_INCLUDE_DIR})
set(POSKI_LIBRARY_DIR $ENV{POSKI_LIBRARY_DIR})
set(POSKI_INCLUDE_DIR $ENV{POSKI_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} "-Wl,-rpath -Wl,${POSKI_LIBRARY_DIR} -L${POSKI_LIBRARY_DIR} -lposki")
endif ()
# MKL
if (NOT DEFINED ENV{MKL_ROOT})
message(WARNING "MKL not found and will not be used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMKL ")
include_directories($ENV{MKL_ROOT}/include)
target_link_libraries(${PROJECT_NAME} "-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl")
endif ()
# Your project
if ((NOT DEFINED ENV{YOUR_INCLUDE_DIR}) OR (NOT DEFINED ENV{YOUR_LIBRARY_DIR}))
message(WARNING "Your not found and will not be used")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DYOUR ")
# Add here dependencies to your library/code
# ...
endif ()