2012-06-09 18:06:22 -06:00
|
|
|
OPTION(DL_RUBY "download libruby from the internet" ON)
|
2012-06-29 09:51:26 -06:00
|
|
|
IF (DL_RUBY AND NOT APPLE)
|
2012-06-09 18:06:22 -06:00
|
|
|
IF (UNIX)
|
2012-08-03 06:52:39 -06:00
|
|
|
FILE(DOWNLOAD http://cloud.github.com/downloads/jjyg/dfhack/libruby187.tar.gz ${CMAKE_CURRENT_BINARY_DIR}/libruby187.tar.gz
|
2012-06-12 10:51:33 -06:00
|
|
|
EXPECTED_MD5 eb2adea59911f68e6066966c1352f291)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E tar xzf libruby187.tar.gz
|
2012-08-03 06:52:39 -06:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
FILE(RENAME ${CMAKE_CURRENT_BINARY_DIR}/libruby1.8.so.1.8.7 ${CMAKE_CURRENT_BINARY_DIR}/libruby.so)
|
|
|
|
SET(RUBYLIB ${CMAKE_CURRENT_BINARY_DIR}/libruby.so)
|
2012-06-09 18:06:22 -06:00
|
|
|
ELSE (UNIX)
|
2012-08-03 06:52:39 -06:00
|
|
|
FILE(DOWNLOAD http://cloud.github.com/downloads/jjyg/dfhack/msvcrtruby187.tar.gz ${CMAKE_CURRENT_BINARY_DIR}/msvcrtruby187.tar.gz
|
2012-06-12 10:51:33 -06:00
|
|
|
EXPECTED_MD5 9f4a1659ac3a5308f32d3a1937bbeeae)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E tar xzf msvcrtruby187.tar.gz
|
2012-08-03 06:52:39 -06:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
FILE(RENAME ${CMAKE_CURRENT_BINARY_DIR}/msvcrt-ruby18.dll ${CMAKE_CURRENT_BINARY_DIR}/libruby.dll)
|
|
|
|
SET(RUBYLIB ${CMAKE_CURRENT_BINARY_DIR}/libruby.dll)
|
2012-06-09 18:06:22 -06:00
|
|
|
ENDIF(UNIX)
|
2012-06-29 09:51:26 -06:00
|
|
|
ENDIF(DL_RUBY AND NOT APPLE)
|
2012-06-09 18:06:22 -06:00
|
|
|
|
2012-06-02 15:44:52 -06:00
|
|
|
ADD_CUSTOM_COMMAND(
|
2012-08-11 12:11:00 -06:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb
|
|
|
|
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb
|
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
|
2012-06-10 15:42:58 -06:00
|
|
|
COMMENT ruby-autogen.rb
|
2012-06-02 15:44:52 -06:00
|
|
|
)
|
2012-08-11 12:11:00 -06:00
|
|
|
ADD_CUSTOM_TARGET(ruby-autogen-rb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb)
|
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
|
|
|
|
2012-06-24 08:09:31 -06:00
|
|
|
INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION})
|
|
|
|
|
|
|
|
INSTALL(DIRECTORY .
|
|
|
|
DESTINATION hack/ruby
|
|
|
|
FILES_MATCHING PATTERN "*.rb")
|
2012-09-30 09:08:03 -06:00
|
|
|
|
|
|
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb DESTINATION hack/ruby)
|