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:

  1. Download the Ruby C++ extension dependencies for Windows.

  2. Extract the downloaded folder and save to a known location on your computer.

  3. 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.
  1. Clone the SU C Ext Utils by Anton: https://github.com/AntonSynytsia/su-cpp-ext-utils

  2. Extract the downloaded folder and save to a known location on your computer.

  3. Open the ./ext-cpp/projects/vs/PropertySheet.props file with an editor and do the following:

    1. Edit the RubyCExt macro to point to the Ruby C++ extension dependency folder.
      • Ensure the bin and include folders are accessible from the path.
      • Ensure to include a \ at the end of the path.
    2. Edit the SketchUpSDK marco to point to the downloaded SketchUp SDK folder.
      • Ensure the binaries and headers folders are accessible from the path.
      • Ensure to include a \ at the end of the path.
    3. Edit the CExtUtils marco to point to the cloned su-cpp-ext-utils.
      • Ensure the utils folder is accessible from the path.
      • Ensure to include a \ at the end of the path.

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:

  1. Set the build configuration to Release (X.Y)
  2. Set the build platform to x86 or x64
  3. Build Solution. The release binaries should be automatically copied to ./ext-ruby/ams_Lib/libraries/stage/[win32/win64]/[X.Y]/.
  4. 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:

  1. Download the Ruby C++ extension dependencies for Mac OS X.

  2. Extract the downloaded folder and save to a known location on your computer.

  3. 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.
  1. Extract the downloaded folder and save to a known location on your computer.

  2. Open the xCode project and do the following:

    1. Select ams_lib project, click on the Build Settings tab and scroll down to User-Defined section.
    2. Edit the RubyCExt macro to point to the Ruby C++ extension dependency folder.
      • Ensure the bin and include folders are accessible from the path.
      • Ensure to include a / at the end of the path.
    3. Edit the SketchUpSDK marco to point to the downloaded SketchUp SDK folder.
      • Ensure SketchUpAPI.framework is accessible from the path.
      • Ensure to include a / at the end of the path.
    4. Save the project
    5. Select a target, click on Build Phases tab, expand the Link Binary With Libraries dropdown, and do the following:
      • Ensure Ruby.Framework is 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.framework is set. If not set, click on the add button and locate the framework within the downloaded SketchUp SDK dependencies.

Compiling

Refer to the following steps to compile ams_lib.bundle with xCode:

  1. Set the active scheme to Ruby (X.Y) - [32/64]
  2. Execute (Menu) Product > Archive
  3. Export the built archive to your documents.
  4. Locate ams_lib.bundle within the exported archive.
  5. Copy ams_lib.bundle to the appropriate binary folder:

ext-ruby/ams_Lib/libraries/stage/[osx32/osx64]/[X.Y]/