diff options
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..0913528 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,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) +#}}} |