-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
78 lines (67 loc) · 2.24 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
cmake_minimum_required(VERSION 2.8)
project(dctdenoising)
# The build type "Release" adds some optimizations
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()
# GCC on MacOs needs this option to use the clang assembler
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (APPLE))
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wa,-q")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-q")
set (CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem")
set (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem")
endif ()
# Optimize to the current CPU and enable warnings
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -Wall -Wextra")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra")
endif ()
# Enable C99
if (CMAKE_VERSION VERSION_LESS "3.1")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
else ()
set (CMAKE_C_STANDARD 99)
endif ()
# Enable C++11
if (CMAKE_VERSION VERSION_LESS "3.1")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
else ()
set (CMAKE_CXX_STANDARD 11)
endif ()
# Enable OpenMP
find_package (OpenMP)
if(OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
endif()
# Link LibFFTW
find_path (FFTW_INCLUDE_DIR fftw3.h)
find_library (FFTWF_LIBRARIES NAMES fftw3f)
include_directories (SYSTEM ${FFTW_INCLUDE_DIR})
link_libraries (${FFTWF_LIBRARIES})
if (NOT FFTW_INCLUDE_DIR)
message (FATAL_ERROR "FFTW3 not found.")
endif ()
# Link LibTIFF, LibJPEG, LibPNG, OpenMP
find_package (TIFF REQUIRED)
find_package (JPEG REQUIRED)
find_package (PNG REQUIRED)
include_directories (SYSTEM ${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIRS})
link_libraries (${TIFF_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES})
set(SOURCE_FILES
main.cpp
DCTdenoising.cpp
DCTdenoising.h
iio.c
iio.h
DCTPatch.hpp
Image.hpp
utils.cpp
utils.hpp
demoutils.cpp
demoutils.hpp
)
set_property(SOURCE iio.c PROPERTY COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-parameter -Wno-pointer-sign -Wno-parentheses -Wno-deprecated-declarations -Wno-unused-function")
add_executable(dctdenoising ${SOURCE_FILES})