mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-29 07:27:58 +00:00
Various MXE build fixes
This commit is contained in:
parent
31267a1ae8
commit
4df902637a
4 changed files with 30 additions and 15 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
#elif defined(__APPLE__)
|
||||
# include <mach-o/dyld.h>
|
||||
#else
|
||||
|
@ -44,7 +45,7 @@
|
|||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
const char *yosys_version_str = "Windows";
|
||||
#endif
|
||||
|
||||
|
@ -224,7 +225,7 @@ std::string make_temp_file(std::string template_str)
|
|||
x ^= x << 13, x ^= x >> 17, x ^= x << 5;
|
||||
template_str[pos+i] = y[x % y.size()];
|
||||
}
|
||||
if (access(template_str.c_str(), F_OK) != 0)
|
||||
if (_access(template_str.c_str(), 0) != 0)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
@ -265,6 +266,18 @@ std::string make_temp_dir(std::string template_str)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
bool check_file_exists(std::string filename, bool)
|
||||
{
|
||||
return _access(filename.c_str(), 0);
|
||||
}
|
||||
#else
|
||||
bool check_file_exists(std::string filename, bool is_exec)
|
||||
{
|
||||
return access(filename.c_str(), is_exec ? X_OK : F_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
void remove_directory(std::string dirname)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
@ -484,10 +497,10 @@ std::string proc_share_dirname()
|
|||
{
|
||||
std::string proc_self_path = proc_self_dirname();
|
||||
std::string proc_share_path = proc_self_path + "share/";
|
||||
if (access(proc_share_path.c_str(), X_OK) == 0)
|
||||
if (check_file_exists(proc_share_path, true) == 0)
|
||||
return proc_share_path;
|
||||
proc_share_path = proc_self_path + "../share/yosys/";
|
||||
if (access(proc_share_path.c_str(), X_OK) == 0)
|
||||
if (check_file_exists(proc_share_path, true) == 0)
|
||||
return proc_share_path;
|
||||
log_error("proc_share_dirname: unable to determine share/ directory!\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue