Hello, I’m brand new to CMake.
I’ve been building interpreters into LibreCAD for a while now.
It works well with QtCreator.
LibreCAD also has a Pixi build with CMake.
I’m trying in vain to port my configs.
The result is an executable file named “librecad” with the Python module “_librecad” built in (with QtCreator or with make).
When I try this with CMake using swig_add_library(librecad…), I get the message that the target “librecad” already exists. If I specify _librecad in swig_add_library(_librecad) and link “_librecad” with “librecad”, I get the message:
CMakeFiles/librecad.dir/librecad/src/lib/scripting/rs_python.cpp.o: in function RS_Python::RS_Python()': rs_python.cpp:(.text+0x48b4): undefined reference to
PyInit__librecad’
because swig now creates __librecad.a, not _librecad.a.
With QtCreator or make, I don’t even have to explicitly link it or set swig to -builtin. It works like this (python.pri).
Please help me.
… __librecad.a /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libQt6PrintSupport.so.6.8.2 /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libQt6Widgets.so.6.8.2 /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libQt6Svg.so.6.8.2 /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libQt6Gui.so.6.8.2 /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libGL.so /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libQt6Network.so.6.8.2 /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libQt6Core.so.6.8.2 -pthread /home/emanuel/projects/LibreCAD/.pixi/envs/default/lib/libpython3.13.so && :
/home/emanuel/projects/LibreCAD/.pixi/envs/default/bin/…/lib/gcc/aarch64-conda-linux-gnu/13.3.0/…/…/…/…/aarch64-conda-linux-gnu/bin/ld: CMakeFiles/librecad.dir/librecad/src/lib/scripting/rs_python.cpp.o: in functionRS_Python::RS_Python()': rs_python.cpp:(.text+0x48b4): undefined reference to
PyInit__librecad’
/home/emanuel/projects/LibreCAD/.pixi/envs/default/bin/…/lib/gcc/aarch64-conda-linux-gnu/13.3.0/…/…/…/…/aarch64-conda-linux-gnu/bin/ld: rs_python.cpp:(.text+0x48b8): undefined reference to `PyInit__librecad’
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
emanuel@raspberrypi:~/projects/LibreCAD $