This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
120 lines (85 loc) · 2.92 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
113
114
115
116
117
118
119
120
cmake_minimum_required(VERSION 3.10)
project(SAIL-BENCHMARK VERSION 1.0.0
DESCRIPTION "Imaging Libraries Benchmarks"
LANGUAGES CXX)
macro(add_benchmark_skeleton)
set(BENCH "${ARGV0}")
add_executable(${BENCH} src/${BENCH}.cpp)
target_link_libraries(${BENCH} benchmark::benchmark benchmark::benchmark_main)
set_target_properties(${BENCH} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BENCH}")
endmacro()
set(CMAKE_PREFIX_PATH
"${PROJECT_SOURCE_DIR}/extra/B/lib/cmake/sail"
${CMAKE_PREFIX_PATH})
# Required pkg-config
#
set(PKG_CONFIG_EXECUTABLE "${PROJECT_SOURCE_DIR}/extra/bin/pkg-config.exe")
find_package(PkgConfig REQUIRED)
find_package(benchmark CONFIG REQUIRED)
# Path to test images
#
set(IMAGES "${PROJECT_SOURCE_DIR}/images/")
string(REPLACE "/" "\\\\" IMAGES "${IMAGES}")
add_definitions(-DIMAGES="${IMAGES}")
# Benchmark units
#
add_definitions(-DBENCHMARK_UNIT=benchmark::kMicrosecond)
#
# Benchmarks
#
# CImg
#
find_package(JPEG REQUIRED)
find_package(libpng CONFIG REQUIRED)
find_package(CImg CONFIG REQUIRED)
add_benchmark_skeleton(sail-benchmark-cimg)
target_include_directories(sail-benchmark-cimg PRIVATE ${JPEG_INCLUDE_DIR})
target_link_libraries(sail-benchmark-cimg ${JPEG_LIBRARIES})
target_link_libraries(sail-benchmark-cimg png)
target_link_libraries(sail-benchmark-cimg CImg::CImg)
# DevIL
#
pkg_check_modules(IL IMPORTED_TARGET REQUIRED DevIL)
add_benchmark_skeleton(sail-benchmark-devil)
target_link_libraries(sail-benchmark-devil PkgConfig::IL)
# FreeImage
#
find_package(freeimage CONFIG REQUIRED)
add_benchmark_skeleton(sail-benchmark-freeimage)
target_link_libraries(sail-benchmark-freeimage freeimage::FreeImage)
# GIL
#
find_package(Boost REQUIRED)
find_package(JPEG REQUIRED)
find_package(libpng CONFIG REQUIRED)
add_benchmark_skeleton(sail-benchmark-gil)
target_include_directories(sail-benchmark-gil PRIVATE ${JPEG_INCLUDE_DIR})
target_link_libraries(sail-benchmark-gil ${JPEG_LIBRARIES})
target_link_libraries(sail-benchmark-gil png)
target_link_libraries(sail-benchmark-gil Boost::boost)
# OpenImageIO
#
find_package(OpenImageIO CONFIG REQUIRED)
add_benchmark_skeleton(sail-benchmark-openimageio)
target_link_libraries(sail-benchmark-openimageio OpenImageIO::OpenImageIO OpenImageIO::OpenImageIO_Util)
# SAIL
#
find_package(Sail REQUIRED)
find_package(SailManip REQUIRED)
add_benchmark_skeleton(sail-benchmark-sail)
target_link_libraries(sail-benchmark-sail SAIL::sail SAIL::sail-manip)
# SDL
#
find_package(sdl2 CONFIG REQUIRED)
find_package(sdl2-image CONFIG REQUIRED)
add_benchmark_skeleton(sail-benchmark-sdl)
target_link_libraries(sail-benchmark-sdl SDL2::SDL2_image)
# STB
#
find_path(STB_INCLUDE_DIRS "stb.h")
add_benchmark_skeleton(sail-benchmark-stb)
target_include_directories(sail-benchmark-stb PRIVATE ${STB_INCLUDE_DIRS})
# WIC
#
add_benchmark_skeleton(sail-benchmark-wic)
target_link_libraries(sail-benchmark-wic Windowscodecs)