-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
executable file
·112 lines (89 loc) · 2.52 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#
# CMAKE parameters file for 'configure'
#
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
#
# Misc parameters
#
# output parameters for 'make'
SET(CMAKE_COLOR_MAKEFILE "ON")
# project declaration
PROJECT(HPCA)
# Release/Debug
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_DEFAULT_BUILD_TYPE "Release")
ENDIF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
# path for binary
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
#
# compiler flags
#
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -fPIC")
IF(NOT APPLE)
ADD_DEFINITIONS(-march=native)
ENDIF(NOT APPLE)
#
# Check for required libraries
# FIND_PACKAGE( xxx REQUIRED ) : REQUIRED removed so that MESSAGE is written
#
# Threads
FIND_PACKAGE( Threads )
IF ( NOT THREADS_FOUND )
MESSAGE(FATAL_ERROR "Package Threads required, but not found!")
ENDIF( NOT THREADS_FOUND )
# Zlib
FIND_PACKAGE( ZLIB )
IF ( NOT ZLIB_FOUND )
MESSAGE(FATAL_ERROR "Package ZLIB required, but not found!")
ENDIF( NOT ZLIB_FOUND )
# Blas
FIND_PACKAGE(BLAS)
IF(BLAS_FOUND)
SET(USE_BLAS 1)
ENDIF(BLAS_FOUND)
# Lapack
FIND_PACKAGE(LAPACK)
IF(LAPACK_FOUND)
SET(USE_LAPACK 1)
ENDIF(LAPACK_FOUND)
# OpenMP
FIND_PACKAGE(OpenMP)
if (OPENMP_FOUND)
MESSAGE(STATUS "Compiling with OpenMP support")
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
ENDIF(OPENMP_FOUND)
#
# Default Options
#
# should we use VERBOSE functions?
OPTION (VERBOSE "Use VERBOSE option" OFF)
# should we use VERBOSE functions?
OPTION (EIGEN_USE_MKL_ALL "Use MKL Library option" OFF)
#
# Management
#
# configure a header file to pass some of the CMake settings
# to the source code
CONFIGURE_FILE (
${CMAKE_SOURCE_DIR}/src/config.h.cmake
${CMAKE_SOURCE_DIR}/src/config.h
)
# specify the cross compiler
SET(CMAKE_CXX_COMPILER g++)
# add a target to generate API documentation with Doxygen
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
ADD_CUSTOM_TARGET(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
ENDIF(DOXYGEN_FOUND)
ADD_SUBDIRECTORY(src)
INCLUDE_DIRECTORIES(data)