CMakeLists.txt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. cmake_minimum_required(VERSION 2.6)
  2. #{{{ Sources
  3. set(ufofilter_SRCS
  4. ufo-anka-backproject-task.c
  5. )
  6. file(GLOB ufofilter_KERNELS "kernels/*.cl")
  7. #}}}
  8. #{{{ Variables
  9. if (CMAKE_COMPILER_IS_GNUCC OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
  10. add_definitions("-Wcast-align -Wcast-qual -Winline -Wmissing-declarations "
  11. "-Wmissing-prototypes -Wnested-externs -Wno-long-long "
  12. "-Wno-missing-field-initializers -Wpointer-arith "
  13. "-Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings")
  14. endif()
  15. #}}}
  16. #{{{ Plugin targets
  17. include_directories(${CMAKE_CURRENT_BINARY_DIR}
  18. ${CMAKE_CURRENT_SOURCE_DIR}
  19. ${OPENCL_INCLUDE_DIRS}
  20. ${UFO_INCLUDE_DIRS})
  21. foreach(_src ${ufofilter_SRCS})
  22. # find plugin suffix
  23. string(REGEX REPLACE "ufo-([^ \\.]+)-task.*" "\\1" task "${_src}")
  24. # build string to get miscalleanous sources
  25. string(REPLACE "-" "_" _misc ${task})
  26. string(TOUPPER ${_misc} _misc_upper)
  27. # create an option name and add this to disable filters
  28. set(target_option "ENABLE_${_misc_upper}")
  29. option(${target_option} "Build filter ${task}" ON)
  30. if (${target_option})
  31. set(_misc "${_misc}_misc_SRCS")
  32. string(REPLACE "-" "" _targetname ${task})
  33. set(target "ufofilter${_targetname}")
  34. # build single shared library per filter
  35. if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  36. add_library(${target} MODULE ${_src} ${${_misc}})
  37. else()
  38. add_library(${target} SHARED ${_src} ${${_misc}})
  39. endif()
  40. target_link_libraries(${target} ${ufofilter_LIBS})
  41. list(APPEND all_targets ${target})
  42. install(TARGETS ${target}
  43. ARCHIVE DESTINATION ${UFO_ANKAFILTERS_PLUGINDIR}
  44. LIBRARY DESTINATION ${UFO_ANKAFILTERS_PLUGINDIR})
  45. endif()
  46. endforeach()
  47. # copy kernels
  48. foreach(_kernel ${ufofilter_KERNELS})
  49. install(FILES ${_kernel} DESTINATION ${UFO_ANKAFILTERS_KERNELDIR})
  50. endforeach()
  51. #}}}