diff --git a/3rdparty/homography.patch b/3rdparty/homography.patch new file mode 100644 index 00000000..6a6d3e56 --- /dev/null +++ b/3rdparty/homography.patch @@ -0,0 +1,57 @@ +diff --git a/3rdparty/homography/LibHomography/Splines.h b/3rdparty/homography/LibHomography/Splines.h +index 56a36f1..46a123d 100644 +--- a/3rdparty/homography/LibHomography/Splines.h ++++ b/3rdparty/homography/LibHomography/Splines.h +@@ -5,8 +5,7 @@ + //! Global includes + #include + #include +-#include +-#include ++#include "../../sse2neon/sse2neon.h" + + + //! Local includes +diff --git a/3rdparty/homography/LibImages/LibImages.cpp b/3rdparty/homography/LibImages/LibImages.cpp +index 7c1f6f5..fd75fb4 100644 +--- a/3rdparty/homography/LibImages/LibImages.cpp ++++ b/3rdparty/homography/LibImages/LibImages.cpp +@@ -14,8 +14,7 @@ + #ifdef _OPENMP + #include + #endif +-#include +-#include ++#include "../../sse2neon/sse2neon.h" + #include + #include + #include +diff --git a/3rdparty/homography/LibImages/LibImages.h b/3rdparty/homography/LibImages/LibImages.h +index 51233a3..8ae589d 100644 +--- a/3rdparty/homography/LibImages/LibImages.h ++++ b/3rdparty/homography/LibImages/LibImages.h +@@ -5,8 +5,7 @@ + #include + #include + #include +-#include +-#include ++#include "../../sse2neon/sse2neon.h" + + //! Local includes + +diff --git a/3rdparty/homography/Utilities/Utilities.h b/3rdparty/homography/Utilities/Utilities.h +index cc80a22..ee45bf9 100644 +--- a/3rdparty/homography/Utilities/Utilities.h ++++ b/3rdparty/homography/Utilities/Utilities.h +@@ -8,8 +8,8 @@ + #include + #include + #include +-#include +-#include ++#include "../../sse2neon/sse2neon.h" ++ + #include + + diff --git a/3rdparty/iio.patch b/3rdparty/iio.patch new file mode 100644 index 00000000..f2795b44 --- /dev/null +++ b/3rdparty/iio.patch @@ -0,0 +1,15 @@ +diff --git a/3rdparty/iio/iio.c b/3rdparty/iio/iio.c +index 5bff3d8..67b06ac 100644 +--- a/3rdparty/iio/iio.c ++++ b/3rdparty/iio/iio.c +@@ -535,7 +535,9 @@ int iio_type_id(size_t sample_size, bool ieeefp_sample, bool signed_sample) + switch(sample_size) { + case sizeof(float): return IIO_TYPE_FLOAT; + case sizeof(double): return IIO_TYPE_DOUBLE; +- case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #ifdef I_CAN_HAS_LONGDOUBLE ++ case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #endif//I_CAN_HAS_LONGDOUBLE + case sizeof(float)/2: return IIO_TYPE_HALF; + default: fail("bad float size %zu", sample_size); + } diff --git a/3rdparty/imscript.patch b/3rdparty/imscript.patch new file mode 100644 index 00000000..ad1b68fd --- /dev/null +++ b/3rdparty/imscript.patch @@ -0,0 +1,15 @@ +diff --git a/3rdparty/imscript/src/iio.c b/3rdparty/imscript/src/iio.c +index 2516713..8428556 100644 +--- a/3rdparty/imscript/src/iio.c ++++ b/3rdparty/imscript/src/iio.c +@@ -535,7 +535,9 @@ int iio_type_id(size_t sample_size, bool ieeefp_sample, bool signed_sample) + switch(sample_size) { + case sizeof(float): return IIO_TYPE_FLOAT; + case sizeof(double): return IIO_TYPE_DOUBLE; +- case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #ifdef I_CAN_HAS_LONGDOUBLE ++ case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #endif//I_CAN_HAS_LONGDOUBLE + case sizeof(float)/2: return IIO_TYPE_HALF; + default: fail("bad float size %zu", sample_size); + } diff --git a/3rdparty/mgm.patch b/3rdparty/mgm.patch new file mode 100644 index 00000000..2409f1d3 --- /dev/null +++ b/3rdparty/mgm.patch @@ -0,0 +1,15 @@ +diff --git a/3rdparty/mgm/iio/iio.c b/3rdparty/mgm/iio/iio.c +index 4a678db..33de681 100644 +--- a/3rdparty/mgm/iio/iio.c ++++ b/3rdparty/mgm/iio/iio.c +@@ -489,7 +489,9 @@ int iio_type_id(size_t sample_size, bool ieeefp_sample, bool signed_sample) + switch(sample_size) { + case sizeof(float): return IIO_TYPE_FLOAT; + case sizeof(double): return IIO_TYPE_DOUBLE; +- case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #ifdef I_CAN_HAS_LONGDOUBLE ++ case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #endif//I_CAN_HAS_LONGDOUBLE + case sizeof(float)/2: return IIO_TYPE_HALF; + default: fail("bad float size %zu", sample_size); + } diff --git a/3rdparty/mgm_multi.patch b/3rdparty/mgm_multi.patch new file mode 100644 index 00000000..116a2d10 --- /dev/null +++ b/3rdparty/mgm_multi.patch @@ -0,0 +1,17 @@ +diff --git a/3rdparty/mgm_multi/iio/iio.c b/3rdparty/mgm_multi/iio/iio.c +index 9f28831..7475497 100644 +--- a/3rdparty/mgm_multi/iio/iio.c ++++ b/3rdparty/mgm_multi/iio/iio.c +@@ -511,8 +511,10 @@ int iio_type_id(size_t sample_size, bool ieeefp_sample, bool signed_sample) + switch(sample_size) { + case sizeof(float): return IIO_TYPE_FLOAT; + case sizeof(double): return IIO_TYPE_DOUBLE; +- case sizeof(long double): return IIO_TYPE_LONGDOUBLE; +- case sizeof(float)/2: return IIO_TYPE_HALF; ++ #ifdef I_CAN_HAS_LONGDOUBLE ++ case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #endif//I_CAN_HAS_LONGDOUBLE ++ case sizeof(float)/2: return IIO_TYPE_HALF; + default: fail("bad float size %zu", sample_size); + } + } else { diff --git a/3rdparty/sift.patch b/3rdparty/sift.patch new file mode 100644 index 00000000..2eac8dec --- /dev/null +++ b/3rdparty/sift.patch @@ -0,0 +1,28 @@ +diff --git a/3rdparty/sift/simd/LibImages/LibImages.cpp b/3rdparty/sift/simd/LibImages/LibImages.cpp +index 6acbe4e..870d80b 100644 +--- a/3rdparty/sift/simd/LibImages/LibImages.cpp ++++ b/3rdparty/sift/simd/LibImages/LibImages.cpp +@@ -10,8 +10,7 @@ + #ifdef _OPENMP + #include + #endif +-#include +-#include ++#include "../../sse2neon/sse2neon.h" + #include + #include + #include +diff --git a/3rdparty/sift/simd/LibImages/LibImages.h b/3rdparty/sift/simd/LibImages/LibImages.h +index 9918472..c8c5db1 100644 +--- a/3rdparty/sift/simd/LibImages/LibImages.h ++++ b/3rdparty/sift/simd/LibImages/LibImages.h +@@ -5,8 +5,7 @@ + #include + #include + #include +-#include +-#include ++#include "../../../sse2neon/sse2neon.h" + + //! Local includes + diff --git a/3rdparty/tvl1flow.patch b/3rdparty/tvl1flow.patch new file mode 100644 index 00000000..dece512a --- /dev/null +++ b/3rdparty/tvl1flow.patch @@ -0,0 +1,15 @@ +diff --git a/3rdparty/tvl1flow/iio.c b/3rdparty/tvl1flow/iio.c +index 9f28831..e27955e 100644 +--- a/3rdparty/tvl1flow/iio.c ++++ b/3rdparty/tvl1flow/iio.c +@@ -511,7 +511,9 @@ int iio_type_id(size_t sample_size, bool ieeefp_sample, bool signed_sample) + switch(sample_size) { + case sizeof(float): return IIO_TYPE_FLOAT; + case sizeof(double): return IIO_TYPE_DOUBLE; +- case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #ifdef I_CAN_HAS_LONGDOUBLE ++ case sizeof(long double): return IIO_TYPE_LONGDOUBLE; ++ #endif//I_CAN_HAS_LONGDOUBLE + case sizeof(float)/2: return IIO_TYPE_HALF; + default: fail("bad float size %zu", sample_size); + } diff --git a/makefile b/makefile index a585b742..1e559040 100644 --- a/makefile +++ b/makefile @@ -1,15 +1,34 @@ +UNAME := $(shell uname) + # the following two options are used to control all C and C++ compilations CFLAGS ?= -march=native -O3 CXXFLAGS ?= -march=native -O3 + +ifeq ($(UNAME), Darwin) + # on Mac OS, use recommended flag for sse2neon + CFLAGS ?= -march=armv8-a+fp+simd+crypto+crc -O3 + CXXFLAGS ?= -march=armv8-a+fp+simd+crypto+crc -O3 +endif + export CFLAGS export CXXFLAGS +ifeq ($(UNAME), Darwin) + # on mac, also link to homebrew + export C_INCLUDE_PATH := ${C_INCLUDE_PATH}:/opt/homebrew/include + export CPLUS_INCLUDE_PATH := ${CPLUS_INCLUDE_PATH}:/opt/homebrew/include + export LIBRARY_PATH := ${LIBRARY_PATH}:/opt/homebrew/lib + export LD_LIBRARY_PATH := ${LD_LIBRARY_PATH}:/opt/homebrew/lib + # apply patches, ignore if they fail (already patched) + patch_osx = git apply 3rdparty/*.patch || true +endif + # these options are only used for the programs directly inside "./c/" IIOLIBS = -lz -ltiff -lpng -ljpeg -lm # default rule builds only the programs necessary for the test -default: homography sift mgm_multi tvl1 lsd executables libraries +default: patch_osx homography sift mgm_multi tvl1 lsd executables libraries # the "all" rule builds three further correlators all: default msmw3 sgbm @@ -22,6 +41,9 @@ test: default # four standard "modules": homography, sift, mgm, and mgm_multi # +patch_osx: + $(patch_osx) + homography: $(MAKE) -j -C 3rdparty/homography cp 3rdparty/homography/homography bin