Skip to content

About

LibreCAD 3 is a next generation 2D CAD application written to be modular, with a core independent from GUI toolkits. Scripting is possible with Lua.

Topics

Resources

Stars

388 stars

Watchers

33 watching

Forks

Latest commit

 

History

2,249 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LibreCAD 3

Build

LibreCAD 3 is the next-generation, C++/Qt implementation of LibreCAD. It provides a desktop CAD application, DXF persistence, Lua scripting, and optional Python scripting.

LibreCAD 3 is under active development. For stable releases and assets, see the releases page.

Scripting

LibreCAD 3 supports embedded Lua and Python scripting, including bundled Python plugins and script-defined custom entities. Lua and Python share the neutral scripting layer, but their API coverage and distribution status are not identical. See doxygen/Scripting.md for tested capabilities, runtime selection, platform status, and plugin authoring notes. Python is enabled by default in ordinary CMake builds (WITH_PYTHONSCRIPT=ON); individual build configurations may disable it.

Requirements

  • CMake 3.28 or newer
  • A C++17 compiler
  • Qt 6, including the Base, Tools, SVG, and OpenGL development packages
  • Git submodules

The project also uses Boost, Eigen3, Lua 5.3+, GLEW, GLFW, FreeType, RapidJSON, and several platform libraries. The supported CI dependency list is maintained in scripts/ubuntu-install/installDependenciesAndBuildRepo.sh. On Debian or Ubuntu, use that script as the authoritative package reference.

Build from source

Clone recursively so the bundled dependencies are available:

git clone --recurse-submodules https://github.com/LibreCAD/LibreCAD_3.git
cd LibreCAD_3

For an existing checkout, initialize the submodules first:

git submodule update --init --recursive

Configure and build:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel

The application is written to build/bin:

./build/bin/librecad

If CMake cannot find a manually installed Qt, pass its installation prefix:

cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/Qt/6.x/<platform>

Ubuntu

The CI build uses Ubuntu 26.04 and Qt 6. To reproduce its dependency install, run the maintained script from a checkout:

./scripts/ubuntu-install/installDependenciesAndBuildRepo.sh

It installs packages with sudo, builds the project, runs the core test suites, and stages an AppDir for packaging. For day-to-day development, install the listed packages once and use the CMake commands above.

Windows

Windows builds use Conan for third-party dependencies and Qt 6. The CI scripts are the supported reference:

  1. Run scripts/windows-install/createConanDirAndInstallDependencies.bat.
  2. Configure with the generated conan_toolchain.cmake and a Qt 6 CMAKE_PREFIX_PATH.
  3. Build with cmake --build build --config Release.

The complete packaging workflow is in scripts/windows-install/buildLibrecadAndCreatePackage.bat.

Configuration

Common CMake options are:

Option Default Purpose
WITH_QT_UI ON Build the Qt desktop application.
WITH_PERSISTENCE ON Build DXF/DWG persistence support.
WITH_DWG_IMPORT OFF Enable experimental DWG reading through libdxfrw.
WITH_PYTHONSCRIPT ON Enable embedded Python scripting. Windows builds must provide a matching CPython SDK/runtime; packaged-artifact validation remains part of the implementation plan.
WITH_LUACMDINTERFACE ON Build the Lua command-line interface.
WITH_UNITTESTS ON Build lcunittest.
WITH_RENDERING_UNITTESTS ON Build rendering tests that require a graphics environment.
WITH_DOCUMENTATION OFF Build documentation.
WITH_HEADERS OFF Install header files and LibreCAD3Config.cmake.

For example, a headless core build can be configured with:

cmake -S . -B build-core \
  -DWITH_QT_UI=OFF -DWITH_PYTHONSCRIPT=OFF \
  -DWITH_LUACMDINTERFACE=OFF -DWITH_RENDERING_UNITTESTS=OFF \
  -DWITH_HEADERS=ON

and consumed with Cmake:

find_package(LibreCAD3 REQUIRED)

if(${LibreCAD3_FOUND})
  message(STATUS "Found LibreCAD3")
  message(STATUS "LibreCAD3_INC_DIR: ${LibreCAD3_INC_DIR}")
  message(STATUS "LibreCAD3_INC_DIRS: ${LibreCAD3_INC_DIRS}")
  message(STATUS "LibreCAD3_LIB_DIR: ${LibreCAD3_LIB_DIR}")
  message(STATUS "LibreCAD3_BIN_DIR: ${LibreCAD3_BIN_DIR}")
  message(STATUS "LibreCAD3_LIBS: ${LibreCAD3_LIBS}")
else()
  message(FATAL_ERROR "Did not find LibreCAD3")
endif()

target_link_libraries(Your_TARGET PRIVATE LibreCAD3)

Librecad transitives are automatically propagated.

Tests

When unit tests are enabled, run the test executable from the build directory:

./build/bin/lcunittest

On a headless Linux machine, use a virtual X server for UI-dependent tests:

xvfb-run -a ./build/bin/lcunittest

The Linux CI workflow runs the stable core suites as blocking checks and runs the remaining UI suites for visibility. See .github/workflows/main.yml for the current CI matrix and packaging jobs.

For a Python-enabled build or installed application, run librecad --python-smoke from outside the checkout. It checks the selected runtime, shipped plugins, document undo/redo and DXF round-trip. Installed runtimes also initialize the staged native-extension catalog and exercise offline native stdlib operations. See scripting validation for scope and platform limits.

Contributing

Please open an issue or pull request on GitHub. Keep submodules pinned and include build or test evidence appropriate to the change.

About

LibreCAD 3 is a next generation 2D CAD application written to be modular, with a core independent from GUI toolkits. Scripting is possible with Lua.

Topics

Resources

Stars

388 stars

Watchers

33 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages