Skip to content

Commit bbbd1d3

Browse files
authored
Merge pull request #277 from openstudiocoalition/fix-mac
Fix loading openstudio_modeleditor.rb
2 parents cc49555 + b7ad980 commit bbbd1d3

File tree

5 files changed

+52
-39
lines changed

5 files changed

+52
-39
lines changed

.github/workflows/app_build.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ jobs:
245245
echo SDKROOT=${{ matrix.SDKROOT }} >> $GITHUB_ENV
246246
echo CMAKE_MACOSX_DEPLOYMENT_TARGET='-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET' >> $GITHUB_ENV
247247
248+
brew install md5sha1sum
249+
248250
curl -L -O https://download.qt.io/official_releases/qt-installer-framework/3.2.2/QtInstallerFramework-mac-x64.dmg
249251
hdiutil attach -mountpoint ./qtfiw_installer QtInstallerFramework-mac-x64.dmg
250252
echo "ls ./qtfiw_installer"
@@ -259,6 +261,9 @@ jobs:
259261
echo "~/Qt/QtIFW-3.2.2/bin/" >> $GITHUB_PATH
260262
fi;
261263
264+
CONAN_INSTALL_MD5=$(md5sum ConanInstall.cmake | awk '{print $1}')
265+
echo CONAN_INSTALL_MD5=$CONAN_INSTALL_MD5 >> $GITHUB_ENV
266+
262267
# TODO: cache the QtIFW folder too
263268

264269
- name: Cache entire build directory
@@ -352,8 +357,10 @@ jobs:
352357
id: cacheconan
353358
uses: actions/cache@v2
354359
with:
355-
path: ~/.conan
356-
key: ${{ matrix.os }}-conan-cache
360+
path: |
361+
~/.conan
362+
/.conan
363+
key: ${{ matrix.os }}-conan-cache-${{ env.CONAN_INSTALL_MD5 }}
357364

358365
- name: Did restoring the conan-cache work? No
359366
# If the SDK wasn't found in the cache
@@ -369,6 +376,7 @@ jobs:
369376
run: |
370377
ls ~/.conan/
371378
ls ~/.conan/data/
379+
ls /.conan
372380
373381
- name: Create Build Environment and locate openstudio
374382
# Some projects don't allow in-source building, so create a separate build directory

FindOpenStudioSDK.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ find_package(openstudio "${OPENSTUDIO_VERSION}" CONFIG
3838
"${OPENSTUDIO_ARCHIVE_DIR}/${OPENSTUDIO_ARCHIVE_BASENAME}"
3939
HINTS
4040
"${OPENSTUDIO_ARCHIVE_DIR}"
41+
NO_DEFAULT_PATH
42+
NO_PACKAGE_ROOT_PATH
4143
)
4244
if(openstudio_FOUND)
4345
message("Found specified openstudio at openstudio_DIR=${openstudio_DIR}")

SketchUpInstallName.rb

+24-20
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
def fixup(file, rpath_replacement)
22
puts
33
puts file
4-
`otool -L #{file}`.split("\n").each do |line|
5-
line.strip!
6-
if md = /(@rpath[^\s]*)/.match(line)
7-
line = md[1]
8-
new_line = line.gsub("@rpath", rpath_replacement)
9-
if md = /Qt.*\/(Qt.*?)$/.match(new_line)
10-
new_line = new_line.gsub(md[0], md[1])
11-
end
12-
puts "#{line} -> #{new_line}"
13-
`install_name_tool -change #{line} #{new_line} #{file}`
14-
end
15-
end
4+
`install_name_tool -add_rpath #{rpath_replacement} #{file}`
5+
#`otool -L #{file}`.split("\n").each do |line|
6+
# line.strip!
7+
# if md = /(@rpath[^\s]*)/.match(line)
8+
# line = md[1]
9+
# new_line = line.gsub("@rpath", rpath_replacement)
10+
# if md = /Qt.*\/(Qt.*?)$/.match(new_line)
11+
# #new_line = new_line.gsub(md[0], md[1])
12+
# end
13+
# puts "#{line} -> #{new_line}"
14+
# `install_name_tool -change #{line} #{new_line} #{file}`
15+
# end
16+
#end
1617
end
1718

