@metasim said:
Success!
Forcing the linking of the shared library in Sketchup.app was the trick (can't just add it to the library search path).
For other cmake users, here's the CMakeLists.txt fragment that did the trick:
CMakeLists.txt
> ...
> find_package(Ruby REQUIRED)
> if(HAVE_SKETCHUP)
> set(SKETCHUP "/Applications/Google\ SketchUp\ 7/SketchUp.app")
> set(SKETCHUP_RUBY "${SKETCHUP}/Contents/Frameworks/Ruby.framework")
> set(SWIG_RUBY_LIB "${SKETCHUP_RUBY}/Ruby")
> else()
> set(SWIG_RUBY_LIB "${RUBY_LIBRARY}")
> endif()
>
> swig_add_module(${RUBY_MODULE_NAME} ruby "${INTERFACE_FILES}")
> include_directories(${RUBY_INCLUDE_PATH})
> swig_link_libraries(${RUBY_MODULE_NAME} "${MYEXTENSION_LIB}" "${SWIG_RUBY_LIB}")
> ...
>
Interestingly, when linking against this, MacOS is smart enough to encode the path to the Ruby library relative to the executable, so that if Sketchup.app is installed in a different location, it still works fine:
otool -L MyExtension.bundle
> @executable_path/../Frameworks/Ruby.framework/Versions/A/Ruby (compatibility version 1.8.0, current version 1.8.5)
> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)
>
I hope someone else finds this useful. I'm glad I don't have to resort to a client/server type implementation and associated headaches.
Thanks for all your help!
Simeon
Thx Simeon ... Someone else did find this useful