1
0
mirror of https://github.com/exaloop/codon.git synced 2025-06-03 15:03:52 +08:00

Add back seq_is_macos

This commit is contained in:
A. R. Shajii 2021-09-30 15:45:45 -04:00
parent d763282137
commit 3e72453f82
3 changed files with 13 additions and 5 deletions

View File

@ -209,12 +209,12 @@ shared_ptr<ImportFile> getImportFile(const string &argv0, const string &what,
auto getStdLibPaths = [](const string &argv0) { auto getStdLibPaths = [](const string &argv0) {
vector<string> paths; vector<string> paths;
char abs[PATH_MAX + 1]; char abs[PATH_MAX + 1];
if (auto c = getenv("SEQ_PATH")) { if (auto c = getenv("CODON_PATH")) {
if (realpath(c, abs)) if (realpath(c, abs))
paths.push_back(abs); paths.push_back(abs);
} }
if (!argv0.empty()) if (!argv0.empty())
for (auto loci : {"../lib/seq/stdlib", "../stdlib", "stdlib"}) { for (auto loci : {"../lib/codon/stdlib", "../stdlib", "stdlib"}) {
strncpy(abs, executable_path(argv0.c_str()).c_str(), PATH_MAX); strncpy(abs, executable_path(argv0.c_str()).c_str(), PATH_MAX);
if (realpath(format("{}/{}", dirname(abs), loci).c_str(), abs)) if (realpath(format("{}/{}", dirname(abs), loci).c_str(), abs))
paths.push_back(abs); paths.push_back(abs);

View File

@ -14,7 +14,7 @@
#define STR_HELPER(x) #x #define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)
#define SEQ_VERSION_STRING() \ #define SEQ_VERSION_STRING() \
("codon version " STR(SEQ_VERSION_MAJOR) "." STR(SEQ_VERSION_MINOR) "." STR( \ ("codon version " STR(SEQ_VERSION_MAJOR) "." STR(SEQ_VERSION_MINOR) "." STR( \
SEQ_VERSION_PATCH)) SEQ_VERSION_PATCH))
extern "C" void seq_gc_add_roots(void *start, void *end); extern "C" void seq_gc_add_roots(void *start, void *end);
@ -486,8 +486,8 @@ void LLVMVisitor::writeToExecutable(const std::string &filename,
command.push_back("-l" + lib); command.push_back("-l" + lib);
} }
std::vector<std::string> extraArgs = {"-lcodonrt", "-lomp", "-lpthread", "-ldl", std::vector<std::string> extraArgs = {"-lcodonrt", "-lomp", "-lpthread", "-ldl",
"-lz", "-lm", "-lc", "-o", "-lz", "-lm", "-lc", "-o",
filename, objFile}; filename, objFile};
for (const auto &arg : extraArgs) { for (const auto &arg : extraArgs) {
command.push_back(arg); command.push_back(arg);
} }

View File

@ -57,6 +57,14 @@ SEQ_FUNC void seq_init(int d) {
debug = d; debug = d;
} }
SEQ_FUNC bool seq_is_macos() {
#ifdef __APPLE__
return true;
#else
return false;
#endif
}
SEQ_FUNC seq_int_t seq_pid() { return (seq_int_t)getpid(); } SEQ_FUNC seq_int_t seq_pid() { return (seq_int_t)getpid(); }
SEQ_FUNC seq_int_t seq_time() { SEQ_FUNC seq_int_t seq_time() {