2012-03-21 11:49:50 -06:00
|
|
|
find_package(Ruby)
|
|
|
|
if(RUBY_FOUND)
|
2012-04-05 08:46:07 -06:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ruby-autogen.cpp
|
|
|
|
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.cpp
|
|
|
|
DEPENDS ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml codegen.pl
|
|
|
|
)
|
|
|
|
ADD_EXECUTABLE(ruby-autogen ruby-autogen.cpp)
|
2012-04-21 13:20:51 -06:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set_target_properties (ruby-autogen PROPERTIES COMPILE_FLAGS "-Wno-invalid-offsetof")
|
|
|
|
endif(CMAKE_COMPILER_IS_GNUCC)
|
2012-04-05 08:46:07 -06:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ruby-autogen.offsets
|
|
|
|
COMMAND ruby-autogen ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.offsets
|
|
|
|
DEPENDS ruby-autogen
|
|
|
|
)
|
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ruby-autogen.rb
|
2012-04-06 11:59:11 -06:00
|
|
|
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/codegen.pl ${dfhack_SOURCE_DIR}/library/include/df/codegen.out.xml ${CMAKE_CURRENT_SOURCE_DIR}/ruby-autogen.rb ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.offsets ${CMAKE_CURRENT_SOURCE_DIR}/ruby-memstruct.rb
|
|
|
|
DEPENDS ruby-autogen.offsets ruby-memstruct.rb
|
2012-04-05 08:46:07 -06:00
|
|
|
)
|
|
|
|
ADD_CUSTOM_TARGET(ruby-autogen-rb ALL DEPENDS ruby-autogen.rb)
|
2012-03-21 11:49:50 -06:00
|
|
|
include_directories("${dfhack_SOURCE_DIR}/depends/tthread" ${RUBY_INCLUDE_PATH})
|
|
|
|
DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread)
|
2012-03-21 12:30:31 -06:00
|
|
|
target_link_libraries(ruby ${RUBY_LIBRARY})
|
2012-04-05 08:46:07 -06:00
|
|
|
install(FILES ruby.rb ruby-autogen.rb DESTINATION ${DFHACK_LIBRARY_DESTINATION})
|
2012-03-21 11:49:50 -06:00
|
|
|
else(RUBY_FOUND)
|
|
|
|
MESSAGE(STATUS "Required library (ruby) not found - ruby plugin can't be built.")
|
|
|
|
endif(RUBY_FOUND)
|