blob: 10cfdc25cb15d2c89466f6e66eb179030b712a1d (
plain)
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
|
##
## This file is part of ufo-serge filter set.
## Copyright (C) 2016 Serge Cohen
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
## Serge Cohen <serge.cohen@synchrotron-soleil.fr>
##
set(contrib_sxc_filter_SRCS
ufo-med-mad-reject-2d-task.c
ufo-med-mad-reject-task.c
ufo-ocl-1liner-task.c
ufo-stat-monitor-task.c
)
set(contrib_sxc_aux_SRCS
ufo-sxc-common.c)
file(GLOB contrib_sxc_filter_KERNELS "kernels/*.cl")
include(ConfigurePaths)
include(PkgConfigVars)
include(CheckCSourceCompiles)
configure_paths(CONTRIB_SXC_FILTERS)
find_package(OpenCL REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(UFO ufo>=${PKG_UFO_CORE_MIN_REQUIRED} REQUIRED)
pkg_check_variable(ufo plugindir)
pkg_check_variable(ufo kerneldir)
add_definitions("-std=c99 -Wall -fPIC")
add_definitions(-DG_LOG_DOMAIN="Ufo")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${OPENCL_INCLUDE_DIRS}
${UFO_INCLUDE_DIRS})
link_directories(${UFO_LIBRARY_DIRS} ${OPENCL_LIBRARY_DIRS})
set(CMAKE_REQUIRED_INCLUDES ${OPENCL_INCLUDE_DIRS})
set(ufofilter_LIBS
m
${UFO_LIBRARIES}
${OpenCL_LIBRARIES})
set(CL_TARGET_OPENCL_VERSION "120")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
# build static auxiliary library first
add_library(contrib_sxc_aux STATIC ${contrib_sxc_aux_SRCS})
foreach(_src ${contrib_sxc_filter_SRCS})
# find plugin suffix
string(REGEX REPLACE "ufo-([^ \\.]+)-task.*" "\\1" task "${_src}")
# build string to get miscalleanous sources
set(target "ufofilter${task}")
# create an option name and add this to disable filters
set(_misc "${_misc}_misc_SRCS")
string(REPLACE "-" "" _targetname ${task})
set(target "ufofilter${_targetname}")
# build single shared library per filter
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_library(${target} MODULE ${_src} ${${_misc}})
else()
add_library(${target} SHARED ${_src} ${${_misc}})
endif()
target_link_libraries(${target} ${ufofilter_LIBS} ${${_aux_libs}} contrib_sxc_aux)
list(APPEND all_targets ${target})
install(TARGETS ${target}
ARCHIVE DESTINATION ${UFO_PLUGINDIR}
LIBRARY DESTINATION ${UFO_PLUGINDIR})
endforeach()
# copy kernels
foreach(_kernel ${contrib_sxc_filter_KERNELS})
install(FILES ${_kernel} DESTINATION ${UFO_KERNELDIR})
endforeach()
|