Hi,
Why there is no example how C++ Rhino Plugin could be compiled using CMake?
The reason to ask, is that sharing your C++ plugin that links 3rd party libraries can be relatively difficult.
If there is one, it would good to have.
Hi,
Why there is no example how C++ Rhino Plugin could be compiled using CMake?
The reason to ask, is that sharing your C++ plugin that links 3rd party libraries can be relatively difficult.
If there is one, it would good to have.
Hi @Petras1,
CMake doesn’t compile - it just creates make files. And since only Visual C++ is supported for C++ plug-ins, it doesn’t make a whole lot of sense to support it.
What library are you trying to use?
— Dale
Hi Dale,
What do you mean it does not compile? I am using it to compile executables, shared .dlls or static libs.
There are bunch of 3rd parties like Boost, Eigen, Open3D, PCL, CGAL, Cilantro, 3D viewers and others with their differences depending on a project. I know how to link them manually through Visual Studio IDE, but seems it is easier to pass onr CMakeLists.txt file rather than instructions for setting a project manually.
CMake is not a compiler. It uses compiler and platform independent configuration files to generate native build tool files specific to your compiler and platform.
Most of the tools you mention are available on vcpkg, which should make using in plug-in projects fairly easy.
– Dale
Dear @Dale vcpkg package does not work on some of the previously mentioned libraries specially on Windows.
It would be really nice if some of you could invest time in providing an example on CMake.
It can be even without linking external libraries.
Maybe you just need this?
https://cmake.org/cmake/help/latest/command/include_external_msproject.html
– Dale
Thanks for a reference but I am searching how to link libraries.
Can it be that McNeel does not provide this explanation partly because Rhino is commercial software? And majority of the libraries I used before are open-source. CMakeLists seems to be one of stadard distribution even together with vcpkg package manager. Maybe there could be something done with OpenNurbs.
Not at all. We just don’t get many requests for this.
– Dale
I’ve been slowly adding this to OpenNURBS. It just takes time and other projects always seem to get in the way.
Fingers crossed we can see this development;)
I use these functions to link libraries on Windows with CMake for Rhino:
link_directories(${CMAKE_BINARY_DIR}/lib)
target_link_libraries(${PROJECT_NAME}
${PATH_TO_RHINO_SDK}/lib/Release/RhinoCore.lib
${PATH_TO_RHINO_SDK}/lib/Release/rdk.lib
${PATH_TO_RHINO_SDK}/lib/Release/opennurbs.lib
$(PATH_TO_SOME_LIB)/lib/somelib.lib
)
Thats super good.
Would you mind sharing the full example folder?
Meaning:
a) CMakeLists.txt
b) main.cpp file
Hi Steve, some time ago I created a basic CMakeLists.txt for OpenNURBS in my GitHub branch:
Feel free to use any parts of it that are useful. Or if you published your work as a GitHub PR I would be happy to contribute to it.
There was also this PR created awhile ago, though it may have included too many other changes:
Thanks, but unfortunately it is a bit more complicated. We have a number of closed source files that we need to account for in our internal build and we need to get this set up for all supported operating systems.