Skip to content

Commit

Permalink
Merge pull request #1970 from NREL/SketchUpOpenSSL
Browse files Browse the repository at this point in the history
This change appears to fix the OpenSSL load issue for SketchUp howeve…
  • Loading branch information
evanweaver committed Nov 25, 2015
2 parents dc72209 + ecd3435 commit 2cef353
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
29 changes: 24 additions & 5 deletions openstudiocore/ruby/openstudio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,22 @@
# add OpenStudio shared library locations to system path
# we need to add these so that require can load the c++ shared libraries
original_path = ENV['PATH']
platform_specific_path = nil
if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM)
ENV['PATH'] = "#{$OpenStudio_Dir};#{$OpenStudio_Dir}openstudio;#{original_path}"
front = []
back = []
original_path.split(';').each do |p|
if /SketchUp/.match(p)
if /platform_specific/.match(p)
platform_specific_path = p
end
front << p
else
back << p
end
end

ENV['PATH'] = "#{front.join(';')};#{$OpenStudio_Dir};#{$OpenStudio_Dir}openstudio;#{back.join(';')}"

# Pre-load our specific Qt Dll's on Windows to make sure we control which get loaded
require 'Win32API'
Expand Down Expand Up @@ -120,13 +134,18 @@
# restore original path
ENV['PATH'] = original_path

if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_Dir}OpenStudio")))
if (!OpenStudio::RemoteBCL::initializeSSL())
raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries"
have_open_ssl = false
if platform_specific_path
have_open_ssl = OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new(platform_specific_path))
end
if (!have_open_ssl)
if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_Dir}OpenStudio")))
if (!OpenStudio::RemoteBCL::initializeSSL())
raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries"
end
end
end


if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM)
$OpenStudio_BinaryDir = "#{$OpenStudio_Dir}../bin/"
elsif /darwin/.match(RUBY_PLATFORM)
Expand Down
29 changes: 24 additions & 5 deletions openstudiocore/ruby/openstudio_dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@

# add binary dir to system path
original_path = ENV['PATH']
platform_specific_path = nil
if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM)
ENV['PATH'] = "#{$OpenStudio_BinaryDir};#{$OpenStudio_RubyBinaryDir};#{original_path}"
front = []
back = []
original_path.split(';').each do |p|
if /SketchUp/.match(p)
if /platform_specific/.match(p)
platform_specific_path = p
end
front << p
else
back << p
end
end

ENV['PATH'] = "#{front.join(';')};#{$OpenStudio_BinaryDir};#{$OpenStudio_RubyBinaryDir};#{back.join(';')}"
else
ENV['PATH'] = "#{$OpenStudio_BinaryDir}:#{$OpenStudio_RubyBinaryDir}:#{original_path}"
end
Expand Down Expand Up @@ -106,13 +120,18 @@
# restore original path
ENV['PATH'] = original_path

if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_RubyBinaryDir}")))
if (!OpenStudio::RemoteBCL::initializeSSL())
raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries"
have_open_ssl = false
if platform_specific_path
have_open_ssl = OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new(platform_specific_path))
end
if (!have_open_ssl)
if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_RubyBinaryDir}")))
if (!OpenStudio::RemoteBCL::initializeSSL())
raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries"
end
end
end


# Find current ruby path, we may need this for launching ruby jobs later
begin

Expand Down

2 comments on commit 2cef353

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iteration (evanweaver) - i386-Windows-7-VisualStudio-12: OK (2336 of 2373 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iteration (evanweaver) - Win64-Windows-7-VisualStudio-12: OK (2336 of 2373 tests passed)

Build Badge Test Badge

Please sign in to comment.