1819
# Fix up any load paths in openstudio_modeleditor.bundle
@@ -23,14 +24,17 @@ def fixup_model_editor(lib_path, lib_path_replacemant, openstudio_modeleditor_pa
2324
end
2425

2526
dir = File.dirname(ARGV[0])
26-
fixup(ARGV[0], "@loader_path")
27-
fixup(File.join(dir, "QtConcurrent"), "@loader_path")
28-
fixup(File.join(dir, "QtCore"), "@loader_path")
29-
fixup(File.join(dir, "QtGui"), "@loader_path")
30-
fixup(File.join(dir, "QtNetwork"), "@loader_path")
31-
fixup(File.join(dir, "QtPrintSupport"), "@loader_path")
32-
fixup(File.join(dir, "QtWidgets"), "@loader_path")
33-
fixup(File.join(dir, "QtXml"), "@loader_path")
27+
28+
fixup(ARGV[0], "@loader_path/")
29+
30+
qt_libs = ['QtConcurrent', 'QtCore', 'QtGui', 'QtNetwork','QtPrintSupport', 'QtWidgets', 'QtXml']
31+
qt_libs.each do |qt_lib|
32+
Dir.glob(File.join(dir, '**', qt_lib)).each do |file|
33+
next if /Headers/.match(file)
34+
fixup(file, "@loader_path/")
35+
end
36+
end
37+
3438
fixup(File.join(dir, "platforms/libqcocoa.dylib"), "@loader_path/..")
3539

3640
fixup_model_editor("libopenstudiolib.dylib", "@loader_path/libopenstudiolib.dylib", File.join(dir, "openstudio_modeleditor.bundle"))

ruby/CMakeLists.txt

+16-16
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ if(APPLE)
6161
POST_BUILD
6262
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/
6363
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::QCocoaIntegrationPlugin> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/.
64-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::Concurrent> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
65-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
66-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::DBus> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
67-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
68-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::Network> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
69-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::PrintSupport> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
70-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
71-
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt5::Xml> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
64+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtConcurrent.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtConcurrent.framework
65+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtCore.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtCore.framework
66+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtDBus.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtDBus.framework
67+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtGui.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtGui.framework
68+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtNetwork.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtNetwork.framework
69+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtPrintSupport.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtPrintSupport.framework
70+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtWidgets.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtWidgets.framework
71+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtXml.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtXml.framework
7272
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:openstudio::openstudiolib> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
7373
COMMAND ruby "${PROJECT_SOURCE_DIR}/SketchUpInstallName.rb" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ruby/openstudio_modeleditor.bundle"
7474
)
@@ -91,15 +91,15 @@ install(TARGETS openstudio_modeleditor_rb DESTINATION Ruby COMPONENT "RubyAPI")
9191
install(FILES openstudio_modeleditor.rb DESTINATION Ruby COMPONENT "RubyAPI")
9292
if(APPLE)
9393
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/$<TARGET_FILE_NAME:Qt5::QCocoaIntegrationPlugin> DESTINATION Ruby/platforms COMPONENT "RubyAPI")
94-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::Concurrent> DESTINATION Ruby COMPONENT "RubyAPI")
95-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::Core> DESTINATION Ruby COMPONENT "RubyAPI")
96-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::DBus> DESTINATION Ruby COMPONENT "RubyAPI")
97-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::Gui> DESTINATION Ruby COMPONENT "RubyAPI")
98-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::Network> DESTINATION Ruby COMPONENT "RubyAPI")
99-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::PrintSupport> DESTINATION Ruby COMPONENT "RubyAPI")
100-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::Widgets> DESTINATION Ruby COMPONENT "RubyAPI")
94+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtConcurrent.framework DESTINATION Ruby COMPONENT "RubyAPI")
95+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtCore.framework DESTINATION Ruby COMPONENT "RubyAPI")
96+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtDBus.framework DESTINATION Ruby COMPONENT "RubyAPI")
97+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtGui.framework DESTINATION Ruby COMPONENT "RubyAPI")
98+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtNetwork.framework DESTINATION Ruby COMPONENT "RubyAPI")
99+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtPrintSupport.framework DESTINATION Ruby COMPONENT "RubyAPI")
100+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtWidgets.framework DESTINATION Ruby COMPONENT "RubyAPI")
101+
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtXml.framework DESTINATION Ruby COMPONENT "RubyAPI")
101102
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:openstudio::openstudiolib> DESTINATION Ruby COMPONENT "RubyAPI")
102-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:Qt5::Xml> DESTINATION Ruby COMPONENT "RubyAPI")
103103
endif()
104104

105105
if( BUILD_PAT )

src/model_editor/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ set(${target_name}_moc
5959
TableView.hpp
6060
TableWidget.hpp
6161
TestButton.hpp
62-
Utilities.hpp
6362
IGPrecisionDialog.hpp
6463
IGLineEdit.hpp
6564
IGSpinBoxes.hpp

0 commit comments

Comments
 (0)