diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 55c1340..0000000 --- a/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -warning_flags = -Wall -Wextra -Wshadow -Wno-unused-parameter -common_cflags = -O3 -ffast-math -fvisibility=hidden $(warning_flags) $(MFLAGS) -AM_CXXFLAGS = -std=c++14 $(common_cflags) - -AM_CPPFLAGS = $(VapourSynth_CFLAGS) - -lib_LTLIBRARIES = libtcanny.la - -libtcanny_la_SOURCES = TCanny/TCanny.cpp \ - TCanny/TCanny.hpp \ - TCanny/vectorclass/instrset.h \ - TCanny/vectorclass/instrset_detect.cpp - -if VS_TARGET_CPU_X86 -libtcanny_la_SOURCES += TCanny/TCanny_SSE2.cpp \ - TCanny/vectorclass/vectorclass.h \ - TCanny/vectorclass/vectorf128.h \ - TCanny/vectorclass/vectorf256.h \ - TCanny/vectorclass/vectorf256e.h \ - TCanny/vectorclass/vectori128.h \ - TCanny/vectorclass/vectori256.h \ - TCanny/vectorclass/vectori256e.h \ - TCanny/vectorclass/vectormath_common.h \ - TCanny/vectorclass/vectormath_trig.h - -noinst_LTLIBRARIES = libavx.la libavx2.la - -libavx_la_SOURCES = TCanny/TCanny_AVX.cpp -libavx_la_CXXFLAGS = $(AM_CXXFLAGS) -mavx - -libavx2_la_SOURCES = TCanny/TCanny_AVX2.cpp -libavx2_la_CXXFLAGS = $(AM_CXXFLAGS) -mavx2 -mfma - -libtcanny_la_LIBADD = libavx.la libavx2.la -endif - -if OPENCL -libtcanny_la_SOURCES += TCanny/TCannyCL.cpp -endif - -libtcanny_la_LDFLAGS = -no-undefined -avoid-version $(PLUGINLDFLAGS) $(OPENCLLDFLAGS) diff --git a/README.md b/README.md index b9820f8..5a8fa61 100644 --- a/README.md +++ b/README.md @@ -47,18 +47,17 @@ Usage * device: Sets target OpenCL device. Use `list_device` to get the index of the available devices. By default the default device is selected. -* list_device: Whether the devices list is drawn on the frame. +* list_device: Whether to draw the devices list on the frame. -* info: Whether the OpenCL-related info is drawn on the frame. +* info: Whether to draw the OpenCL-related info on the frame. Compilation =========== -Requires `Boost` unless configured with `--disable-opencl`. +Requires `Boost` unless specify `-D opencl=false`. ``` -./autogen.sh -./configure -make +meson build +ninja -C build ``` diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index a8fd885..0000000 --- a/autogen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -autoreconf --verbose --install --force diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 8fd52f1..0000000 --- a/configure.ac +++ /dev/null @@ -1,72 +0,0 @@ -AC_INIT([TCanny], [11], [https://github.com/HomeOfVapourSynthEvolution/VapourSynth-TCanny/issues], [TCanny], [https://github.com/HomeOfVapourSynthEvolution/VapourSynth-TCanny/]) - -: ${CXXFLAGS=""} - -AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz subdir-objects no-define]) -AM_SILENT_RULES([yes]) - -LT_INIT([disable-static win32-dll]) - -AC_CANONICAL_HOST - -AC_PROG_CXX - - -X86="false" -OPENCLLDFLAGS="-lOpenCL" - -AS_CASE( - [$host_cpu], - [i?86], [BITS="32" X86="true"], - [x86_64], [BITS="64" X86="true"] -) - -AS_CASE( - [$host_os], - [darwin*], - [ - OPENCLLDFLAGS="-framework OpenCL" - ], - [cygwin*|mingw*], - [ - AS_IF( - [test "x$BITS" = "x32"], - [ - AC_SUBST([PLUGINLDFLAGS], ["-Wl,--kill-at"]) - ] - ) - ] -) - -AS_IF( - [test "x$X86" = "xtrue"], - [ - AC_DEFINE([VS_TARGET_CPU_X86]) - - AC_SUBST([MFLAGS], ["-mfpmath=sse -msse2"]) - ] -) - - -AC_ARG_ENABLE([opencl], AS_HELP_STRING([--enable-opencl], [Enable TCannyCL filter (default=yes)])) -AS_IF( - [test "x$enable_opencl" != "xno"], - [ - AC_DEFINE([HAVE_OPENCL]) - - AC_SUBST([OPENCLLDFLAGS], ["$OPENCLLDFLAGS -lboost_filesystem -lboost_system"]) - ], - [ - OPENCLLDFLAGS= - ] -) - - -AM_CONDITIONAL([VS_TARGET_CPU_X86], [test "x$X86" = "xtrue"]) -AM_CONDITIONAL([OPENCL], [test "x$enable_opencl" != "xno"]) - - -PKG_CHECK_MODULES([VapourSynth], [vapoursynth]) - -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..a178859 --- /dev/null +++ b/meson.build @@ -0,0 +1,74 @@ +project('TCanny', 'cpp', + default_options : ['buildtype=release', 'b_ndebug=if-release', 'cpp_std=c++14'], + meson_version : '>=0.48.0', + version : '11' +) + +add_project_arguments('-ffast-math', language : 'cpp') + +sources = [ + 'TCanny/TCanny.cpp', + 'TCanny/TCanny.hpp', + 'TCanny/vectorclass/instrset.h', + 'TCanny/vectorclass/instrset_detect.cpp' +] + +vapoursynth_dep = dependency('vapoursynth').partial_dependency(compile_args : true, includes : true) + +deps = [vapoursynth_dep] + +libs = [] + +if host_machine.cpu_family().startswith('x86') + add_project_arguments('-DVS_TARGET_CPU_X86', '-mfpmath=sse', '-msse2', language : 'cpp') + + sources += [ + 'TCanny/TCanny_SSE2.cpp', + 'TCanny/vectorclass/vectorclass.h', + 'TCanny/vectorclass/vectorf128.h', + 'TCanny/vectorclass/vectorf256.h', + 'TCanny/vectorclass/vectorf256e.h', + 'TCanny/vectorclass/vectori128.h', + 'TCanny/vectorclass/vectori256.h', + 'TCanny/vectorclass/vectori256e.h', + 'TCanny/vectorclass/vectormath_common.h', + 'TCanny/vectorclass/vectormath_trig.h' + ] + + if get_option('opencl') + add_project_arguments('-DHAVE_OPENCL', language : 'cpp') + + sources += [ + 'TCanny/TCannyCL.cpp' + ] + + opencl_dep = dependency('OpenCL', required : false) + if not opencl_dep.found() + opencl_dep = meson.get_compiler('cpp').find_library('OpenCL') + endif + + boost_dep = dependency('boost', modules : ['filesystem', 'system']) + + deps += [opencl_dep, boost_dep] + endif + + libs += static_library('avx', 'TCanny/TCanny_AVX.cpp', + dependencies : [vapoursynth_dep], + cpp_args : ['-mavx'], + gnu_symbol_visibility : 'hidden' + ) + + libs += static_library('avx2', 'TCanny/TCanny_AVX2.cpp', + dependencies : [vapoursynth_dep], + cpp_args : ['-mavx2', '-mfma'], + gnu_symbol_visibility : 'hidden' + ) +endif + +shared_module('tcanny', sources, + dependencies : deps, + link_with : libs, + install : true, + install_dir : join_paths(vapoursynth_dep.get_pkgconfig_variable('libdir'), 'vapoursynth'), + gnu_symbol_visibility : 'hidden' +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..27fc587 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('opencl', type : 'boolean', value : true, description : 'Enable TCannyCL filter')