mirror of https://github.com/KLayout/klayout.git
Enabled Windows build on Qt5.
This commit is contained in:
parent
585d0941bb
commit
c442202ca4
|
|
@ -62,7 +62,7 @@ namespace DB_HASH_NAMESPACE
|
||||||
{
|
{
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
/**
|
/**
|
||||||
* @brief Specialization missing for size_t on WIN32
|
* @brief Specialization missing for size_t on WIN64
|
||||||
*/
|
*/
|
||||||
template<>
|
template<>
|
||||||
struct hash<size_t>
|
struct hash<size_t>
|
||||||
|
|
@ -74,6 +74,32 @@ namespace DB_HASH_NAMESPACE
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN64)
|
||||||
|
/**
|
||||||
|
* @brief Specialization missing for long long on WIN64
|
||||||
|
*/
|
||||||
|
template<>
|
||||||
|
struct hash<long long>
|
||||||
|
{
|
||||||
|
size_t operator()(long long __x) const
|
||||||
|
{
|
||||||
|
return size_t (__x);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
/**
|
||||||
|
* @brief Specialization missing for long long (64 bit) on WIN32
|
||||||
|
*/
|
||||||
|
template<>
|
||||||
|
struct hash<long long>
|
||||||
|
{
|
||||||
|
size_t operator()(long long __x) const
|
||||||
|
{
|
||||||
|
return size_t (__x ^ (__x >> 32));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline size_t hfunc (const T &t)
|
inline size_t hfunc (const T &t)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ static PluginDescriptor load_plugin (const std::string &pp)
|
||||||
if (! handle) {
|
if (! handle) {
|
||||||
throw tl::Exception (tl::to_string (QObject::tr ("Unable to load plugin: %s with error message: %s ")), pp, GetLastError ());
|
throw tl::Exception (tl::to_string (QObject::tr ("Unable to load plugin: %s with error message: %s ")), pp, GetLastError ());
|
||||||
}
|
}
|
||||||
init_func = reinterpret_cast<init_func_t> (GetProcAddress (handle, init_func_name));
|
init_func = reinterpret_cast<klp_init_func_t> (GetProcAddress (handle, init_func_name));
|
||||||
#else
|
#else
|
||||||
void *handle;
|
void *handle;
|
||||||
handle = dlopen (tl::string_to_system (pp).c_str (), RTLD_LAZY);
|
handle = dlopen (tl::string_to_system (pp).c_str (), RTLD_LAZY);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
namespace lay
|
namespace lay
|
||||||
{
|
{
|
||||||
|
|
@ -65,7 +66,7 @@ ConfirmationDialog::add_info (const std::string &name, bool update, const std::s
|
||||||
item->setText (3, tl::to_qstring (url));
|
item->setText (3, tl::to_qstring (url));
|
||||||
|
|
||||||
for (int column = 0; column < list->colorCount (); ++column) {
|
for (int column = 0; column < list->colorCount (); ++column) {
|
||||||
item->setData (column, Qt::ForegroundRole, update ? Qt::blue : Qt::black);
|
item->setData (column, Qt::ForegroundRole, QVariant (QBrush (update ? Qt::blue : Qt::black)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
namespace lay
|
namespace lay
|
||||||
{
|
{
|
||||||
|
|
@ -234,7 +235,7 @@ static void handle_signal (int signo)
|
||||||
RaiseException(signo + user_base, 0, 0, NULL);
|
RaiseException(signo + user_base, 0, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void install_signal_handlers ()
|
void install_signal_handlers ()
|
||||||
{
|
{
|
||||||
// disable any signal handlers that Ruby might have installed.
|
// disable any signal handlers that Ruby might have installed.
|
||||||
signal (SIGSEGV, SIG_DFL);
|
signal (SIGSEGV, SIG_DFL);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ bool TL_PUBLIC is_parent_path (const QString &parent, const QString &path);
|
||||||
/**
|
/**
|
||||||
* @brief Returns a value indicating whether the parent path is a parent directory of the path (version with std::string)
|
* @brief Returns a value indicating whether the parent path is a parent directory of the path (version with std::string)
|
||||||
*/
|
*/
|
||||||
inline bool TL_PUBLIC is_parent_path (const std::string &parent, const std::string &path)
|
inline bool is_parent_path (const std::string &parent, const std::string &path)
|
||||||
{
|
{
|
||||||
return is_parent_path (tl::to_qstring (parent), tl::to_qstring (path));
|
return is_parent_path (tl::to_qstring (parent), tl::to_qstring (path));
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +53,7 @@ bool TL_PUBLIC rm_dir_recursive (const QString &path);
|
||||||
* @brief Recursively remove the given directory, the files from that directory and all sub-directories (version with std::string)
|
* @brief Recursively remove the given directory, the files from that directory and all sub-directories (version with std::string)
|
||||||
* @return True, if successful. false otherwise.
|
* @return True, if successful. false otherwise.
|
||||||
*/
|
*/
|
||||||
inline bool TL_PUBLIC rm_dir_recursive (const std::string &path)
|
inline bool rm_dir_recursive (const std::string &path)
|
||||||
{
|
{
|
||||||
return rm_dir_recursive (tl::to_qstring (path));
|
return rm_dir_recursive (tl::to_qstring (path));
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +70,7 @@ bool TL_PUBLIC cp_dir_recursive (const QString &source, const QString &target);
|
||||||
* @brief Recursively remove the given directory, the files from that directory and all sub-directories (version with std::string)
|
* @brief Recursively remove the given directory, the files from that directory and all sub-directories (version with std::string)
|
||||||
* @return True, if successful. false otherwise.
|
* @return True, if successful. false otherwise.
|
||||||
*/
|
*/
|
||||||
inline bool TL_PUBLIC cp_dir_recursive (const std::string &source, const std::string &target)
|
inline bool cp_dir_recursive (const std::string &source, const std::string &target)
|
||||||
{
|
{
|
||||||
return cp_dir_recursive (tl::to_qstring (source), tl::to_qstring (target));
|
return cp_dir_recursive (tl::to_qstring (source), tl::to_qstring (target));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,15 @@ def find_layer(ly, lp):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def nh(h):
|
||||||
|
"""
|
||||||
|
Returns a normalized hash representation
|
||||||
|
"""
|
||||||
|
v = []
|
||||||
|
for k in sorted(h):
|
||||||
|
v.append(repr(k) + ": " + repr(h[k]))
|
||||||
|
return "{" + (", ".join(v)) + "}"
|
||||||
|
|
||||||
class DBPCellTests(unittest.TestCase):
|
class DBPCellTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_1(self):
|
def test_1(self):
|
||||||
|
|
@ -132,12 +141,12 @@ class DBPCellTests(unittest.TestCase):
|
||||||
self.assertEqual(pcell_var.pcell_id(), pcell_decl_id)
|
self.assertEqual(pcell_var.pcell_id(), pcell_decl_id)
|
||||||
self.assertEqual(pcell_var.pcell_library().__repr__(), lib.__repr__())
|
self.assertEqual(pcell_var.pcell_library().__repr__(), lib.__repr__())
|
||||||
self.assertEqual(pcell_var.pcell_parameters().__repr__(), "[<1/0>, 1.0, 1.0]")
|
self.assertEqual(pcell_var.pcell_parameters().__repr__(), "[<1/0>, 1.0, 1.0]")
|
||||||
self.assertEqual(pcell_var.pcell_parameters_by_name().__repr__(), "{'h': 1.0, 'l': <1/0>, 'w': 1.0}")
|
self.assertEqual(nh(pcell_var.pcell_parameters_by_name()), "{'h': 1.0, 'l': <1/0>, 'w': 1.0}")
|
||||||
self.assertEqual(pcell_var.pcell_parameter("h").__repr__(), "1.0")
|
self.assertEqual(pcell_var.pcell_parameter("h").__repr__(), "1.0")
|
||||||
self.assertEqual(c1.pcell_parameters(pcell_inst).__repr__(), "[<1/0>, 1.0, 1.0]")
|
self.assertEqual(c1.pcell_parameters(pcell_inst).__repr__(), "[<1/0>, 1.0, 1.0]")
|
||||||
self.assertEqual(c1.pcell_parameters_by_name(pcell_inst).__repr__(), "{'h': 1.0, 'l': <1/0>, 'w': 1.0}")
|
self.assertEqual(nh(c1.pcell_parameters_by_name(pcell_inst)), "{'h': 1.0, 'l': <1/0>, 'w': 1.0}")
|
||||||
self.assertEqual(c1.pcell_parameter(pcell_inst, "h").__repr__(), "1.0")
|
self.assertEqual(c1.pcell_parameter(pcell_inst, "h").__repr__(), "1.0")
|
||||||
self.assertEqual(pcell_inst.pcell_parameters_by_name().__repr__(), "{'h': 1.0, 'l': <1/0>, 'w': 1.0}")
|
self.assertEqual(nh(pcell_inst.pcell_parameters_by_name()), "{'h': 1.0, 'l': <1/0>, 'w': 1.0}")
|
||||||
self.assertEqual(pcell_inst["h"].__repr__(), "1.0")
|
self.assertEqual(pcell_inst["h"].__repr__(), "1.0")
|
||||||
self.assertEqual(pcell_inst["i"].__repr__(), "None")
|
self.assertEqual(pcell_inst["i"].__repr__(), "None")
|
||||||
self.assertEqual(pcell_inst.pcell_parameter("h").__repr__(), "1.0")
|
self.assertEqual(pcell_inst.pcell_parameter("h").__repr__(), "1.0")
|
||||||
|
|
@ -146,7 +155,7 @@ class DBPCellTests(unittest.TestCase):
|
||||||
self.assertEqual(pcell_inst.pcell_declaration().__repr__(), pcell_decl.__repr__())
|
self.assertEqual(pcell_inst.pcell_declaration().__repr__(), pcell_decl.__repr__())
|
||||||
|
|
||||||
pcell_inst.change_pcell_parameter("h", 2.0)
|
pcell_inst.change_pcell_parameter("h", 2.0)
|
||||||
self.assertEqual(pcell_inst.pcell_parameters_by_name().__repr__(), "{'h': 2.0, 'l': <1/0>, 'w': 1.0}")
|
self.assertEqual(nh(pcell_inst.pcell_parameters_by_name()), "{'h': 2.0, 'l': <1/0>, 'w': 1.0}")
|
||||||
pcell_inst.set_property("abc", "a property")
|
pcell_inst.set_property("abc", "a property")
|
||||||
self.assertEqual(pcell_inst.property("abc").__repr__(), "'a property'")
|
self.assertEqual(pcell_inst.property("abc").__repr__(), "'a property'")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,8 +156,8 @@ class QtBinding_TestClass < TestBase
|
||||||
|
|
||||||
# destroying a will also destroy aa
|
# destroying a will also destroy aa
|
||||||
a.destroy
|
a.destroy
|
||||||
assert_equal(a.destroyed?, true)
|
assert_equal(a._destroyed?, true)
|
||||||
assert_equal(aa.destroyed?, true)
|
assert_equal(aa._destroyed?, true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ class QtBinding_TestClass < TestBase
|
||||||
a = nil
|
a = nil
|
||||||
GC.start
|
GC.start
|
||||||
|
|
||||||
assert_equal(aa.destroyed?, true)
|
assert_equal(aa._destroyed?, true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ class QtBinding_TestClass < TestBase
|
||||||
assert_equal(aa != nil, true)
|
assert_equal(aa != nil, true)
|
||||||
assert_equal(aa.class.to_s, "RBA::QAction")
|
assert_equal(aa.class.to_s, "RBA::QAction")
|
||||||
assert_equal(aa.text, "aatext")
|
assert_equal(aa.text, "aatext")
|
||||||
assert_equal(aa.destroyed?, false)
|
assert_equal(aa._destroyed?, false)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -569,7 +569,7 @@ class QtBinding_TestClass < TestBase
|
||||||
child = parent.viewport
|
child = parent.viewport
|
||||||
|
|
||||||
# ensure parent and child are working
|
# ensure parent and child are working
|
||||||
assert_equal(child.destroyed?, false)
|
assert_equal(child._destroyed?, false)
|
||||||
|
|
||||||
parent.resize(200, 200)
|
parent.resize(200, 200)
|
||||||
assert_equal(child.width() > 100, true)
|
assert_equal(child.width() > 100, true)
|
||||||
|
|
@ -582,8 +582,8 @@ class QtBinding_TestClass < TestBase
|
||||||
# now if we delete the parent, the child needs to become disconnected
|
# now if we delete the parent, the child needs to become disconnected
|
||||||
|
|
||||||
parent._destroy()
|
parent._destroy()
|
||||||
assert_equal(parent.destroyed?, true)
|
assert_equal(parent._destroyed?, true)
|
||||||
assert_equal(child.destroyed?, true)
|
assert_equal(child._destroyed?, true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue