I am attempting to make use of lib2geom in an Electron app. I was able to write a script that employs the library to obtain an intersection of two paths and then wrap it with node-addon-api using examples from https://github.com/nodejs/node-addon-examples. I've hosted this attempt: lib2geom-path-boolean-addon.
I'm having problems using cmake-js to build the script (I was successful building a non-addon script using CMake). As documented in the CMakeLists.txt file, I get the following error when attempting to run the install npm script:
relocation R_X86_64_PC32 against symbol `_ZGVZN4Geom6chooseIdEET_jjE16pascals_triangle' can not be used when making a shared object; recompile with -fPIC
and adopting the suggestion here (now commented) did not remedy the issue.
I'm just learning C++ and CMake for this addon so it's hard to know where to start with debugging this issue. Any insights would be greatly appreciated. I hope this can become a valuable resource for the community.