aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--graphics/colmap/Makefile19
-rw-r--r--graphics/colmap/files/patch-vlfeat-rtcpu83
2 files changed, 87 insertions, 15 deletions
diff --git a/graphics/colmap/Makefile b/graphics/colmap/Makefile
index 5b87049ce773..382bea955248 100644
--- a/graphics/colmap/Makefile
+++ b/graphics/colmap/Makefile
@@ -3,7 +3,7 @@
PORTNAME= colmap
DISTVERSION= 2.1-0 # synthetic tag
DISTVERSIONSUFFIX= -g55fbe10
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= graphics
MAINTAINER= jbeich@FreeBSD.org
@@ -40,18 +40,12 @@ CXXFLAGS+= -D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH_TR1 \
LDFLAGS+= -Wl,--as-needed # gflags, glu, xi, xmu
TEST_TARGET= test ARGS="-V"
-OPTIONS_DEFINE= DOCS OPENMP
-OPTIONS_DEFAULT= OPENMP ${MACHINE_CPU:tu}
+OPTIONS_DEFINE= DOCS OPENMP SIMD
+OPTIONS_DEFAULT= OPENMP SIMD
# XXX ports/215138: exclude still broken
OPTIONS_EXCLUDE= ${OPTIONS_EXCLUDE_${OPSYS}_${OSREL}} # not OSREL:R
OPTIONS_EXCLUDE_FreeBSD_10.1= OPENMP
-OPTIONS_GROUP= SIMD
-OPTIONS_GROUP_SIMD= ${OPTIONS_GROUP_SIMD_${MACHINE_ARCH}}
-# Keep in sync with src/ext/VLFeat/CMakeLists.txt
-OPTIONS_GROUP_SIMD_amd64= ${OPTIONS_GROUP_SIMD_i386}
-OPTIONS_GROUP_SIMD_i386= SSE2 AVX
-
DOCS_BUILD_DEPENDS= sphinx-build:textproc/py-sphinx
DOCS_USES= gmake
DOCS_PORTDOCS= *
@@ -61,15 +55,10 @@ OPENMP_CMAKE_BOOL= OPENMP_ENABLED
# XXX ports/199603 + ports/210337
OPENMP_VARS= OPENMP=gcc-
-.for _simd in ${OPTIONS_GROUP_SIMD}
-${_simd}_DESC= ${MMX_DESC:S/MMX/${_simd}/}
-${_simd}_CMAKE_BOOL= HAS_${_simd}_EXTENSION
-${_simd}_CFLAGS= -m${_simd:tl}
-.endfor
+SIMD_CMAKE_BOOL= SIMD_ENABLED
post-patch:
@${REINPLACE_CMD} -e 's/Qt5OpenGL/Qt5Widgets/' \
- -e '/CheckSSEExtensions/d' \
${WRKSRC}/CMakeLists.txt
@${REINPLACE_CMD} -e '/install.*test/d' \
${WRKSRC}/cmake/CMakeHelper.cmake
diff --git a/graphics/colmap/files/patch-vlfeat-rtcpu b/graphics/colmap/files/patch-vlfeat-rtcpu
new file mode 100644
index 000000000000..9cf922ecbb74
--- /dev/null
+++ b/graphics/colmap/files/patch-vlfeat-rtcpu
@@ -0,0 +1,83 @@
+build: don't force SSE2/AVX, enable at runtime instead
+
+--- CMakeLists.txt.orig 2016-12-07 13:47:54 UTC
++++ CMakeLists.txt
+@@ -16,8 +16,6 @@ include(CheckCXXCompilerFlag)
+ # the CMake policies in this file
+ include(${CMAKE_SOURCE_DIR}/cmake/CMakeHelper.cmake NO_POLICY_SCOPE)
+
+-include(${CMAKE_SOURCE_DIR}/cmake/CheckSSEExtensions.cmake)
+-
+ if(EXISTS ${CMAKE_SOURCE_DIR}/LocalConfig.cmake)
+ include(${CMAKE_SOURCE_DIR}/LocalConfig.cmake)
+ endif()
+@@ -29,6 +27,7 @@ endif()
+
+ enable_testing()
+
++option(SIMD_ENABLED "Wether to enable SIMD optimizations" ON)
+ option(OPENMP_ENABLED "Whether to enable OpenMP" ON)
+ option(LTO_ENABLED "Whether to enable link-time optimization" ON)
+ option(CUDA_ENABLED "Whether to enable CUDA, if available" ON)
+--- src/ext/VLFeat/CMakeLists.txt.orig 2016-12-07 13:47:54 UTC
++++ src/ext/VLFeat/CMakeLists.txt
+@@ -1,8 +1,27 @@
+-if(IS_MSVC OR NOT HAS_AVX_EXTENSION)
+- add_definitions(-DVL_DISABLE_AVX)
++set(VLFEAT_SOURCE_FILES)
++
++if(CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86|amd64|AMD64")
++ set(IS_X86 TRUE)
+ endif()
+
+-if(IS_MSVC OR NOT HAS_SSE2_EXTENSION)
++if(SIMD_ENABLED AND IS_X86 AND NOT IS_MSVC)
++ set(SSE2_SOURCES
++ imopv_sse2.c
++ imopv_sse2.h
++ mathop_sse2.c
++ mathop_sse2.h)
++ set(AVX_SOURCES
++ mathop_avx.c
++ mathop_avx.h)
++
++ list(APPEND VLFEAT_SOURCE_FILES ${AVX_SOURCES} ${SSE2_SOURCES})
++
++ set_source_files_properties(${AVX_SOURCES}
++ PROPERTIES COMPILE_FLAGS "-mavx")
++ set_source_files_properties(${SSE2_SOURCES}
++ PROPERTIES COMPILE_FLAGS "-msse2")
++else()
++ add_definitions(-DVL_DISABLE_AVX)
+ add_definitions(-DVL_DISABLE_SSE2)
+ endif()
+
+@@ -10,7 +29,7 @@ if(NOT OPENMP_ENABLED OR NOT OPENMP_FOUN
+ add_definitions(-DVL_DISABLE_OPENMP)
+ endif()
+
+-set(VLFEAT_SOURCE_FILES
++list(APPEND VLFEAT_SOURCE_FILES
+ aib.c
+ aib.h
+ array.c
+@@ -44,8 +63,6 @@ set(VLFEAT_SOURCE_FILES
+ ikmeans_lloyd.tc
+ imopv.c
+ imopv.h
+- imopv_sse2.c
+- imopv_sse2.h
+ kdtree.c
+ kdtree.h
+ kmeans.c
+@@ -56,10 +73,6 @@ set(VLFEAT_SOURCE_FILES
+ liop.h
+ mathop.c
+ mathop.h
+- mathop_avx.c
+- mathop_avx.h
+- mathop_sse2.c
+- mathop_sse2.h
+ mser.c
+ mser.h
+ pgm.c