From 7edc760af94a46a10b6200d6befe229c487e652a Mon Sep 17 00:00:00 2001 From: Julien Malik <julien.malik@c-s.fr> Date: Sat, 25 Feb 2012 16:49:24 +0100 Subject: [PATCH] ENH: make siftfast compilation optional --- CMake/ImportSiftFast.cmake | 3 +++ CMake/otbConfigure.h.in | 5 ++++- CMake/otbIncludeDirectories.cmake | 11 +++++++++-- CMakeLists.txt | 1 + Code/FeatureExtraction/CMakeLists.txt | 11 ++++++++++- Examples/Patented/CMakeLists.txt | 17 ++++++++++------- ...bPointSetDensityEpanechnikovFunctionTest.cxx | 1 - .../otbPointSetDensityFunctionTest.cxx | 1 - .../otbPointSetDensityGaussianFunctionTest.cxx | 1 - Testing/Code/FeatureExtraction/CMakeLists.txt | 2 ++ .../otbFeatureExtractionTests10.cxx | 2 ++ Testing/Utilities/CMakeLists.txt | 15 +++++++++++++-- Testing/Utilities/otbUtilitiesTests.cxx | 3 +++ Utilities/CMakeLists.txt | 8 ++++++-- 14 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 CMake/ImportSiftFast.cmake diff --git a/CMake/ImportSiftFast.cmake b/CMake/ImportSiftFast.cmake new file mode 100644 index 0000000000..57dfa0feb1 --- /dev/null +++ b/CMake/ImportSiftFast.cmake @@ -0,0 +1,3 @@ +MESSAGE(STATUS "Importing libSiftFast...") +OPTION(OTB_USE_SIFTFAST "Use Fast SIFT Image Features Library" ON) +MARK_AS_ADVANCED(OTB_USE_SIFTFAST) diff --git a/CMake/otbConfigure.h.in b/CMake/otbConfigure.h.in index bf03b25137..79b9b3dfac 100644 --- a/CMake/otbConfigure.h.in +++ b/CMake/otbConfigure.h.in @@ -62,9 +62,12 @@ #cmakedefine OTB_USE_CURL #cmakedefine OTB_CURL_MULTI_AVAILABLE -/* Curl */ +/* OpenJpeg */ #cmakedefine OTB_USE_JPEG2000 +/* SiftFast */ +#cmakedefine OTB_USE_SIFTFAST + /* Use Visu/Gui configurations */ #cmakedefine OTB_USE_VISU_GUI diff --git a/CMake/otbIncludeDirectories.cmake b/CMake/otbIncludeDirectories.cmake index 4a755a7ec8..0961d6a7b5 100644 --- a/CMake/otbIncludeDirectories.cmake +++ b/CMake/otbIncludeDirectories.cmake @@ -72,7 +72,6 @@ SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Utilities/otbedison/segm ${OTB_SOURCE_DIR}/Utilities/otbedison/prompt ${OTB_SOURCE_DIR}/Utilities/otbedison/edge - ${OTB_SOURCE_DIR}/Utilities/otbsiftfast ${OTB_SOURCE_DIR}/Utilities/otbconfigfile ${OTB_SOURCE_DIR}/Utilities/otbknn ${OTB_SOURCE_DIR}/Utilities/otbmuparser @@ -106,6 +105,10 @@ IF(OTB_USE_PQXX) ${OTB_SOURCE_DIR}/Code/GeospatialAnalysis) ENDIF(OTB_USE_PQXX) +IF(OTB_USE_SIFTFAST) + SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} + ${OTB_SOURCE_DIR}/Utilities/otbsiftfast) +ENDIF(OTB_USE_SIFTFAST) #----------------------------------------------------------------------------- # Include directories from the ossim build tree @@ -325,7 +328,6 @@ SET(OTB_INCLUDE_RELATIVE_DIRS ${OTB_INCLUDE_RELATIVE_DIRS} Utilities/otbkml/third_party/boost_1_34_1 Utilities/otbliblas/include Utilities/otbedison - Utilities/otbsiftfast Utilities/otbconfigfile Utilities/otbknn Utilities/otbmuparser @@ -368,6 +370,11 @@ IF(OTB_USE_GETTEXT) ${GETTEXT_INCLUDE_DIR} ) ENDIF(OTB_USE_GETTEXT) +IF(OTB_USE_SIFTFAST) + SET(OTB_INCLUDE_RELATIVE_DIRS ${OTB_INCLUDE_RELATIVE_DIRS} + Utilities/otbsiftfast) +ENDIF(OTB_USE_SIFTFAST) + #For FLTK header file IF(OTB_USE_EXTERNAL_FLTK) SET(OTB_INCLUDE_ABSOLUE_DIRS ${OTB_INCLUDE_ABSOLUE_DIRS} diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dc93a54e4..7ed9f55bd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,6 +229,7 @@ INCLUDE(ImportOpenThreads) INCLUDE(ImportOssim) INCLUDE(ImportQt4) INCLUDE(ImportGetText) +INCLUDE(ImportSiftFast) INCLUDE_DIRECTORIES ( diff --git a/Code/FeatureExtraction/CMakeLists.txt b/Code/FeatureExtraction/CMakeLists.txt index 5b3f420ff7..7eb071be20 100644 --- a/Code/FeatureExtraction/CMakeLists.txt +++ b/Code/FeatureExtraction/CMakeLists.txt @@ -4,7 +4,11 @@ FILE(GLOB OTBFeatureExtraction_SRCS "*.cxx" ) ADD_LIBRARY(OTBFeatureExtraction ${OTBFeatureExtraction_SRCS}) -TARGET_LINK_LIBRARIES (OTBFeatureExtraction OTBCommon otbsiftfast) +TARGET_LINK_LIBRARIES (OTBFeatureExtraction OTBCommon) +IF(OTB_USE_SIFTFAST) + TARGET_LINK_LIBRARIES (OTBFeatureExtraction otbsiftfast) +ENDIF(OTB_USE_SIFTFAST) + IF(OTB_LIBRARY_PROPERTIES) SET_TARGET_PROPERTIES(OTBFeatureExtraction PROPERTIES ${OTB_LIBRARY_PROPERTIES}) ENDIF(OTB_LIBRARY_PROPERTIES) @@ -19,6 +23,11 @@ ENDIF(NOT OTB_INSTALL_NO_LIBRARIES) IF(NOT OTB_INSTALL_NO_DEVELOPMENT) FILE(GLOB __files1 "${CMAKE_CURRENT_SOURCE_DIR}/*.h") FILE(GLOB __files2 "${CMAKE_CURRENT_SOURCE_DIR}/*.txx") + IF( NOT OTB_USE_SIFTFAST ) + LIST(REMOVE_ITEM __files1 "${CMAKE_CURRENT_SOURCE_DIR}/otbSiftFastImageFilter.h" ) + LIST(REMOVE_ITEM __files2 "${CMAKE_CURRENT_SOURCE_DIR}/otbSiftFastImageFilter.txx" ) + ENDIF( NOT OTB_USE_SIFTFAST ) + INSTALL(FILES ${__files1} ${__files2} DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/FeatureExtraction COMPONENT Development) diff --git a/Examples/Patented/CMakeLists.txt b/Examples/Patented/CMakeLists.txt index 23828b57fe..df0d2fc0c6 100644 --- a/Examples/Patented/CMakeLists.txt +++ b/Examples/Patented/CMakeLists.txt @@ -22,12 +22,15 @@ ADD_EXECUTABLE(SIFTExample SIFTExample.cxx) TARGET_LINK_LIBRARIES(SIFTExample OTBIO OTBCommon OTBFeatureExtraction ITKCommon ITKBasicFilters) -ADD_EXECUTABLE(SIFTFastExample SIFTFastExample.cxx) -TARGET_LINK_LIBRARIES(SIFTFastExample OTBIO OTBCommon OTBFeatureExtraction -ITKCommon ITKBasicFilters) +IF(OTB_USE_SIFTFAST) + + ADD_EXECUTABLE(SIFTFastExample SIFTFastExample.cxx) + TARGET_LINK_LIBRARIES(SIFTFastExample OTBIO OTBCommon OTBFeatureExtraction ITKCommon ITKBasicFilters) + + ADD_EXECUTABLE(SIFTDensityExample SIFTDensityExample.cxx) + TARGET_LINK_LIBRARIES(SIFTDensityExample OTBIO OTBCommon OTBBasicFilters ITKCommon ITKBasicFilters) -ADD_EXECUTABLE(SIFTDensityExample SIFTDensityExample.cxx) -TARGET_LINK_LIBRARIES(SIFTDensityExample OTBIO OTBCommon OTBBasicFilters ITKCommon ITKBasicFilters) +ENDIF(OTB_USE_SIFTFAST) IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) @@ -101,7 +104,7 @@ ADD_TEST(feTeScaleInvariantFeatureImageFilterTest ${EXE_TESTS} 1 10 0.5 0 ) - +IF(OTB_USE_SIFTFAST) ADD_TEST(feTeSIFTFastExampleTest ${EXE_TESTS} --compare-image ${TOL} ${BASELINE}/ROISpot5SiftFast.png @@ -111,7 +114,7 @@ ADD_TEST(feTeSIFTFastExampleTest ${EXE_TESTS} ${TEMP}/ROISpot5SiftFast.png 3 ) - +ENDIF(OTB_USE_SIFTFAST) INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code) ADD_EXECUTABLE(otbPatentedExamplesTests otbPatentedExamplesTests.cxx) diff --git a/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx b/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx index 71ed585c19..332f73a907 100644 --- a/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx +++ b/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx @@ -20,7 +20,6 @@ #include "otbPointSetDensityEpanechnikovFunction.h" #include "itkPointSet.h" #include "itkVariableLengthVector.h" -#include "otbSiftFastImageFilter.h" #include <iostream> diff --git a/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx b/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx index 47d8341c98..369159c818 100644 --- a/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx +++ b/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx @@ -20,7 +20,6 @@ #include "otbPointSetDensityFunction.h" #include "itkPointSet.h" #include "itkVariableLengthVector.h" -#include "otbSiftFastImageFilter.h" #include <iostream> diff --git a/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx b/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx index 320f5bc393..57eb47c6fe 100644 --- a/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx +++ b/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx @@ -20,7 +20,6 @@ #include "otbPointSetDensityGaussianFunction.h" #include "itkPointSet.h" #include "itkVariableLengthVector.h" -#include "otbSiftFastImageFilter.h" #include <iostream> diff --git a/Testing/Code/FeatureExtraction/CMakeLists.txt b/Testing/Code/FeatureExtraction/CMakeLists.txt index b54b0da0a4..50bcb8b8f0 100644 --- a/Testing/Code/FeatureExtraction/CMakeLists.txt +++ b/Testing/Code/FeatureExtraction/CMakeLists.txt @@ -1039,6 +1039,7 @@ ADD_TEST(feTvImageToSURFKeyPointSetFilterSceneOutputDescriptorAscii ${FEATUREEXT # ------- otb::ImageToFastSIFTKeyPointSetFilter ------------- +IF(OTB_USE_SIFTFAST) ADD_TEST(feTuImageToFastSIFTKeyPointSetFilterNew ${FEATUREEXTRACTION_TESTS10} otbImageToFastSIFTKeyPointSetFilterNew) @@ -1064,6 +1065,7 @@ ADD_TEST(feTvImageToFastSIFTKeyPointSetFilterSceneOutputInterestPointAscii ${FEA 6 ) +ENDIF(OTB_USE_SIFTFAST) # --------- MatchingFilter ---------------- diff --git a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx index c4d52b787e..b69d9178b1 100644 --- a/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx +++ b/Testing/Code/FeatureExtraction/otbFeatureExtractionTests10.cxx @@ -27,9 +27,11 @@ void RegisterTests() REGISTER_TEST(otbImageToSURFKeyPointSetFilterNew); REGISTER_TEST(otbImageToSURFKeyPointSetFilterOutputInterestPointAscii); REGISTER_TEST(otbImageToSURFKeyPointSetFilterOutputDescriptorAscii); +#ifdef OTB_USE_SIFTFAST REGISTER_TEST(otbImageToFastSIFTKeyPointSetFilterNew); REGISTER_TEST(otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii); REGISTER_TEST(otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii); +#endif REGISTER_TEST(otbKeyPointSetsMatchingFilterNew); REGISTER_TEST(otbKeyPointSetsMatchingFilter); REGISTER_TEST(otbLandmarkNew); diff --git a/Testing/Utilities/CMakeLists.txt b/Testing/Utilities/CMakeLists.txt index dcd7545f55..3f083f2c59 100644 --- a/Testing/Utilities/CMakeLists.txt +++ b/Testing/Utilities/CMakeLists.txt @@ -335,6 +335,9 @@ ijObjectLabelAttributeValuesTest.cxx ijGreyLevelRunLengthMatrixTextureCoefficientsCalculatorTest.cxx ) +IF(OTB_USE_SIFTFAST) + SET(UtilitiesTests_SRCS ${UtilitiesTests_SRCS} siftfast.cpp) +ENDIF(OTB_USE_SIFTFAST) IF(OTB_USE_JPEG2000) # SET(UtilitiesTests_SRCS ${UtilitiesTests_SRCS} openJpegEncoder.cxx openJpegDecoder.cxx) @@ -369,12 +372,16 @@ ENDIF(NOT OTB_USE_EXTERNAL_EXPAT) # ------- Select sources files suppress warning ----------------------------------- SET(UtilitiesTests_DisableWarning_SRCS - siftfast.cpp openthreadsWorkCrew.cpp expatchardata.cxx expatminicheck.cxx expatruntests.cxx ) + +IF(OTB_USE_SIFTFAST) + SET(UtilitiesTests_DisableWarning_SRCS ${UtilitiesTests_DisableWarning_SRCS} siftfast.cpp) +ENDIF(OTB_USE_SIFTFAST) + IF(CMAKE_COMPILER_IS_GNUCXX) SET_SOURCE_FILES_PROPERTIES( ${UtilitiesTests_DisableWarning_SRCS} PROPERTIES COMPILE_FLAGS -w) ELSE(CMAKE_COMPILER_IS_GNUCXX) @@ -393,7 +400,11 @@ IF(NOT BUILD_SHARED_LIBS) ENDIF(NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE(otbUtilitiesTests otbUtilitiesTests.cxx ${UtilitiesTests_SRCS}) -TARGET_LINK_LIBRARIES(otbUtilitiesTests OTBIO OTBCommon OTBTesting otbsvm otb6S tinyXML otbkml otbsiftfast) +TARGET_LINK_LIBRARIES(otbUtilitiesTests OTBIO OTBCommon OTBTesting otbsvm otb6S tinyXML otbkml) + +IF(OTB_USE_SIFTFAST) + TARGET_LINK_LIBRARIES(otbUtilitiesTests otbsiftfast) +ENDIF(OTB_USE_SIFTFAST) IF(OTB_USE_JPEG2000) TARGET_LINK_LIBRARIES(otbUtilitiesTests otbopenjpeg) diff --git a/Testing/Utilities/otbUtilitiesTests.cxx b/Testing/Utilities/otbUtilitiesTests.cxx index 5177dc0fad..3123cb5b13 100644 --- a/Testing/Utilities/otbUtilitiesTests.cxx +++ b/Testing/Utilities/otbUtilitiesTests.cxx @@ -77,7 +77,10 @@ REGISTER_TEST(kmlsharedstyles); REGISTER_TEST(kmlsimplifylines); REGISTER_TEST(kmlsortplacemarks); +#ifdef OTB_USE_SIFTFAST REGISTER_TEST(SiftFast); +#endif + REGISTER_TEST(ijObjectLabelAttributeValuesTest); REGISTER_TEST(ijGreyLevelRunLengthMatrixTextureCoefficientsCalculatorTest); } diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index cf912dc2b2..3e025b98f4 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -74,8 +74,12 @@ MESSAGE(STATUS "Configuring otbkml...") ADD_SUBDIRECTORY(otbkml) MESSAGE(STATUS "Configuring otbedison...") ADD_SUBDIRECTORY(otbedison) -MESSAGE(STATUS "Configuring otbsiftfast...") -ADD_SUBDIRECTORY(otbsiftfast) + +IF(OTB_USE_SIFTFAST) + MESSAGE(STATUS "Configuring otbsiftfast...") + ADD_SUBDIRECTORY(otbsiftfast) +ENDIF(OTB_USE_SIFTFAST) + MESSAGE(STATUS "Configuring otbconfigfile...") ADD_SUBDIRECTORY(otbconfigfile) -- GitLab