mirror of https://github.com/KLayout/klayout.git
Enable Qt-less build of unit tests on Windows in debug mode and without iterator assertions
This commit is contained in:
parent
6721cb9c5b
commit
7a60f5957b
13
build.bat
13
build.bat
|
|
@ -17,6 +17,9 @@ set HAVE_64BIT_COORD=0
|
||||||
set HAVE_PYTHON=1
|
set HAVE_PYTHON=1
|
||||||
set HAVE_RUBY=1
|
set HAVE_RUBY=1
|
||||||
set MAKE_OPT=
|
set MAKE_OPT=
|
||||||
|
set HAVE_CURL=0
|
||||||
|
set HAVE_EXPAT=0
|
||||||
|
set HAVE_PTHREADS=0
|
||||||
|
|
||||||
set arch=x64
|
set arch=x64
|
||||||
set compiler=msvc2017
|
set compiler=msvc2017
|
||||||
|
|
@ -64,6 +67,10 @@ for %%a in (%*) do (
|
||||||
set "HAVE_QTBINDINGS=0"
|
set "HAVE_QTBINDINGS=0"
|
||||||
) else if "!arg!" equ "-without-qt" (
|
) else if "!arg!" equ "-without-qt" (
|
||||||
set "HAVE_QT=0"
|
set "HAVE_QT=0"
|
||||||
|
set "HAVE_CURL=1"
|
||||||
|
set "HAVE_EXPAT=1"
|
||||||
|
set "HAVE_PTHREADS=1"
|
||||||
|
set "HAVE_QTBINDINGS=0"
|
||||||
) else if "!arg!" equ "-with-64bit-coord" (
|
) else if "!arg!" equ "-with-64bit-coord" (
|
||||||
set "HAVE_64BIT_COORD=1"
|
set "HAVE_64BIT_COORD=1"
|
||||||
) else if "!arg!" equ "-without-64bit-coord" (
|
) else if "!arg!" equ "-without-64bit-coord" (
|
||||||
|
|
@ -211,6 +218,9 @@ echo HAVE_QT: %HAVE_QT%
|
||||||
echo HAVE_64BIT_COORD: %HAVE_64BIT_COORD%
|
echo HAVE_64BIT_COORD: %HAVE_64BIT_COORD%
|
||||||
echo HAVE_PYTHON: %HAVE_PYTHON%
|
echo HAVE_PYTHON: %HAVE_PYTHON%
|
||||||
echo HAVE_RUBY: %HAVE_RUBY%
|
echo HAVE_RUBY: %HAVE_RUBY%
|
||||||
|
echo HAVE_CURL: %HAVE_CURL%
|
||||||
|
echo HAVE_PTHREADS: %HAVE_PTHREADS%
|
||||||
|
echo HAVE_EXPAT: %HAVE_EXPAT%
|
||||||
echo MAKE_OPT: %MAKE_OPT%
|
echo MAKE_OPT: %MAKE_OPT%
|
||||||
echo.
|
echo.
|
||||||
echo qmake binary: %option-qmake%
|
echo qmake binary: %option-qmake%
|
||||||
|
|
@ -245,6 +255,9 @@ echo on
|
||||||
"KLAYOUT_VERSION_REV=%KLAYOUT_VERSION_REV%" ^
|
"KLAYOUT_VERSION_REV=%KLAYOUT_VERSION_REV%" ^
|
||||||
"HAVE_QTBINDINGS=%HAVE_QTBINDINGS%" ^
|
"HAVE_QTBINDINGS=%HAVE_QTBINDINGS%" ^
|
||||||
"HAVE_QT=%HAVE_QT%" ^
|
"HAVE_QT=%HAVE_QT%" ^
|
||||||
|
"HAVE_EXPAT=%HAVE_EXPAT%" ^
|
||||||
|
"HAVE_CURL=%HAVE_CURL%" ^
|
||||||
|
"HAVE_PTHREADS=%HAVE_PTHREADS%" ^
|
||||||
"HAVE_RUBY=%HAVE_RUBY%" ^
|
"HAVE_RUBY=%HAVE_RUBY%" ^
|
||||||
"HAVE_PYTHON=%HAVE_PYTHON%" ^
|
"HAVE_PYTHON=%HAVE_PYTHON%" ^
|
||||||
"HAVE_64BIT_COORD=%HAVE_64BIT_COORD%" ^
|
"HAVE_64BIT_COORD=%HAVE_64BIT_COORD%" ^
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,10 @@ msvc {
|
||||||
|
|
||||||
QMAKE_CXXFLAGS_WARN_ON += \
|
QMAKE_CXXFLAGS_WARN_ON += \
|
||||||
|
|
||||||
|
# as we're using default-constructed iterators as "null" we can't have
|
||||||
|
# checked iterators with MSVC
|
||||||
|
DEFINES += _ITERATOR_DEBUG_LEVEL=0
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
CONFIG(gcov) {
|
CONFIG(gcov) {
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ plugins.depends += lib rdb db
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unit_tests.depends += plugins $$MAIN_DEPENDS
|
unit_tests.depends += plugins $$MAIN_DEPENDS $$LANG_DEPENDS
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
plugins/tools/import/lay_plugin/layResources.qrc \
|
plugins/tools/import/lay_plugin/layResources.qrc \
|
||||||
|
|
|
||||||
|
|
@ -73,18 +73,78 @@
|
||||||
|
|
||||||
static int main_cont (int &argc, char **argv);
|
static int main_cont (int &argc, char **argv);
|
||||||
|
|
||||||
int
|
#ifdef _WIN32 // for VC++
|
||||||
main (int argc, char **argv)
|
|
||||||
|
// for VC++/MinGW provide a wrapper for main.
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
int WINAPI
|
||||||
|
WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*prevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
|
||||||
{
|
{
|
||||||
int ret = rba::RubyInterpreter::initialize (argc, argv, &main_cont);
|
int argCount = 0;
|
||||||
|
LPWSTR *szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount);
|
||||||
|
|
||||||
|
// fail safe behaviour
|
||||||
|
if (!szArgList) {
|
||||||
|
MessageBox(NULL, L"Unable to parse command line", L"Error", MB_OK);
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
char **argv = new char *[argCount];
|
||||||
|
for (int i = 0; i < argCount; i++) {
|
||||||
|
std::wstring a;
|
||||||
|
for (WCHAR *wc = szArgList [i]; *wc; ++wc) {
|
||||||
|
a += wchar_t ((unsigned int) *wc);
|
||||||
|
}
|
||||||
|
std::string aa = tl::to_string (a);
|
||||||
|
argv [i] = new char [aa.size () + 1];
|
||||||
|
strcpy (argv [i], aa.c_str ());
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = rba::RubyInterpreter::initialize (argCount, argv, &main_cont);
|
||||||
|
|
||||||
// NOTE: this needs to happen after the Ruby interpreter went down since otherwise the GC will
|
// NOTE: this needs to happen after the Ruby interpreter went down since otherwise the GC will
|
||||||
// access objects that are already cleaned up.
|
// access objects that are already cleaned up.
|
||||||
tl::StaticObjects::cleanup ();
|
tl::StaticObjects::cleanup ();
|
||||||
|
|
||||||
|
for (int i = 0; i < argCount; i++) {
|
||||||
|
delete[] argv [i];
|
||||||
|
}
|
||||||
|
delete[] argv;
|
||||||
|
|
||||||
|
LocalFree(szArgList);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int a_argc, const char **a_argv)
|
||||||
|
{
|
||||||
|
char **argv = new char *[a_argc];
|
||||||
|
for (int i = 0; i < a_argc; i++) {
|
||||||
|
tl::string aa = tl::system_to_string (a_argv[i]);
|
||||||
|
argv [i] = new char [aa.size () + 1];
|
||||||
|
strcpy (argv [i], aa.c_str ());
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = rba::RubyInterpreter::initialize (a_argc, argv, &main_cont);
|
||||||
|
|
||||||
|
// NOTE: this needs to happen after the Ruby interpreter went down since otherwise the GC will
|
||||||
|
// access objects that are already cleaned up.
|
||||||
|
tl::StaticObjects::cleanup ();
|
||||||
|
|
||||||
|
for (int i = 0; i < a_argc; i++) {
|
||||||
|
delete[] argv [i];
|
||||||
|
}
|
||||||
|
delete[] argv;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
run_test (tl::TestBase *t, bool editable, bool slow, int repeat)
|
run_test (tl::TestBase *t, bool editable, bool slow, int repeat)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ HEADERS += \
|
||||||
|
|
||||||
!win32 {
|
!win32 {
|
||||||
LIBS += -ldl
|
LIBS += -ldl
|
||||||
|
} else {
|
||||||
|
LIBS += -lshell32
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBS += -lklayout_gsi_test
|
LIBS += -lklayout_gsi_test
|
||||||
|
|
@ -38,5 +40,7 @@ LIBS += -lklayout_gsi_test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
CONFIG -= qt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue