Skip to content

Commit 63a948a

Browse files
author
Matthias Koefferlein
committed
Merge branch 'master' of github.com:KLayout/klayout
2 parents e656434 + b6d8ce9 commit 63a948a

57 files changed

Lines changed: 1730 additions & 622 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
large-packages: true
4949
- uses: hmarr/debug-action@v3
5050
- name: Cancel Workflow Action
51-
uses: styfle/cancel-workflow-action@0.13.0
51+
uses: styfle/cancel-workflow-action@0.13.1
5252
- uses: actions/checkout@v6
5353
- name: ccache
5454
if: matrix.os != 'ubuntu-24.04-arm'
@@ -66,7 +66,7 @@ jobs:
6666
mkdir -p $HOST_CCACHE_DIR
6767
- name: Build wheels (ARM)
6868
if: matrix.os == 'ubuntu-24.04-arm'
69-
uses: pypa/cibuildwheel@v3.3.1
69+
uses: pypa/cibuildwheel@v3.4.0
7070
env:
7171
# override the default CentOS “yum install … ccache” and drop ccache
7272
CIBW_BEFORE_ALL_LINUX: |
@@ -81,7 +81,7 @@ jobs:
8181

8282
- name: Build wheels (all other platforms)
8383
if: matrix.os != 'ubuntu-24.04-arm'
84-
uses: pypa/cibuildwheel@v3.3.1
84+
uses: pypa/cibuildwheel@v3.4.0
8585
env:
8686
CIBW_BUILD: ${{ matrix.cibuild }}
8787
CIBW_ARCHS_MACOS: ${{ matrix.macos-arch }}

src/buddies/src/bd/bd.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ INCLUDEPATH += $$RBA_INC
4141
DEPENDPATH += $$RBA_INC
4242

4343
equals(HAVE_RUBY, "1") {
44-
LIBS += -lklayout_rba
44+
INCLUDEPATH += $$DRC_INC $$LVS_INC
45+
DEPENDPATH += $$DRC_INC $$LVS_INC
46+
LIBS += -lklayout_rba -lklayout_drc -lklayout_lvs
4547
} else {
4648
LIBS += -lklayout_rbastub
4749
}

src/buddies/src/bd/strmclip.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ void clip (ClipData &data)
153153
// write the layout
154154

155155
db::SaveLayoutOptions save_options;
156-
save_options.set_format_from_filename (data.file_out);
156+
std::string of = save_options.set_format_from_filename (data.file_out).second;
157157
data.writer_options.configure (save_options, target_layout);
158158

