Rectified Cmake.
This commit is contained in:
+7
-3
@@ -339,15 +339,19 @@ if (NOT STB_IMAGE_FOUND)
|
||||
# Now we have to also ensure these header files get installed.
|
||||
install(FILES ${CMAKE_BINARY_DIR}/deps/${STB_DIR}/stb_image.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(FILES ${CMAKE_BINARY_DIR}/deps/${STB_DIR}/stb_image_write.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
add_definitions(-DHAS_STB)
|
||||
else ()
|
||||
list(GET STB_IMAGE_DOWNLOAD_STATUS_LIST 1 STB_DOWNLOAD_ERROR)
|
||||
message(FATAL_ERROR
|
||||
message(WARNING
|
||||
"Could not download stb! Error code ${STB_DOWNLOAD_STATUS}: ${STB_DOWNLOAD_ERROR}! Error log: ${STB_DOWNLOAD_LOG}")
|
||||
endif ()
|
||||
else ()
|
||||
message(SEND_ERROR
|
||||
"stb/stb_image.h not installed. Image utilites will not be available!")
|
||||
message(WARNING
|
||||
"stb/stb_image.h is not installed. Image utilites will not be available!")
|
||||
endif ()
|
||||
else ()
|
||||
# Already has STB installed.
|
||||
add_definitions(-DHAS_STB)
|
||||
endif ()
|
||||
|
||||
# Find ensmallen.
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#ifndef MLPACK_CORE_DATA_LOAD_IMAGE_HPP
|
||||
#define MLPACK_CORE_DATA_LOAD_IMAGE_HPP
|
||||
|
||||
#ifdef HAS_STB // Compile this only if stb is present.
|
||||
|
||||
#include <mlpack/core.hpp>
|
||||
#include <mlpack/core/util/log.hpp>
|
||||
#include <mlpack/prereqs.hpp>
|
||||
@@ -204,4 +206,6 @@ class Image
|
||||
// Include implementation of Image.
|
||||
#include "load_image_impl.hpp"
|
||||
|
||||
#endif
|
||||
#endif // HAS_STB.
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,8 @@
|
||||
#ifndef MLPACK_CORE_DATA_LOAD_IMAGE_IMPL_HPP
|
||||
#define MLPACK_CORE_DATA_LOAD_IMAGE_IMPL_HPP
|
||||
|
||||
#ifdef HAS_STB // Compile this only if stb is present.
|
||||
|
||||
// In case it hasn't been included yet.
|
||||
#include "load_image.hpp"
|
||||
|
||||
@@ -302,4 +304,6 @@ bool Image::LoadDir(const std::string& dirPath,
|
||||
} // namespace data
|
||||
} // namespace mlpack
|
||||
|
||||
#endif
|
||||
#endif // HAS_STB.
|
||||
|
||||
#endif
|
||||
@@ -17,6 +17,8 @@
|
||||
using namespace mlpack;
|
||||
using namespace std;
|
||||
|
||||
#ifdef HAS_STB // Compile this only if stb is present.
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(ImageLoadTest);
|
||||
|
||||
/**
|
||||
@@ -160,3 +162,5 @@ BOOST_AUTO_TEST_CASE(SaveMultipleImageTest)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END();
|
||||
|
||||
#endif // HAS_STB.
|
||||
Reference in New Issue
Block a user