[arrayfire] 159/284: Fix NONFREE Build CMake Options
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:29 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.
commit d9e5288006a1cafdb1e0a26ba3b063e52f65a554
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Wed Jan 6 13:05:39 2016 -0500
Fix NONFREE Build CMake Options
* NONFREE becomes the parent flag. If off, then child flags are unset
* When NONFREE is on, each child flag can be set to on or off
* Changed child (SIFT) flag to be BUILD_NONFREE_SIFT
* Changed child (SIFT) define to be AF_BUILD_NONFREE_SIFT
* Made the changes in test as well
---
CMakeLists.txt | 24 +++++++++++-------------
src/api/c/sift.cpp | 4 ++--
src/backend/cpu/sift.cpp | 4 ++--
src/backend/cuda/sift.cu | 4 ++--
src/backend/opencl/sift.cpp | 4 ++--
test/CMakeLists.txt | 22 ++++++++++++++++++++--
test/gloh_nonfree.cpp | 4 ++--
test/sift_nonfree.cpp | 4 ++--
8 files changed, 43 insertions(+), 27 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c79fbca..61a78a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,9 +31,6 @@ OPTION(BUILD_DOCS "Create ArrayFire Documentation" OFF)
OPTION(WITH_COVERAGE "Added code coverage flags" OFF)
OPTION(BUILD_NONFREE "Build ArrayFire nonfree algorithms" OFF)
-OPTION(BUILD_SIFT "Build ArrayFire nonfree algorithms" OFF)
-
-MARK_AS_ADVANCED(BUILD_SIFT)
OPTION(BUILD_UNIFIED "Build Backend-Independent ArrayFire API" ON)
@@ -91,17 +88,18 @@ IF(BUILD_GRAPHICS)
ENDIF(BUILD_GRAPHICS)
-IF(BUILD_NONFREE)
- MESSAGE(WARNING "Building With NONFREE ON requires the following patents")
- SET(BUILD_SIFT ON)
-ENDIF(BUILD_NONFREE)
+IF(${BUILD_NONFREE})
+ MESSAGE(WARNING "Building With NONFREE ON requires the following patents")
+ SET(BUILD_NONFREE_SIFT ON CACHE BOOL "Build ArrayFire with SIFT")
+ MARK_AS_ADVANCED(BUILD_NONFREE_SIFT)
+ELSE(${BUILD_NONFREE})
+ UNSET(BUILD_NONFREE_SIFT CACHE) # BUILD_NONFREE_SIFT cannot be built without BUILD_NONFREE
+ENDIF(${BUILD_NONFREE})
-IF(BUILD_SIFT)
- ADD_DEFINITIONS(-DAF_BUILD_SIFT)
+IF(${BUILD_NONFREE_SIFT})
+ ADD_DEFINITIONS(-DAF_BUILD_NONFREE_SIFT)
- IF (NOT BUILD_NONFREE)
- MESSAGE(WARNING "Building with SIFT requires the following patents")
- ENDIF()
+ MESSAGE(WARNING "Building with SIFT requires the following patents")
MESSAGE("Method and apparatus for identifying scale invariant features"
"in an image and use of same for locating an object in an image,\" David"
@@ -110,7 +108,7 @@ IF(BUILD_SIFT)
"further details, contact David Lowe (lowe at cs.ubc.ca) or the"
"University-Industry Liaison Office of the University of British"
"Columbia.")
-ENDIF(BUILD_SIFT)
+ENDIF(${BUILD_NONFREE_SIFT})
INCLUDE_DIRECTORIES(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
diff --git a/src/api/c/sift.cpp b/src/api/c/sift.cpp
index c7a3858..a14badc 100644
--- a/src/api/c/sift.cpp
+++ b/src/api/c/sift.cpp
@@ -54,7 +54,7 @@ af_err af_sift(af_features* feat, af_array* desc, const af_array in, const unsig
const bool double_input, const float img_scale, const float feature_ratio)
{
try {
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
ArrayInfo info = getInfo(in);
af::dim4 dims = info.dims();
@@ -95,7 +95,7 @@ af_err af_gloh(af_features* feat, af_array* desc, const af_array in, const unsig
const bool double_input, const float img_scale, const float feature_ratio)
{
try {
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
ArrayInfo info = getInfo(in);
af::dim4 dims = info.dims();
diff --git a/src/backend/cpu/sift.cpp b/src/backend/cpu/sift.cpp
index 4b20f8a..0345e37 100644
--- a/src/backend/cpu/sift.cpp
+++ b/src/backend/cpu/sift.cpp
@@ -21,7 +21,7 @@
#include <cfloat>
#include <vector>
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
#include <kernel/sift_nonfree.hpp>
#endif
@@ -39,7 +39,7 @@ unsigned sift(Array<float>& x, Array<float>& y, Array<float>& score,
const float img_scale, const float feature_ratio,
const bool compute_GLOH)
{
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
return sift_impl<T, convAccT>(x, y, score, ori, size, desc, in, n_layers,
contrast_thr, edge_thr, init_sigma, double_input,
img_scale, feature_ratio, compute_GLOH);
diff --git a/src/backend/cuda/sift.cu b/src/backend/cuda/sift.cu
index f3d36d7..ad668af 100644
--- a/src/backend/cuda/sift.cu
+++ b/src/backend/cuda/sift.cu
@@ -15,7 +15,7 @@
#include <err_cuda.hpp>
#include <handle.hpp>
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
#include <kernel/sift_nonfree.hpp>
#endif
@@ -34,7 +34,7 @@ unsigned sift(Array<float>& x, Array<float>& y, Array<float>& score,
const float img_scale, const float feature_ratio,
const bool compute_GLOH)
{
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
const dim4 dims = in.dims();
unsigned nfeat_out;
diff --git a/src/backend/opencl/sift.cpp b/src/backend/opencl/sift.cpp
index 5bd940d..632647c 100644
--- a/src/backend/opencl/sift.cpp
+++ b/src/backend/opencl/sift.cpp
@@ -15,7 +15,7 @@
#include <err_opencl.hpp>
#include <handle.hpp>
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
#include <kernel/sift_nonfree.hpp>
#endif
@@ -34,7 +34,7 @@ unsigned sift(Array<float>& x_out, Array<float>& y_out, Array<float>& score_out,
const float img_scale, const float feature_ratio,
const bool compute_GLOH)
{
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
unsigned nfeat_out;
unsigned desc_len;
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3b7b42c..1bcdde9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -18,10 +18,28 @@ ELSE()
FIND_PACKAGE(ArrayFire REQUIRED)
INCLUDE_DIRECTORIES(${ArrayFire_INCLUDE_DIRS})
OPTION(BUILD_NONFREE "Build Tests for nonfree algorithms" OFF)
- IF(${BUILD_NONFREE}) # Add definition. Not required when building with AF
- ADD_DEFINITIONS(-DAF_BUILD_SIFT)
+
+ IF(${BUILD_NONFREE})
+ MESSAGE(WARNING "Building With NONFREE ON requires the following patents")
+ SET(BUILD_NONFREE_SIFT ON CACHE BOOL "Build ArrayFire with SIFT")
+ ELSE(${BUILD_NONFREE})
+ UNSET(BUILD_NONFREE_SIFT CACHE) # BUILD_NONFREE_SIFT cannot be built without BUILD_NONFREE
ENDIF(${BUILD_NONFREE})
+ IF(${BUILD_NONFREE_SIFT})
+ ADD_DEFINITIONS(-DAF_BUILD_NONFREE_SIFT)
+
+ MESSAGE(WARNING "Building with SIFT requires the following patents")
+
+ MESSAGE("Method and apparatus for identifying scale invariant features"
+ "in an image and use of same for locating an object in an image,\" David"
+ "G. Lowe, US Patent 6,711,293 (March 23, 2004). Provisional application"
+ "filed March 8, 1999. Asignee: The University of British Columbia. For"
+ "further details, contact David Lowe (lowe at cs.ubc.ca) or the"
+ "University-Industry Liaison Office of the University of British"
+ "Columbia.")
+ ENDIF(${BUILD_NONFREE_SIFT})
+
# ENABLE_TESTING is required when building only tests
# When building from source, enable_testing is picked from from the main
# CMakeLists.txt
diff --git a/test/gloh_nonfree.cpp b/test/gloh_nonfree.cpp
index 052351a..f50e403 100644
--- a/test/gloh_nonfree.cpp
+++ b/test/gloh_nonfree.cpp
@@ -158,7 +158,7 @@ TYPED_TEST_CASE(GLOH, TestTypes);
template<typename T>
void glohTest(string pTestFile)
{
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
if (noDoubleTests<T>()) return;
if (noImageIOTests()) return;
@@ -270,7 +270,7 @@ void glohTest(string pTestFile)
//
TEST(GLOH, CPP)
{
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
if (noDoubleTests<float>()) return;
if (noImageIOTests()) return;
diff --git a/test/sift_nonfree.cpp b/test/sift_nonfree.cpp
index 45c9462..2e069fd 100644
--- a/test/sift_nonfree.cpp
+++ b/test/sift_nonfree.cpp
@@ -158,7 +158,7 @@ TYPED_TEST_CASE(SIFT, TestTypes);
template<typename T>
void siftTest(string pTestFile, unsigned nLayers, float contrastThr, float edgeThr, float initSigma, bool doubleInput)
{
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
if (noDoubleTests<T>()) return;
if (noImageIOTests()) return;
@@ -276,7 +276,7 @@ void siftTest(string pTestFile, unsigned nLayers, float contrastThr, float edgeT
//
TEST(SIFT, CPP)
{
-#ifdef AF_BUILD_SIFT
+#ifdef AF_BUILD_NONFREE_SIFT
if (noDoubleTests<float>()) return;
if (noImageIOTests()) return;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list