diff options
author | Francis Murtagh <francis.murtagh@arm.com> | 2020-06-29 11:50:01 +0100 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2020-06-30 11:29:07 +0000 |
commit | 532a29d12d72f54549d8b71edd485c17af65698a (patch) | |
tree | 6748cc16706f52f413f7b2163a41d4807387cdf8 /src/backends | |
parent | 3b90af6bb79639d3813f21f3c3017503ee0c66af (diff) | |
download | armnn-532a29d12d72f54549d8b71edd485c17af65698a.tar.gz |
IVGCVSW-4487 Remove boost::filesystem
* Replace filesystem::path
* Replace filesystem::exists
* Replace filesystem::is_directory
* Replace filesystem::directory_iterator
* Replace filesystem::filesystem_error exception
* Replace filesystem::temp_directory_path
* Replace filesystem::unique path
* Replace filesystem::ofstream with std::ofstream
* Replace filesystem::remove
* Replace filesystem::is_regular_file
* Replace boost::optional with armnn::Optional in touched files
* Remove some superfluous includes
* Update build guides, GlobalConfig.cmake and CMakeLists.txt
* Remove redundant armnnUtils::Filesystem::Remove function.
* Remove redundant armnnUtils::Filesystem::GetFileSize function.
Temporarily adding back Boost::filesystem to enable Boost::dll.
Signed-off-by: Francis Murtagh <francis.murtagh@arm.com>
Signed-off-by: Colm Donelan <Colm.Donelan@arm.com>
Change-Id: Ifa46d4a0097d2612ddacd8e9736c0b36e365fb11
Diffstat (limited to 'src/backends')
-rw-r--r-- | src/backends/backendsCommon/DynamicBackendUtils.cpp | 13 | ||||
-rw-r--r-- | src/backends/backendsCommon/test/DynamicBackendTests.hpp | 41 |
2 files changed, 26 insertions, 28 deletions
diff --git a/src/backends/backendsCommon/DynamicBackendUtils.cpp b/src/backends/backendsCommon/DynamicBackendUtils.cpp index 5b675ba476..1abea114bd 100644 --- a/src/backends/backendsCommon/DynamicBackendUtils.cpp +++ b/src/backends/backendsCommon/DynamicBackendUtils.cpp @@ -6,8 +6,7 @@ #include <armnn/Logging.hpp> #include <backendsCommon/DynamicBackendUtils.hpp> #include "armnn/utility/StringUtils.hpp" - -#include <boost/filesystem.hpp> +#include <Filesystem.hpp> #include <regex> @@ -149,21 +148,21 @@ bool DynamicBackendUtils::IsPathValid(const std::string& path) return false; } - boost::filesystem::path boostPath(path); + fs::path fsPath(path); - if (!boost::filesystem::exists(boostPath)) + if (!fs::exists(fsPath)) { ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" does not exist"; return false; } - if (!boost::filesystem::is_directory(boostPath)) + if (!fs::is_directory(fsPath)) { ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" is not a directory"; return false; } - if (!boostPath.is_absolute()) + if (!fsPath.is_absolute()) { ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" is not absolute"; return false; @@ -179,7 +178,7 @@ std::vector<std::string> DynamicBackendUtils::GetSharedObjects(const std::vector for (const std::string& backendPath : backendPaths) { - using namespace boost::filesystem; + using namespace fs; // Check if the path is valid. In case of error, IsValidPath will log an error message if (!IsPathValid(backendPath)) diff --git a/src/backends/backendsCommon/test/DynamicBackendTests.hpp b/src/backends/backendsCommon/test/DynamicBackendTests.hpp index a2a6df0432..79f208d784 100644 --- a/src/backends/backendsCommon/test/DynamicBackendTests.hpp +++ b/src/backends/backendsCommon/test/DynamicBackendTests.hpp @@ -11,6 +11,7 @@ #include <armnn/utility/PolymorphicDowncast.hpp> #include <backendsCommon/CpuTensorHandle.hpp> #include <backendsCommon/DynamicBackendUtils.hpp> +#include <Filesystem.hpp> #include <reference/workloads/RefConvolution2dWorkload.hpp> #include <Runtime.hpp> @@ -18,7 +19,6 @@ #include <memory> #include <boost/test/unit_test.hpp> -#include <boost/filesystem.hpp> #include <boost/dll.hpp> static std::string g_TestBaseDir = "src/backends/backendsCommon/test/"; @@ -104,9 +104,9 @@ private: std::string GetBasePath(const std::string& basePath) { - using namespace boost::filesystem; + using namespace fs; - path programLocation = boost::dll::program_location().parent_path(); + path programLocation = boost::dll::program_location().parent_path().c_str(); path sharedObjectPath = programLocation.append(basePath); BOOST_CHECK_MESSAGE(exists(sharedObjectPath), "Base path for shared objects does not exist: " + sharedObjectPath.string()); @@ -125,7 +125,7 @@ std::string GetDynamicBackendsBasePath() std::string GetTestSubDirectory(const std::string& subdir) { - using namespace boost::filesystem; + using namespace fs; std::string testDynamicBackendsBaseDir = GetTestDirectoryBasePath(); path testDynamicBackendsBasePath(testDynamicBackendsBaseDir); @@ -137,7 +137,7 @@ std::string GetTestSubDirectory(const std::string& subdir) std::string GetTestSubDirectory(const std::string& basePath, const std::string& subdir) { - using namespace boost::filesystem; + using namespace fs; path testDynamicBackendsBasePath(basePath); path testDynamicBackendsSubDir = testDynamicBackendsBasePath.append(subdir); @@ -148,7 +148,7 @@ std::string GetTestSubDirectory(const std::string& basePath, const std::string& std::string GetTestFilePath(const std::string& directory, const std::string& fileName) { - using namespace boost::filesystem; + using namespace fs; path directoryPath(directory); path fileNamePath = directoryPath.append(fileName); @@ -346,7 +346,7 @@ void CreateValidDynamicBackendObjectTestImpl() std::string testSubDirectory = GetTestSubDirectory(g_TestDynamicBackendSubDir); // We expect this path to exists so we can load a valid dynamic backend. - BOOST_CHECK_MESSAGE(boost::filesystem::exists(testSubDirectory), + BOOST_CHECK_MESSAGE(fs::exists(testSubDirectory), "Base path for shared objects does not exist: " + testSubDirectory); std::string sharedObjectFilePath = GetTestFilePath(testSubDirectory, g_TestValidTestDynamicBackendFileName); @@ -560,7 +560,7 @@ void CreateDynamicBackendObjectInvalidInterface7TestImpl() void GetBackendPathsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // The test covers four directories: // <unit test path>/src/backends/backendsCommon/test/ @@ -640,7 +640,7 @@ void GetBackendPathsTestImpl() void GetBackendPathsOverrideTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; std::string subDir1 = GetTestSubDirectory(g_TestDynamicBackendsSubDir1); std::string subDir4 = GetTestSubDirectory(g_TestDynamicBackendsSubDir4); @@ -661,7 +661,7 @@ void GetBackendPathsOverrideTestImpl() void GetSharedObjectsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // The test covers four directories: // <unit test path>/src/backends/backendsCommon/test/ @@ -752,7 +752,7 @@ void GetSharedObjectsTestImpl() void CreateDynamicBackendsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // The test covers four directories: // <unit test path>/src/backends/backendsCommon/test/ @@ -839,7 +839,7 @@ void CreateDynamicBackendsAllInvalidTestImpl() void CreateDynamicBackendsMixedTypesTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; std::string testDynamicBackendsSubDir5 = GetTestSubDirectory(g_TestDynamicBackendsSubDir5); std::string testDynamicBackendsSubDir6 = GetTestSubDirectory(g_TestDynamicBackendsSubDir6); @@ -873,7 +873,7 @@ void CreateDynamicBackendsMixedTypesTestImpl() void RegisterSingleDynamicBackendTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // Register one valid dynamic backend @@ -920,7 +920,7 @@ void RegisterSingleDynamicBackendTestImpl() void RegisterMultipleDynamicBackendsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // Register many valid dynamic backends @@ -996,7 +996,7 @@ void RegisterMultipleDynamicBackendsTestImpl() void RegisterMultipleInvalidDynamicBackendsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // Try to register many invalid dynamic backends @@ -1056,7 +1056,7 @@ void RegisterMultipleInvalidDynamicBackendsTestImpl() void RegisterMixedDynamicBackendsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // The test covers five directories: // <unit test path>/src/backends/backendsCommon/test/ @@ -1226,7 +1226,7 @@ void RuntimeEmptyTestImpl() void RuntimeDynamicBackendsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // Swapping the backend registry storage for testing TestBackendRegistry testBackendRegistry; @@ -1267,7 +1267,7 @@ void RuntimeDynamicBackendsTestImpl() void RuntimeDuplicateDynamicBackendsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // Swapping the backend registry storage for testing TestBackendRegistry testBackendRegistry; @@ -1308,7 +1308,7 @@ void RuntimeDuplicateDynamicBackendsTestImpl() void RuntimeInvalidDynamicBackendsTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // Swapping the backend registry storage for testing TestBackendRegistry testBackendRegistry; @@ -1357,7 +1357,7 @@ void RuntimeInvalidOverridePathTestImpl() void CreateReferenceDynamicBackendTestImpl() { using namespace armnn; - using namespace boost::filesystem; + using namespace fs; // Swapping the backend registry storage for testing TestBackendRegistry testBackendRegistry; @@ -1520,7 +1520,6 @@ void CreateSampleDynamicBackendTestImpl() void SampleDynamicBackendEndToEndTestImpl() { using namespace armnn; - using namespace boost::filesystem; // Create runtime in which test will run IRuntime::CreationOptions options; IRuntimePtr runtime(IRuntime::Create(options)); |