Fix symbol resolution on windows.

This commit is contained in:
Adam Treat 2023-06-05 11:19:02 -04:00
parent 969ff0ee6b
commit 8a9ad258f4
2 changed files with 12 additions and 9 deletions

View File

@ -10,7 +10,7 @@
#include <cstdlib> #include <cstdlib>
#include <sstream> #include <sstream>
std::string LLModel::m_implementations_search_path = "."; std::string s_implementations_search_path = ".";
static bool has_at_least_minimal_hardware() { static bool has_at_least_minimal_hardware() {
#ifdef __x86_64__ #ifdef __x86_64__
@ -98,7 +98,7 @@ const std::vector<LLModel::Implementation> &LLModel::implementationList() {
} }
}; };
search_in_directory(m_implementations_search_path); search_in_directory(s_implementations_search_path);
return fres; return fres;
}()); }());
@ -139,3 +139,11 @@ LLModel *LLModel::construct(const std::string &modelPath, std::string buildVaria
// Construct and return llmodel implementation // Construct and return llmodel implementation
return impl->construct(); return impl->construct();
} }
void LLModel::setImplementationsSearchPath(const std::string& path) {
s_implementations_search_path = path;
}
const std::string& LLModel::implementationsSearchPath() {
return s_implementations_search_path;
}

View File

@ -79,12 +79,8 @@ public:
static const Implementation *implementation(std::ifstream& f, const std::string& buildVariant); static const Implementation *implementation(std::ifstream& f, const std::string& buildVariant);
static LLModel *construct(const std::string &modelPath, std::string buildVariant = "default"); static LLModel *construct(const std::string &modelPath, std::string buildVariant = "default");
static inline void setImplementationsSearchPath(const std::string& path) { static void setImplementationsSearchPath(const std::string& path);
m_implementations_search_path = path; static const std::string& implementationsSearchPath();
}
static inline const std::string& implementationsSearchPath() {
return m_implementations_search_path;
}
protected: protected:
// These are pure virtual because subclasses need to implement as the default implementation of // These are pure virtual because subclasses need to implement as the default implementation of
@ -101,6 +97,5 @@ protected:
void recalculateContext(PromptContext &promptCtx, std::function<bool(bool)> recalculate); void recalculateContext(PromptContext &promptCtx, std::function<bool(bool)> recalculate);
const Implementation *m_implementation = nullptr; const Implementation *m_implementation = nullptr;
static std::string m_implementations_search_path;
}; };
#endif // LLMODEL_H #endif // LLMODEL_H