summaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
blob: 091352874ea35c713029503a5b9e2945591246ba (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
cmake_minimum_required(VERSION 2.6)

#{{{ Sources
set(ufofilter_SRCS
    ufo-roof-read-task.c
    ufo-roof-build-task.c
    )

set(common_SRCS
    ufo-roof-config.c
    )

set(roof_read_aux_SRCS
    ufo-roof-read-socket.c
    ufo-roof-read-file.c
    )

set(roof_build_aux_SRCS
    ufo-roof-buffer.c
    )
    

file(GLOB ufofilter_KERNELS "kernels/*.cl")
#}}}
#{{{ Variables
set(ufofilter_LIBS
    m
    ${UFO_LIBRARIES}
    ${OpenCL_LIBRARIES})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -Wall -Wextra -fPIC -Wno-unused-parameter -Wno-deprecated-declarations")

add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES)
#}}}
#{{{ Dependency checks


#}}}
#{{{ Plugin targets
include_directories(${CMAKE_CURRENT_BINARY_DIR}
                    ${CMAKE_CURRENT_SOURCE_DIR}
                    ${OpenCL_INCLUDE_DIRS}
                    ${UFO_INCLUDE_DIRS})

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
               ${CMAKE_CURRENT_BINARY_DIR}/config.h)


foreach(_src ${ufofilter_SRCS})
    # find plugin suffix
    string(REGEX REPLACE "ufo-([^ \\.]+)-task.*" "\\1" task "${_src}")

    # build string to get auxalleanous sources
    string(REPLACE "-" "_" _aux ${task})
    string(TOUPPER ${_aux} _aux_upper)

    # create an option name and add this to disable filters
    set(_aux_src "${_aux}_aux_SRCS")
    set(_aux_libs "${_aux}_aux_LIBS")

    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} ${common_SRCS} ${${_aux_src}})
    else()
        add_library(${target} SHARED ${_src} ${common_SRCS} ${${_aux_src}})
    endif()

    target_link_libraries(${target} ${ufofilter_LIBS} ${${_aux_libs}} ufoaux)

    list(APPEND all_targets ${target})

    install(TARGETS ${target}
            ARCHIVE DESTINATION ${UFO_PLUGINDIR}
            LIBRARY DESTINATION ${UFO_PLUGINDIR})
endforeach()
#}}}
#{{{ Subdirectories
add_subdirectory(kernels)
#}}}