From 82c221dd580805ce2b3a0676b4a55034e812334b Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 27 Nov 2023 18:20:42 +0100 Subject: [PATCH 01/17] dxfread --- CMakeLists.txt | 1 + libredwg.spec | 2 + programs/Makefile.am | 3 + programs/dxfread.1 | 42 +++++ programs/dxfread.c | 360 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 408 insertions(+) create mode 100644 programs/dxfread.1 create mode 100644 programs/dxfread.c diff --git a/CMakeLists.txt b/CMakeLists.txt index cbf9341494..968181bbe0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,6 +289,7 @@ if(NOT LIBREDWG_LIBONLY) endif(NOT HAVE_GETOPT_H) set(executables_TARGETS dwgread dwg2dxf dwggrep dwglayers dwgbmp dwg2SVG) add_executable(dwgread programs/dwgread.c ${getopt_c}) + add_executable(dxfread programs/dxfread.c ${getopt_c}) add_executable(dwg2dxf programs/dwg2dxf.c ${getopt_c}) if(NOT LIBREDWG_DISABLE_WRITE) add_executable(dwgrewrite programs/dwgrewrite.c ${getopt_c}) diff --git a/libredwg.spec b/libredwg.spec index b950acdae5..537bd391b7 100644 --- a/libredwg.spec +++ b/libredwg.spec @@ -135,6 +135,7 @@ fi %{_bindir}/dwgread %{_bindir}/dwgrewrite %{_bindir}/dwgwrite +%{_bindir}/dxfread %{_bindir}/dxf2dwg %{_bindir}/dxfwrite %{_libdir}/libredwg.so.0 @@ -151,6 +152,7 @@ fi %{_mandir}/man1/dwgread.1.gz %{_mandir}/man1/dwgrewrite.1.gz %{_mandir}/man1/dwgwrite.1.gz +%{_mandir}/man1/dxfread.1.gz %{_mandir}/man1/dxf2dwg.1.gz %{_mandir}/man1/dxfwrite.1.gz %{_mandir}/man5/dwg* diff --git a/programs/Makefile.am b/programs/Makefile.am index 0348f32402..cb53d6c570 100644 --- a/programs/Makefile.am +++ b/programs/Makefile.am @@ -34,6 +34,9 @@ dist_man1_MANS += $(srcdir)/dwgbmp.1 $(srcdir)/dwg2dxf.1 \ endif if !DISABLE_DXF +dxfread_SOURCES = dxfread.c +bin_PROGRAMS += dxfread +dist_man1_MANS += $(srcdir)/dxfread.1 if HAVE_LIBPS bin_PROGRAMS += dwg2ps dist_man1_MANS += $(srcdir)/dwg2ps.1 diff --git a/programs/dxfread.1 b/programs/dxfread.1 new file mode 100644 index 0000000000..67cc545344 --- /dev/null +++ b/programs/dxfread.1 @@ -0,0 +1,42 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. +.TH DXFREAD "1" "November 2023" "dxfread 0.13.0" "User Commands" +.SH NAME +dxfread \- manual page for dxfread 0.13.0 +.SH SYNOPSIS +.B dxfread +[\fI\,OPTION\/\fR]... \fI\,DXFFILE\/\fR +.SH DESCRIPTION +Reads the DWG into some optional output format to stdout or some file, +and prints error, success or verbose internal progress to stderr. +.TP +\fB\-v[0\-9]\fR, \fB\-\-verbose\fR [0\-9] +verbosity +.TP +\fB\-O\fR fmt, \fB\-\-format\fR fmt +fmt: DXF, DXFB, JSON, GeoJSON +.TP +Planned output formats: +YAML, XML/OGR, GPX, SVG, PS +.TP +\fB\-o\fR outfile +also defines the output fmt. Default: stdout +.TP +\fB\-\-help\fR +display this help and exit +.TP +\fB\-\-version\fR +output version information and exit +.PP +GNU LibreDWG online manual: +.SH "SEE ALSO" +The full documentation for +.B dxfread +is maintained as a Texinfo manual. If the +.B info +and +.B dxfread +programs are properly installed at your site, the command +.IP +.B info LibreDWG +.PP +should give you access to the complete manual. diff --git a/programs/dxfread.c b/programs/dxfread.c new file mode 100644 index 0000000000..4d20916c7a --- /dev/null +++ b/programs/dxfread.c @@ -0,0 +1,360 @@ +/*****************************************************************************/ +/* LibreDWG - free implementation of the DWG file format */ +/* */ +/* Copyright (C) 2009-2023 Free Software Foundation, Inc. */ +/* Copyright (C) 2010 Thien-Thi Nguyen */ +/* */ +/* This library is free software, licensed under the terms of the GNU */ +/* General Public License as published by the Free Software Foundation, */ +/* either version 3 of the License, or (at your option) any later version. */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/*****************************************************************************/ + +/* + * dxfread.c: read a DXF file, print verbose logging, and output to + * various formats. + * written by Felipe Castro + * modified by Felipe CorrĂȘa da Silva Sances + * modified by Rodrigo Rodrigues da Silva + * modified by Thien-Thi Nguyen + * modified by Reini Urban + */ + +#include "../src/config.h" +#include +#include +#include +// strings.h or string.h +#ifdef AX_STRCASECMP_HEADER +# include AX_STRCASECMP_HEADER +#endif +#include "my_getopt.h" +#ifdef HAVE_VALGRIND_VALGRIND_H +# include +#endif + +#include "dwg.h" +#include "common.h" +#include "bits.h" +#ifndef DISABLE_DXF +# include "out_dxf.h" +# ifndef DISABLE_JSON +# include "out_json.h" +# endif +#endif + +#if !defined HAVE_STRCASECMP +int strcasecmp (const char *a, const char *b); +#endif + +static int opts = 1; + +static int +usage (void) +{ +#ifndef DISABLE_DXF + printf ("\nUsage: dxfread [-v[0-9]] [-O FMT] [-o OUTFILE] [DXFFILE|-]\n"); +#else + printf ("\nUsage: dxfread [-v[0-9]] [DXFFILE|-]\n"); +#endif + return 1; +} +static int +opt_version (void) +{ + printf ("dxfread %s\n", PACKAGE_VERSION); + return 0; +} +static int +help (void) +{ + printf ("\nUsage: dxfread [OPTION]... DWGFILE\n"); + printf ("Reads the DXF into some optional output format to stdout or some " + "file,\n" + "and prints error, success or verbose internal progress to stderr.\n" + "\n"); +#ifdef HAVE_GETOPT_LONG + printf (" -v[0-9], --verbose [0-9] verbosity\n"); +# ifndef DISABLE_DXF +# ifndef DISABLE_JSON + printf (" -O fmt, --format fmt fmt: DXF, DXFB, JSON, GeoJSON\n"); +# else + printf (" -O fmt, --format fmt fmt: DXF, DXFB\n"); +# endif + printf (" Planned output formats: YAML, XML/OGR, GPX, SVG, PS\n"); + printf (" -o outfile also defines the output fmt. Default: " + "stdout\n"); +# endif + printf (" --help display this help and exit\n"); + printf (" --version output version information and exit\n" + "\n"); +#else + printf (" -v[0-9] verbosity\n"); +# ifndef DISABLE_DXF +# ifndef DISABLE_JSON + printf (" -O fmt fmt: DXF, DXFB, JSON, GeoJSON\n"); +# else + printf (" -O fmt fmt: DXF, DXFB\n"); +# endif + printf ( + " Planned output formats: YAML, XML/OGR, GPX, SVG, PS\n"); + printf (" -o outfile also defines the output fmt. Default: stdout\n"); +# endif + printf (" -h display this help and exit\n"); + printf (" -i output version information and exit\n" + "\n"); +#endif + printf ("GNU LibreDWG online manual: " + "\n"); + return 0; +} + +int +main (int argc, char *argv[]) +{ + int i = 1; + int error; + Dwg_Data dwg; + const char *fmt = NULL; + const char *outfile = NULL; + int has_v = 0; + int force_free = 0; + int c; +#ifdef HAVE_GETOPT_LONG + int option_index = 0; + static struct option long_options[] + = { { "verbose", 1, &opts, 1 }, // optional + { "format", 1, NULL, 'O' }, { "file", 1, NULL, 'o' }, + { "help", 0, NULL, 0 }, { "version", 0, NULL, 0 }, + { "force-free", 0, NULL, 0 }, { NULL, 0, NULL, 0 } }; +#endif + + if (argc < 2) + return usage (); + + while (1) + { +#ifdef HAVE_GETOPT_LONG + c = getopt_long (argc, argv, "v::O:o:h", long_options, &option_index); +#else + c = getopt (argc, argv, "v::O:o:hi"); +#endif + if (c == -1) + break; + switch (c) + { + case ':': // missing arg + if (optarg && !strcmp (optarg, "v")) + { + opts = 1; + has_v = 1; + break; + } + fprintf (stderr, "%s: option '-%c' requires an argument\n", argv[0], + optopt); + break; +#ifdef HAVE_GETOPT_LONG + case 0: + /* This option sets a flag */ + if (!strcmp (long_options[option_index].name, "verbose")) + { + if (opts < 0 || opts > 9) + return usage (); +# if defined(USE_TRACING) && defined(HAVE_SETENV) + { + char v[2]; + *v = opts + '0'; + *(v + 1) = 0; + setenv ("LIBREDWG_TRACE", v, 1); + } +# endif + has_v = 1; + break; + } + if (!strcmp (long_options[option_index].name, "version")) + return opt_version (); + if (!strcmp (long_options[option_index].name, "help")) + return help (); + if (!strcmp (long_options[option_index].name, "force-free")) + force_free = 1; + break; +#else + case 'i': + return opt_version (); +#endif + case 'O': + fmt = strdup (optarg); + break; + case 'o': + outfile = strdup (optarg); + if (!fmt && outfile != NULL) + { +#ifndef DISABLE_DXF + if (strstr (outfile, ".dxf") || strstr (outfile, ".DXF")) + fmt = strdup ("dxf"); + else if (strstr (outfile, ".dxfb") || strstr (outfile, ".DXFB")) + fmt = strdup ("dxfb"); + else +#endif +#ifndef DISABLE_JSON + if (strstr (outfile, ".json") || strstr (outfile, ".JSON")) + fmt = strdup ("json"); + else if (strstr (outfile, ".geojson") + || strstr (outfile, ".GeoJSON")) + fmt = strdup ("geojson"); + else +#endif + fprintf (stderr, "Unknown output format for %s\n", outfile); + } + break; + case 'v': // support -v3 and -v + i = (optind > 0 && optind < argc) ? optind - 1 : 1; + if (!memcmp (argv[i], "-v", 2)) + { + opts = argv[i][2] ? argv[i][2] - '0' : 1; + } + if (opts < 0 || opts > 9) + return usage (); +#if defined(USE_TRACING) && defined(HAVE_SETENV) + { + char v[2]; + *v = opts + '0'; + *(v + 1) = 0; + setenv ("LIBREDWG_TRACE", v, 1); + } +#endif + has_v = 1; + break; + case 'h': + return help (); + case '?': + fprintf (stderr, "%s: invalid option '-%c' ignored\n", argv[0], + optopt); + break; + default: + return usage (); + } + } + i = optind; + + memset (&dwg, 0, sizeof (Dwg_Data)); + if (has_v || !fmt) + dwg.opts = opts; +#if defined(USE_TRACING) && defined(HAVE_SETENV) + if (!has_v) + setenv ("LIBREDWG_TRACE", "1", 0); +#endif + + if (optind != argc) + { + if (opts > 1) + fprintf (stderr, "Reading DXF file %s\n", argv[i]); + error = dxf_read_file (argv[i], &dwg); + } + else + { + if (opts > 1) + fprintf (stderr, "Reading DXF from stdin\n"); + error = dxf_read_file ("-", &dwg); // i.e. from stdin + } + + if (error >= DWG_ERR_CRITICAL) + goto done; + + if (fmt) + { + Bit_Chain dat = { 0 }; + if (outfile) + dat.fh = fopen (outfile, "w"); + else + dat.fh = stdout; + fprintf (stderr, "\n"); + dat.version = dat.from_version = dwg.header.version; + dat.codepage = dwg.header.codepage; + // TODO --as-rNNNN version? for now not. + // we want the native dump, converters are separate. +#ifndef DISABLE_DXF +# ifndef DISABLE_JSON + if (!strcasecmp (fmt, "json")) + { + if (opts > 1 && outfile) + fprintf (stderr, "Writing JSON file %s\n", outfile); + error = dwg_write_json (&dat, &dwg); + } + else +# endif + if (!strcasecmp (fmt, "dxfb")) + { + if (opts > 1 && outfile) + fprintf (stderr, "Writing Binary DXF file %s\n", outfile); + error = dwg_write_dxfb (&dat, &dwg); + } + else if (!strcasecmp (fmt, "dxf")) + { + if (opts > 1 && outfile) + fprintf (stderr, "Writing Binary DXF file %s\n", outfile); + error = dwg_write_dxf (&dat, &dwg); + } +# ifndef DISABLE_JSON + else if (!strcasecmp (fmt, "geojson")) + { + if (opts > 1 && outfile) + fprintf (stderr, "Writing GeoJSON file %s\n", outfile); + error = dwg_write_geojson (&dat, &dwg); + } + else +# endif +#endif + fprintf (stderr, "Invalid output format '%s'\n", fmt); + + if (outfile) + fclose (dat.fh); + } + +done: +#if defined __SANITIZE_ADDRESS__ || __has_feature(address_sanitizer) + { + char *asanenv = getenv ("ASAN_OPTIONS"); + if (!asanenv) + force_free = 1; + // detect_leaks is enabled by default. see if it's turned off + else if (strstr (asanenv, "detect_leaks=0") == NULL) /* not found */ + force_free = 1; + } +#endif + + // forget about valgrind. really huge DWG's need endlessly here. + if ((dwg.header.version && dwg.num_objects < 1000) || force_free +#ifdef HAVE_VALGRIND_VALGRIND_H + || (RUNNING_ON_VALGRIND) +#endif + ) + { + if (fmt) + free ((char *)fmt); + if (outfile) + free ((char *)outfile); + dwg_free (&dwg); + } + + if (error >= DWG_ERR_CRITICAL) + { + fprintf (stderr, "ERROR 0x%x\n", error); + if (error && opts > 2) + dwg_errstrings (error); + } + else + { + if (opts > 1) + { + fprintf (stderr, "SUCCESS 0x%x\n", error); + if (error && opts > 2) + dwg_errstrings (error); + } + else + fprintf (stderr, "SUCCESS\n"); + } + + return error >= DWG_ERR_CRITICAL ? 1 : 0; +} From b63f02ce2ea9eb1131909ce5029718d9356909a7 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 09:17:28 +0100 Subject: [PATCH 02/17] small correction in dxfread help --- programs/dxfread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/dxfread.c b/programs/dxfread.c index 4d20916c7a..12c7276281 100644 --- a/programs/dxfread.c +++ b/programs/dxfread.c @@ -69,7 +69,7 @@ opt_version (void) static int help (void) { - printf ("\nUsage: dxfread [OPTION]... DWGFILE\n"); + printf ("\nUsage: dxfread [OPTION]... DXFFILE\n"); printf ("Reads the DXF into some optional output format to stdout or some " "file,\n" "and prints error, success or verbose internal progress to stderr.\n" From e42c363306c808243c0f764ea6ff878cc43f0352 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 10:01:51 +0100 Subject: [PATCH 03/17] fix DISABLE_DXF test --- programs/dxfread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/programs/dxfread.c b/programs/dxfread.c index 12c7276281..c68a84f1c9 100644 --- a/programs/dxfread.c +++ b/programs/dxfread.c @@ -246,6 +246,7 @@ main (int argc, char *argv[]) setenv ("LIBREDWG_TRACE", "1", 0); #endif +#ifndef DISABLE_DXF if (optind != argc) { if (opts > 1) @@ -258,6 +259,7 @@ main (int argc, char *argv[]) fprintf (stderr, "Reading DXF from stdin\n"); error = dxf_read_file ("-", &dwg); // i.e. from stdin } +#endif if (error >= DWG_ERR_CRITICAL) goto done; From d32e32c23de24fbd13c77aa0f7e14d3910f750ee Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 10:24:04 +0100 Subject: [PATCH 04/17] fix --disable-write test --- src/dwg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dwg.c b/src/dwg.c index 8aec6b2236..1324df56d4 100644 --- a/src/dwg.c +++ b/src/dwg.c @@ -284,7 +284,7 @@ dwg_read_file (const char *restrict filename, Dwg_Data *restrict dwg) return error; } -#if !defined(DISABLE_DXF) && defined(USE_WRITE) +#if !defined(DISABLE_DXF) /** dxf_read_file * returns 0 on success. * From 558ccd1423c7667e42fff3094aea9c641d6010b3 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 11:02:39 +0100 Subject: [PATCH 05/17] fix --disable-write test --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 968181bbe0..561dad9790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,7 +236,6 @@ endif() if(NOT LIBREDWG_DISABLE_WRITE) set(write_SOURCES src/encode.c - src/in_dxf.c ${injson_SOURCES} src/reedsolomon.c) endif() @@ -257,6 +256,7 @@ set(libredwg_SOURCES src/dxfclasses.c src/free.c src/geom.c + src/in_dxf.c src/out_dxf.c ${outjson_SOURCES} src/out_dxfb.c @@ -289,7 +289,10 @@ if(NOT LIBREDWG_LIBONLY) endif(NOT HAVE_GETOPT_H) set(executables_TARGETS dwgread dwg2dxf dwggrep dwglayers dwgbmp dwg2SVG) add_executable(dwgread programs/dwgread.c ${getopt_c}) - add_executable(dxfread programs/dxfread.c ${getopt_c}) + if(NOT LIBREDWG_DISABLE_WRITE) + add_executable(dxfread programs/dxfread.c ${getopt_c}) + set(executables_TARGETS ${executables_TARGETS} dxfread) + endif add_executable(dwg2dxf programs/dwg2dxf.c ${getopt_c}) if(NOT LIBREDWG_DISABLE_WRITE) add_executable(dwgrewrite programs/dwgrewrite.c ${getopt_c}) From fa662d41f5283501a91a92f5f72a3fc639a16c17 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 11:09:51 +0100 Subject: [PATCH 06/17] fix LIBREDWG_DISABLE_WRITE related source inclusion --- CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 561dad9790..b709ab28d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,10 +233,19 @@ if(NOT LIBREDWG_DISABLE_JSON) src/in_json.c) endif() +if(NOT LIBREDWG_DISABLE_DXF) + set(outdxf_SOURCES + src/out_dxf.c + src/out_dxfb.c) + set(indxf_SOURCES + src/in_dxf.c) +endif() + if(NOT LIBREDWG_DISABLE_WRITE) set(write_SOURCES src/encode.c - ${injson_SOURCES} + ${outjson_SOURCES} + ${outdxf_SOURCES} src/reedsolomon.c) endif() @@ -256,10 +265,8 @@ set(libredwg_SOURCES src/dxfclasses.c src/free.c src/geom.c - src/in_dxf.c - src/out_dxf.c - ${outjson_SOURCES} - src/out_dxfb.c + ${indxf_SOURCES} + ${injson_SOURCES} ${write_SOURCES} src/print.c) From a8b45af93cfcbdf400719caf41c97e759f5223b5 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 11:32:38 +0100 Subject: [PATCH 07/17] fix LIBREDWG_DISABLE_WRITE/DXF related source inclusion --- CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b709ab28d6..265eb516a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,18 +294,21 @@ if(NOT LIBREDWG_LIBONLY) if(NOT HAVE_GETOPT_H) set(getopt_c programs/getopt.c) endif(NOT HAVE_GETOPT_H) - set(executables_TARGETS dwgread dwg2dxf dwggrep dwglayers dwgbmp dwg2SVG) + set(executables_TARGETS dwgread dwggrep dwglayers dwgbmp dwg2SVG) add_executable(dwgread programs/dwgread.c ${getopt_c}) - if(NOT LIBREDWG_DISABLE_WRITE) + if(NOT LIBREDWG_DISABLE_DXF) add_executable(dxfread programs/dxfread.c ${getopt_c}) set(executables_TARGETS ${executables_TARGETS} dxfread) - endif - add_executable(dwg2dxf programs/dwg2dxf.c ${getopt_c}) + if(NOT LIBREDWG_DISABLE_WRITE) + add_executable(dwg2dxf programs/dwg2dxf.c ${getopt_c}) + add_executable(dxf2dwg programs/dxf2dwg.c ${getopt_c}) + set(executables_TARGETS ${executables_TARGETS} dxf2dwg dwg2dxf) + endif(NOT LIBREDWG_DISABLE_WRITE) + endif(NOT LIBREDWG_DISABLE_DXF) if(NOT LIBREDWG_DISABLE_WRITE) add_executable(dwgrewrite programs/dwgrewrite.c ${getopt_c}) add_executable(dwgwrite programs/dwgwrite.c ${getopt_c}) - add_executable(dxf2dwg programs/dxf2dwg.c ${getopt_c}) - set(executables_TARGETS ${executables_TARGETS} dwgrewrite dwgwrite dxf2dwg) + set(executables_TARGETS ${executables_TARGETS} dwgrewrite dwgwrite) endif(NOT LIBREDWG_DISABLE_WRITE) add_executable(dwggrep programs/dwggrep.c ${getopt_c}) add_executable(dwglayers programs/dwglayers.c ${getopt_c}) From ad372ed94ec95cdcad598fce127e2e93c179a29a Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 11:45:23 +0100 Subject: [PATCH 08/17] fix LIBREDWG_DISABLE_WRITE/DXF related source inclusion --- src/Makefile.am | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3f308e355b..3cc3be7391 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,10 +49,7 @@ libredwg_la_SOURCES = \ $(EXTRA_HEADERS) if !DISABLE_DXF libredwg_la_SOURCES += \ - out_dxf.c \ - out_dxfb.c -# out_xml.c \ -# out_yaml.c + in_dxf.c if !DISABLE_JSON libredwg_la_SOURCES += \ out_json.c \ @@ -68,7 +65,10 @@ libredwg_la_SOURCES += \ # in_yaml.c if !DISABLE_DXF libredwg_la_SOURCES += \ - in_dxf.c + out_dxf.c \ + out_dxfb.c \ +# out_xml.c \ +# out_yaml.c endif if !DISABLE_JSON libredwg_la_SOURCES += \ From 4595e91c5cab90863a008abc54f6b1a49c41ab95 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 11:56:49 +0100 Subject: [PATCH 09/17] fix LIBREDWG_DISABLE_WRITE/DXF related source inclusion --- src/Makefile.am | 163 ++++++++++++++++++++++++------------------------ 1 file changed, 83 insertions(+), 80 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3cc3be7391..3a59afe2e9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,54 +30,54 @@ endif CPPCHECK = @CPPCHECK@ libredwg_la_SOURCES = \ - dwg.c \ - common.c \ - codepages.c \ - bits.c \ - decode.c \ + dwg.c \ + common.c \ + codepages.c \ + bits.c \ + decode.c \ decode_r11.c \ decode_r2007.c \ - reedsolomon.c \ + reedsolomon.c \ print.c \ free.c \ hash.c \ - dynapi.c \ - classes.c \ - dwg_api.c \ - objects.c \ - geom.c \ - $(EXTRA_HEADERS) + dynapi.c \ + classes.c \ + dwg_api.c \ + objects.c \ + geom.c \ + $(EXTRA_HEADERS) if !DISABLE_DXF libredwg_la_SOURCES += \ - in_dxf.c + in_dxf.c if !DISABLE_JSON libredwg_la_SOURCES += \ - out_json.c \ - out_geojson.c + in_json.c endif endif if USE_WRITE libredwg_la_SOURCES += \ - encode.c \ - dxfclasses.c + encode.c \ + dxfclasses.c # encode_r2007.c # in_xml.c # in_yaml.c if !DISABLE_DXF libredwg_la_SOURCES += \ - out_dxf.c \ - out_dxfb.c \ -# out_xml.c \ + out_dxf.c \ + out_dxfb.c +# out_xml.c # out_yaml.c endif if !DISABLE_JSON libredwg_la_SOURCES += \ - in_json.c + out_json.c \ + out_geojson.c endif endif EXTRA_HEADERS = \ - dwg.spec \ + dwg.spec \ header_variables.spec \ header_variables_r11.spec \ header_variables_dxf.spec \ @@ -87,7 +87,7 @@ EXTRA_HEADERS = \ header.spec \ auxheader.spec \ 2ndheader.spec \ - r2004_file_header.spec \ + r2004_file_header.spec \ summaryinfo.spec \ acds.spec \ appinfo.spec \ @@ -97,108 +97,111 @@ EXTRA_HEADERS = \ template.spec \ objfreespace.spec \ revhistory.spec \ - classes.inc \ - objects.inc \ - spec.h \ - common.h \ - importer.h \ - classes.h \ - codepages.h \ - bits.h \ - myalloca.h \ - decode.h \ - decode_r11.h \ - dec_macros.h \ - free.h \ + classes.inc \ + objects.inc \ + spec.h \ + common.h \ + importer.h \ + classes.h \ + codepages.h \ + bits.h \ + myalloca.h \ + decode.h \ + decode_r11.h \ + dec_macros.h \ + free.h \ print.h \ - logging.h \ - reedsolomon.h \ + logging.h \ + reedsolomon.h \ hash.h \ - dynapi.h \ - out_json.h \ - geom.h + dynapi.h \ + geom.h +if !DISABLE_json +EXTRA_HEADERS += \ + in_json.h +# in_xml.h +# in_yaml.h +endif if !DISABLE_DXF EXTRA_HEADERS += \ - out_dxf.h -# out_xml.h -# out_yaml.h + in_dxf.h endif if USE_WRITE EXTRA_HEADERS += \ - encode.h + encode.h if !DISABLE_DXF EXTRA_HEADERS += \ - in_dxf.h -# in_xml.h -# in_yaml.h + out_dxf.h +# out_xml.h +# out_yaml.h if !DISABLE_JSON EXTRA_HEADERS += \ - in_json.h + out_json.h endif endif endif EXTRA_DIST = \ - $(include_HEADERS) \ - $(EXTRA_HEADERS) \ - gen-dynapi.pl \ - dxfclasses.in \ - objects.in + $(include_HEADERS) \ + $(EXTRA_HEADERS) \ + gen-dynapi.pl \ + dxfclasses.in \ + objects.in # maintainer only: $(srcdir)/dynapi.c: $(srcdir)/gen-dynapi.pl $(top_srcdir)/include/dwg.h - echo make regen-dynapi might be needed + echo make regen-dynapi might be needed if HAVE_GPERF $(srcdir)/dxfclasses.c: $(srcdir)/dxfclasses.in - -cd $(abs_top_srcdir) && \ - $(GPERF) --output-file src/dxfclasses.tmp.c src/dxfclasses.in && \ - sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ - -e's,unsigned int len,size_t len,;' -e 's,register ,,g' src/dxfclasses.c && \ - rm -f src/dxfclasses.tmp.c + -cd $(abs_top_srcdir) && \ + $(GPERF) --output-file src/dxfclasses.tmp.c src/dxfclasses.in && \ + sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ + -e's,unsigned int len,size_t len,;' -e 's,register ,,g' src/dxfclasses.c && \ + rm -f src/dxfclasses.tmp.c $(srcdir)/objects.c: $(srcdir)/objects.in - -cd $(abs_top_srcdir) && \ - $(GPERF) --output-file src/objects.tmp.c src/objects.in && \ - sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ + -cd $(abs_top_srcdir) && \ + $(GPERF) --output-file src/objects.tmp.c src/objects.in && \ + sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ -e's,unsigned int len,size_t len,; s,register ,,g' src/objects.c && \ - rm -f src/objects.tmp.c + rm -f src/objects.tmp.c endif .c.i: - $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(COMPILE) -E -o $@ $< + $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(COMPILE) -E -o $@ $< .c.ii: # no linemarkers - $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(COMPILE) -E -P -o $@ $< + $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(COMPILE) -E -P -o $@ $< .c.ic: # replace the original .c with the expanded version. - $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(COMPILE) -E -P -o $@ $< - $(CLANG_FORMAT) -i $@ - $(am__mv) $< $<.orig - $(am__mv) $@ $< + $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(COMPILE) -E -P -o $@ $< + $(CLANG_FORMAT) -i $@ + $(am__mv) $< $<.orig + $(am__mv) $@ $< cppcheck: if HAVE_CPPCHECK - $(CPPCHECK) -j4 --inline-suppr -I$(top_srcdir)/include -I. $(srcdir)/*.c + $(CPPCHECK) -j4 --inline-suppr -I$(top_srcdir)/include -I. $(srcdir)/*.c endif clang-tidy: ../compile_commands.json - $(CLANG_TIDY) --checks='-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' $(srcdir)/*.c + $(CLANG_TIDY) --checks='-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' $(srcdir)/*.c # emacs flymake-mode check-syntax: - test -n "$(CHK_SOURCES)" && \ - nice $(COMPILE) -O0 -o /dev/null -S $(CHK_SOURCES) + test -n "$(CHK_SOURCES)" && \ + nice $(COMPILE) -O0 -o /dev/null -S $(CHK_SOURCES) .PHONY: check-syntax cppcheck clang-tidy if ENABLE_GCOV AM_CFLAGS += @GCOV_CFLAGS@ LIBS += @GCOV_LIBS@ gcov: - -test -f $(builddir)/gcov.log && rm $(builddir)/gcov.log - $(GCOV) -lp *.gcno | tee -a $(builddir)/gcov.log + -test -f $(builddir)/gcov.log && rm $(builddir)/gcov.log + $(GCOV) -lp *.gcno | tee -a $(builddir)/gcov.log endif MAINTAINERCLEANFILES = *~ *.i *_flymake.[ch] if ENABLE_GCOV From 3fd39d5f5afeee489c9916af6e0c0f26071287a9 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 12:00:31 +0100 Subject: [PATCH 10/17] fix LIBREDWG_DISABLE_WRITE/DXF related source inclusion --- src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3a59afe2e9..2dec7b3cbe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -116,7 +116,7 @@ EXTRA_HEADERS = \ hash.h \ dynapi.h \ geom.h -if !DISABLE_json +if !DISABLE_JSON EXTRA_HEADERS += \ in_json.h # in_xml.h @@ -163,7 +163,7 @@ $(srcdir)/objects.c: $(srcdir)/objects.in -cd $(abs_top_srcdir) && \ $(GPERF) --output-file src/objects.tmp.c src/objects.in && \ sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ - -e's,unsigned int len,size_t len,; s,register ,,g' src/objects.c && \ + -e's,unsigned int len,size_t len,; s,register ,,g' src/objects.c && \ rm -f src/objects.tmp.c endif From cd56650f1767952ff2b60449ae6af5928e883259 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 12:28:35 +0100 Subject: [PATCH 11/17] fix LIBREDWG_DISABLE_WRITE/DXF related source inclusion --- src/Makefile.am | 54 ++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 2dec7b3cbe..13b9588612 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -150,58 +150,58 @@ EXTRA_DIST = \ # maintainer only: $(srcdir)/dynapi.c: $(srcdir)/gen-dynapi.pl $(top_srcdir)/include/dwg.h - echo make regen-dynapi might be needed + echo make regen-dynapi might be needed if HAVE_GPERF $(srcdir)/dxfclasses.c: $(srcdir)/dxfclasses.in - -cd $(abs_top_srcdir) && \ - $(GPERF) --output-file src/dxfclasses.tmp.c src/dxfclasses.in && \ - sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ - -e's,unsigned int len,size_t len,;' -e 's,register ,,g' src/dxfclasses.c && \ - rm -f src/dxfclasses.tmp.c + -cd $(abs_top_srcdir) && \ + $(GPERF) --output-file src/dxfclasses.tmp.c src/dxfclasses.in && \ + sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ + -e's,unsigned int len,size_t len,;' -e 's,register ,,g' src/dxfclasses.c && \ + rm -f src/dxfclasses.tmp.c $(srcdir)/objects.c: $(srcdir)/objects.in - -cd $(abs_top_srcdir) && \ - $(GPERF) --output-file src/objects.tmp.c src/objects.in && \ - sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ - -e's,unsigned int len,size_t len,; s,register ,,g' src/objects.c && \ - rm -f src/objects.tmp.c + -cd $(abs_top_srcdir) && \ + $(GPERF) --output-file src/objects.tmp.c src/objects.in && \ + sed -e's,unsigned int hval = len;,unsigned int hval = len \& UINT_MAX;,' \ + -e's,unsigned int len,size_t len,; s,register ,,g' src/objects.c && \ + rm -f src/objects.tmp.c endif .c.i: - $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(COMPILE) -E -o $@ $< + $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(COMPILE) -E -o $@ $< .c.ii: # no linemarkers - $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(COMPILE) -E -P -o $@ $< + $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(COMPILE) -E -P -o $@ $< .c.ic: # replace the original .c with the expanded version. - $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(COMPILE) -E -P -o $@ $< - $(CLANG_FORMAT) -i $@ - $(am__mv) $< $<.orig - $(am__mv) $@ $< + $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(COMPILE) -E -P -o $@ $< + $(CLANG_FORMAT) -i $@ + $(am__mv) $< $<.orig + $(am__mv) $@ $< cppcheck: if HAVE_CPPCHECK - $(CPPCHECK) -j4 --inline-suppr -I$(top_srcdir)/include -I. $(srcdir)/*.c + $(CPPCHECK) -j4 --inline-suppr -I$(top_srcdir)/include -I. $(srcdir)/*.c endif clang-tidy: ../compile_commands.json - $(CLANG_TIDY) --checks='-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' $(srcdir)/*.c + $(CLANG_TIDY) --checks='-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' $(srcdir)/*.c # emacs flymake-mode check-syntax: - test -n "$(CHK_SOURCES)" && \ - nice $(COMPILE) -O0 -o /dev/null -S $(CHK_SOURCES) + test -n "$(CHK_SOURCES)" && \ + nice $(COMPILE) -O0 -o /dev/null -S $(CHK_SOURCES) .PHONY: check-syntax cppcheck clang-tidy if ENABLE_GCOV AM_CFLAGS += @GCOV_CFLAGS@ LIBS += @GCOV_LIBS@ gcov: - -test -f $(builddir)/gcov.log && rm $(builddir)/gcov.log - $(GCOV) -lp *.gcno | tee -a $(builddir)/gcov.log + -test -f $(builddir)/gcov.log && rm $(builddir)/gcov.log + $(GCOV) -lp *.gcno | tee -a $(builddir)/gcov.log endif MAINTAINERCLEANFILES = *~ *.i *_flymake.[ch] if ENABLE_GCOV From e46714e883f599cb172c4794f383c4e66b3f3a1b Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 12:59:26 +0100 Subject: [PATCH 12/17] fix LIBREDWG_DISABLE_WRITE/DXF related source inclusion --- programs/Makefile.am | 48 ++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/programs/Makefile.am b/programs/Makefile.am index cb53d6c570..a028402b00 100644 --- a/programs/Makefile.am +++ b/programs/Makefile.am @@ -22,48 +22,40 @@ AM_CFLAGS = -I. -I$(top_srcdir)/include -I$(top_srcdir)/src $(WARN_CFLAGS) LDADD = $(top_builddir)/src/libredwg.la CPPCHECK = @CPPCHECK@ -bin_PROGRAMS = dwgread +bin_PROGRAMS += dwglayers dwggrep noinst_PROGRAMS = -dist_man1_MANS = $(srcdir)/dwgread.1 -if !DISABLE_DXF -bin_PROGRAMS += dwgbmp dwg2dxf dwg2SVG dwglayers dwggrep dist_bin_SCRIPTS = dwgfilter -dist_man1_MANS += $(srcdir)/dwgbmp.1 $(srcdir)/dwg2dxf.1 \ - $(srcdir)/dwg2SVG.1 $(srcdir)/dwglayers.1 \ +dist_man1_MANS += $(srcdir)/dwglayers.1 \ $(srcdir)/dwggrep.1 $(srcdir)/dwgfilter.1 -endif -if !DISABLE_DXF -dxfread_SOURCES = dxfread.c -bin_PROGRAMS += dxfread -dist_man1_MANS += $(srcdir)/dxfread.1 -if HAVE_LIBPS -bin_PROGRAMS += dwg2ps -dist_man1_MANS += $(srcdir)/dwg2ps.1 -dwg2ps_SOURCES = dwg2ps.c -dwg2ps_LDADD = $(LDADD) -lps -endif -endif - -dwgread_SOURCES = dwgread.c -dwgbmp_SOURCES = dwgbmp.c -dwg2dxf_SOURCES = dwg2dxf.c dwglayers_SOURCES = dwglayers.c -dwg2SVG_SOURCES = dwg2SVG.c escape.c dwggrep_SOURCES = dwggrep.c dwggrep_CFLAGS = $(AM_CFLAGS) $(CFLAGS) $(PCRE2_CFLAGS) dwggrep_LDADD = $(LDADD) $(PCRE2_LIBS) if USE_WRITE -bin_PROGRAMS += dwgrewrite -dist_man1_MANS += $(srcdir)/dwgrewrite.1 +bin_PROGRAMS += dwgread dwgrewrite dwgwrite dwgbmp dwg2SVG +dist_man1_MANS += $(srcdir)/dwgread.1 $(srcdir)/dwgrewrite.1 \ + $(srcdir)/dwgwrite.1 $(srcdir)/dwgbmp.1 $(srcdir)/dwg2SVG.1 dwgrewrite_SOURCES = dwgrewrite.c +dwgwrite_SOURCES = dwgwrite.c +dwgread_SOURCES = dwgread.c +dwgbmp_SOURCES = dwgbmp.c +dwg2SVG_SOURCES = dwg2SVG.c escape.c if !DISABLE_DXF -bin_PROGRAMS += dxf2dwg dwgwrite dxfwrite -dist_man1_MANS += $(srcdir)/dxf2dwg.1 $(srcdir)/dwgwrite.1 $(srcdir)/dxfwrite.1 +bin_PROGRAMS += dxf2dwg dwg2dxf dxfwrite dxfread +dist_man1_MANS += $(srcdir)/dxf2dwg.1 $(srcdir)/dwg2dxf.1 \ + $(srcdir)/dxfwrite.1 $(srcdir)/dxfread.1 dxf2dwg_SOURCES = dxf2dwg.c -dwgwrite_SOURCES = dwgwrite.c +dxfread_SOURCES = dxfread.c dxfwrite_SOURCES = dxfwrite.c +dwg2dxf_SOURCES = dwg2dxf.c +endif +if HAVE_LIBPS +bin_PROGRAMS += dwg2ps +dist_man1_MANS += $(srcdir)/dwg2ps.1 +dwg2ps_SOURCES = dwg2ps.c +dwg2ps_LDADD = $(LDADD) -lps endif endif From 9a163d3791dc4d7962bfc141702859609d3929de Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 3 Dec 2023 13:03:13 +0100 Subject: [PATCH 13/17] fix LIBREDWG_DISABLE_WRITE/DXF related source inclusion --- programs/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/programs/Makefile.am b/programs/Makefile.am index a028402b00..0122b7d7e9 100644 --- a/programs/Makefile.am +++ b/programs/Makefile.am @@ -22,10 +22,10 @@ AM_CFLAGS = -I. -I$(top_srcdir)/include -I$(top_srcdir)/src $(WARN_CFLAGS) LDADD = $(top_builddir)/src/libredwg.la CPPCHECK = @CPPCHECK@ -bin_PROGRAMS += dwglayers dwggrep -noinst_PROGRAMS = -dist_bin_SCRIPTS = dwgfilter -dist_man1_MANS += $(srcdir)/dwglayers.1 \ +bin_PROGRAMS = dwglayers dwggrep +noinst_PROGRAMS = +dist_bin_SCRIPTS = dwgfilter +dist_man1_MANS = $(srcdir)/dwglayers.1 \ $(srcdir)/dwggrep.1 $(srcdir)/dwgfilter.1 dwglayers_SOURCES = dwglayers.c From 8fd1f8238961d8927dfe357577cbbe79e8844951 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 6 Dec 2023 21:02:37 +0100 Subject: [PATCH 14/17] fix manual --- programs/dxfread.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/dxfread.1 b/programs/dxfread.1 index 67cc545344..364adf0ee1 100644 --- a/programs/dxfread.1 +++ b/programs/dxfread.1 @@ -6,7 +6,7 @@ dxfread \- manual page for dxfread 0.13.0 .B dxfread [\fI\,OPTION\/\fR]... \fI\,DXFFILE\/\fR .SH DESCRIPTION -Reads the DWG into some optional output format to stdout or some file, +Reads the DXF into some optional output format to stdout or some file, and prints error, success or verbose internal progress to stderr. .TP \fB\-v[0\-9]\fR, \fB\-\-verbose\fR [0\-9] From 64c0f425eab69d3950baac88430d60b4f58d31ef Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 7 Dec 2023 07:39:32 +0100 Subject: [PATCH 15/17] fix in_dxf dependency on encode --- src/Makefile.am | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 13b9588612..0be58c9d69 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,6 +50,10 @@ libredwg_la_SOURCES = \ if !DISABLE_DXF libredwg_la_SOURCES += \ in_dxf.c +if !USE_WRITE +libredwg_la_SOURCES += \ + encode.c # in_dxf.c depends on some functions +endif if !DISABLE_JSON libredwg_la_SOURCES += \ in_json.c From 5dead97611401564540acc889bc1184a2a40acfc Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 7 Dec 2023 10:19:14 +0100 Subject: [PATCH 16/17] fix test --- programs/alive.test.in | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/programs/alive.test.in b/programs/alive.test.in index 8374551224..b1018f1a3c 100755 --- a/programs/alive.test.in +++ b/programs/alive.test.in @@ -107,6 +107,24 @@ run () fi fi ;; + dxfread) if [ -z "$DISABLE_JSON" ]; then + if [ -n "$addarg" ]; then + arg="-y -v2 $addarg -o $bdwg-$out.json $bdwg.dxf" + else + arg="-y -v2 $bdwg.dxf" + fi + else + if [ -n "$addarg" ]; then + arg="-y -v2 $addarg -o $bdwg-$out.dwg $bdwg.dxf" + else + arg="-y -v2 $dwg.dxf" + fi + fi + # no pre-r2 dxf yet (not sure this actually applies to reading) + if [ "$ddwg" = "r1.4" ]; then + return + fi + ;; dxfwrite) if [ -z "$DISABLE_JSON" ]; then if [ -n "$addarg" ]; then arg="-y -v2 $addarg -o $bdwg-$out.dxf $bdwg.json" From 05102346831d0c223b6cd19e5bd49638fa1ec97d Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 7 Dec 2023 22:33:35 +0100 Subject: [PATCH 17/17] fix test --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 265eb516a2..b8476f7116 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,6 +239,10 @@ if(NOT LIBREDWG_DISABLE_DXF) src/out_dxfb.c) set(indxf_SOURCES src/in_dxf.c) + if(LIBREDWG_DISABLE_WRITE) + set(indxf_SOURCES + src/encode.c) # in_dxf depends on some functions + endif endif() if(NOT LIBREDWG_DISABLE_WRITE)