mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-07 01:54:10 +00:00
More win32 (mxe and vs) build fixes
This commit is contained in:
parent
468ae92374
commit
b3a6f8f530
5
Makefile
5
Makefile
|
@ -324,8 +324,9 @@ ifeq ($(ENABLE_ABC),1)
|
||||||
endif
|
endif
|
||||||
echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-$(YOSYS_VER)/readme.txt
|
echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-$(YOSYS_VER)/readme.txt
|
||||||
echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-$(YOSYS_VER)/readme.txt
|
echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-$(YOSYS_VER)/readme.txt
|
||||||
find backends frontends kernel libs passes techlibs -name '*.d' | xargs sed -e 's,^[^ ]*:,,; s, ,\n,g; s, *\\,,;' \
|
find backends frontends kernel libs passes techlibs -name '*.d' | xargs
|
||||||
-e 's,/[^/]*/\.\./,/,g; s,'"$PWD/"',,' | sort -u | sed '/^[^/]/ ! d; s,$,\r,;' > srcfiles.txt
|
sed -e 's,^[^ ]*:,,; s, ,\n,g; s, *\\,,; s,/[^/]*/\.\./,/,g; s,'"$$PWD/"',,' $(addsuffix .d,$(basename $(OBJS))) \
|
||||||
|
| sort -u | sed '/^[^/]/ ! d; s,$$,\r,;' > srcfiles.txt
|
||||||
zip yosys-win32-$(YOSYS_VER)/genfiles.zip $(GENFILES) srcfiles.txt
|
zip yosys-win32-$(YOSYS_VER)/genfiles.zip $(GENFILES) srcfiles.txt
|
||||||
zip -r yosys-win32-$(YOSYS_VER).zip yosys-win32-$(YOSYS_VER)/
|
zip -r yosys-win32-$(YOSYS_VER).zip yosys-win32-$(YOSYS_VER)/
|
||||||
rm -f srcfiles.txt
|
rm -f srcfiles.txt
|
||||||
|
|
|
@ -32,6 +32,36 @@
|
||||||
|
|
||||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
#if !defined(_WIN32) || defined(__MINGW32__)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
#else
|
||||||
|
char *optarg;
|
||||||
|
int optind = 1, optcur = 1;
|
||||||
|
int getopt(int argc, char **argv, const char *optstring)
|
||||||
|
{
|
||||||
|
if (optind >= argc || argv[optind][0] != '-')
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
bool takes_arg = false;
|
||||||
|
int opt = argv[optind][optcur];
|
||||||
|
for (int i = 0; optstring[i]; i++)
|
||||||
|
if (opt == optstring[i] && optstring[i + 1] == ':')
|
||||||
|
takes_arg = true;
|
||||||
|
|
||||||
|
if (!takes_arg) {
|
||||||
|
if (argv[optind][++optcur] == 0)
|
||||||
|
optind++, optcur = 1;
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv[optind][++optcur]) {
|
||||||
|
optarg = argv[optind++] + optcur;
|
||||||
|
optcur = 1;
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
optarg = argv[++optind];
|
||||||
|
optind++, optcur = 1;
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
YOSYS_NAMESPACE_BEGIN
|
YOSYS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||||
const char *yosys_version_str = "Windows";
|
const char *yosys_version_str = "Yosys for Windows (Version Information Unavailable)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int autoidx = 1;
|
int autoidx = 1;
|
||||||
|
@ -210,9 +210,19 @@ std::string make_temp_file(std::string template_str)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (template_str.rfind("/tmp/", 0) == 0) {
|
if (template_str.rfind("/tmp/", 0) == 0) {
|
||||||
char path[MAX_PATH+1];
|
# ifdef __MINGW32__
|
||||||
GetTempPath(MAX_PATH+1, path);
|
char longpath[MAX_PATH + 1];
|
||||||
template_str = stringf("%s\\%s", path, template_str.c_str() + 5);
|
char shortpath[MAX_PATH + 1];
|
||||||
|
# else
|
||||||
|
WCHAR longpath[MAX_PATH + 1];
|
||||||
|
TCHAR shortpath[MAX_PATH + 1];
|
||||||
|
# endif
|
||||||
|
if (!GetTempPath(MAX_PATH+1, longpath))
|
||||||
|
log_error("GetTempPath() failed.\n");
|
||||||
|
if (!GetShortPathName(longpath, shortpath, MAX_PATH + 1))
|
||||||
|
log_error("GetShortPathName() failed.\n");
|
||||||
|
log_assert(sizeof(TCHAR) == sizeof(char));
|
||||||
|
template_str = stringf("%s\\%s", shortpath, template_str.c_str() + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pos = template_str.rfind("XXXXXX");
|
size_t pos = template_str.rfind("XXXXXX");
|
||||||
|
@ -475,14 +485,24 @@ std::string proc_self_dirname()
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
std::string proc_self_dirname()
|
std::string proc_self_dirname()
|
||||||
{
|
{
|
||||||
char longpath[MAX_PATH+1], shortpath[MAX_PATH+1];
|
int i = 0;
|
||||||
|
# ifdef __MINGW32__
|
||||||
|
char longpath[MAX_PATH + 1];
|
||||||
|
char shortpath[MAX_PATH + 1];
|
||||||
|
# else
|
||||||
|
WCHAR longpath[MAX_PATH + 1];
|
||||||
|
TCHAR shortpath[MAX_PATH + 1];
|
||||||
|
# endif
|
||||||
if (!GetModuleFileName(0, longpath, MAX_PATH+1))
|
if (!GetModuleFileName(0, longpath, MAX_PATH+1))
|
||||||
log_error("GetModuleFileName() failed.\n");
|
log_error("GetModuleFileName() failed.\n");
|
||||||
if (!GetShortPathName(longpath, shortpath, MAX_PATH+1))
|
if (!GetShortPathName(longpath, shortpath, MAX_PATH+1))
|
||||||
log_error("GetShortPathName() failed.\n");
|
log_error("GetShortPathName() failed.\n");
|
||||||
for (int i = strlen(shortpath)-1; i >= 0 && shortpath[i] != '/' && shortpath[i] != '\\' ; i--)
|
while (shortpath[i] != 0)
|
||||||
shortpath[i] = 0;
|
i++;
|
||||||
return std::string(shortpath);
|
while (i > 0 && shortpath[i-1] != '/' && shortpath[i-1] != '\\')
|
||||||
|
shortpath[--i] = 0;
|
||||||
|
log_assert(sizeof(TCHAR) == sizeof(char));
|
||||||
|
return std::string((char*)shortpath);
|
||||||
}
|
}
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN)
|
||||||
std::string proc_self_dirname()
|
std::string proc_self_dirname()
|
||||||
|
|
|
@ -60,9 +60,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef _YOSYS_
|
#ifndef _YOSYS_
|
||||||
# error It looks like you are trying to build Yosys with the config defines set. \
|
# error It looks like you are trying to build Yosys without the config defines set. \
|
||||||
When building Yosys with a custom make system, make sure you set all the \
|
When building Yosys with a custom make system, make sure you set all the \
|
||||||
defines the Yosys Makefile would set for your build configuration.
|
defines the Yosys Makefile would set for your build configuration.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef YOSYS_ENABLE_TCL
|
#ifdef YOSYS_ENABLE_TCL
|
||||||
|
@ -74,8 +74,6 @@
|
||||||
# define NOMINMAX 1
|
# define NOMINMAX 1
|
||||||
# undef YY_NO_UNISTD_H
|
# undef YY_NO_UNISTD_H
|
||||||
# define YY_NO_UNISTD_H 1
|
# define YY_NO_UNISTD_H 1
|
||||||
# undef _CRT_SECURE_NO_WARNINGS
|
|
||||||
# define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
|
@ -89,6 +87,11 @@
|
||||||
# define popen _popen
|
# define popen _popen
|
||||||
# define pclose _pclose
|
# define pclose _pclose
|
||||||
# define PATH_MAX MAX_PATH
|
# define PATH_MAX MAX_PATH
|
||||||
|
|
||||||
|
# ifndef __MINGW32__
|
||||||
|
# define isatty _isatty
|
||||||
|
# define fileno _fileno
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PRIVATE_NAMESPACE_BEGIN namespace {
|
#define PRIVATE_NAMESPACE_BEGIN namespace {
|
||||||
|
|
|
@ -22,12 +22,24 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
const int ezSAT::CONST_TRUE = 1;
|
const int ezSAT::CONST_TRUE = 1;
|
||||||
const int ezSAT::CONST_FALSE = 2;
|
const int ezSAT::CONST_FALSE = 2;
|
||||||
|
|
||||||
|
static std::string my_int_to_string(int i)
|
||||||
|
{
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
char buffer[64];
|
||||||
|
snprintf(buffer, 64, "%d", i);
|
||||||
|
return buffer;
|
||||||
|
#else
|
||||||
|
return std::to_string(i);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
ezSAT::ezSAT()
|
ezSAT::ezSAT()
|
||||||
{
|
{
|
||||||
flag_keep_cnf = false;
|
flag_keep_cnf = false;
|
||||||
|
@ -183,7 +195,7 @@ int ezSAT::expression(OpId op, const std::vector<int> &args)
|
||||||
if (expressionsCache.count(myExpr) > 0) {
|
if (expressionsCache.count(myExpr) > 0) {
|
||||||
id = expressionsCache.at(myExpr);
|
id = expressionsCache.at(myExpr);
|
||||||
} else {
|
} else {
|
||||||
id = -(expressions.size() + 1);
|
id = -(int(expressions.size()) + 1);
|
||||||
expressionsCache[myExpr] = id;
|
expressionsCache[myExpr] = id;
|
||||||
expressions.push_back(myExpr);
|
expressions.push_back(myExpr);
|
||||||
}
|
}
|
||||||
|
@ -490,13 +502,13 @@ int ezSAT::bound(int id) const
|
||||||
|
|
||||||
std::string ezSAT::cnfLiteralInfo(int idx) const
|
std::string ezSAT::cnfLiteralInfo(int idx) const
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < cnfLiteralVariables.size(); i++) {
|
for (int i = 0; i < int(cnfLiteralVariables.size()); i++) {
|
||||||
if (cnfLiteralVariables[i] == idx)
|
if (cnfLiteralVariables[i] == idx)
|
||||||
return to_string(i+1);
|
return to_string(i+1);
|
||||||
if (cnfLiteralVariables[i] == -idx)
|
if (cnfLiteralVariables[i] == -idx)
|
||||||
return "NOT " + to_string(i+1);
|
return "NOT " + to_string(i+1);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < cnfExpressionVariables.size(); i++) {
|
for (int i = 0; i < int(cnfExpressionVariables.size()); i++) {
|
||||||
if (cnfExpressionVariables[i] == idx)
|
if (cnfExpressionVariables[i] == idx)
|
||||||
return to_string(-i-1);
|
return to_string(-i-1);
|
||||||
if (cnfExpressionVariables[i] == -idx)
|
if (cnfExpressionVariables[i] == -idx)
|
||||||
|
@ -670,9 +682,7 @@ std::vector<int> ezSAT::vec_var(std::string name, int numBits)
|
||||||
{
|
{
|
||||||
std::vector<int> vec;
|
std::vector<int> vec;
|
||||||
for (int i = 0; i < numBits; i++) {
|
for (int i = 0; i < numBits; i++) {
|
||||||
char buf[64];
|
vec.push_back(VAR(name + my_int_to_string(i)));
|
||||||
snprintf(buf, 64, " [%d]", i);
|
|
||||||
vec.push_back(VAR(name + buf));
|
|
||||||
}
|
}
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
@ -1245,11 +1255,8 @@ static std::string expression2str(const std::pair<ezSAT::OpId, std::vector<int>>
|
||||||
#undef X
|
#undef X
|
||||||
}
|
}
|
||||||
text += ":";
|
text += ":";
|
||||||
for (auto it : data.second) {
|
for (auto it : data.second)
|
||||||
char buf[64];
|
text += " " + my_int_to_string(it);
|
||||||
snprintf(buf, 64, " %d", it);
|
|
||||||
text += buf;
|
|
||||||
}
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue