Skip to content

Commit 3507fb3

Browse files
macumberjmarrec
authored andcommitted
Remove openstudio_modeleditor.so, keep the simple openstudio_modeleditor.rb to maintain backwards compatibility w plugin for now
1 parent 539d2a7 commit 3507fb3

8 files changed

Lines changed: 1 addition & 679 deletions

ruby/CMakeLists.txt

Lines changed: 1 addition & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -1,218 +1,2 @@
1-
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
2-
# using Clang
3-
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup")
4-
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
5-
# using GCC
6-
#set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --unresolved-symbols=ignore-all")
7-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --unresolved-symbols=ignore-all")
8-
endif()
9-
10-
if (UNIX)
11-
# Disable register warnings
12-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=register -Wno-register")
13-
endif()
14-
15-
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
16-
17-
add_library(openstudio_modeleditor_rb MODULE
18-
RubyAPI.hpp
19-
openstudio_modeleditor_rb.cpp
20-
)
21-
22-
target_include_directories(openstudio_modeleditor_rb SYSTEM PRIVATE ${Ruby_INCLUDE_DIRS})
23-
24-
set_target_properties(openstudio_modeleditor_rb PROPERTIES PREFIX "")
25-
set_target_properties(openstudio_modeleditor_rb PROPERTIES OUTPUT_NAME openstudio_modeleditor)
26-
27-
set_target_properties(openstudio_modeleditor_rb PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/ruby/")
28-
set_target_properties(openstudio_modeleditor_rb PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ruby/")
29-
set_target_properties(openstudio_modeleditor_rb PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ruby/")
30-
31-
if(APPLE)
32-
set_target_properties(openstudio_modeleditor_rb PROPERTIES SUFFIX ".bundle" )
33-
34-
# DLM: these properties affect the rpath of executables, not the rpath added before load library commands
35-
#set_target_properties(openstudio_modeleditor_rb PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE )
36-
#set_target_properties(openstudio_modeleditor_rb PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE )
37-
#set_target_properties(openstudio_modeleditor_rb PROPERTIES INSTALL_RPATH "@loader_path/../OpenStudioApp.app/Contents/Frameworks/" )
38-
#set_target_properties(openstudio_modeleditor_rb PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE )
39-
#set_target_properties(openstudio_modeleditor_rb PROPERTIES INSTALL_NAME_DIR "@loader_path/../OpenStudioApp.app/Contents/Frameworks/" )
40-
else()
41-
set_target_properties(openstudio_modeleditor_rb PROPERTIES SUFFIX ".so" )
42-
endif()
43-
44-
if(MSVC)
45-
# wd4996=no deprecated warnings ; wd5033=register
46-
set_target_properties(openstudio_modeleditor_rb PROPERTIES COMPILE_FLAGS "/bigobj /wd4996 /wd5033")
47-
endif()
48-
49-
add_custom_command(TARGET openstudio_modeleditor_rb
50-
POST_BUILD
51-
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/openstudio_modeleditor.rb $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/openstudio_modeleditor.rb
52-
)
53-
54-
if(APPLE)
55-
find_library(QT_QCOCOA NAMES libqcocoa.dylib PATHS "${QT_INSTALL_DIR}/plugins/platforms" NO_DEFAULT_PATH)
56-
57-
add_custom_command(TARGET openstudio_modeleditor_rb
58-
POST_BUILD
59-
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/
60-
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Qt6::QCocoaIntegrationPlugin> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/.
61-
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_QCOCOA} $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/
62-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtCore.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtCore.framework
63-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtCore5Compat.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtCore5Compat.framework
64-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtDBus.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtDBus.framework
65-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtGui.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtGui.framework
66-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtNetwork.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtNetwork.framework
67-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtPrintSupport.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtPrintSupport.framework
68-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtSvg.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtSvg.framework
69-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtWidgets.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtWidgets.framework
70-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtXml.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtXml.framework
71-
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:openstudio::openstudiolib> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
72-
COMMAND ruby "${PROJECT_SOURCE_DIR}/SketchUpInstallName.rb" $<TARGET_FILE:openstudio_modeleditor_rb>
73-
# Add for local build dir. TODO: find a better way, this sticks onto the installed openstudio_modeleditor.bundle
74-
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "${openstudio_ROOT_DIR}/lib/" $<TARGET_FILE:openstudio_modeleditor_rb>
75-
)
76-
endif()
77-
78-
target_link_libraries(openstudio_modeleditor_rb
79-
ruby_OpenStudioModelEditor
80-
openstudio_modeleditor
81-
)
82-
83-
if( WIN32 )
84-
include("${openstudio_ROOT_DIR}/lib/cmake/openstudio/FetchRubyMinGW.cmake")
85-
FetchRubyMinGW()
86-
target_link_libraries(openstudio_modeleditor_rb ${RUBY_MINGW_STUB_LIB})
87-
endif()
88-
89-
install(TARGETS openstudio_modeleditor_rb DESTINATION Ruby COMPONENT "RubyAPI")
1+
# this is just a stub file which loads openstudio.rb
902
install(FILES openstudio_modeleditor.rb DESTINATION Ruby COMPONENT "RubyAPI")
91-
92-
if(APPLE)
93-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/libqcocoa.dylib DESTINATION Ruby/platforms COMPONENT "RubyAPI")
94-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtCore.framework DESTINATION Ruby COMPONENT "RubyAPI")
95-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtCore5Compat.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>/QtSvg.framework DESTINATION Ruby COMPONENT "RubyAPI")
101-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtWidgets.framework DESTINATION Ruby COMPONENT "RubyAPI")
102-
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtXml.framework DESTINATION Ruby COMPONENT "RubyAPI")
103-
# install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:openstudio::openstudiolib> DESTINATION Ruby COMPONENT "RubyAPI")
104-
105-
if(CPACK_CODESIGNING_DEVELOPPER_ID_APPLICATION)
106-
107-
set(FILES_TO_SIGN
108-
Ruby/openstudio_modeleditor.bundle
109-
Ruby/platforms/libqcocoa.dylib
110-
)
111-
112-
# Codesign inner binaries and libraries, in the CPack staging area for the current project & component
113-
# Define some required variables for the script in the scope of the install(SCRIPT) first
114-
install(CODE "set(CPACK_CODESIGNING_DEVELOPPER_ID_APPLICATION \"${CPACK_CODESIGNING_DEVELOPPER_ID_APPLICATION}\")" COMPONENT "RubyAPI")
115-
install(CODE "set(CPACK_CODESIGNING_MACOS_IDENTIFIER \"${CPACK_CODESIGNING_MACOS_IDENTIFIER}\")" COMPONENT "RubyAPI")
116-
install(CODE "set(FILES_TO_SIGN \"${FILES_TO_SIGN}\")" COMPONENT "RubyAPI")
117-
install(SCRIPT "${CMAKE_CURRENT_LIST_DIR}/../CMake/install_codesign_script.cmake" COMPONENT "RubyAPI")
118-
endif()
119-
endif()
120-
121-
###############################################################################
122-
# T E S T I N G: C T E S T S #
123-
###############################################################################
124-
125-
if(BUILD_TESTING)
126-
127-
# find all tests
128-
file(GLOB RUBY_TEST_SRC "test/*.rb")
129-
130-
131-
# **NOTE**: we do not want to grab the conan one, which is statically built on all platforms, and is a msvc build on windows
132-
# Instead, we want to grab the regularly installed one on your system
133-
134-
set(_RUBY_POSSIBLE_EXECUTABLE_NAMES
135-
ruby
136-
ruby3.2
137-
ruby3.2.2
138-
ruby32
139-
ruby322
140-
)
141-
142-
# TODO: this isn't great but I haven't found a better way to locate the system ruby (and avoid the conan one)
143-
find_program(SYSTEM_RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}
144-
HINTS
145-
"/usr/local/rvm/rubies/ruby-3.2.2/bin/"
146-
"/usr/local/rvm/rubies/ruby-3.2.2/bin/ruby"
147-
"/usr/share/rvm/rubies/ruby-3.2.2/bin/"
148-
"$ENV{HOME}/.rvm/rubies/ruby-3.2.2/bin/"
149-
"$ENV{HOME}/.rbenv/versions/3.2.2/bin/"
150-
"/opt/rbenv/versions/3.2.2/bin/"
151-
152-
"C:/Ruby32-x64/bin/"
153-
154-
"/usr/local/ruby322/bin/"
155-
"/usr/local/ruby32/bin/"
156-
"/usr/bin/"
157-
"/usr/local/bin/"
158-
159-
NO_DEFAULT_PATH)
160-
161-
if(SYSTEM_RUBY_EXECUTABLE)
162-
# Validate the version
163-
execute_process (COMMAND "${SYSTEM_RUBY_EXECUTABLE}" -e "puts RUBY_VERSION"
164-
RESULT_VARIABLE _result
165-
OUTPUT_VARIABLE _system_ruby_version
166-
ERROR_QUIET
167-
OUTPUT_STRIP_TRAILING_WHITESPACE)
168-
if(_result OR (_system_ruby_version VERSION_LESS 3.2) OR (_system_ruby_version VERSION_GREATER_EQUAL 3.3))
169-
if(_result)
170-
message(WARNING "Cannot use the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\"")
171-
else()
172-
message(WARNING "Wrong version \"${_system_ruby_version}\" for the interpreter \"${SYSTEM_RUBY_EXECUTABLE}\", not >= 3.2 < 3.3")
173-
endif()
174-
set_property (CACHE SYSTEM_RUBY_EXECUTABLE PROPERTY VALUE "SYSTEM_RUBY_EXECUTABLE-NOTFOUND")
175-
else()
176-
message(STATUS "Found SYSTEM_RUBY_EXECUTABLE=${SYSTEM_RUBY_EXECUTABLE} with version ${_system_ruby_version}")
177-
endif()
178-
endif()
179-
180-
if(NOT SYSTEM_RUBY_EXECUTABLE)
181-
message(WARNING "A valid system ruby (3.2.2 or near) wasn't found, you won't be able to run the `ctest -R RubyTest` command and the tests won't be created at all.")
182-
else()
183-
# add a test for each unit test
184-
set(RUBY_TEST_REQUIRES "#include test files")
185-
foreach(f ${RUBY_TEST_SRC})
186-
187-
file(READ "${f}" CONTENTS)
188-
string(REGEX MATCHALL "def +test_([A-Za-z_0-9 ]+)" FOUND_TESTS ${CONTENTS})
189-
190-
foreach(HIT ${FOUND_TESTS})
191-
string(REGEX REPLACE "def +test_([A-Za-z_0-9]+)" "\\1" TEST_NAME ${HIT})
192-
string(REGEX MATCH "/?([A-Za-z_0-9 ]+)\\.rb" FILE_NAME ${f})
193-
string(REGEX REPLACE "/?([A-Za-z_0-9 ]+)\\.rb" "\\1" FILE_NAME ${FILE_NAME})
194-
195-
set(CTEST_NAME "OSApp-RubyTest-${FILE_NAME}-${TEST_NAME}")
196-
197-
# DLM: Cannot load openstudio_modeleditor.so into CLI because linked with different version of Ruby
198-
# CLI Test
199-
#add_test(NAME "OSApp-CLITest-${FILE_NAME}-${TEST_NAME}"
200-
# COMMAND "${CMAKE_COMMAND}" -E chdir "${CMAKE_CURRENT_BINARY_DIR}"
201-
# "${openstudio_EXECUTABLE}" "-I" "$<TARGET_FILE_DIR:openstudio_modeleditor_rb>"
202-
# "${f}" "--name=test_${TEST_NAME}"
203-
#)
204-
205-
# Call with Ruby itself
206-
add_test(NAME "${CTEST_NAME}"
207-
COMMAND "${CMAKE_COMMAND}" -E chdir "${CMAKE_CURRENT_BINARY_DIR}"
208-
"${SYSTEM_RUBY_EXECUTABLE}" "-I" "$<TARGET_FILE_DIR:openstudio::openstudio_rb>" # Or just ${openstudio_ROOT_DIR}/Ruby
209-
"-I" "$<TARGET_FILE_DIR:openstudio_modeleditor_rb>"
210-
"${f}" "--name=test_${TEST_NAME}"
211-
)
212-
set_tests_properties("${CTEST_NAME}" PROPERTIES TIMEOUT 660 )
213-
endforeach()
214-
215-
endforeach()
216-
217-
endif()
218-
endif()

ruby/RubyAPI.hpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

ruby/openstudio_modeleditor_rb.cpp

Lines changed: 0 additions & 39 deletions
This file was deleted.

ruby/test/PathWatcher_Test.rb

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)