1LibreDWG - free implementation of the DWG file format
2
3LibreDWG is a free C library to read and write DWG files. This program is
4part of the GNU project, released under the aegis of GNU. It is licensed
5under the terms of the GNU General Public License version 3 (or at you option
6any later version).
7
8DWG is a file format created in the 70's for the emerging CAD applications.
9Currently it is the native file format of AutoCAD, a proprietary CAD program
10developed by AutoDesk.
11
12LibreDWG is a fork from LibDWG due to its usage of Esperanto, which we
13think is not the best strategy for a free software project which aims
14to get lots of contributors. LibreDWG is written in English. At the
15moment our decoder (i.e. reader) is done, just some very advanced
16R2010+ and pre-R13 entities fail to read and are skipped over. The
17writer is good enough for R2000. Among the example applications we
18wrote using LibreDWG is a reader, a writer, a rewriter (i.e. saveas),
19an initial SVG and Postscript conversion, dxf and json converters,
20dwggrep to search for text, and dwglayer to print the list of layers.
21More are in the pipeline.
22Please contact us if you want to help.
23
24The strings API is utf-8 (wtf8 really, Windows UCS-2 has no surrogate
25pairs), and encodes to the internal 8-bit or UCS-2 strings, depending
26on the DWG version.
27
28Sometimes we hang on our IRC channel which is #libredwg at irc.freenode.net
29If you don't find us there, please email the package maintainers:
30
31Reini Urban <rurban AT cpan.org>
32
33The now inactive founders and previous maintainers were:
34
35Felipe Corrêa da Silva Sanches <juca AT members.fsf.org>
36Rodrigo Rodrigues da Silva <pitanga AT members.fsf.org>
37Hardeep Singh Rai <hardeep.rai AT gmail DOT com>
38
39If you are looking for general information about the project, check our website:
40http://www.gnu.org/software/libredwg
41
42== Building and installing the library ==
43
44You need the following dependencies:
45- Basic development tools (a C99 compiler like gcc/clang, make, autoconf, automake
46 and libtool)
47
48Optionally:
49
50- gperf to update static hashes for several API's
51 Only needed when you added objects or changed the dwg.spec significantly
52- TeXinfo for building the docs
53- pslib for dwg2ps: http://pslib.sourceforge.net/doc/pslib.html
54- pcre2 with 8bit and 16bit libraries for dwggrep regexp support
55- SWIG 1.7+
56- Python 2.7 or 3.x development headers (debian: python-dev; yum: python-devel)
57 and the libxml2 python bindings.
58- Perl 5 for the perl bindings
59- doxygen to generate the reference manual
60- jq to check json validity
61- shellcheck to check shell scripts
62- rpmlint to check the spec validity
63- jinq with some svg11 relaxng to check SVG validity.
64 LaTeXML used to have a broken svg11-basic.rng. If so
65 the zip from http://yupotan.sppd.ne.jp/relax-ng/svg11/ is correct.
66 Needs to be installed into /usr/local/share/relaxng/svg11/
67- mapbox/geojsonhint as geojson linter
68 npm install -g @mapbox/geojsonhint
69- geojson-validation as 2nd geojson fallback linter
70 npm install -g geojson-validation
71- valgrind to find leaks and memory bugs
72- timeout to help tests with large or hanging DWG's
73- GNU parallel to speed up special tests (not the moreutils parallel!)
74- picat to find unknown fields, a better prolog. http://picat-lang.org/
75
76See INSTALL for generic instructions. Basically, you do:
77
78$ sh ./autogen.sh (if you checked out the source code from git)
79$ ./configure [--enable-trace] [--disable-write] [--disable-shared]
80$ make
81$ make check
82$ sudo make install
83
84This builds and installs various files in the "installation dirs":
85 $libdir ($exec_prefix/lib) -- library files (libredwg.*)
86 $includedir ($prefix/include) -- dwg.h dwg_api.h
87 $libdir/pkgconfig -- libredwg.pc
88 $infodir ($datarootdir/info) -- LibreDWG.info
89
90Use "./configure --help" to see a full list of options you can use to
91customize the installation dirs. Other options recognized by configure are:
92
93 --enable-release
94
95 Recommended for packagers and fuzzers. Disables all features
96 which will not be enabled in official tarball releases. Like support
97 for pre-R13 DWGs, skipping unstable DWG features, unknown DWG versions
98 and objects.
99
100 --enable-trace
101
102 Enable runtime tracing (default: no). When enabled, the environment
103 variable LIBREDWG_TRACE is consulted on the first decode/encode attempt.
104 Its value is an integer: 0 (no output) through 9 (full verbosity).
105 Most tools do support a --verbosity|-v flag instead.
106
107 --disable-write
108
109 Disable DWG write support (default: no). When enabled, you activate the write
110 support for the DWG format.
111 This is an experimental feature. Rewriting most DWG's to the r2000 format
112 usually works fine, DWG versions since r2004 are not yet supported, and the
113 API usage is very rough so far.
114
115 --disable-bindings
116
117 Disable SWIG bindings for python and perl5.
118
119 --disable-dxf
120
121 Disables all in and out modules: DXF, DXFB, JSON, GeoJSON.
122
123 --disable-json
124
125 Disables the json in and out modules: JSON, GeoJSON.
126
127 --disable-python
128
129 Disable python bindings and tests.
130 Related: --enable-python=python3.6
131 Enforce a specific version.
132
133 --enable-debug
134
135 Activates support for unstable classes. For testing only.
136
137 --enable-gcov
138
139 Activates support for GNU gcov, test coverage reporting.
140
141 --with-perl-install=vendor
142
143 Where to install the perl bindings: vendor,arch,yes,no,site.
144 Default is perl-install=site
145
146== Windows ==
147
148See the following scripts how we build on Windows:
149
150* build-aux/smoke.sh: cross-compilation recipes
151* build-aux/msys2.bat: msys2 deps
152* .appveyor.yml: windows smoker
153
154We only support C99 compilers and POSIX environments, i.e. cygwin or msys or cross.
155stdint.h and inttypes.h must be available.
156Pre-compiled Windows binaries are here: https://github.com/LibreDWG/libredwg/releases
157
158== Example usage of the library ==
159
160The programs and examples directories contains some application code that uses our lib:
161
162* dwgread -- A DWG reader supporting various output formats, such as
163 JSON, DXF, DXFB, GeoJSON. Later also YAML, XML/OGR, GPX, SVG, PS.
164
165* dwgwrite -- A DWG writer supporting various input formats, such as DXF, DXFB, JSON.
166 GeoJSON, YAML, XML/OGR, GPX are under construction.
167
168* dwgrewrite -- Reads a DWG, writes it back under a different name and optionally
169 under a different version (default r2000), and re-reads it back for confirmation.
170
171* dwg2dxf -- Converts a DWG to a DXF (ascii or binary, minimal or full), optionally
172 under a different version. About 90% coverage.
173
174* dxf2dwg -- Converts a ascii or binary DXF to a DWG (r2000 only so far).
175 About 80% coverage.
176
177* dwglayers -- Prints the list of layers in a DWG. Optionally with --extnames
178
179* dwggrep -- Searches DWG files for a text string, via regular expressions.
180
181* dwg2ps -- Opens a DWG file and outputs an PostScript file. This code
182 depends on the PSlib library. On Debian-based systems this is usually
183 available as a package named pslib-dev. This is very limited so far.
184
185* dwg2SVG -- Opens a DWG file and outputs an SVG (Scalable Vector Graphics)
186 file. SVG is a W3C standard for 2d vector graphics. You can open these
187 files on several free software tools. We recommend Inkscape, a free software
188 vector graphics editor. The dwg2SVG program will not handle 3d content
189 from DWG since SVG only supports 2-dimensional images. Handles only some
190 entities.
191
192* dwgbmp -- Extracts the bmp thumbnail of a dwg file when it is available.
193
194* load_dwg -- This is a skeleton code, reading the DWG and adding an entity.
195 Look there if you want to have a quickly glance on how to use the library.
196
197* dwg2svg2 -- Another example how to use the DWG API, bypassing direct access to
198 the DWG struct.
199
200* xmlsuite -- an extensive example library to use XML to compare against prepared
201 features is in the test/xmlsuite directory. It also features code to output entities
202 in XML, but does not use the python bindings.
203
204Copyright (C) 2009, 2010, 2015, 2018-2020 Free Software Foundation, Inc.
205
206This library is free software, licensed under the terms of the GNU
207General Public License as published by the Free Software Foundation,
208either version 3 of the License, or (at your option) any later version.
209You should have received a copy of the GNU General Public License
210along with this program. If not, see <http://www.gnu.org/licenses/>.
211