error: 'engine/engine.h' file not found [and other headers]
Hi, I am struggling to build gerber-parser project and I wasn't able to find the issue - maybe it is issue on my end, but maybe you will be able to help. However I have some some reccomendations for improvements.
a) in definition of .gitmodule one of the submodules uses ssh url which could be potential problem for someone who does not use ssh key. b) when I tried to run cmake:
cmake .. -G "Unix Makefiles" -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
it endes with following error:
CMake Error at src/pygerber-parser/CMakeLists.txt:11 (add_subdirectory):
add_subdirectory not given a binary directory but the given source
directory "/x/xx/dev/gerber-parser/3rdparty/pybind11" is not a
subdirectory of "/x/xx/dev/gerber-parser/src/pygerber-parser".
When specifying an out-of-tree source a binary directory must be explicitly
specified.
the problem is in this CMakeLists.txt line 11
which I managed to fix:
include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.12.1
)
FetchContent_MakeAvailable(pybind11)
- but I am not sure if this is the best solution/fix.
However when i try to build solution with make (macOS Sequoia - appleClang) - or by using Visual Studio 2022 (Win11 Pro - MSVC 2022) I encounter the same error (i am pasting output from macOS build)
[ 3%] Building CXX object 3rdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags.cc.o
[ 7%] Built target gerber_engine_autogen_timestamp_deps
[ 11%] Building CXX object 3rdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_reporting.cc.o
[ 11%] Building CXX object 3rdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_completions.cc.o
[ 15%] Automatic MOC for target gerber_engine
[ 15%] Built target gerber_engine_autogen
[ 19%] Building CXX object src/CMakeFiles/gerber_engine.dir/gerber_engine_autogen/mocs_compilation.cpp.o
[ 23%] Building CXX object src/CMakeFiles/gerber_engine.dir/engines/qgraphics_scene_engine.cpp.o
In file included from /x/xx/dev/gerber-parser/src/engines/qgraphics_scene_engine.cpp:1:
/x/xx/dev/gerber-parser/src/engines/qgraphics_scene_engine.h:5:10: fatal error: 'engine/engine.h' file not found
5 | #include "engine/engine.h"
| ^~~~~~~~~~~~~~~~~
[ 26%] Building CXX object src/CMakeFiles/gerber_engine.dir/engines/qpainter_engine.cpp.o
1 error generated.
make[2]: *** [src/CMakeFiles/gerber_engine.dir/engines/qgraphics_scene_engine.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /x/xx/dev/gerber-parser/src/engines/qpainter_engine.cpp:1:
/x/xx/dev/gerber-parser/src/engines/qpainter_engine.h:5:10: fatal error: 'engine/engine.h' file not found
5 | #include "engine/engine.h"
| ^~~~~~~~~~~~~~~~~
[ 30%] Linking CXX static library libgflags_nothreads.a
[ 30%] Built target gflags_nothreads_static
1 error generated.
make[2]: *** [src/CMakeFiles/gerber_engine.dir/engines/qpainter_engine.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/gerber_engine.dir/all] Error 2
make: *** [all] Error 2
I tried to add prefix - afterwards include looked as "parser/src/engine/engine.h" but it only caused more errors.
macOS has Qt 6.8.2, Python 3.13.5, cmake 4.0.3 windows has Qt 6.10.1, Python 3.14.2, cmake 4.0.3
Would you be able to help me to build your project? Have I documented problem enough? Is there something missing?
Thank you. Best Regards. Maria