Skip to content
Snippets Groups Projects
Commit 91700598 authored by Christophe Palmann's avatar Christophe Palmann
Browse files

COMP: fixed OTBSupervisedHeaderTest1 compilation when OTB_USE_LIBSVM and...

COMP: fixed OTBSupervisedHeaderTest1 compilation when OTB_USE_LIBSVM and OTB_USE_OPENCV are turned off
parent a7baf00a
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,32 @@ add_custom_target( OTBHeaderTests
${CMAKE_COMMAND} --build ${OTB_BINARY_DIR}
COMMENT "Regenerating and building the header tests." )
SET(BANNED_HEADERS)
if(NOT OTB_USE_OPENCV)
string(CONCAT BANNED_HEADERS ${BANNED_HEADERS} "otbDecisionTreeMachineLearningModelFactory.h otbDecisionTreeMachineLearningModel.h otbKNearestNeighborsMachineLearningModelFactory.h otbKNearestNeighborsMachineLearningModel.h otbRandomForestsMachineLearningModelFactory.h otbRandomForestsMachineLearningModel.h otbSVMMachineLearningModelFactory.h otbSVMMachineLearningModel.h otbGradientBoostedTreeMachineLearningModelFactory.h otbGradientBoostedTreeMachineLearningModel.h otbBoostMachineLearningModelFactory.h otbBoostMachineLearningModel.h otbNeuralNetworkMachineLearningModelFactory.h otbNeuralNetworkMachineLearningModel.h otbNormalBayesMachineLearningModelFactory.h otbNormalBayesMachineLearningModel.h otbRequiresOpenCVCheck.h ")
string(STRIP ${BANNED_HEADERS} BANNED_HEADERS)
string(CONCAT BANNED_HEADERS ${BANNED_HEADERS} " ")
endif()
if(NOT OTB_USE_LIBSVM)
string(CONCAT BANNED_HEADERS ${BANNED_HEADERS} "otbLibSVMMachineLearningModel.h otbLibSVMMachineLearningModelFactory.h")
string(STRIP ${BANNED_HEADERS} BANNED_HEADERS)
string(CONCAT BANNED_HEADERS ${BANNED_HEADERS} " ")
endif()
# ************ ADD YOUR BANNED HEADERS HERE ************
#if(CONDITION)
# string(CONCAT BANNED_HEADERS ${BANNED_HEADERS} "BANNED-HEADER1.h")
# string(STRIP ${BANNED_HEADERS} BANNED_HEADERS)
# string(CONCAT BANNED_HEADERS ${BANNED_HEADERS} " ")
#endif()
string(STRIP ${BANNED_HEADERS} BANNED_HEADERS)
macro( otb_module_headertest _name )
if( NOT ${_name}_THIRD_PARTY AND
EXISTS ${${_name}_SOURCE_DIR}/include
......@@ -83,6 +109,7 @@ macro( otb_module_headertest _name )
${${_name}_BINARY_DIR}
${MAXIMUM_NUMBER_OF_HEADERS}
${_test_num}
${BANNED_HEADERS}
)
add_executable( ${_test_name} ${_header_test_src} )
target_link_libraries( ${_test_name} OTBCommon )
......
......@@ -28,7 +28,9 @@
#include "otbDecisionTreeMachineLearningModelFactory.h"
#include "otbGradientBoostedTreeMachineLearningModelFactory.h"
#endif
#ifdef OTB_USE_LIBSVM
#include "otbLibSVMMachineLearningModelFactory.h"
#endif
#include "itkMutexLockHolder.h"
......@@ -88,8 +90,10 @@ MachineLearningModelFactory<TInputValue,TOutputValue>
::RegisterBuiltInFactories()
{
itk::MutexLockHolder<itk::SimpleMutexLock> lockHolder(mutex);
#ifdef OTB_USE_LIBSVM
RegisterFactory(LibSVMMachineLearningModelFactory<TInputValue,TOutputValue>::New());
#endif
#ifdef OTB_USE_OPENCV
RegisterFactory(RandomForestsMachineLearningModelFactory<TInputValue,TOutputValue>::New());
......
......@@ -30,8 +30,8 @@ test is to make sure there are not missing module dependencies. It also tests
for syntax and missing #include's.
"""
# Headers to not test because of dependecy issues, etc.
BANNED_HEADERS = set(()) # No banned headers in OTB for now
# BANNED_HEADERS = Headers to not test because of dependecy issues, etc.
HEADER = """/*=========================================================================
*
......@@ -81,6 +81,7 @@ def main():
module_binary_path = sys.argv[3]
maximum_number_of_headers = int(sys.argv[4])
test_num = int(sys.argv[5])
BANNED_HEADERS = sys.argv[6].split(' ')
# Get all the header files.
include_dir = os.path.join(module_source_path, 'include')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment