-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
94 lines (77 loc) · 2.8 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
cmake_minimum_required(VERSION 2.8)
project(compute_gist)
set(CMAKE_BUILD_TYPE "Release")
################
# FFTW (fast fourier transform)
################
SET(FFTW_SEARCH_PATHS
${CMAKE_SOURCE_DIR}/fftw-3.3.4-dll32
/usr/lib
$ENV{LD_LIBRARY_PATH}
$ENV{FFTW_HOME}/lib )
#FIND_LIBRARY(FFTW_LIB NAMES fftw3 fftw3f fftw3f-3 fftw3l-3 PATHS ${FFTW_SEARCH_PATHS})
FIND_LIBRARY(FFTW_LIB NAMES fftw3f fftw3f-3 PATHS ${FFTW_SEARCH_PATHS})
SET(FFTW_FOUND FALSE)
IF (FFTW_LIB)
SET(FFTW_FOUND TRUE)
MARK_AS_ADVANCED(FFTW_LIB)
ENDIF (FFTW_LIB)
IF (FFTW_FOUND)
#IF (NOT FFTW_LIB_FIND_QUIETLY)
MESSAGE(STATUS "Found FFTW: ${FFTW_LIB}")
GET_FILENAME_COMPONENT(FFTW_PATH ${FFTW_LIB} PATH CACHE)
SET(FFTW_INCLUDE_DIR ${FFTW_PATH}/../include CACHE FILEPATH "FFTW include directory.")
MARK_AS_ADVANCED(FFTW_PATH)
MARK_AS_ADVANCED(FFTW_INCLUDE_DIR)
#ENDIF (NOT FFTW_LIB_FIND_QUIETLY)
set(FFTW_LIBRARIES "${FFTW_LIBRARY}")
ELSE(FFTW_FOUND)
#IF (FFTW_LIB_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "FATAL ERROR: Could not find FFTW")
#ENDIF (FFTW_LIB_FIND_REQUIRED)
ENDIF (FFTW_FOUND)
################
################
# OPEN MP
################
message(STATUS "Checking OpenMP")
find_package(OpenMP REQUIRED)
IF(OPENMP_FOUND)
MESSAGE(STATUS "Found OpenMP: ${OpenMP_C_FLAGS}")
# add flags for OpenMP
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
ELSE()
MESSAGE(FATAL_ERROR "FATAL ERROR: Could not find OpenMP")
ENDIF()
################
################
# MATH Libraries
################
find_library(M_LIB m)
################
set(SOURCE_FILES
${CMAKE_SOURCE_DIR}/gist/gist.c
${CMAKE_SOURCE_DIR}/gist/gist.h
${CMAKE_SOURCE_DIR}/gist/compute_gist.c
${CMAKE_SOURCE_DIR}/gist/standalone_image.c
${CMAKE_SOURCE_DIR}/gist/standalone_image.h)
include_directories(${CMAKE_SOURCE_DIR}/gist)
include_directories(${FFTW_INCLUDE_DIR}) # unix include
include_directories(${FFTW_PATH}) # win32 include
# Add definition flags
add_definitions(-DUSE_GIST -DSTANDALONE_GIST)
add_executable(compute_gist ${SOURCE_FILES})
########################################
message("FFTW_LIB = ${FFTW_LIB}")
message("FFTW_PATH = ${FFTW_PATH}")
message("FFTW_INCLUDE_DIR = ${FFTW_INCLUDE_DIR}")
message("FFTW_LIBRARIES = ${FFTW_LIBRARIES}")
message("M_LIB = ${M_LIB}")
message("CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
message("CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
message("CMAKE_SHARED_LINKER_FLAGS = ${CMAKE_SHARED_LINKER_FLAGS}")
message("CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}")
target_link_libraries(compute_gist ${FFTW_LIB} ${M_LIB})