Fixed buffer initialization in reduce kernel. Enabled OCL version of reduce for SUM, MAX, MIN modes.
move CUDA compilation step from ocv_glob_module_sources to ocv_add_library
use directory-based include_directories command if we build with CUDA
remove -fvisibility-inlines-hidden from CUDA compiler flags 

it generates warning
Enable OpenCL version of norm and convertScaleAbs or 32F data

Fix error in minmaxloc.cl
Change test for convertScaleAbs
Fix minMaxIdx for _src2 align
Change epsilon on the tests
fix cudabgsegm module compilation
fixed build of iOS framework another time; clang does not like the new NEON-optimized split/merge
Change epsilon for NORM_INF_2args accuracy tests
avoid compiler warnings
another mac-related fix, let's squeeze it in this PR too
Fixed incorrect pointer conversion for in-place threshold
Minimal image size is set to 5*5 for OCL path of fastNlMeansDenoising and fastNlMeansDenoisingColored since it breaks tests with test_loop_times=30 and in general doesn't make sense for computation on GPU.
Set sync=true in ocl_minMaxIdx kernel call. For tests
removed optim module; moved its functionality to core and photo modules; moved drawing functions from core to imgproc. Removed FilterEngine etc. from public API
Merge pull request #3100 from vpisarev:disabled_neon_split_merge_on_ios
Merge pull request #3090 from akarsakov:ocl_reduce_fix
trying to fix builds
fixing more compile problems with Java bindings etc
Merge pull request #3098 from jet47:fix-cuda-compilation
trying to solve compile problems; temporarily disabled some tests for just added optimization algo's