Compile Instructions
To compile the C++ extension, you will need to first download the required binary and header dependencies; then, adjust two shared path macros to point to the downloaded dependencies. Refer to your operating-system-specific section for setting up the dependencies. Upon setting up the dependencies, you should be able to compile.
Windows
Requirements
The Windows project is set up with Visual Studio 2017, with the
Platform Toolset set to v141_xp. If desired, you can upgrade or downgrade
the solution to a different version of Visual Studio. Just be aware of the
warnings and errors that may arise.
Setup
Refer to the following steps to set up the required dependencies for Visual Studio:
Download the Ruby C++ extension dependencies for Windows.
Extract the downloaded folder and save to a known location on your computer.
Download the latest SketchUp SDK for 64-bit Windows: https://extensions.sketchup.com/sketchup-sdk
- Downloading the 32-bit SketchUp SDK is not necessary as the extension does not depend on them.
- You can use the latest SDK for building binaries for older SketchUp versions, such as for SketchUp 2016 64-bit; if making changes, just be aware of an SDK function's minimum supported SketchUp version, indicated in the SDK documentation.
Clone the SU C Ext Utils by Anton: https://github.com/AntonSynytsia/su-cpp-ext-utils
Extract the downloaded folder and save to a known location on your computer.
Open the
./ext-cpp/projects/vs/PropertySheet.propsfile with an editor and do the following:- Edit the
RubyCExtmacro to point to the Ruby C++ extension dependency folder.- Ensure the
binandincludefolders are accessible from the path. - Ensure to include a
\at the end of the path.
- Ensure the
- Edit the
SketchUpSDKmarco to point to the downloaded SketchUp SDK folder.- Ensure the
binariesandheadersfolders are accessible from the path. - Ensure to include a
\at the end of the path.
- Ensure the
- Edit the
CExtUtilsmarco to point to the cloned su-cpp-ext-utils.- Ensure the
utilsfolder is accessible from the path. - Ensure to include a
\at the end of the path.
- Ensure the
- Edit the
Upon performing the steps, save and close the file. You can alternatively edit this file from the Visual Studio Property Manager window.
Compiling
Refer to the following steps to compile ams_lib.so with Visual Studio:
- Set the build configuration to
Release (X.Y) - Set the build platform to
x86orx64 - Build Solution. The release binaries should be automatically copied to
./ext-ruby/ams_Lib/libraries/stage/[win32/win64]/[X.Y]/. - To copy manually, copy
./ext-cpp/projects/vs/[Win32/x64]/Release (X.Y)/ams_Lib/ams_lib.so
to the appropriate binary folder:
./ext-ruby/ams_Lib/libraries/stage/[win32/win64]/[X.Y]/
Mac OS X
Requirements
xCode
Setup
Refer to the following steps to set up the required dependencies for Visual Studio:
Download the Ruby C++ extension dependencies for Mac OS X.
Extract the downloaded folder and save to a known location on your computer.
Download the latest SketchUp SDK for 64-bit Mac OS X: https://extensions.sketchup.com/sketchup-sdk
- Downloading the 32-bit SketchUp SDK is not necessary as the extension does not depend on them.
- You can use the latest SDK for building binaries for older SketchUp versions, such as for SketchUp 2016 64-bit; if making changes, just be aware of an SDK function's minimum supported SketchUp version, indicated in the SDK documentation.
Extract the downloaded folder and save to a known location on your computer.
Open the xCode project and do the following:
- Select
ams_libproject, click on theBuild Settingstab and scroll down toUser-Definedsection. - Edit the
RubyCExtmacro to point to the Ruby C++ extension dependency folder.- Ensure the
binandincludefolders are accessible from the path. - Ensure to include a
/at the end of the path.
- Ensure the
- Edit the
SketchUpSDKmarco to point to the downloaded SketchUp SDK folder.- Ensure
SketchUpAPI.frameworkis accessible from the path. - Ensure to include a
/at the end of the path.
- Ensure
- Save the project
- Select a target, click on
Build Phasestab, expand theLink Binary With Librariesdropdown, and do the following:- Ensure
Ruby.Frameworkis set. If not set, click on the add button and locate the corresponding Ruby framework within the downloaded Ruby C++ extension dependencies. - If the target is 64bit, ensure
SketchUpAPI.frameworkis set. If not set, click on the add button and locate the framework within the downloaded SketchUp SDK dependencies.
- Ensure
- Select
Compiling
Refer to the following steps to compile ams_lib.bundle with xCode:
- Set the active scheme to
Ruby (X.Y) - [32/64] - Execute
(Menu) Product > Archive - Export the built archive to your documents.
- Locate
ams_lib.bundlewithin the exported archive. - Copy
ams_lib.bundleto the appropriate binary folder:
ext-ruby/ams_Lib/libraries/stage/[osx32/osx64]/[X.Y]/