cmake_minimum_required(VERSION 2.6) #{{{ Sources set(ufofilter_SRCS ufo-roof-build-task.c ufo-roof-filter-task.c ufo-roof-flat-field-correct-task.c ) set(common_SRCS ufo-roof-config.c ) set(roof_build_aux_SRCS hw_sched.c hw_thread.c ufo-roof-read-socket.c ufo-roof-read-file.c 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=gnu18 -pedantic -Wall -Wextra -fPIC -Wno-unused-parameter -Wno-deprecated-declarations -g -gdwarf-2 -g3 -fno-omit-frame-pointer") 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}}) list(APPEND all_targets ${target}) install(TARGETS ${target} ARCHIVE DESTINATION ${UFO_PLUGINDIR} LIBRARY DESTINATION ${UFO_PLUGINDIR}) endforeach() #}}} #{{{ Subdirectories add_subdirectory(kernels) #}}}