2015-02-21 19:51:07 -07:00
|
|
|
IF (APPLE)
|
2016-09-26 15:23:55 -06:00
|
|
|
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib)
|
|
|
|
SET(RUBYLIB_INSTALL_NAME "libruby.dylib")
|
|
|
|
IF(${DFHACK_BUILD_ARCH} STREQUAL 64)
|
2016-10-29 17:08:54 -06:00
|
|
|
# MESSAGE("No ruby lib for 64-bit OS X yet")
|
2016-09-26 15:23:55 -06:00
|
|
|
ELSE()
|
|
|
|
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.43.05/osx32-libruby187.dylib.gz"
|
|
|
|
"gz"
|
|
|
|
${RUBYLIB}.gz
|
|
|
|
"e9bc4263557e652121b055a46abb4f97"
|
|
|
|
${RUBYLIB}
|
|
|
|
"3ee5356759f764a440be5b5b44649826")
|
|
|
|
ENDIF()
|
2015-02-21 19:51:07 -07:00
|
|
|
ELSEIF(UNIX)
|
2016-09-26 15:23:55 -06:00
|
|
|
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/linux${DFHACK_BUILD_ARCH}/libruby.so)
|
|
|
|
SET(RUBYLIB_INSTALL_NAME "libruby.so")
|
2016-09-26 15:36:57 -06:00
|
|
|
IF(${DFHACK_BUILD_ARCH} STREQUAL 64)
|
2016-09-26 15:46:50 -06:00
|
|
|
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.43.05/linux64-libruby187.so.gz"
|
|
|
|
"gz"
|
|
|
|
${RUBYLIB}.gz
|
|
|
|
"8eb757bb9ada08608914d8ca8906c427"
|
|
|
|
${RUBYLIB}
|
|
|
|
"e8c36a06f031cfbf02def28169bb5f1f")
|
2016-09-26 15:36:57 -06:00
|
|
|
ELSE()
|
|
|
|
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.43.05/linux32-libruby187.so.gz"
|
|
|
|
"gz"
|
|
|
|
${RUBYLIB}.gz
|
|
|
|
"2d06f5069ff07ea934ecd40db55a4ac5"
|
|
|
|
${RUBYLIB}
|
|
|
|
"b00d8d7086cb39f6fde793f9d89cb2d7")
|
|
|
|
ENDIF()
|
2015-02-21 19:51:07 -07:00
|
|
|
ELSE()
|
2016-09-26 15:23:55 -06:00
|
|
|
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/win${DFHACK_BUILD_ARCH}/libruby.dll)
|
|
|
|
SET(RUBYLIB_INSTALL_NAME "libruby.dll")
|
2016-09-26 15:36:57 -06:00
|
|
|
IF(${DFHACK_BUILD_ARCH} STREQUAL 64)
|
2016-10-29 17:00:28 -06:00
|
|
|
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.43.05/win64-libruby200.dll.gz"
|
|
|
|
"gz"
|
|
|
|
${RUBYLIB}.gz
|
|
|
|
"81db54a8b8b3090c94c6ae2147d30b8f"
|
|
|
|
${RUBYLIB}
|
2016-11-14 12:16:43 -07:00
|
|
|
"8a8564418aebddef3dfee1e96690e713")
|
2016-09-26 15:36:57 -06:00
|
|
|
ELSE()
|
|
|
|
DOWNLOAD_FILE_UNZIP("https://github.com/DFHack/dfhack-bin/releases/download/0.43.05/win32-libruby187.dll.gz"
|
|
|
|
"gz"
|
|
|
|
${RUBYLIB}.gz
|
|
|
|
"ffc0f1b5b33748e2a36128e90c97f6b2"
|
|
|
|
${RUBYLIB}
|
|
|
|
"482c1c418f4ee1a5f04203eee1cda0ef")
|
|
|
|
ENDIF()
|
2015-02-21 19:51:07 -07:00
|
|
|
ENDIF()
|
2012-06-09 18:06:22 -06:00
|
|
|
|
2014-11-14 04:47:42 -07:00
|
|
|
IF (APPLE OR UNIX)
|
|
|
|
SET(RUBYAUTOGEN ruby-autogen-gcc.rb)
|
|
|
|
ELSE (APPLE OR UNIX)
|
|
|
|
SET(RUBYAUTOGEN ruby-autogen-win.rb)
|
|
|
|
ENDIF (APPLE OR UNIX)
|
|
|
|
|
2012-06-02 15:44:52 -06:00
|
|
|
ADD_CUSTOM_COMMAND(
|
2014-11-14 04:47:42 -07:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN}
|
2016-08-05 15:09:25 -06:00
|
|
|
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} ${CMAKE_SYSTEM_NAME} ${DFHACK_BUILD_ARCH}
|
2012-09-29 04:12:56 -06:00
|
|
|
# cmake quirk: depending on codegen.out.xml or generate_headers only is not enough, needs both
|
|
|
|
# test by manually patching any library/xml/moo.xml, run make ruby-autogen-rb -j2, and check build/plugins/ruby/ruby-autogen.rb for patched xml data
|
|
|
|
DEPENDS generate_headers ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl
|
2014-11-14 04:47:42 -07:00
|
|
|
COMMENT ${RUBYAUTOGEN}
|
2012-06-02 15:44:52 -06:00
|
|
|
)
|
2014-11-14 04:47:42 -07:00
|
|
|
ADD_CUSTOM_TARGET(ruby-autogen-rb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN})
|
2012-06-09 18:06:22 -06:00
|
|
|
|
2012-06-12 10:51:33 -06:00
|
|
|
INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread")
|
2012-06-09 18:06:22 -06:00
|
|
|
|
2012-06-02 15:44:52 -06:00
|
|
|
DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread)
|
2012-06-10 15:42:58 -06:00
|
|
|
ADD_DEPENDENCIES(ruby ruby-autogen-rb)
|
2012-06-09 18:06:22 -06:00
|
|
|
|
2016-09-26 16:28:59 -06:00
|
|
|
IF(EXISTS ${RUBYLIB})
|
|
|
|
INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME})
|
|
|
|
ELSE()
|
2016-10-29 17:08:54 -06:00
|
|
|
IF(NOT(APPLE AND ${DFHACK_BUILD_ARCH} STREQUAL 64))
|
|
|
|
MESSAGE(WARNING "Ruby library not found at ${RUBYLIB} - will not be installed")
|
|
|
|
ENDIF()
|
2016-09-26 16:28:59 -06:00
|
|
|
ENDIF()
|
2012-06-24 08:09:31 -06:00
|
|
|
|
|
|
|
INSTALL(DIRECTORY .
|
|
|
|
DESTINATION hack/ruby
|
|
|
|
FILES_MATCHING PATTERN "*.rb")
|
2012-09-30 09:08:03 -06:00
|
|
|
|
2014-11-14 04:47:42 -07:00
|
|
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby)
|