Commit d22e0a76 authored by Julien Malik's avatar Julien Malik

COMP: use OPTIONAL_DEPENDS for CurlAdapters

parent e03f0ed7
......@@ -46,8 +46,11 @@ public:
itkNewMacro(Self);
bool TestUrlAvailability(const std::string& url) const;
bool IsCurlReturnHttpError(const std::string& url) const;
int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const;
int RetrieveFile(const std::string& urlString, std::string filename) const;
int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const;
......@@ -57,6 +60,7 @@ public:
int maxConnect) const;
itkGetMacro(Timeout,long int);
itkSetMacro(Timeout,long int);
protected:
......
......@@ -41,11 +41,15 @@ public:
typedef CurlHelperInterface Superclass;
itkTypeMacro(CurlHelperStub, CurlHelperInterface);
itkNewMacro(Self);
bool TestUrlAvailability(const std::string& url) const;
int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const;
int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const;
int RetrieveFile(const std::string& urlString, std::string filename) const;
int RetrieveFileMulti(const std::vector<std::string>& listURLs,
......
......@@ -2,11 +2,11 @@ set(DOCUMENTATION "Adapters for the Curl library.")
otb_module(OTBCurlAdapters
DEPENDS
OTBCurl
OTBCommon
OPTIONAL_DEPENDS
OTBCurl
TEST_DEPENDS
OTBTestKernel
DESCRIPTION
"${DOCUMENTATION}"
)
......@@ -5,10 +5,12 @@ set(OTBCurlAdapters_SRC
)
add_library(OTBCurlAdapters ${OTBCurlAdapters_SRC})
target_link_libraries(OTBCurlAdapters
${OTBCurl_LIBRARIES}
target_link_libraries(OTBCurlAdapters
${OTBCommon_LIBRARIES}
)
if (OTBCurl_ENABLED)
target_link_libraries(OTBCurlAdapters ${OTBCurl_LIBRARIES})
endif()
otb_module_target(OTBCurlAdapters)
......@@ -145,7 +145,7 @@ private:
CurlMultiResource (const CurlMultiResource &);
CurlMultiResource & operator= (const CurlMultiResource &);
}; //end of class CurlMultiResource
#endif
#endif // OTB_CURL_MULTI_AVAILABLE
/**
* Resource class that create FILE * and close the FILE * descriptor
......@@ -194,7 +194,7 @@ private:
CurlFileDescriptorResource & operator= (const CurlFileDescriptorResource &);
}; //end of class FileResource
#endif // Necessary only if Curl Availabale
#endif // OTB_USE_CURL
bool CurlHelper::TestUrlAvailability(const std::string& url) const
{
......
......@@ -24,22 +24,24 @@ namespace otb {
bool
CurlHelperInterface::IsCurlAvailable()
{
bool curlAvailable = false;
#ifdef OTB_USE_CURL
curlAvailable = true;
const bool curlAvailable = true;
#else
const bool curlAvailable = false;
#endif
return curlAvailable;
}
bool
CurlHelperInterface::IsCurlMultiAvailable()
{
bool curlMultiAvailable = false;
#ifdef OTB_CURL_MULTI_AVAILABLE
curlMultiAvailable = true;
const bool curlMultiAvailable = true;
#else
const bool curlMultiAvailable = false;
#endif
return curlMultiAvailable;
}
......
......@@ -8,3 +8,5 @@ otb_module(OTBCurl
DESCRIPTION
"${DOCUMENTATION}"
)
otb_module_activation_option("Enable curl based functionnalities" ON)
......@@ -4,6 +4,7 @@
* remove KMLVectorDataIO since it should not be used. leave libkml dependency only for KmzWriter module.
* LineSegmentDetectorExample RightAngleDetectionExample depends on VectorDataRendering (mapnik) : rewrite it with the OGR based rasterization
* OTB_USE_CURL
* CurlHelperStub is only for tests : move to TestKernel
* OTB_USE_OPENCV
* Wrapper test (Java Python)
* Handle OTB_DATA_USE_SPOTPHRINPUT & OTB_DATA_USE_CNESPHRINPUT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment