Commit 8940977e authored by T.J. Corona's avatar T.J. Corona

Remove hard-coded mesh worker search paths.

parent cc1c55eb
Pipeline #79837 passed with stage
......@@ -151,6 +151,7 @@ std::string Paths::bundleDirectory()
std::vector<std::string> Paths::workerSearchPaths(bool pruneInvalid)
{
this->update();
return pruneInvalid ? Paths::pruneInvalidDirectories(Paths::s_workerSearchPaths)
: Paths::s_workerSearchPaths;
}
......@@ -193,6 +194,17 @@ bool Paths::update()
#endif
Paths::s_lastGen = Paths::s_lastSet;
// Let's look for search paths relative to the location of the library
// containing this method.
boost::filesystem::path smtkLibDir =
boost::dll::symbol_location(Paths::currentDirectory).parent_path();
boost::filesystem::path smtkBinDir = smtkLibDir.parent_path() / "bin";
if (boost::filesystem::is_directory(smtkBinDir))
{
Paths::s_workerSearchPaths.push_back(smtkBinDir.string());
}
return true;
}
return false;
......
......@@ -26,11 +26,6 @@ set_target_properties(${library_name}
COMPILE_FLAGS ${SMTK_PYBIND11_FLAGS}
)
get_filename_component(build_search_path "${CMAKE_BINARY_DIR}/bin" ABSOLUTE)
get_filename_component(install_search_path "${CMAKE_INSTALL_PREFIX}/bin" ABSOLUTE)
target_compile_definitions(${library_name} PRIVATE "BUILD_SEARCH_PATH=\"${build_search_path}\"")
target_compile_definitions(${library_name} PRIVATE "INSTALL_SEARCH_PATH=\"${install_search_path}\"")
# Install library
install(TARGETS ${library_name} DESTINATION "${install_path}")
......
......@@ -19,12 +19,14 @@ SMTK_THIRDPARTY_POST_INCLUDE
#include <utility>
#include "smtk/extension/delaunay/worker/DelaunayMeshWorker.h"
#include "remus/common/LocateFile.h"
#include "remus/proto/JobRequirements.h"
#include "remus/common/MeshIOType.h"
#include "remus/common/ContentTypes.h"
#include "smtk/attribute/System.h"
#include "smtk/common/Paths.h"
#include "smtk/io/AttributeReader.h"
#include "smtk/io/AttributeWriter.h"
#include "smtk/io/Logger.h"
......@@ -39,11 +41,10 @@ namespace
return rel_search_paths;
}
const std::vector<std::string>& absolute_search_paths()
const std::vector<std::string> absolute_search_paths()
{
static std::vector<std::string> abs_search_paths =
{ INSTALL_SEARCH_PATH, BUILD_SEARCH_PATH };
return abs_search_paths;
static smtk::common::Paths paths;
return paths.workerSearchPaths();
}
}
......@@ -92,8 +93,4 @@ PYBIND11_MODULE(_smtkPybindMeshWorkerDelaunay, delaunay)
logger);
return sysptr;
});
delaunay.def("search_paths", [](){
return absolute_search_paths();
});
}
......@@ -23,9 +23,6 @@ if(SMTK_ENABLE_POLYGON_SESSION AND
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
get_filename_component(build_search_path "${CMAKE_BINARY_DIR}/bin" ABSOLUTE)
get_filename_component(install_search_path "${CMAKE_INSTALL_PREFIX}/bin" ABSOLUTE)
target_compile_definitions(UnitTestDelaunayMeshWorker PRIVATE "BUILD_SEARCH_PATH=\"${build_search_path}\"")
add_test(NAME UnitTestDelaunayMeshWorker
COMMAND $<TARGET_FILE:UnitTestDelaunayMeshWorker>
......
......@@ -23,6 +23,8 @@
#include "smtk/bridge/polygon/Operator.h"
#include "smtk/bridge/polygon/Session.h"
#include "smtk/common/Paths.h"
#include "smtk/extension/remus/MeshServerLauncher.h"
#include "smtk/mesh/Collection.h"
......@@ -52,10 +54,10 @@ const std::vector<std::string>& relative_search_paths()
return rel_search_paths;
}
const std::vector<std::string>& absolute_search_paths()
const std::vector<std::string> absolute_search_paths()
{
static std::vector<std::string> abs_search_paths = { BUILD_SEARCH_PATH };
return abs_search_paths;
static smtk::common::Paths paths;
return paths.workerSearchPaths();
}
}
......@@ -114,9 +116,8 @@ int main(int argc, char** const argv)
// Provide the worker factory with a list of locations where it can
// find the job requirements file (*.rw) and associated executable.
// The first path is the install location of the worker, and the second
// path is the build location.
for (std::string path : absolute_search_paths())
smtk::common::Paths paths;
for (std::string path : paths.workerSearchPaths())
{
meshServerLauncher.addWorkerSearchDirectory(path);
}
......
......@@ -64,10 +64,9 @@ class TestDelaunayMeshWorker(smtk.testing.TestCase):
# provide the worker factory with a list of locations where it can
# find the job requirements file (*.rw) and associated executable.
# The first path is the install location of the worker, and the second
# path is the build location.
for directory in smtk.mesh.delaunay.worker.search_paths():
self.meshServerLauncher.addWorkerSearchDirectory(directory)
paths = smtk.common.Paths()
for search_path in paths.workerSearchPaths():
self.meshServerLauncher.addWorkerSearchDirectory(search_path)
# access the meshing attribute system for the delaunay worker
meshingAttributes = smtk.mesh.delaunay.worker.meshing_attributes()
......
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