159-
tl::OutputStream stream (data.file_out);
159+
tl::OutputStream stream (of);
160160
db::Writer writer (save_options);
161161
writer.write (target_layout, stream);
162162
}
@@ -176,7 +176,9 @@ BD_PUBLIC int strmclip (int argc, char *argv[])
176176
<< tl::arg ("output", &data.file_out, "The output file",
177177
"The output format is determined from the suffix of the file. If the suffix indicates "
178178
"gzip compression, the file will be compressed on output. Examples for recognized suffixes are "
179-
"\".oas\", \".gds.gz\", \".dxf\" or \".gds2\"."
179+
"\".oas\", \".gds.gz\", \".dxf\" or \".gds2\". You can also use any name, and specify the "
180+
"desired suffix in square brackets after the file name. For example, 'file.clip[oas]' will "
181+
"create an OASIS file called 'file.clip'."
180182
)
181183
<< tl::arg ("-l|--clip-layer=spec", &data, &ClipData::set_clip_layer, "Specifies a layer to take the clip regions from",
182184
"If this option is given, the clip rectangles are taken from the given layer."

src/buddies/src/bd/strmrun.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include "libForceLink.h"
3737
#include "rdbForceLink.h"
3838
#include "pexForceLink.h"
39+
#include "drcForceLink.h"
40+
#include "lvsForceLink.h"
3941
#include "lymMacro.h"
4042
#include "lymMacroCollection.h"
4143

src/buddies/src/bd/strmxor.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ BD_PUBLIC int strmxor (int argc, char *argv[])
408408
<< tl::arg ("?output", &output, "The output file to which the XOR differences are written",
409409
"This argument is optional. If not given, the exit status alone will indicate whether the layouts "
410410
"are identical or not. The output is a layout file. The format of the file is derived "
411-
"from the file name's suffix (.oas[.gz] for (gzipped) OASIS, .gds[.gz] for (gzipped) GDS2 etc.)."
411+
"from the file name's suffix (.oas for OASIS, .gds[.gz] for (gzipped) GDS2 etc.). "
412+
"You can also use any name, and specify the desired suffix in square brackets after the file name. "
413+
"For example, 'file.xor[oas]' will create an OASIS file called 'file.xor'."
412414
)
413415
<< tl::arg ("-ta|--top-a=name", &top_a, "Specifies the top cell for the first layout",
414416
"Use this option to take a specific cell as the top cell from the first layout. All "
@@ -587,10 +589,10 @@ BD_PUBLIC int strmxor (int argc, char *argv[])
587589
if (output_layout.get ()) {
588590

589591
db::SaveLayoutOptions save_options;
590-
save_options.set_format_from_filename (output);
592+
std::string of = save_options.set_format_from_filename (output).second;
591593
writer_options.configure (save_options, *output_layout);
592594

593-
tl::OutputStream stream (output);
595+
tl::OutputStream stream (of);
594596
db::Writer writer (save_options);
595597
writer.write (*output_layout, stream);
596598

src/buddies/src/buddy_app.pri

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ INCLUDEPATH += $$RBA_INC
2525
DEPENDPATH += $$RBA_INC
2626

2727
equals(HAVE_RUBY, "1") {
28-
LIBS += -lklayout_rba
28+
LIBS += -lklayout_rba -lklayout_drc -lklayout_lvs
2929
} else {
3030
LIBS += -lklayout_rbastub
3131
}

src/buddies/unit_tests/bdConverterTests.cc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,34 @@ TEST(7)
212212
db::compare_layouts (this, layout, input, db::NoNormalization);
213213
}
214214

215+
// Small DEF example with explicit format
216+
TEST(8)
217+
{
218+
std::string input = tl::testdata ();
219+
input += "/lefdef/strm2oas_small/in.defok[def]";
220+
221+
std::string input_au = tl::testdata ();
222+
input_au += "/lefdef/strm2oas_small/au.gds";
223+
224+
std::string output = this->tmp_file ("small_def");
225+
226+
const char *argv[] = { "x", input.c_str (), output.c_str () };
227+
228+
EXPECT_EQ (bd::converter_main (sizeof (argv) / sizeof (argv[0]), (char **) argv, bd::GenericWriterOptions::oasis_format_name), 0);
229+
230+
db::Layout layout;
231+
232+
{
233+
tl::InputStream stream (output);
234+
db::LoadLayoutOptions options;
235+
db::Reader reader (stream);
236+
reader.read (layout, options);
237+
EXPECT_EQ (reader.format (), "OASIS");
238+
}
239+
240+
db::compare_layouts (this, layout, input_au, db::WriteGDS2);
241+
}
242+
215243
// Large LEF/DEF to OAS converter test
216244
TEST(10)
217245
{

src/buddies/unit_tests/bdStrmclipTests.cc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,34 @@ TEST(2)
9797
tl::InputStream stream (output);
9898
db::Reader reader (stream);
9999
reader.read (layout);
100+
EXPECT_EQ (reader.format (), "GDS2");
101+
}
102+
103+
db::compare_layouts (this, layout, au, db::NoNormalization);
104+
}
105+
106+
// with explicit output format
107+
TEST(3)
108+
{
109+
std::string input = tl::testdata ();
110+
input += "/bd/strm2clip_in.gds";
111+
112+
std::string au = tl::testdata ();
113+
au += "/bd/strm2clip_au2.gds";
114+
115+
std::string output = this->tmp_file () + "[oas]";
116+
117+
const char *argv[] = { "x", input.c_str (), output.c_str (), "-r=0,-2,9,5", "-t", "INV2", "-x=CLIP_OUT" };
118+
119+
EXPECT_EQ (strmclip (sizeof (argv) / sizeof (argv[0]), (char **) argv), 0);
120+
121+
db::Layout layout;
122+
123+
{
124+
tl::InputStream stream (output);
125+
db::Reader reader (stream);
126+
reader.read (layout);
127+
EXPECT_EQ (reader.format (), "OASIS");
100128
}
101129

102130
db::compare_layouts (this, layout, au, db::NoNormalization);

src/buddies/unit_tests/bdStrmrunTests.cc

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,50 @@
2828
TEST(1)
2929
{
3030
#if defined(HAVE_PYTHON)
31-
std::string fp (tl::testsrc ());
32-
fp += "/testdata/bd/strmrun.py";
33-
34-
std::string cmd;
31+
std::string cmd_call;
3532

3633
#if defined(__APPLE__)
3734
// NOTE: because of system integrity, MacOS does not inherit DYLD_LIBRARY_PATH to child
3835
// processes like sh. We need to port this variable explicitly.
3936
const char *ldpath_name = "DYLD_LIBRARY_PATH";
4037
const char *ldpath = getenv (ldpath_name);
4138
if (ldpath) {
42-
cmd += std::string (ldpath_name) + "=\"" + ldpath + "\"; export " + ldpath_name + "; ";
39+
cmd_call += std::string (ldpath_name) + "=\"" + ldpath + "\"; export " + ldpath_name + "; ";
4340
}
4441
#endif
4542

46-
cmd += tl::combine_path (tl::get_inst_path (), "strmrun ") + fp;
47-
tl::info << cmd;
43+
cmd_call += tl::combine_path (tl::get_inst_path (), "strmrun");
44+
45+
{
46+
std::string fp (tl::testsrc ());
47+
fp += "/testdata/bd/strmrun.py";
48+
49+
std::string cmd = cmd_call + " " + fp;
50+
tl::info << cmd;
51+
52+
tl::InputPipe pipe (cmd);
53+
tl::InputStream is (pipe);
54+
std::string data = is.read_all ();
55+
tl::info << data;
56+
57+
EXPECT_EQ (data, "Hello, world (0,-42;42,0)!\n");
58+
}
59+
60+
{
61+
std::string fp (tl::testsrc ());
62+
fp += "/testdata/bd/strmrun.drc";
63+
64+
std::string cmd = cmd_call + " " + fp;
65+
tl::info << cmd;
4866

49-
tl::InputPipe pipe (cmd);
50-
tl::InputStream is (pipe);
51-
std::string data = is.read_all ();
52-
tl::info << data;
67+
tl::InputPipe pipe (cmd);
68+
tl::InputStream is (pipe);
69+
std::string data = is.read_all ();
70+
tl::info << data;
71+
72+
EXPECT_EQ (data, "This is DRC.\n");
73+
}
5374

54-
EXPECT_EQ (data, "Hello, world (0,-42;42,0)!\n");
5575
#endif
5676
}
5777

src/buddies/unit_tests/bdStrmxorTests.cc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,52 @@ TEST(1A_Flat)
9797
tl::InputStream stream (output);
9898
db::Reader reader (stream);
9999
reader.read (layout);
100+
101+
EXPECT_EQ (std::string (reader.format ()), "OASIS");
102+
}
103+
104+
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
105+
EXPECT_EQ (cap.captured_text (),
106+
"Layer 10/0 is not present in first layout, but in second\n"
107+
"Result summary (layers without differences are not shown):\n"
108+
"\n"
109+
" Layer Output Differences (shape count)\n"
110+
" ----------------------------------------------------------------\n"
111+
" 3/0 3/0 30\n"
112+
" 6/0 6/0 41\n"
113+
" 8/1 8/1 1\n"
114+
" 10/0 - (no such layer in first layout)\n"
115+
"\n"
116+
);
117+
}
118+
119+
TEST(1A_FlatWithExplicitOutputFormat)
120+
{
121+
tl::CaptureChannel cap;
122+
123+
std::string input_a = tl::testdata ();
124+
input_a += "/bd/strmxor_in1.gds";
125+
126+
std::string input_b = tl::testdata ();
127+
input_b += "/bd/strmxor_in2.gds";
128+
129+
std::string au = tl::testdata ();
130+
au += "/bd/strmxor_au1.oas";
131+
132+
std::string output = this->tmp_file ("tmp.xxx[oas]");
133+
134+
const char *argv[] = { "x", input_a.c_str (), input_b.c_str (), output.c_str () };
135+
136+
EXPECT_EQ (strmxor (sizeof (argv) / sizeof (argv[0]), (char **) argv), 1);
137+
138+
db::Layout layout;
139+
140+
{
141+
tl::InputStream stream (output);
142+
db::Reader reader (stream);
143+
reader.read (layout);
144+
145+
EXPECT_EQ (std::string (reader.format ()), "OASIS");
100146
}
101147

102148
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));

0 commit comments

Comments
 (0)